changeset 6412:c9ab121e737c

Merge
author coffeys
date Wed, 19 Jun 2013 11:52:12 +0100
parents 3592be0f4f3e 60d52db33828
children b2fb82766c5d
files make/sun/xawt/ToBin.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/sun/security/provider/certpath/X509CertPath/ForwardBuildCompromised.java test/sun/security/provider/certpath/X509CertPath/ReverseBuildCompromised.java test/sun/security/provider/certpath/X509CertPath/ValidateCompromised.java
diffstat 524 files changed, 17593 insertions(+), 8543 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Wed Jun 19 02:46:50 2013 -0700
+++ b/.hgtags	Wed Jun 19 11:52:12 2013 +0100
@@ -274,6 +274,7 @@
 b130c8cfecfc552614047b3244d5d94439827fcd jdk7u17-b02
 a474615061bf610105a426780a7ac4c95bd76456 jdk7u17-b30
 1ad6f413e250bd2671b4908e232bd0d244c917a7 jdk7u17-b31
+6c6b9d7943e78d1f797b0c2e1c1231f81816dfde jdk7u17-b32
 8261e56b7f91c7553e8485b206bdc9030a3546e4 jdk7u21-b01
 af6be9d7aed7c323858932c908b049f4bcdb6a3e jdk7u21-b05
 ffc1454e644a39265cd6d80ef4b4c12c5dbf35c9 jdk7u21-b06
@@ -284,6 +285,26 @@
 f9323b9d020ce8d313af2d2e2682e2b6cabcc40d jdk7u21-b11
 08ed0bfc9668f04ce4e3803f16aad92f6e50f885 jdk7u21-b30
 f3cf02a53684b9fbefabb212c80dfbea0c27f113 jdk7u21-b12
+a5e712ea6944b1c81bcd5343a50645964f12b107 jdk7u21-b02
+9d87f5f84afef6ba4c92523a76e3c81fd9acfa00 jdk7u21-b03
+139d3e3b62d49374112ce1add84cd3d1e5ed5335 jdk7u21-b04
+7fd0922d6ed2988954c666de313f7fceef75dc63 jdk7u25-b01
+846304f476f1b1d2955d025d54307be76c3c4874 jdk7u25-b02
+2a444d8e36ebc7161a735b45143b22e141d9a5c0 jdk7u25-b03
+7fc6c331082c3586fa6c6ead014c96f3c532bc34 jdk7u25-b04
+f2d4da9ba0f05165e8a85d0fd5085d707e434eab jdk7u25-b05
+5748526c96f0d3fd5771b72a81fcd61f4e23b0d8 jdk7u25-b06
+fe514475bc17355f5f0a8dc7dd423d0043ed5326 jdk7u25-b07
+f8373784a79eba32b47e655cc5880f594a12423c jdk7u25-b08
+023297d5b047c0b6c54869d6514fa3c1427c206c jdk7u25-b09
+c82ed89b21bcb5279ff2fd4bc54127cd580dea7e jdk7u25-b10
+ef5d29607ccee9712f2c768f269e4b9fa53a6859 jdk7u25-b11
+39282f16234385bbddd19189de2450f8bf88492b jdk7u25-b12
+ba6c3d64b94d17d90b86e36b7a282480a1c6808a jdk7u25-b13
+a71103b8cbb155a4af136baaee4f4bdd30ee817c jdk7u25-b14
+e1768e2070c938ec97325ad48b0d281e3031a29c jdk7u25-b15
+0d68732acbd4b6669512b1d2be496a9e391795a9 jdk7u25-b30
+173b399abd8aa2e4fdc0066c977719670d180125 jdk7u25-b16
 555ea0c4e9567294d37793777d521902d43f1a39 jdk7u14-b16
 950fa827c2ec8a3a1ceba755994ae59016daa621 jdk7u14-b17
 e7ba683c15009b166127c3437fe9fbaf4eee6efe jdk7u14-b18
@@ -299,3 +320,4 @@
 ac03c48f1d82e0c8c1d5d72b8953be8aef558d87 jdk7u40-b26
 6ce66ba864780251fc44fff65358ef24f68ea51a jdk7u40-b27
 2043900095890e676f5ed0f959f470e2138c2a9a jdk7u40-b28
+d3186a0676dbc7ab80e00fa67f952b67933d5a35 jdk7u40-b29
--- a/make/java/java/FILES_c.gmk	Wed Jun 19 02:46:50 2013 -0700
+++ b/make/java/java/FILES_c.gmk	Wed Jun 19 11:52:12 2013 +0100
@@ -48,7 +48,6 @@
 	Proxy.c \
 	RandomAccessFile.c \
 	RandomAccessFile_md.c \
-	ResourceBundle.c \
 	Runtime.c \
 	SecurityManager.c \
 	Shutdown.c \
@@ -69,7 +68,6 @@
 	jdk_util_md.c \
 	check_version.c \
 	java_props_md.c \
-	DriverManager.c \
 	ConstantPool.c \
 	MessageUtils.c \
 	GC.c \
--- a/make/java/java/mapfile-vers	Wed Jun 19 02:46:50 2013 -0700
+++ b/make/java/java/mapfile-vers	Wed Jun 19 11:52:12 2013 +0100
@@ -134,7 +134,6 @@
 		Java_java_lang_ClassLoader_00024NativeLibrary_find;
 		Java_java_lang_ClassLoader_00024NativeLibrary_load;
 		Java_java_lang_ClassLoader_00024NativeLibrary_unload;
-		Java_java_lang_ClassLoader_getCaller; 
 		Java_java_lang_ClassLoader_registerNatives;
 		Java_java_lang_Compiler_registerNatives;
 		Java_java_lang_Double_longBitsToDouble;
@@ -232,8 +231,6 @@
 		Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2Ljava_security_AccessControlContext_2;
 		Java_java_security_AccessController_getStackAccessControlContext;
 		Java_java_security_AccessController_getInheritedAccessControlContext;
-		Java_java_sql_DriverManager_getCallerClassLoader;
-		Java_java_util_ResourceBundle_getClassContext;
 		Java_java_util_TimeZone_getSystemTimeZoneID;
 		Java_java_util_TimeZone_getSystemGMTOffsetID;
 		Java_java_util_concurrent_atomic_AtomicLong_VMSupportsCS8;
@@ -268,6 +265,7 @@
 		Java_sun_reflect_NativeConstructorAccessorImpl_newInstance0;
 		Java_sun_reflect_NativeMethodAccessorImpl_invoke0;
 		Java_sun_reflect_Reflection_getCallerClass;
+		Java_sun_reflect_Reflection_getCallerClass0;
 		Java_sun_reflect_Reflection_getClassAccessFlags;
                 Java_sun_misc_Version_getJdkVersionInfo;
                 Java_sun_misc_Version_getJdkSpecialVersion;
--- a/make/java/java/reorder-i586	Wed Jun 19 02:46:50 2013 -0700
+++ b/make/java/java/reorder-i586	Wed Jun 19 11:52:12 2013 +0100
@@ -73,7 +73,6 @@
 # Test Sleep
 # Test IntToString
 # Test LoadToolkit
-text: .text%Java_java_util_ResourceBundle_getClassContext;
 text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2Ljava_security_AccessControlContext_2;
 text: .text%JNU_GetEnv;
 text: .text%Java_java_io_UnixFileSystem_checkAccess;
--- a/make/java/java/reorder-sparc	Wed Jun 19 02:46:50 2013 -0700
+++ b/make/java/java/reorder-sparc	Wed Jun 19 11:52:12 2013 +0100
@@ -78,7 +78,6 @@
 # Test Sleep
 # Test IntToString
 # Test LoadToolkit
-text: .text%Java_java_util_ResourceBundle_getClassContext;
 text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2Ljava_security_AccessControlContext_2;
 text: .text%JNU_GetEnv;
 text: .text%Java_java_io_UnixFileSystem_checkAccess;
--- a/make/java/java/reorder-sparcv9	Wed Jun 19 02:46:50 2013 -0700
+++ b/make/java/java/reorder-sparcv9	Wed Jun 19 11:52:12 2013 +0100
@@ -74,7 +74,6 @@
 # Test Sleep
 # Test IntToString
 # Test LoadToolkit
-text: .text%Java_java_util_ResourceBundle_getClassContext;
 text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2Ljava_security_AccessControlContext_2;
 text: .text%JNU_GetEnv;
 text: .text%Java_java_io_UnixFileSystem_checkAccess;
--- a/make/java/nio/mapfile-bsd	Wed Jun 19 02:46:50 2013 -0700
+++ b/make/java/nio/mapfile-bsd	Wed Jun 19 11:52:12 2013 +0100
@@ -108,6 +108,7 @@
 		Java_sun_nio_ch_Net_setInterface6;
 		Java_sun_nio_ch_Net_getInterface6;
 		Java_sun_nio_ch_Net_shutdown;
+                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 19 02:46:50 2013 -0700
+++ b/make/java/nio/mapfile-linux	Wed Jun 19 11:52:12 2013 +0100
@@ -116,6 +116,7 @@
 		Java_sun_nio_ch_Net_setInterface6;
 		Java_sun_nio_ch_Net_getInterface6;
 		Java_sun_nio_ch_Net_shutdown;
+                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 19 02:46:50 2013 -0700
+++ b/make/java/nio/mapfile-solaris	Wed Jun 19 11:52:12 2013 +0100
@@ -104,6 +104,7 @@
 		Java_sun_nio_ch_Net_setInterface6;
 		Java_sun_nio_ch_Net_getInterface6;
 		Java_sun_nio_ch_Net_shutdown;
+                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 19 02:46:50 2013 -0700
+++ b/make/java/zip/mapfile-vers	Wed Jun 19 11:52:12 2013 +0100
@@ -64,6 +64,7 @@
 		Java_java_util_zip_ZipFile_initIDs;
 		Java_java_util_zip_ZipFile_open;
 		Java_java_util_zip_ZipFile_read;
+		Java_java_util_zip_ZipFile_startsWithLOC;
 
 		ZIP_Close;
 		ZIP_CRC32;
--- a/make/java/zip/reorder-i586	Wed Jun 19 02:46:50 2013 -0700
+++ b/make/java/zip/reorder-i586	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/make/java/zip/reorder-sparc	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/make/java/zip/reorder-sparcv9	Wed Jun 19 11:52:12 2013 +0100
@@ -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/sun/awt/Makefile	Wed Jun 19 02:46:50 2013 -0700
+++ b/make/sun/awt/Makefile	Wed Jun 19 11:52:12 2013 +0100
@@ -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
@@ -565,5 +642,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	Wed Jun 19 11:52:12 2013 +0100
@@ -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/cmm/lcms/FILES_c_unix.gmk	Wed Jun 19 02:46:50 2013 -0700
+++ b/make/sun/cmm/lcms/FILES_c_unix.gmk	Wed Jun 19 11:52:12 2013 +0100
@@ -30,6 +30,7 @@
     cmserr.c \
     cmsgamma.c \
     cmsgmt.c \
+    cmshalf.c \
     cmsintrp.c \
     cmsio0.c \
     cmsio1.c \
--- a/make/sun/cmm/lcms/FILES_c_windows.gmk	Wed Jun 19 02:46:50 2013 -0700
+++ b/make/sun/cmm/lcms/FILES_c_windows.gmk	Wed Jun 19 11:52:12 2013 +0100
@@ -30,6 +30,7 @@
     cmserr.c \
     cmsgamma.c \
     cmsgmt.c \
+    cmshalf.c \
     cmsintrp.c \
     cmsio0.c \
     cmsio1.c \
--- a/make/sun/xawt/Makefile	Wed Jun 19 02:46:50 2013 -0700
+++ b/make/sun/xawt/Makefile	Wed Jun 19 11:52:12 2013 +0100
@@ -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
@@ -39,7 +39,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
 
@@ -323,70 +323,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 19 02:46:50 2013 -0700
+++ /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/sun/java2d/opengl/CGLLayer.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/macosx/classes/sun/java2d/opengl/CGLLayer.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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/LWKeyboardFocusManagerPeer.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/macosx/classes/sun/lwawt/LWKeyboardFocusManagerPeer.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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/LWScrollBarPeer.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/macosx/classes/sun/lwawt/LWScrollBarPeer.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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,6 +57,8 @@
     void initializeImpl() {
         super.initializeImpl();
         final Scrollbar target = getTarget();
+        setLineIncrement(target.getUnitIncrement());
+        setPageIncrement(target.getBlockIncrement());
         setValues(target.getValue(), target.getVisibleAmount(),
                   target.getMinimum(), target.getMaximum());
 
--- a/src/macosx/classes/sun/lwawt/LWToolkit.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/macosx/classes/sun/lwawt/LWToolkit.java	Wed Jun 19 11:52:12 2013 +0100
@@ -491,6 +491,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 19 02:46:50 2013 -0700
+++ b/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Wed Jun 19 11:52:12 2013 +0100
@@ -42,7 +42,7 @@
 
 public class LWWindowPeer
     extends LWContainerPeer<Window, JComponent>
-    implements FramePeer, DialogPeer, FullScreenCapable, DisplayChangedListener
+    implements FramePeer, DialogPeer, FullScreenCapable, DisplayChangedListener, PlatformEventNotifier
 {
     public static enum PeerType {
         SIMPLEWINDOW,
@@ -117,6 +117,8 @@
 
     private final PeerType peerType;
 
+    private final SecurityWarningWindow warningWindow;
+
     /**
      * Current modal blocker or null.
      *
@@ -163,6 +165,19 @@
         }
 
         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
@@ -227,6 +242,9 @@
         if (isGrabbing()) {
             ungrab();
         }
+        if (warningWindow != null) {
+            warningWindow.dispose();
+        }
         destroyBuffers();
         platformWindow.dispose();
         super.disposeImpl();
@@ -234,6 +252,10 @@
 
     @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);
@@ -534,7 +556,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 ---- //
@@ -594,6 +624,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.
@@ -618,6 +649,7 @@
         }
     }
 
+    @Override
     public void notifyZoom(boolean isZoomed) {
         int newWindowState = isZoomed ? Frame.MAXIMIZED_BOTH : Frame.NORMAL;
         postWindowStateChangedEvent(newWindowState);
@@ -627,6 +659,7 @@
      * Called by the {@code PlatformWindow} when any part of the window should
      * be repainted.
      */
+    @Override
     public final void notifyExpose(final Rectangle r) {
         repaintPeer(r);
     }
@@ -637,6 +670,7 @@
      * LWComponentPeer as the only components which could be resized by user are
      * top-level windows.
      */
+    @Override
     public final void notifyReshape(int x, int y, int w, int h) {
         final boolean moved;
         final boolean resized;
@@ -671,6 +705,8 @@
             handleResize(w, h, true);
             repaintPeer();
         }
+
+        repositionSecurityWarning();
     }
 
     private void clearBackground(final int w, final int h) {
@@ -698,16 +734,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 &&
@@ -724,10 +763,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();
@@ -746,11 +786,9 @@
                 if (isEnabled()) {
                     Point lp = lastMouseEventPeer.windowToLocal(x, y,
                                                                 lastWindowPeer);
-                    postEvent(new MouseEvent(lastMouseEventPeer.getTarget(),
-                                             MouseEvent.MOUSE_EXITED, when,
-                                             modifiers, lp.x, lp.y, screenX,
-                                             screenY, clickCount, popupTrigger,
-                                             button));
+                    Component target = lastMouseEventPeer.getTarget();
+                    postMouseEnteredExitedEvent(target, id, when, modifiers, lp,
+                            screenX, screenY, clickCount, popupTrigger, button);
                 }
                 lastMouseEventPeer = null;
             }
@@ -766,28 +804,22 @@
                         Rectangle lr = lastWindowPeer.getBounds();
                         oldp.x += r.x - lr.x;
                         oldp.y += r.y - lr.y;
-                        postEvent(new MouseEvent(lastMouseEventPeer.getTarget(),
-                                                 MouseEvent.MOUSE_EXITED,
-                                                 when, modifiers,
-                                                 oldp.x, oldp.y, screenX, screenY,
-                                                 clickCount, popupTrigger, button));
+                        Component target = lastMouseEventPeer.getTarget();
+                        postMouseEnteredExitedEvent(target, id, when, modifiers, oldp,
+                                screenX, screenY, clickCount, popupTrigger, button);
                     } else {
                         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();
+                        postMouseEnteredExitedEvent(target, id, when, modifiers, oldp,
+                                screenX, screenY, clickCount, popupTrigger, button);
                     }
                 }
                 lastMouseEventPeer = targetPeer;
                 if (targetPeer != null && targetPeer.isEnabled() && id != MouseEvent.MOUSE_ENTERED) {
                     Point newp = targetPeer.windowToLocal(x, y, curWindowPeer);
-                    postEvent(new MouseEvent(targetPeer.getTarget(),
-                                             MouseEvent.MOUSE_ENTERED,
-                                             when, modifiers,
-                                             newp.x, newp.y, screenX, screenY,
-                                             clickCount, popupTrigger, button));
+                    Component target = targetPeer.getTarget();
+                    postMouseEnteredExitedEvent(target, id, when, modifiers, newp,
+                            screenX, screenY, clickCount, popupTrigger, button);
                 }
             }
             // TODO: fill "bdata" member of AWTEvent
@@ -853,11 +885,18 @@
 
             Point lp = targetPeer.windowToLocal(x, y, curWindowPeer);
             if (targetPeer.isEnabled()) {
-                MouseEvent event = new MouseEvent(targetPeer.getTarget(), id,
+                if (id == MouseEvent.MOUSE_ENTERED || id == MouseEvent.MOUSE_EXITED) {
+                    postMouseEnteredExitedEvent(targetPeer.getTarget(), id,
+                            when, modifiers, lp, screenX, screenY,
+                            clickCount, popupTrigger, button);
+
+                } else {
+                    MouseEvent event = new MouseEvent(targetPeer.getTarget(), id,
                                                   when, modifiers, lp.x, lp.y,
                                                   screenX, screenY, clickCount,
                                                   popupTrigger, button);
-                postEvent(event);
+                    postEvent(event);
+                }
             }
 
             if (id == MouseEvent.MOUSE_RELEASED) {
@@ -875,10 +914,22 @@
         notifyUpdateCursor();
     }
 
-    public void dispatchMouseWheelEvent(long when, int x, int y, int modifiers,
-                                        int scrollType, int scrollAmount,
-                                        int wheelRotation, double preciseWheelRotation,
-                                        byte[] bdata)
+    private void postMouseEnteredExitedEvent(
+            Component target, int id, long when, int modifiers,
+            Point loc, int xAbs, int yAbs,
+            int clickCount, boolean popupTrigger, int button) {
+
+        updateSecurityWarningVisibility();
+
+        postEvent(new MouseEvent(target, id, 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();
@@ -904,8 +955,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();
@@ -944,6 +996,8 @@
                 windowState, newWindowState);
         postEvent(stateChangedEvent);
         windowState = newWindowState;
+
+        updateSecurityWarningVisibility();
     }
 
     private static int getGraphicsConfigScreen(GraphicsConfiguration gc) {
@@ -1308,10 +1362,12 @@
 
     public void enterFullScreenMode() {
         platformWindow.enterFullScreenMode();
+        updateSecurityWarningVisibility();
     }
 
     public void exitFullScreenMode() {
         platformWindow.exitFullScreenMode();
+        updateSecurityWarningVisibility();
     }
 
     public long getLayerPtr() {
@@ -1346,6 +1402,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	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/macosx/classes/sun/lwawt/PlatformWindow.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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
@@ -155,6 +155,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	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java	Wed Jun 19 11:52:12 2013 +0100
@@ -97,7 +97,7 @@
     public void handleKeyEvent(int eventType, int modifierFlags, String characters,
                                String charsIgnoringMods, boolean isRepeat, short keyCode,
                                boolean needsKeyTyped) {
-        responder.handleKeyEvent(eventType, modifierFlags, charsIgnoringMods, keyCode, needsKeyTyped);
+        responder.handleKeyEvent(eventType, modifierFlags, charsIgnoringMods, keyCode, needsKeyTyped, isRepeat);
     }
 
     // REMIND: delete this method once 'deploy' changes for 7156194 is pushed
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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
@@ -203,6 +203,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 19 02:46:50 2013 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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
@@ -28,22 +28,26 @@
 import sun.awt.SunToolkit;
 import sun.lwawt.LWWindowPeer;
 import sun.lwawt.macosx.event.NSEvent;
-import java.awt.Toolkit;
+
+import java.awt.*;
 import java.awt.event.MouseEvent;
 import java.awt.event.InputEvent;
 import java.awt.event.MouseWheelEvent;
 import java.awt.event.KeyEvent;
+import sun.lwawt.PlatformEventNotifier;
 
 /**
  * Translates NSEvents/NPCocoaEvents into AWT events.
  */
 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;
     }
 
@@ -77,9 +81,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);
     }
 
     /**
@@ -115,15 +119,15 @@
             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);
     }
 
     /**
      * Handles key events.
      */
     void handleKeyEvent(int eventType, int modifierFlags, String chars,
-                        short keyCode, boolean needsKeyTyped) {
+                        short keyCode, boolean needsKeyTyped, boolean needsKeyReleased) {
         boolean isFlagsChangedEvent =
             isNpapiCallback ? (eventType == CocoaConstants.NPCocoaEventFlagsChanged) :
                               (eventType == CocoaConstants.NSFlagsChanged);
@@ -182,9 +186,11 @@
 
         int jmodifiers = NSEvent.nsToJavaKeyModifiers(modifierFlags);
         long when = System.currentTimeMillis();
-
-        peer.dispatchKeyEvent(jeventType, when, jmodifiers,
-                              jkeyCode, javaChar, jkeyLocation);
+        if (jeventType == KeyEvent.KEY_PRESSED) {
+            lastKeyPressCode = jkeyCode;
+        }
+        eventNotifier.notifyKeyEvent(jeventType, when, jmodifiers,
+                jkeyCode, javaChar, jkeyLocation);
 
         // Current browser may be sending input events, so don't
         // post the KEY_TYPED here.
@@ -195,30 +201,53 @@
         // Modifier keys (shift, etc) don't want to send TYPED events.
         // On the other hand we don't want to generate keyTyped events
         // for clipboard related shortcuts like Meta + [CVX]
-        boolean isMetaDown = (jmodifiers & KeyEvent.META_DOWN_MASK) != 0;
-        if (jeventType == KeyEvent.KEY_PRESSED && postsTyped && !isMetaDown) {
-            peer.dispatchKeyEvent(KeyEvent.KEY_TYPED, when, jmodifiers,
-                                  KeyEvent.VK_UNDEFINED, javaChar,
-                                  KeyEvent.KEY_LOCATION_UNKNOWN);
+        if (jeventType == KeyEvent.KEY_PRESSED && postsTyped &&
+                (jmodifiers & KeyEvent.META_DOWN_MASK) == 0) {
+            // Enter and Space keys finish the input method processing,
+            // KEY_TYPED and KEY_RELEASED events for them are synthesized in handleInputEvent
+            if (needsKeyReleased && (jkeyCode == KeyEvent.VK_ENTER || jkeyCode == KeyEvent.VK_SPACE)) {
+                return;
+            }
+            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) {
+            eventNotifier.notifyKeyEvent(KeyEvent.KEY_RELEASED, when, jmodifiers,
+                                         jkeyCode, javaChar,
+                                         KeyEvent.KEY_LOCATION_UNKNOWN);
+            }
         }
     }
 
     void handleInputEvent(String text) {
         if (text != null) {
             int index = 0, length = text.length();
-            char c;
+            char c = 0;
             while (index < length) {
                 c = text.charAt(index);
-                peer.dispatchKeyEvent(KeyEvent.KEY_TYPED,
-                                      System.currentTimeMillis(),
-                                      0, KeyEvent.VK_UNDEFINED, c,
-                                      KeyEvent.KEY_LOCATION_UNKNOWN);
+                eventNotifier.notifyKeyEvent(KeyEvent.KEY_TYPED,
+                        System.currentTimeMillis(),
+                        0, KeyEvent.VK_UNDEFINED, c,
+                        KeyEvent.KEY_LOCATION_UNKNOWN);
                 index++;
             }
+            eventNotifier.notifyKeyEvent(KeyEvent.KEY_RELEASED,
+                                         System.currentTimeMillis(),
+                                         0, lastKeyPressCode, c,
+                                         KeyEvent.KEY_LOCATION_UNKNOWN);
         }
     }
 
     void handleWindowFocusEvent(boolean gained, LWWindowPeer opposite) {
-        peer.notifyActivation(gained, opposite);
+        eventNotifier.notifyActivation(gained, opposite);
+    }
+
+    void handleWindowDidExposeEvent(final Rectangle r) {
+        eventNotifier.notifyExpose(r);
+    }
+
+    void handleReshapeEvent(int x, int y, int w, int h) {
+        eventNotifier.notifyReshape(x, y, w, h);
     }
 }
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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
@@ -60,11 +60,15 @@
         this.responder = 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);
+    }
+
     public long getAWTView() {
         return ptr;
         }
@@ -98,6 +102,10 @@
         CWrapper.NSView.exitFullScreenMode(ptr);
     }
 
+    public void setToolTip(String msg) {
+        CWrapper.NSView.setToolTip(ptr, msg);
+    }
+
     // ----------------------------------------------------------------------
     // PAINTING METHODS
     // ----------------------------------------------------------------------
@@ -112,11 +120,11 @@
     }
 
     public Image createBackBuffer() {
-        Rectangle r = peer.getBounds();
+        Rectangle r = getBounds();
         Image im = null;
         if (!r.isEmpty()) {
             int transparency = (isOpaque() ? Transparency.OPAQUE : Transparency.TRANSLUCENT);
-            im = peer.getGraphicsConfiguration().createCompatibleImage(r.width, r.height, transparency);
+            im = getGraphicsConfiguration().createCompatibleImage(r.width, r.height, transparency);
         }
         return im;
     }
@@ -126,7 +134,7 @@
             surfaceData = windowLayer.replaceSurfaceData();
         } else {
             if (surfaceData == null) {
-                CGraphicsConfig graphicsConfig = (CGraphicsConfig)peer.getGraphicsConfiguration();
+                CGraphicsConfig graphicsConfig = (CGraphicsConfig)getGraphicsConfiguration();
                 surfaceData = graphicsConfig.createSurfaceData(this);
             } else {
                 validateSurface();
@@ -201,7 +209,7 @@
      * In normal mode this method is never called.
      */
     private void deliverResize(int x, int y, int w, int h) {
-        peer.notifyReshape(x, y, w, h);
+        responder.handleReshapeEvent(x, y, w, h);
     }
 
 
@@ -220,7 +228,7 @@
 
     private void deliverKeyEvent(NSEvent event) {
         responder.handleKeyEvent(event.getType(), event.getModifierFlags(),
-                                 event.getCharactersIgnoringModifiers(), event.getKeyCode(), true);
+                                 event.getCharactersIgnoringModifiers(), event.getKeyCode(), true, false);
     }
 
     /**
@@ -228,6 +236,7 @@
      * NSView mode. See NSView.drawRect().
      */
     private void deliverWindowDidExposeEvent() {
-        peer.notifyExpose(peer.getSize());
+        Rectangle r = getBounds();
+        responder.handleWindowDidExposeEvent(new Rectangle(r.width, r.height));
     }
 }
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Wed Jun 19 11:52:12 2013 +0100
@@ -47,7 +47,7 @@
 import com.apple.laf.ClientPropertyApplicator.Property;
 import com.sun.awt.AWTUtilities;
 
-public final class CPlatformWindow extends CFRetainedResource implements PlatformWindow {
+public class CPlatformWindow extends CFRetainedResource implements PlatformWindow {
     private native long nativeCreateNSWindow(long nsViewPtr, long styleBits, double x, double y, double w, double h);
     private static native void nativeSetNSWindowStyleBits(long nsWindowPtr, int mask, int data);
     private static native void nativeSetNSWindowMenuBar(long nsWindowPtr, long menuBarPtr);
@@ -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;
@@ -230,12 +230,8 @@
 
         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);
-        contentView = new CPlatformView();
+        responder = createPlatformResponder();
+        contentView = createContentView();
         contentView.initialize(peer, responder);
 
         final long nativeWindowPtr = nativeCreateNSWindow(contentView.getAWTView(), styleBits, 0, 0, 0, 0);
@@ -257,6 +253,14 @@
         validateSurface();
     }
 
+    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;
@@ -470,7 +474,7 @@
         nativeSetNSWindowBounds(getNSWindowPtr(), x, y, w, h);
     }
 
-    private boolean isVisible() {
+    public boolean isVisible() {
         return this.visible;
     }
 
@@ -479,7 +483,7 @@
     }
 
     private void maximize() {
-        if (isMaximized()) {
+        if (peer == null || isMaximized()) {
             return;
         }
         if (!undecorated) {
@@ -542,7 +546,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) {
@@ -668,6 +672,10 @@
 
     @Override
     public void setResizable(boolean resizable) {
+        if (peer == null) {
+            return;
+        }
+
         setStyleBits(RESIZABLE, resizable);
 
         // Re-apply the size constraints and the size to ensure the space
@@ -737,7 +745,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,7 +775,7 @@
         } finally {
             CWrapper.NSObject.release(screenPtr);
         }
-        peer.notifyReshape(screenBounds.x, screenBounds.y, screenBounds.width,
+        responder.handleReshapeEvent(screenBounds.x, screenBounds.y, screenBounds.width,
                            screenBounds.height);
     }
 
@@ -777,8 +786,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;
         }
@@ -923,7 +937,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
@@ -935,9 +949,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();
+        final GraphicsConfiguration oldGC = contentView.getGraphicsConfiguration();
+
+        if (peer!= null) {
+            peer.notifyReshape(x, y, width, height);
+        }
+
+        final GraphicsConfiguration newGC = contentView.getGraphicsConfiguration();
         // System-dependent appearance optimization.
         if ((byUser && !oldB.getSize().equals(nativeBounds.getSize()))
             || isFullScreenAnimationOn || !Objects.equals(newGC, oldGC)) {
@@ -946,21 +964,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();
+        }
     }
 
     /*
@@ -968,6 +994,10 @@
      * may become natively focusable window.
      */
     private boolean isNativelyFocusableWindow() {
+        if (peer == null) {
+            return false;
+        }
+
         return !peer.isSimpleWindow() && target.getFocusableWindowState();
     }
 
@@ -982,7 +1012,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/CViewPlatformEmbeddedFrame.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CViewPlatformEmbeddedFrame.java	Wed Jun 19 11:52:12 2013 +0100
@@ -200,6 +200,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	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CWrapper.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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
@@ -86,6 +86,7 @@
         public static native void enterFullScreenMode(long view);
         public static native void exitFullScreenMode(long view);
 
+        public static native void setToolTip(long view, String msg);
         public static native void setHidden(long view, boolean hidden);
     }
 
--- a/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Wed Jun 19 11:52:12 2013 +0100
@@ -166,6 +166,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/jobjc/src/core/native/SEL.m	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/macosx/native/jobjc/src/core/native/SEL.m	Wed Jun 19 11:52:12 2013 +0100
@@ -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
--- a/src/macosx/native/sun/awt/AWTView.m	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/macosx/native/sun/awt/AWTView.m	Wed Jun 19 11:52:12 2013 +0100
@@ -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
--- a/src/macosx/native/sun/awt/CRobot.m	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/macosx/native/sun/awt/CRobot.m	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/macosx/native/sun/awt/CWrapper.m	Wed Jun 19 11:52:12 2013 +0100
@@ -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
@@ -652,6 +652,27 @@
 
 /*
  * 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);
+    [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
+        [view setToolTip: s];
+    }];
+
+JNF_COCOA_EXIT(env);
+}
+
+/*
+ * Class:     sun_lwawt_macosx_CWrapper$NSView
  * Method:    setHidden
  * Signature: (JZ)V
  */
--- a/src/macosx/native/sun/awt/LWCToolkit.m	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/macosx/native/sun/awt/LWCToolkit.m	Wed Jun 19 11:52:12 2013 +0100
@@ -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
@@ -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 19 02:46:50 2013 -0700
+++ b/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m	Wed Jun 19 11:52:12 2013 +0100
@@ -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/jmx/interceptor/DefaultMBeanServerInterceptor.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/jmx/mbeanserver/ClassLoaderRepositorySupport.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/jmx/mbeanserver/ConvertingMethod.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java	Wed Jun 19 11:52:12 2013 +0100
@@ -73,6 +73,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
@@ -298,6 +300,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));
     }
 
@@ -422,6 +425,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();
@@ -827,7 +831,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 " +
@@ -1010,7 +1014,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);
@@ -1106,13 +1110,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) {
@@ -1321,6 +1327,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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java	Wed Jun 19 11:52:12 2013 +0100
@@ -230,6 +230,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
@@ -250,6 +255,7 @@
             throws NotCompliantMBeanException {
         if (mbeanInterface == null)
             mbeanInterface = getStandardMBeanInterface(baseClass);
+        ReflectUtil.checkPackageAccess(mbeanInterface);
         MBeanIntrospector<?> introspector = StandardMBeanIntrospector.getInstance();
         return getClassMBeanInfo(introspector, baseClass, mbeanInterface);
     }
@@ -374,13 +380,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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/jmx/mbeanserver/JmxMBeanServer.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/jmx/mbeanserver/ObjectInputStreamWithLoader.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/jmx/mbeanserver/StandardMBeanIntrospector.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/jmx/remote/internal/ArrayNotificationBuffer.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -227,8 +227,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
@@ -362,9 +363,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();
@@ -374,7 +382,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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/jmx/remote/util/OrderClassLoaders.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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/media/sound/AbstractDataLine.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/AbstractDataLine.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/AbstractLine.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/AbstractMidiDevice.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/AbstractMidiDeviceProvider.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/AbstractMixer.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/AiffFileFormat.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/AiffFileReader.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/AiffFileWriter.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/AlawCodec.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/AuFileFormat.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/AuFileReader.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/AuFileWriter.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/AudioFileSoundbankReader.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/AudioFloatConverter.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/AudioFloatFormatConverter.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/AudioFloatInputStream.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/DLSInfo.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/DLSInstrument.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/DLSModulator.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/DLSRegion.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/DLSSample.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/DLSSampleLoop.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/DLSSampleOptions.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/DLSSoundbank.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/DLSSoundbankReader.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/DataPusher.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/DirectAudioDevice.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/DirectAudioDeviceProvider.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/EmergencySoundbank.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/EventDispatcher.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/FFT.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/FastShortMessage.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/JARSoundbankReader.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/JDK13Services.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/JSSecurityManager.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -49,7 +49,7 @@
  *
  * @author Matthias Pfisterer
  */
-class JSSecurityManager {
+final class JSSecurityManager {
 
     /** Prevent instantiation.
      */
@@ -75,30 +75,6 @@
         }
     }
 
-
-    static void loadLibrary(final String libName) {
-        try {
-            if (hasSecurityManager()) {
-                if(Printer.debug) Printer.debug("using security manager to load library");
-                PrivilegedAction action = new PrivilegedAction() {
-                        public Object run() {
-                            System.loadLibrary(libName);
-                            return null;
-                        }
-                    };
-                AccessController.doPrivileged(action);
-            } else {
-                if(Printer.debug) Printer.debug("not using security manager to load library");
-                System.loadLibrary(libName);
-            }
-            if (Printer.debug) Printer.debug("loaded library " + libName);
-        } catch (UnsatisfiedLinkError e2) {
-            if (Printer.err)Printer.err("UnsatisfiedLinkError loading native library " + libName);
-            throw(e2);
-        }
-    }
-
-
     static String getProperty(final String propertyName) {
         String propertyValue;
         if (hasSecurityManager()) {
@@ -191,83 +167,13 @@
         if(Printer.trace)Printer.trace("<< JSSecurityManager: loadPropertiesImpl() completed");
     }
 
-
-    private static ThreadGroup getTopmostThreadGroup() {
-        ThreadGroup topmostThreadGroup;
-        if(hasSecurityManager()) {
-            try {
-                // invoke the privileged action using 1.2 security
-                PrivilegedAction action = new PrivilegedAction() {
-                        public Object run() {
-                            try {
-                                return getTopmostThreadGroupImpl();
-                            } catch (Throwable t) {
-                                return null;
-                            }
-                        }
-                    };
-                topmostThreadGroup = (ThreadGroup) AccessController.doPrivileged(action);
-                if(Printer.debug)Printer.debug("Got topmost thread group with JDK 1.2 security");
-            } catch (Exception e) {
-                if(Printer.debug)Printer.debug("Exception getting topmost thread group with JDK 1.2 security");
-                // try without using JDK 1.2 security
-                topmostThreadGroup = getTopmostThreadGroupImpl();
-            }
-        } else {
-            // not JDK 1.2 security, assume we already have permission
-            topmostThreadGroup = getTopmostThreadGroupImpl();
-        }
-        return topmostThreadGroup;
-    }
-
-
-    private static ThreadGroup getTopmostThreadGroupImpl() {
-        if(Printer.trace)Printer.trace(">> JSSecurityManager: getTopmostThreadGroupImpl()");
-        ThreadGroup g = Thread.currentThread().getThreadGroup();
-        while ((g.getParent() != null) && (g.getParent().getParent() != null)) {
-            g = g.getParent();
-        }
-        if(Printer.trace)Printer.trace("<< JSSecurityManager: getTopmostThreadGroupImpl() completed");
-        return g;
-    }
-
-
-    /** Create a Thread in the topmost ThreadGroup.
+    /** Create a Thread in the current ThreadGroup.
      */
     static Thread createThread(final Runnable runnable,
                                final String threadName,
                                final boolean isDaemon, final int priority,
                                final boolean doStart) {
-        Thread thread = null;
-        if(hasSecurityManager()) {
-            PrivilegedAction action = new PrivilegedAction() {
-                    public Object run() {
-                        try {
-                            return createThreadImpl(runnable, threadName,
-                                                    isDaemon, priority,
-                                                    doStart);
-                        } catch (Throwable t) {
-                            return null;
-                        }
-                    }
-                };
-            thread = (Thread) AccessController.doPrivileged(action);
-            if(Printer.debug) Printer.debug("created thread with JDK 1.2 security");
-        } else {
-            if(Printer.debug)Printer.debug("not using JDK 1.2 security");
-            thread = createThreadImpl(runnable, threadName, isDaemon, priority,
-                                      doStart);
-        }
-        return thread;
-    }
-
-
-    private static Thread createThreadImpl(Runnable runnable,
-                                           String threadName,
-                                           boolean isDaemon, int priority,
-                                           boolean doStart) {
-        ThreadGroup threadGroup = getTopmostThreadGroupImpl();
-        Thread thread = new Thread(threadGroup, runnable);
+        Thread thread = new Thread(runnable);
         if (threadName != null) {
             thread.setName(threadName);
         }
@@ -281,7 +187,6 @@
         return thread;
     }
 
-
     static List getProviders(final Class providerClass) {
         List p = new ArrayList();
         // Service.providers(Class) just creates "lazy" iterator instance,
--- a/src/share/classes/com/sun/media/sound/JavaSoundAudioClip.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/JavaSoundAudioClip.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/MidiDeviceReceiverEnvelope.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/MidiDeviceTransmitterEnvelope.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/MidiInDevice.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/MidiInDeviceProvider.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/MidiOutDevice.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/MidiOutDeviceProvider.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/MidiUtils.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/ModelByteBuffer.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/ModelByteBufferWavetable.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/ModelConnectionBlock.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/ModelDestination.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/ModelIdentifier.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/ModelInstrument.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/ModelInstrumentComparator.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/ModelMappedInstrument.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/ModelPatch.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/ModelPerformer.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/ModelSource.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/ModelStandardDirector.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/ModelStandardIndexedDirector.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/ModelStandardTransform.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/PCMtoPCMCodec.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/Platform.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/PortMixer.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/PortMixerProvider.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/Printer.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/RIFFInvalidDataException.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/RIFFInvalidFormatException.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/RIFFReader.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/RIFFWriter.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/RealTimeSequencer.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/RealTimeSequencerProvider.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SF2GlobalRegion.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SF2Instrument.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SF2InstrumentRegion.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SF2Layer.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,11 +34,11 @@
  *
  * @author Karl Helgason
  */
-public class SF2Layer extends SoundbankResource {
+public final class SF2Layer extends SoundbankResource {
 
-    protected String name = "";
-    protected SF2GlobalRegion globalregion = null;
-    protected List<SF2LayerRegion> regions = new ArrayList<SF2LayerRegion>();
+    String name = "";
+    SF2GlobalRegion globalregion = null;
+    List<SF2LayerRegion> regions = new ArrayList<SF2LayerRegion>();
 
     public SF2Layer(SF2Soundbank soundBank) {
         super(soundBank, null, null);
--- a/src/share/classes/com/sun/media/sound/SF2LayerRegion.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SF2LayerRegion.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,9 +29,9 @@
  *
  * @author Karl Helgason
  */
-public class SF2LayerRegion extends SF2Region {
+public final class SF2LayerRegion extends SF2Region {
 
-    protected SF2Sample sample;
+    SF2Sample sample;
 
     public SF2Sample getSample() {
         return sample;
--- a/src/share/classes/com/sun/media/sound/SF2Modulator.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SF2Modulator.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
  *
  * @author Karl Helgason
  */
-public class SF2Modulator {
+public final class SF2Modulator {
 
     public final static int SOURCE_NONE = 0;
     public final static int SOURCE_NOTE_ON_VELOCITY = 2;
@@ -49,11 +49,11 @@
     public final static int SOURCE_TYPE_SWITCH = 1024 * 3;
     public final static int TRANSFORM_LINEAR = 0;
     public final static int TRANSFORM_ABSOLUTE = 2;
-    protected int sourceOperator;
-    protected int destinationOperator;
-    protected short amount;
-    protected int amountSourceOperator;
-    protected int transportOperator;
+    int sourceOperator;
+    int destinationOperator;
+    short amount;
+    int amountSourceOperator;
+    int transportOperator;
 
     public short getAmount() {
         return amount;
--- a/src/share/classes/com/sun/media/sound/SF2Sample.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SF2Sample.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,18 +36,18 @@
  *
  * @author Karl Helgason
  */
-public class SF2Sample extends SoundbankResource {
+public final class SF2Sample extends SoundbankResource {
 
-    protected String name = "";
-    protected long startLoop = 0;
-    protected long endLoop = 0;
-    protected long sampleRate = 44100;
-    protected int originalPitch = 60;
-    protected byte pitchCorrection = 0;
-    protected int sampleLink = 0;
-    protected int sampleType = 0;
-    protected ModelByteBuffer data;
-    protected ModelByteBuffer data24;
+    String name = "";
+    long startLoop = 0;
+    long endLoop = 0;
+    long sampleRate = 44100;
+    int originalPitch = 60;
+    byte pitchCorrection = 0;
+    int sampleLink = 0;
+    int sampleType = 0;
+    ModelByteBuffer data;
+    ModelByteBuffer data24;
 
     public SF2Sample(Soundbank soundBank) {
         super(soundBank, null, AudioInputStream.class);
--- a/src/share/classes/com/sun/media/sound/SF2Soundbank.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SF2Soundbank.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,40 +50,40 @@
  *
  * @author Karl Helgason
  */
-public class SF2Soundbank implements Soundbank {
+public final class SF2Soundbank implements Soundbank {
 
     // version of the Sound Font RIFF file
-    protected int major = 2;
-    protected int minor = 1;
+    int major = 2;
+    int minor = 1;
     // target Sound Engine
-    protected String targetEngine = "EMU8000";
+    String targetEngine = "EMU8000";
     // Sound Font Bank Name
-    protected String name = "untitled";
+    String name = "untitled";
     // Sound ROM Name
-    protected String romName = null;
+    String romName = null;
     // Sound ROM Version
-    protected int romVersionMajor = -1;
-    protected int romVersionMinor = -1;
+    int romVersionMajor = -1;
+    int romVersionMinor = -1;
     // Date of Creation of the Bank
-    protected String creationDate = null;
+    String creationDate = null;
     // Sound Designers and Engineers for the Bank
-    protected String engineers = null;
+    String engineers = null;
     // Product for which the Bank was intended
-    protected String product = null;
+    String product = null;
     // Copyright message
-    protected String copyright = null;
+    String copyright = null;
     // Comments
-    protected String comments = null;
+    String comments = null;
     // The SoundFont tools used to create and alter the bank
-    protected String tools = null;
+    String tools = null;
     // The Sample Data loaded from the SoundFont
     private ModelByteBuffer sampleData = null;
     private ModelByteBuffer sampleData24 = null;
     private File sampleFile = null;
     private boolean largeFormat = false;
-    private List<SF2Instrument> instruments = new ArrayList<SF2Instrument>();
-    private List<SF2Layer> layers = new ArrayList<SF2Layer>();
-    private List<SF2Sample> samples = new ArrayList<SF2Sample>();
+    private final List<SF2Instrument> instruments = new ArrayList<SF2Instrument>();
+    private final List<SF2Layer> layers = new ArrayList<SF2Layer>();
+    private final List<SF2Sample> samples = new ArrayList<SF2Sample>();
 
     public SF2Soundbank() {
     }
--- a/src/share/classes/com/sun/media/sound/SF2SoundbankReader.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SF2SoundbankReader.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,7 @@
  *
  * @author Karl Helgason
  */
-public class SF2SoundbankReader extends SoundbankReader {
+public final class SF2SoundbankReader extends SoundbankReader {
 
     public Soundbank getSoundbank(URL url)
             throws InvalidMidiDataException, IOException {
--- a/src/share/classes/com/sun/media/sound/SoftAbstractResampler.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftAbstractResampler.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -67,7 +67,7 @@
         float samplerateconv = 1;
         float pitchcorrection = 0;
 
-        public ModelAbstractResamplerStream() {
+        ModelAbstractResamplerStream() {
             pad = getPadding();
             pad2 = getPadding() * 2;
             ibuffer = new float[2][sector_size + pad2];
@@ -384,7 +384,7 @@
             float in_end, float[] pitch, float pitchstep, float[] out,
             int[] out_offset, int out_end);
 
-    public SoftResamplerStreamer openStreamer() {
+    public final SoftResamplerStreamer openStreamer() {
         return new ModelAbstractResamplerStream();
     }
 }
--- a/src/share/classes/com/sun/media/sound/SoftAudioBuffer.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftAudioBuffer.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,7 @@
  *
  * @author Karl Helgason
  */
-public class SoftAudioBuffer {
+public final class SoftAudioBuffer {
 
     private int size;
     private float[] buffer;
--- a/src/share/classes/com/sun/media/sound/SoftAudioPusher.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftAudioPusher.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,13 +34,13 @@
  *
  * @author Karl Helgason
  */
-public class SoftAudioPusher implements Runnable {
+public final class SoftAudioPusher implements Runnable {
 
     private volatile boolean active = false;
     private SourceDataLine sourceDataLine = null;
     private Thread audiothread;
-    private AudioInputStream ais;
-    private byte[] buffer;
+    private final AudioInputStream ais;
+    private final byte[] buffer;
 
     public SoftAudioPusher(SourceDataLine sourceDataLine, AudioInputStream ais,
             int workbuffersizer) {
--- a/src/share/classes/com/sun/media/sound/SoftChannel.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftChannel.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,7 @@
  *
  * @author Karl Helgason
  */
-public class SoftChannel implements MidiChannel, ModelDirectedPlayer {
+public final class SoftChannel implements MidiChannel, ModelDirectedPlayer {
 
     private static boolean[] dontResetControls = new boolean[128];
     static {
@@ -90,15 +90,15 @@
     private static final int RPN_NULL_VALUE = (127 << 7) + 127;
     private int rpn_control = RPN_NULL_VALUE;
     private int nrpn_control = RPN_NULL_VALUE;
-    protected double portamento_time = 1; // keyschanges per control buffer time
-    protected int[] portamento_lastnote = new int[128];
-    protected int portamento_lastnote_ix = 0;
+    double portamento_time = 1; // keyschanges per control buffer time
+    int[] portamento_lastnote = new int[128];
+    int portamento_lastnote_ix = 0;
     private boolean portamento = false;
     private boolean mono = false;
     private boolean mute = false;
     private boolean solo = false;
     private boolean solomute = false;
-    private Object control_mutex;
+    private final Object control_mutex;
     private int channel;
     private SoftVoice[] voices;
     private int bank;
@@ -111,21 +111,21 @@
     private int pitchbend;
     private double[] co_midi_pitch = new double[1];
     private double[] co_midi_channel_pressure = new double[1];
-    protected SoftTuning tuning = new SoftTuning();
-    protected int tuning_bank = 0;
-    protected int tuning_program = 0;
-    protected SoftInstrument current_instrument = null;
-    protected ModelChannelMixer current_mixer = null;
-    protected ModelDirector current_director = null;
+    SoftTuning tuning = new SoftTuning();
+    int tuning_bank = 0;
+    int tuning_program = 0;
+    SoftInstrument current_instrument = null;
+    ModelChannelMixer current_mixer = null;
+    ModelDirector current_director = null;
 
     // Controller Destination Settings
-    protected int cds_control_number = -1;
-    protected ModelConnectionBlock[] cds_control_connections = null;
-    protected ModelConnectionBlock[] cds_channelpressure_connections = null;
-    protected ModelConnectionBlock[] cds_polypressure_connections = null;
-    protected boolean sustain = false;
-    protected boolean[][] keybasedcontroller_active = null;
-    protected double[][] keybasedcontroller_value = null;
+    int cds_control_number = -1;
+    ModelConnectionBlock[] cds_control_connections = null;
+    ModelConnectionBlock[] cds_channelpressure_connections = null;
+    ModelConnectionBlock[] cds_polypressure_connections = null;
+    boolean sustain = false;
+    boolean[][] keybasedcontroller_active = null;
+    double[][] keybasedcontroller_value = null;
 
     private class MidiControlObject implements SoftControl {
         double[] pitch = co_midi_pitch;
@@ -336,7 +336,7 @@
 
     }
 
-    protected void initVoice(SoftVoice voice, SoftPerformer p, int voiceID,
+    void initVoice(SoftVoice voice, SoftPerformer p, int voiceID,
             int noteNumber, int velocity, int delay, ModelConnectionBlock[] connectionBlocks,
             ModelChannelMixer channelmixer, boolean releaseTriggered) {
         if (voice.active) {
@@ -414,7 +414,7 @@
     /* A special noteOn with delay parameter, which is used to
      * start note within control buffers.
      */
-    protected void noteOn(int noteNumber, int velocity, int delay) {
+    void noteOn(int noteNumber, int velocity, int delay) {
         noteNumber = restrict7Bit(noteNumber);
         velocity = restrict7Bit(velocity);
         noteOn_internal(noteNumber, velocity, delay);
@@ -707,7 +707,7 @@
         }
     }
 
-    protected void applyInstrumentCustomization() {
+    void applyInstrumentCustomization() {
         if (cds_control_connections == null
                 && cds_channelpressure_connections == null
                 && cds_polypressure_connections == null) {
--- a/src/share/classes/com/sun/media/sound/SoftChannelProxy.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftChannelProxy.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
  *
  * @author Karl Helgason
  */
-public class SoftChannelProxy implements MidiChannel {
+public final class SoftChannelProxy implements MidiChannel {
 
     private MidiChannel channel = null;
 
--- a/src/share/classes/com/sun/media/sound/SoftChorus.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftChorus.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,11 +32,11 @@
  *
  * @author Karl Helgason
  */
-public class SoftChorus implements SoftAudioProcessor {
+public final class SoftChorus implements SoftAudioProcessor {
 
     private static class VariableDelay {
 
-        private float[] delaybuffer;
+        private final float[] delaybuffer;
         private int rovepos = 0;
         private float gain = 1;
         private float rgain = 0;
@@ -44,7 +44,7 @@
         private float lastdelay = 0;
         private float feedback = 0;
 
-        public VariableDelay(int maxbuffersize) {
+        VariableDelay(int maxbuffersize) {
             delaybuffer = new float[maxbuffersize];
         }
 
@@ -119,10 +119,10 @@
         private double phase_step = 0;
         private double depth = 0;
         private VariableDelay vdelay;
-        private double samplerate;
-        private double controlrate;
+        private final double samplerate;
+        private final double controlrate;
 
-        public LFODelay(double samplerate, double controlrate) {
+        LFODelay(double samplerate, double controlrate) {
             this.samplerate = samplerate;
             this.controlrate = controlrate;
             // vdelay = new VariableDelay((int)(samplerate*4));
--- a/src/share/classes/com/sun/media/sound/SoftCubicResampler.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftCubicResampler.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
  *
  * @author Karl Helgason
  */
-public class SoftCubicResampler extends SoftAbstractResampler {
+public final class SoftCubicResampler extends SoftAbstractResampler {
 
     public int getPadding() {
         return 3;
--- a/src/share/classes/com/sun/media/sound/SoftEnvelopeGenerator.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftEnvelopeGenerator.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
  *
  * @author Karl Helgason
  */
-public class SoftEnvelopeGenerator implements SoftProcess {
+public final class SoftEnvelopeGenerator implements SoftProcess {
 
     public final static int EG_OFF = 0;
     public final static int EG_DELAY = 1;
@@ -42,23 +42,23 @@
     public final static int EG_END = 8;
     int max_count = 10;
     int used_count = 0;
-    private int[] stage = new int[max_count];
-    private int[] stage_ix = new int[max_count];
-    private double[] stage_v = new double[max_count];
-    private int[] stage_count = new int[max_count];
-    private double[][] on = new double[max_count][1];
-    private double[][] active = new double[max_count][1];
-    private double[][] out = new double[max_count][1];
-    private double[][] delay = new double[max_count][1];
-    private double[][] attack = new double[max_count][1];
-    private double[][] hold = new double[max_count][1];
-    private double[][] decay = new double[max_count][1];
-    private double[][] sustain = new double[max_count][1];
-    private double[][] release = new double[max_count][1];
-    private double[][] shutdown = new double[max_count][1];
-    private double[][] release2 = new double[max_count][1];
-    private double[][] attack2 = new double[max_count][1];
-    private double[][] decay2 = new double[max_count][1];
+    private final int[] stage = new int[max_count];
+    private final int[] stage_ix = new int[max_count];
+    private final double[] stage_v = new double[max_count];
+    private final int[] stage_count = new int[max_count];
+    private final double[][] on = new double[max_count][1];
+    private final double[][] active = new double[max_count][1];
+    private final double[][] out = new double[max_count][1];
+    private final double[][] delay = new double[max_count][1];
+    private final double[][] attack = new double[max_count][1];
+    private final double[][] hold = new double[max_count][1];
+    private final double[][] decay = new double[max_count][1];
+    private final double[][] sustain = new double[max_count][1];
+    private final double[][] release = new double[max_count][1];
+    private final double[][] shutdown = new double[max_count][1];
+    private final double[][] release2 = new double[max_count][1];
+    private final double[][] attack2 = new double[max_count][1];
+    private final double[][] decay2 = new double[max_count][1];
     private double control_time = 0;
 
     public void reset() {
--- a/src/share/classes/com/sun/media/sound/SoftFilter.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftFilter.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,7 @@
  *
  * @author Karl Helgason
  */
-public class SoftFilter {
+public final class SoftFilter {
 
     public final static int FILTERTYPE_LP6 = 0x00;
     public final static int FILTERTYPE_LP12 = 0x01;
@@ -55,7 +55,7 @@
     // 0x30 = NP, Notch or Band Elimination Filter
     //
     private int filtertype = FILTERTYPE_LP6;
-    private float samplerate;
+    private final float samplerate;
     private float x1;
     private float x2;
     private float y1;
--- a/src/share/classes/com/sun/media/sound/SoftInstrument.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftInstrument.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,12 +32,12 @@
  *
  * @author Karl Helgason
  */
-public class SoftInstrument extends Instrument {
+public final class SoftInstrument extends Instrument {
 
     private SoftPerformer[] performers;
     private ModelPerformer[] modelperformers;
-    private Object data;
-    private ModelInstrument ins;
+    private final Object data;
+    private final ModelInstrument ins;
 
     public SoftInstrument(ModelInstrument ins) {
         super(ins.getSoundbank(), ins.getPatch(), ins.getName(),
--- a/src/share/classes/com/sun/media/sound/SoftJitterCorrector.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftJitterCorrector.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@
  *
  * @author Karl Helgason
  */
-public class SoftJitterCorrector extends AudioInputStream {
+public final class SoftJitterCorrector extends AudioInputStream {
 
     private static class JitterStream extends InputStream {
 
@@ -48,7 +48,7 @@
         int writepos = 0;
         int readpos = 0;
         byte[][] buffers;
-        Object buffers_mutex = new Object();
+        private final Object buffers_mutex = new Object();
 
         // Adapative Drift Statistics
         int w_count = 1000;
@@ -112,7 +112,7 @@
             }
         }
 
-        public JitterStream(AudioInputStream s, int buffersize,
+        JitterStream(AudioInputStream s, int buffersize,
                 int smallbuffersize) {
             this.w_count = 10 * (buffersize / smallbuffersize);
             if (w_count < 100)
--- a/src/share/classes/com/sun/media/sound/SoftLanczosResampler.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftLanczosResampler.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
  *
  * @author Karl Helgason
  */
-public class SoftLanczosResampler extends SoftAbstractResampler {
+public final class SoftLanczosResampler extends SoftAbstractResampler {
 
     float[][] sinc_table;
     int sinc_table_fsize = 2000;
--- a/src/share/classes/com/sun/media/sound/SoftLimiter.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftLimiter.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,7 @@
  *
  * @author Karl Helgason
  */
-public class SoftLimiter implements SoftAudioProcessor {
+public final class SoftLimiter implements SoftAudioProcessor {
 
     float lastmax = 0;
     float gain = 1;
--- a/src/share/classes/com/sun/media/sound/SoftLinearResampler.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftLinearResampler.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
  *
  * @author Karl Helgason
  */
-public class SoftLinearResampler extends SoftAbstractResampler {
+public final class SoftLinearResampler extends SoftAbstractResampler {
 
     public int getPadding() {
         return 2;
--- a/src/share/classes/com/sun/media/sound/SoftLinearResampler2.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftLinearResampler2.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
  *
  * @author Karl Helgason
  */
-public class SoftLinearResampler2 extends SoftAbstractResampler {
+public final class SoftLinearResampler2 extends SoftAbstractResampler {
 
     public int getPadding() {
         return 2;
--- a/src/share/classes/com/sun/media/sound/SoftLowFrequencyOscillator.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftLowFrequencyOscillator.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,21 +29,21 @@
  *
  * @author Karl Helgason
  */
-public class SoftLowFrequencyOscillator implements SoftProcess {
+public final class SoftLowFrequencyOscillator implements SoftProcess {
 
-    private int max_count = 10;
+    private final int max_count = 10;
     private int used_count = 0;
-    private double[][] out = new double[max_count][1];
-    private double[][] delay = new double[max_count][1];
-    private double[][] delay2 = new double[max_count][1];
-    private double[][] freq = new double[max_count][1];
-    private int[] delay_counter = new int[max_count];
-    private double[] sin_phase = new double[max_count];
-    private double[] sin_stepfreq = new double[max_count];
-    private double[] sin_step = new double[max_count];
+    private final double[][] out = new double[max_count][1];
+    private final double[][] delay = new double[max_count][1];
+    private final double[][] delay2 = new double[max_count][1];
+    private final double[][] freq = new double[max_count][1];
+    private final int[] delay_counter = new int[max_count];
+    private final double[] sin_phase = new double[max_count];
+    private final double[] sin_stepfreq = new double[max_count];
+    private final double[] sin_step = new double[max_count];
     private double control_time = 0;
     private double sin_factor = 0;
-    private static double PI2 = 2.0 * Math.PI;
+    private static final double PI2 = 2.0 * Math.PI;
 
     public SoftLowFrequencyOscillator() {
         // If sin_step is 0 then sin_stepfreq must be -INF
--- a/src/share/classes/com/sun/media/sound/SoftMainMixer.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftMainMixer.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,7 @@
  *
  * @author Karl Helgason
  */
-public class SoftMainMixer {
+public final class SoftMainMixer {
 
     // A private class thats contains a ModelChannelMixer and it's private buffers.
     // This becomes necessary when we want to have separate delay buffers for each channel mixer.
@@ -67,13 +67,13 @@
     public final static int CHANNEL_RIGHT_DRY = 11;
     public final static int CHANNEL_SCRATCH1 = 12;
     public final static int CHANNEL_SCRATCH2 = 13;
-    protected boolean active_sensing_on = false;
+    boolean active_sensing_on = false;
     private long msec_last_activity = -1;
     private boolean pusher_silent = false;
     private int pusher_silent_count = 0;
     private long sample_pos = 0;
-    protected boolean readfully = true;
-    private Object control_mutex;
+    boolean readfully = true;
+    private final Object control_mutex;
     private SoftSynthesizer synth;
     private float samplerate = 44100;
     private int nrofchannels = 2;
@@ -84,7 +84,7 @@
     private SoftAudioProcessor agc;
     private long msec_buffer_len = 0;
     private int buffer_len = 0;
-    protected TreeMap<Long, Object> midimessages = new TreeMap<Long, Object>();
+    TreeMap<Long, Object> midimessages = new TreeMap<Long, Object>();
     private int delay_midievent = 0;
     private int max_delay_midievent = 0;
     double last_volume_left = 1.0;
@@ -97,7 +97,7 @@
     private Set<SoftChannelMixerContainer> registeredMixers = null;
     private Set<ModelChannelMixer> stoppedMixers = null;
     private SoftChannelMixerContainer[] cur_registeredMixers = null;
-    protected SoftControl co_master = new SoftControl() {
+    SoftControl co_master = new SoftControl() {
 
         double[] balance = co_master_balance;
         double[] volume = co_master_volume;
@@ -438,7 +438,7 @@
         delay_midievent = 0;
     }
 
-    protected void processAudioBuffers() {
+    void processAudioBuffers() {
 
         if(synth.weakstream != null && synth.weakstream.silent_samples != 0)
         {
@@ -859,16 +859,16 @@
 
         InputStream in = new InputStream() {
 
-            private SoftAudioBuffer[] buffers = SoftMainMixer.this.buffers;
-            private int nrofchannels
+            private final SoftAudioBuffer[] buffers = SoftMainMixer.this.buffers;
+            private final int nrofchannels
                     = SoftMainMixer.this.synth.getFormat().getChannels();
-            private int buffersize = buffers[0].getSize();
-            private byte[] bbuffer = new byte[buffersize
+            private final int buffersize = buffers[0].getSize();
+            private final byte[] bbuffer = new byte[buffersize
                     * (SoftMainMixer.this.synth.getFormat()
                         .getSampleSizeInBits() / 8)
                     * nrofchannels];
             private int bbuffer_pos = 0;
-            private byte[] single = new byte[1];
+            private final byte[] single = new byte[1];
 
             public void fillBuffer() {
                 /*
--- a/src/share/classes/com/sun/media/sound/SoftMidiAudioFileReader.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftMidiAudioFileReader.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@
  *
  * @author Karl Helgason
  */
-public class SoftMidiAudioFileReader extends AudioFileReader {
+public final class SoftMidiAudioFileReader extends AudioFileReader {
 
     public static final Type MIDI = new Type("MIDI", "mid");
     private static AudioFormat format = new AudioFormat(44100, 16, 2, true, false);
--- a/src/share/classes/com/sun/media/sound/SoftMixingClip.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftMixingClip.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,7 @@
  *
  * @author Karl Helgason
  */
-public class SoftMixingClip extends SoftMixingDataLine implements Clip {
+public final class SoftMixingClip extends SoftMixingDataLine implements Clip {
 
     private AudioFormat format;
 
@@ -50,7 +50,7 @@
 
     private byte[] data;
 
-    private InputStream datastream = new InputStream() {
+    private final InputStream datastream = new InputStream() {
 
         public int read() throws IOException {
             byte[] b = new byte[1];
@@ -162,7 +162,7 @@
 
     private AudioFloatInputStream afis;
 
-    protected SoftMixingClip(SoftMixingMixer mixer, DataLine.Info info) {
+    SoftMixingClip(SoftMixingMixer mixer, DataLine.Info info) {
         super(mixer, info);
     }
 
--- a/src/share/classes/com/sun/media/sound/SoftMixingDataLine.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftMixingDataLine.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,22 +50,22 @@
             "Chorus Send") {
     };
 
-    protected static class AudioFloatInputStreamResampler extends
+    protected static final class AudioFloatInputStreamResampler extends
             AudioFloatInputStream {
 
-        private AudioFloatInputStream ais;
+        private final AudioFloatInputStream ais;
 
-        private AudioFormat targetFormat;
+        private final AudioFormat targetFormat;
 
         private float[] skipbuffer;
 
         private SoftAbstractResampler resampler;
 
-        private float[] pitch = new float[1];
+        private final float[] pitch = new float[1];
 
-        private float[] ibuffer2;
+        private final float[] ibuffer2;
 
-        private float[][] ibuffer;
+        private final float[][] ibuffer;
 
         private float ibuffer_index = 0;
 
@@ -75,15 +75,15 @@
 
         private float[][] cbuffer;
 
-        private int buffer_len = 512;
+        private final int buffer_len = 512;
 
-        private int pad;
+        private final int pad;
 
-        private int pad2;
+        private final int pad2;
 
-        private float[] ix = new float[1];
+        private final float[] ix = new float[1];
 
-        private int[] ox = new int[1];
+        private final int[] ox = new int[1];
 
         private float[][] mark_ibuffer = null;
 
@@ -294,7 +294,7 @@
 
     }
 
-    private class Gain extends FloatControl {
+    private final class Gain extends FloatControl {
 
         private Gain() {
 
@@ -308,7 +308,7 @@
         }
     }
 
-    private class Mute extends BooleanControl {
+    private final class Mute extends BooleanControl {
 
         private Mute() {
             super(BooleanControl.Type.MUTE, false, "True", "False");
@@ -320,7 +320,7 @@
         }
     }
 
-    private class ApplyReverb extends BooleanControl {
+    private final class ApplyReverb extends BooleanControl {
 
         private ApplyReverb() {
             super(BooleanControl.Type.APPLY_REVERB, false, "True", "False");
@@ -333,7 +333,7 @@
 
     }
 
-    private class Balance extends FloatControl {
+    private final class Balance extends FloatControl {
 
         private Balance() {
             super(FloatControl.Type.BALANCE, -1.0f, 1.0f, (1.0f / 128.0f), -1,
@@ -347,7 +347,7 @@
 
     }
 
-    private class Pan extends FloatControl {
+    private final class Pan extends FloatControl {
 
         private Pan() {
             super(FloatControl.Type.PAN, -1.0f, 1.0f, (1.0f / 128.0f), -1,
@@ -365,7 +365,7 @@
 
     }
 
-    private class ReverbSend extends FloatControl {
+    private final class ReverbSend extends FloatControl {
 
         private ReverbSend() {
             super(FloatControl.Type.REVERB_SEND, -80f, 6.0206f, 80f / 128.0f,
@@ -379,7 +379,7 @@
 
     }
 
-    private class ChorusSend extends FloatControl {
+    private final class ChorusSend extends FloatControl {
 
         private ChorusSend() {
             super(CHORUS_SEND, -80f, 6.0206f, 80f / 128.0f, -1, -80f, "dB",
@@ -393,43 +393,43 @@
 
     }
 
-    private Gain gain_control = new Gain();
+    private final Gain gain_control = new Gain();
 
-    private Mute mute_control = new Mute();
+    private final Mute mute_control = new Mute();
 
-    private Balance balance_control = new Balance();
+    private final Balance balance_control = new Balance();
 
-    private Pan pan_control = new Pan();
+    private final Pan pan_control = new Pan();
 
-    private ReverbSend reverbsend_control = new ReverbSend();
+    private final ReverbSend reverbsend_control = new ReverbSend();
 
-    private ChorusSend chorussend_control = new ChorusSend();
+    private final ChorusSend chorussend_control = new ChorusSend();
 
-    private ApplyReverb apply_reverb = new ApplyReverb();
+    private final ApplyReverb apply_reverb = new ApplyReverb();
 
-    private Control[] controls;
+    private final Control[] controls;
 
-    protected float leftgain = 1;
+    float leftgain = 1;
 
-    protected float rightgain = 1;
+    float rightgain = 1;
 
-    protected float eff1gain = 0;
+    float eff1gain = 0;
 
-    protected float eff2gain = 0;
+    float eff2gain = 0;
 
-    protected List<LineListener> listeners = new ArrayList<LineListener>();
+    List<LineListener> listeners = new ArrayList<LineListener>();
 
-    protected Object control_mutex;
+    final Object control_mutex;
 
-    protected SoftMixingMixer mixer;
+    SoftMixingMixer mixer;
 
-    protected DataLine.Info info;
+    DataLine.Info info;
 
     protected abstract void processControlLogic();
 
     protected abstract void processAudioLogic(SoftAudioBuffer[] buffers);
 
-    protected SoftMixingDataLine(SoftMixingMixer mixer, DataLine.Info info) {
+    SoftMixingDataLine(SoftMixingMixer mixer, DataLine.Info info) {
         this.mixer = mixer;
         this.info = info;
         this.control_mutex = mixer.control_mutex;
@@ -440,7 +440,7 @@
         calcVolume();
     }
 
-    protected void calcVolume() {
+    final void calcVolume() {
         synchronized (control_mutex) {
             double gain = Math.pow(10.0, gain_control.getValue() / 20.0);
             if (mute_control.getValue())
@@ -466,7 +466,7 @@
         }
     }
 
-    protected void sendEvent(LineEvent event) {
+    final void sendEvent(LineEvent event) {
         if (listeners.size() == 0)
             return;
         LineListener[] listener_array = listeners
@@ -476,23 +476,23 @@
         }
     }
 
-    public void addLineListener(LineListener listener) {
+    public final void addLineListener(LineListener listener) {
         synchronized (control_mutex) {
             listeners.add(listener);
         }
     }
 
-    public void removeLineListener(LineListener listener) {
+    public final void removeLineListener(LineListener listener) {
         synchronized (control_mutex) {
             listeners.add(listener);
         }
     }
 
-    public javax.sound.sampled.Line.Info getLineInfo() {
+    public final javax.sound.sampled.Line.Info getLineInfo() {
         return info;
     }
 
-    public Control getControl(Type control) {
+    public final Control getControl(Type control) {
         if (control != null) {
             for (int i = 0; i < controls.length; i++) {
                 if (controls[i].getType() == control) {
@@ -504,11 +504,11 @@
                 + control);
     }
 
-    public Control[] getControls() {
+    public final Control[] getControls() {
         return Arrays.copyOf(controls, controls.length);
     }
 
-    public boolean isControlSupported(Type control) {
+    public final boolean isControlSupported(Type control) {
         if (control != null) {
             for (int i = 0; i < controls.length; i++) {
                 if (controls[i].getType() == control) {
--- a/src/share/classes/com/sun/media/sound/SoftMixingMainMixer.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftMixingMainMixer.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,7 @@
  *
  * @author Karl Helgason
  */
-public class SoftMixingMainMixer {
+public final class SoftMixingMainMixer {
 
     public final static int CHANNEL_LEFT = 0;
 
@@ -63,23 +63,23 @@
 
     public final static int CHANNEL_CHANNELMIXER_RIGHT = 15;
 
-    private SoftMixingMixer mixer;
+    private final SoftMixingMixer mixer;
 
-    private AudioInputStream ais;
+    private final AudioInputStream ais;
 
-    private SoftAudioBuffer[] buffers;
+    private final SoftAudioBuffer[] buffers;
 
-    private SoftAudioProcessor reverb;
+    private final SoftAudioProcessor reverb;
 
-    private SoftAudioProcessor chorus;
+    private final SoftAudioProcessor chorus;
 
-    private SoftAudioProcessor agc;
+    private final SoftAudioProcessor agc;
 
-    private int nrofchannels;
+    private final int nrofchannels;
 
-    private Object control_mutex;
+    private final Object control_mutex;
 
-    private List<SoftMixingDataLine> openLinesList = new ArrayList<SoftMixingDataLine>();
+    private final List<SoftMixingDataLine> openLinesList = new ArrayList<SoftMixingDataLine>();
 
     private SoftMixingDataLine[] openLines = new SoftMixingDataLine[0];
 
@@ -87,7 +87,7 @@
         return ais;
     }
 
-    protected void processAudioBuffers() {
+    void processAudioBuffers() {
         for (int i = 0; i < buffers.length; i++) {
             buffers[i].clear();
         }
@@ -162,20 +162,20 @@
 
         InputStream in = new InputStream() {
 
-            private SoftAudioBuffer[] buffers = SoftMixingMainMixer.this.buffers;
+            private final SoftAudioBuffer[] buffers = SoftMixingMainMixer.this.buffers;
 
-            private int nrofchannels = SoftMixingMainMixer.this.mixer
+            private final int nrofchannels = SoftMixingMainMixer.this.mixer
                     .getFormat().getChannels();
 
-            private int buffersize = buffers[0].getSize();
+            private final int buffersize = buffers[0].getSize();
 
-            private byte[] bbuffer = new byte[buffersize
+            private final byte[] bbuffer = new byte[buffersize
                     * (SoftMixingMainMixer.this.mixer.getFormat()
                             .getSampleSizeInBits() / 8) * nrofchannels];
 
             private int bbuffer_pos = 0;
 
-            private byte[] single = new byte[1];
+            private final byte[] single = new byte[1];
 
             public void fillBuffer() {
                 processAudioBuffers();
--- a/src/share/classes/com/sun/media/sound/SoftMixingMixer.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftMixingMixer.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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
@@ -48,27 +48,27 @@
  *
  * @author Karl Helgason
  */
-public class SoftMixingMixer implements Mixer {
+public final class SoftMixingMixer implements Mixer {
 
     private static class Info extends Mixer.Info {
-        public Info() {
+        Info() {
             super(INFO_NAME, INFO_VENDOR, INFO_DESCRIPTION, INFO_VERSION);
         }
     }
 
-    protected static final String INFO_NAME = "Gervill Sound Mixer";
+    static final String INFO_NAME = "Gervill Sound Mixer";
 
-    protected static final String INFO_VENDOR = "OpenJDK Proposal";
+    static final String INFO_VENDOR = "OpenJDK Proposal";
 
-    protected static final String INFO_DESCRIPTION = "Software Sound Mixer";
+    static final String INFO_DESCRIPTION = "Software Sound Mixer";
 
-    protected static final String INFO_VERSION = "1.0";
+    static final String INFO_VERSION = "1.0";
 
-    protected final static Mixer.Info info = new Info();
+    static final Mixer.Info info = new Info();
 
-    protected Object control_mutex = this;
+    final Object control_mutex = this;
 
-    protected boolean implicitOpen = false;
+    boolean implicitOpen = false;
 
     private boolean open = false;
 
@@ -82,15 +82,15 @@
 
     private AudioInputStream pusher_stream = null;
 
-    private float controlrate = 147f;
+    private final float controlrate = 147f;
 
-    private long latency = 100000; // 100 msec
+    private final long latency = 100000; // 100 msec
 
-    private boolean jitter_correction = false;
+    private final boolean jitter_correction = false;
 
-    private List<LineListener> listeners = new ArrayList<LineListener>();
+    private final List<LineListener> listeners = new ArrayList<LineListener>();
 
-    private javax.sound.sampled.Line.Info[] sourceLineInfo;
+    private final javax.sound.sampled.Line.Info[] sourceLineInfo;
 
     public SoftMixingMixer() {
 
@@ -516,11 +516,11 @@
         }
     }
 
-    protected float getControlRate() {
+    float getControlRate() {
         return controlrate;
     }
 
-    protected SoftMixingMainMixer getMainMixer() {
+    SoftMixingMainMixer getMainMixer() {
         if (!isOpen())
             return null;
         return mainmixer;
--- a/src/share/classes/com/sun/media/sound/SoftMixingMixerProvider.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftMixingMixerProvider.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,13 +33,13 @@
  *
  * @author Karl Helgason
  */
-public class SoftMixingMixerProvider extends MixerProvider {
+public final class SoftMixingMixerProvider extends MixerProvider {
 
     static SoftMixingMixer globalmixer = null;
 
     static Thread lockthread = null;
 
-    protected final static Object mutex = new Object();
+    static final Object mutex = new Object();
 
     public Mixer getMixer(Info info) {
         if (!(info == null || info == SoftMixingMixer.info)) {
--- a/src/share/classes/com/sun/media/sound/SoftMixingSourceDataLine.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftMixingSourceDataLine.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,8 +41,8 @@
  *
  * @author Karl Helgason
  */
-public class SoftMixingSourceDataLine extends SoftMixingDataLine implements
-        SourceDataLine {
+public final class SoftMixingSourceDataLine extends SoftMixingDataLine
+        implements SourceDataLine {
 
     private boolean open = false;
 
@@ -72,7 +72,7 @@
             AudioFloatInputStream {
         AudioFloatInputStream ais;
 
-        public NonBlockingFloatInputStream(AudioFloatInputStream ais) {
+        NonBlockingFloatInputStream(AudioFloatInputStream ais) {
             this.ais = ais;
         }
 
@@ -120,7 +120,7 @@
 
     }
 
-    protected SoftMixingSourceDataLine(SoftMixingMixer mixer, DataLine.Info info) {
+    SoftMixingSourceDataLine(SoftMixingMixer mixer, DataLine.Info info) {
         super(mixer, info);
     }
 
--- a/src/share/classes/com/sun/media/sound/SoftPerformer.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftPerformer.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,7 @@
  *
  * @author Karl Helgason
  */
-public class SoftPerformer {
+public final class SoftPerformer {
 
     static ModelConnectionBlock[] defaultconnections
             = new ModelConnectionBlock[42];
--- a/src/share/classes/com/sun/media/sound/SoftPointResampler.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftPointResampler.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
  *
  * @author Karl Helgason
  */
-public class SoftPointResampler extends SoftAbstractResampler {
+public final class SoftPointResampler extends SoftAbstractResampler {
 
     public int getPadding() {
         return 100;
--- a/src/share/classes/com/sun/media/sound/SoftProvider.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftProvider.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,10 +34,10 @@
  *
  * @author Karl Helgason
  */
-public class SoftProvider extends MidiDeviceProvider {
+public final class SoftProvider extends MidiDeviceProvider {
 
-    protected final static Info softinfo = SoftSynthesizer.info;
-    private static Info[] softinfos = {softinfo};
+    static final Info softinfo = SoftSynthesizer.info;
+    private static final Info[] softinfos = {softinfo};
 
     public MidiDevice.Info[] getDeviceInfo() {
         return Arrays.copyOf(softinfos, softinfos.length);
--- a/src/share/classes/com/sun/media/sound/SoftReceiver.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftReceiver.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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,13 +36,13 @@
  *
  * @author Karl Helgason
  */
-public class SoftReceiver implements MidiDeviceReceiver {
+public final class SoftReceiver implements MidiDeviceReceiver {
 
-    protected boolean open = true;
-    private Object control_mutex;
-    private SoftSynthesizer synth;
-    protected TreeMap<Long, Object> midimessages;
-    protected SoftMainMixer mainmixer;
+    boolean open = true;
+    private final Object control_mutex;
+    private final SoftSynthesizer synth;
+    TreeMap<Long, Object> midimessages;
+    SoftMainMixer mainmixer;
 
     public SoftReceiver(SoftSynthesizer synth) {
         this.control_mutex = synth.control_mutex;
--- a/src/share/classes/com/sun/media/sound/SoftReverb.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftReverb.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,14 +33,14 @@
  *
  * @author Karl Helgason
  */
-public class SoftReverb implements SoftAudioProcessor {
+public final class SoftReverb implements SoftAudioProcessor {
 
     private final static class Delay {
 
         private float[] delaybuffer;
         private int rovepos = 0;
 
-        public Delay() {
+        Delay() {
             delaybuffer = null;
         }
 
@@ -77,7 +77,7 @@
         private int rovepos = 0;
         private float feedback;
 
-        public AllPass(int size) {
+        AllPass(int size) {
             delaybuffer = new float[size];
             delaybuffersize = size;
         }
@@ -127,7 +127,7 @@
         private float filtercoeff1 = 0;
         private float filtercoeff2 = 1;
 
-        public Comb(int size) {
+        Comb(int size) {
             delaybuffer = new float[size];
             delaybuffersize = size;
         }
--- a/src/share/classes/com/sun/media/sound/SoftShortMessage.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftShortMessage.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
  *
  * @author Karl Helgason
  */
-public class SoftShortMessage extends ShortMessage {
+public final class SoftShortMessage extends ShortMessage {
 
     int channel = 0;
 
--- a/src/share/classes/com/sun/media/sound/SoftSincResampler.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftSincResampler.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
  *
  * @author Karl Helgason
  */
-public class SoftSincResampler extends SoftAbstractResampler {
+public final class SoftSincResampler extends SoftAbstractResampler {
 
     float[][][] sinc_table;
     int sinc_scale_size = 100;
--- a/src/share/classes/com/sun/media/sound/SoftSynthesizer.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftSynthesizer.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -66,10 +66,10 @@
  *
  * @author Karl Helgason
  */
-public class SoftSynthesizer implements AudioSynthesizer,
+public final class SoftSynthesizer implements AudioSynthesizer,
         ReferenceCountingDevice {
 
-    protected static class WeakAudioStream extends InputStream
+    protected static final class WeakAudioStream extends InputStream
     {
         private volatile AudioInputStream stream;
         public SoftAudioPusher pusher = null;
@@ -166,39 +166,39 @@
     }
 
     private static class Info extends MidiDevice.Info {
-        public Info() {
+        Info() {
             super(INFO_NAME, INFO_VENDOR, INFO_DESCRIPTION, INFO_VERSION);
         }
     }
 
-    protected static final String INFO_NAME = "Gervill";
-    protected static final String INFO_VENDOR = "OpenJDK";
-    protected static final String INFO_DESCRIPTION = "Software MIDI Synthesizer";
-    protected static final String INFO_VERSION = "1.0";
-    protected final static MidiDevice.Info info = new Info();
+    static final String INFO_NAME = "Gervill";
+    static final String INFO_VENDOR = "OpenJDK";
+    static final String INFO_DESCRIPTION = "Software MIDI Synthesizer";
+    static final String INFO_VERSION = "1.0";
+    final static MidiDevice.Info info = new Info();
 
     private static SourceDataLine testline = null;
 
     private static Soundbank defaultSoundBank = null;
 
-    protected WeakAudioStream weakstream = null;
+    WeakAudioStream weakstream = null;
 
-    protected Object control_mutex = this;
+    final Object control_mutex = this;
 
-    protected int voiceIDCounter = 0;
+    int voiceIDCounter = 0;
 
     // 0: default
     // 1: DLS Voice Allocation
-    protected int voice_allocation_mode = 0;
+    int voice_allocation_mode = 0;
 
-    protected boolean load_default_soundbank = false;
-    protected boolean reverb_light = true;
-    protected boolean reverb_on = true;
-    protected boolean chorus_on = true;
-    protected boolean agc_on = true;
+    boolean load_default_soundbank = false;
+    boolean reverb_light = true;
+    boolean reverb_on = true;
+    boolean chorus_on = true;
+    boolean agc_on = true;
 
-    protected SoftChannel[] channels;
-    protected SoftChannelProxy[] external_channels = null;
+    SoftChannel[] channels;
+    SoftChannelProxy[] external_channels = null;
 
     private boolean largemode = false;
 
@@ -371,7 +371,7 @@
         this.format = format;
     }
 
-    protected void removeReceiver(Receiver recv) {
+    void removeReceiver(Receiver recv) {
         boolean perform_close = false;
         synchronized (control_mutex) {
             if (recvslist.remove(recv)) {
@@ -383,13 +383,13 @@
             close();
     }
 
-    protected SoftMainMixer getMainMixer() {
+    SoftMainMixer getMainMixer() {
         if (!isOpen())
             return null;
         return mainmixer;
     }
 
-    protected SoftInstrument findInstrument(int program, int bank, int channel) {
+    SoftInstrument findInstrument(int program, int bank, int channel) {
 
         // Add support for GM2 banks 0x78 and 0x79
         // as specified in DLS 2.2 in Section 1.4.6
@@ -450,31 +450,31 @@
         return null;
     }
 
-    protected int getVoiceAllocationMode() {
+    int getVoiceAllocationMode() {
         return voice_allocation_mode;
     }
 
-    protected int getGeneralMidiMode() {
+    int getGeneralMidiMode() {
         return gmmode;
     }
 
-    protected void setGeneralMidiMode(int gmmode) {
+    void setGeneralMidiMode(int gmmode) {
         this.gmmode = gmmode;
     }
 
-    protected int getDeviceID() {
+    int getDeviceID() {
         return deviceid;
     }
 
-    protected float getControlRate() {
+    float getControlRate() {
         return controlrate;
     }
 
-    protected SoftVoice[] getVoices() {
+    SoftVoice[] getVoices() {
         return voices;
     }
 
-    protected SoftTuning getTuning(Patch patch) {
+    SoftTuning getTuning(Patch patch) {
         String t_id = patchToString(patch);
         SoftTuning tuning = tunings.get(t_id);
         if (tuning == null) {
--- a/src/share/classes/com/sun/media/sound/SoftTuning.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftTuning.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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,10 +35,10 @@
  *
  * @author Karl Helgason
  */
-public class SoftTuning {
+public final class SoftTuning {
 
     private String name = null;
-    private double[] tuning = new double[128];
+    private final double[] tuning = new double[128];
     private Patch patch = null;
 
     public SoftTuning() {
--- a/src/share/classes/com/sun/media/sound/SoftVoice.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftVoice.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@
  *
  * @author Karl Helgason
  */
-public class SoftVoice extends VoiceStatus {
+public final class SoftVoice extends VoiceStatus {
 
     public int exclusiveClass = 0;
     public boolean releaseTriggered = false;
@@ -44,32 +44,32 @@
     private int noteOn_velocity = 0;
     private int noteOff_velocity = 0;
     private int delay = 0;
-    protected ModelChannelMixer channelmixer = null;
-    protected double tunedKey = 0;
-    protected SoftTuning tuning = null;
-    protected SoftChannel stealer_channel = null;
-    protected ModelConnectionBlock[] stealer_extendedConnectionBlocks = null;
-    protected SoftPerformer stealer_performer = null;
-    protected ModelChannelMixer stealer_channelmixer = null;
-    protected int stealer_voiceID = -1;
-    protected int stealer_noteNumber = 0;
-    protected int stealer_velocity = 0;
-    protected boolean stealer_releaseTriggered = false;
-    protected int voiceID = -1;
-    protected boolean sustain = false;
-    protected boolean sostenuto = false;
-    protected boolean portamento = false;
-    private SoftFilter filter_left;
-    private SoftFilter filter_right;
-    private SoftProcess eg = new SoftEnvelopeGenerator();
-    private SoftProcess lfo = new SoftLowFrequencyOscillator();
-    protected Map<String, SoftControl> objects =
+    ModelChannelMixer channelmixer = null;
+    double tunedKey = 0;
+    SoftTuning tuning = null;
+    SoftChannel stealer_channel = null;
+    ModelConnectionBlock[] stealer_extendedConnectionBlocks = null;
+    SoftPerformer stealer_performer = null;
+    ModelChannelMixer stealer_channelmixer = null;
+    int stealer_voiceID = -1;
+    int stealer_noteNumber = 0;
+    int stealer_velocity = 0;
+    boolean stealer_releaseTriggered = false;
+    int voiceID = -1;
+    boolean sustain = false;
+    boolean sostenuto = false;
+    boolean portamento = false;
+    private final SoftFilter filter_left;
+    private final SoftFilter filter_right;
+    private final SoftProcess eg = new SoftEnvelopeGenerator();
+    private final SoftProcess lfo = new SoftLowFrequencyOscillator();
+    Map<String, SoftControl> objects =
             new HashMap<String, SoftControl>();
-    protected SoftSynthesizer synthesizer;
-    protected SoftInstrument instrument;
-    protected SoftPerformer performer;
-    protected SoftChannel softchannel = null;
-    protected boolean on = false;
+    SoftSynthesizer synthesizer;
+    SoftInstrument instrument;
+    SoftPerformer performer;
+    SoftChannel softchannel = null;
+    boolean on = false;
     private boolean audiostarted = false;
     private boolean started = false;
     private boolean stopping = false;
@@ -87,7 +87,7 @@
     private float last_out_mixer_right = 0;
     private float last_out_mixer_effect1 = 0;
     private float last_out_mixer_effect2 = 0;
-    protected ModelConnectionBlock[] extendedConnectionBlocks = null;
+    ModelConnectionBlock[] extendedConnectionBlocks = null;
     private ModelConnectionBlock[] connections;
     // Last value added to destination
     private double[] connections_last = new double[50];
@@ -100,10 +100,10 @@
     private boolean soundoff = false;
     private float lastMuteValue = 0;
     private float lastSoloMuteValue = 0;
-    protected double[] co_noteon_keynumber = new double[1];
-    protected double[] co_noteon_velocity = new double[1];
-    protected double[] co_noteon_on = new double[1];
-    private SoftControl co_noteon = new SoftControl() {
+    double[] co_noteon_keynumber = new double[1];
+    double[] co_noteon_velocity = new double[1];
+    double[] co_noteon_on = new double[1];
+    private final SoftControl co_noteon = new SoftControl() {
         double[] keynumber = co_noteon_keynumber;
         double[] velocity = co_noteon_velocity;
         double[] on = co_noteon_on;
@@ -119,13 +119,13 @@
             return null;
         }
     };
-    private double[] co_mixer_active = new double[1];
-    private double[] co_mixer_gain = new double[1];
-    private double[] co_mixer_pan = new double[1];
-    private double[] co_mixer_balance = new double[1];
-    private double[] co_mixer_reverb = new double[1];
-    private double[] co_mixer_chorus = new double[1];
-    private SoftControl co_mixer = new SoftControl() {
+    private final double[] co_mixer_active = new double[1];
+    private final double[] co_mixer_gain = new double[1];
+    private final double[] co_mixer_pan = new double[1];
+    private final double[] co_mixer_balance = new double[1];
+    private final double[] co_mixer_reverb = new double[1];
+    private final double[] co_mixer_chorus = new double[1];
+    private final SoftControl co_mixer = new SoftControl() {
         double[] active = co_mixer_active;
         double[] gain = co_mixer_gain;
         double[] pan = co_mixer_pan;
@@ -150,8 +150,8 @@
             return null;
         }
     };
-    private double[] co_osc_pitch = new double[1];
-    private SoftControl co_osc = new SoftControl() {
+    private final double[] co_osc_pitch = new double[1];
+    private final SoftControl co_osc = new SoftControl() {
         double[] pitch = co_osc_pitch;
         public double[] get(int instance, String name) {
             if (name == null)
@@ -161,10 +161,10 @@
             return null;
         }
     };
-    private double[] co_filter_freq = new double[1];
-    private double[] co_filter_type = new double[1];
-    private double[] co_filter_q = new double[1];
-    private SoftControl co_filter = new SoftControl() {
+    private final double[] co_filter_freq = new double[1];
+    private final double[] co_filter_type = new double[1];
+    private final double[] co_filter_q = new double[1];
+    private final SoftControl co_filter = new SoftControl() {
         double[] freq = co_filter_freq;
         double[] ftype = co_filter_type;
         double[] q = co_filter_q;
@@ -180,8 +180,8 @@
             return null;
         }
     };
-    protected SoftResamplerStreamer resampler;
-    private int nrofchannels;
+    SoftResamplerStreamer resampler;
+    private final int nrofchannels;
 
     public SoftVoice(SoftSynthesizer synth) {
         synthesizer = synth;
@@ -278,7 +278,7 @@
         // co_mixer_gain[0] = 0;
     }
 
-    protected void updateTuning(SoftTuning newtuning) {
+    void updateTuning(SoftTuning newtuning) {
         tuning = newtuning;
         tunedKey = tuning.getTuning(note) / 100.0;
         if (!portamento) {
@@ -293,12 +293,12 @@
         }
     }
 
-    protected void setNote(int noteNumber) {
+    void setNote(int noteNumber) {
         note = noteNumber;
         tunedKey = tuning.getTuning(noteNumber) / 100.0;
     }
 
-    protected void noteOn(int noteNumber, int velocity, int delay) {
+    void noteOn(int noteNumber, int velocity, int delay) {
 
         sustain = false;
         sostenuto = false;
@@ -435,7 +435,7 @@
 
     }
 
-    protected void setPolyPressure(int pressure) {
+    void setPolyPressure(int pressure) {
         if(performer == null)
             return;
         int[] c = performer.midi_connections[2];
@@ -445,7 +445,7 @@
             processConnection(c[i]);
     }
 
-    protected void setChannelPressure(int pressure) {
+    void setChannelPressure(int pressure) {
         if(performer == null)
             return;
         int[] c = performer.midi_connections[1];
@@ -455,7 +455,7 @@
             processConnection(c[i]);
     }
 
-    protected void controlChange(int controller, int value) {
+    void controlChange(int controller, int value) {
         if(performer == null)
             return;
         int[] c = performer.midi_ctrl_connections[controller];
@@ -465,7 +465,7 @@
             processConnection(c[i]);
     }
 
-    protected void nrpnChange(int controller, int value) {
+    void nrpnChange(int controller, int value) {
         if(performer == null)
             return;
         int[] c = performer.midi_nrpn_connections.get(controller);
@@ -475,7 +475,7 @@
             processConnection(c[i]);
     }
 
-    protected void rpnChange(int controller, int value) {
+    void rpnChange(int controller, int value) {
         if(performer == null)
             return;
         int[] c = performer.midi_rpn_connections.get(controller);
@@ -485,7 +485,7 @@
             processConnection(c[i]);
     }
 
-    protected void setPitchBend(int bend) {
+    void setPitchBend(int bend) {
         if(performer == null)
             return;
         int[] c = performer.midi_connections[0];
@@ -495,19 +495,19 @@
             processConnection(c[i]);
     }
 
-    protected void setMute(boolean mute) {
+    void setMute(boolean mute) {
         co_mixer_gain[0] -= lastMuteValue;
         lastMuteValue = mute ? -960 : 0;
         co_mixer_gain[0] += lastMuteValue;
     }
 
-    protected void setSoloMute(boolean mute) {
+    void setSoloMute(boolean mute) {
         co_mixer_gain[0] -= lastSoloMuteValue;
         lastSoloMuteValue = mute ? -960 : 0;
         co_mixer_gain[0] += lastSoloMuteValue;
     }
 
-    protected void shutdown() {
+    void shutdown() {
         if (co_noteon_on[0] < -0.5)
             return;
         on = false;
@@ -523,12 +523,12 @@
             processConnection(c[i]);
     }
 
-    protected void soundOff() {
+    void soundOff() {
         on = false;
         soundoff = true;
     }
 
-    protected void noteOff(int velocity) {
+    void noteOff(int velocity) {
         if (!on)
             return;
         on = false;
@@ -553,7 +553,7 @@
             processConnection(c[i]);
     }
 
-    protected void redamp() {
+    void redamp() {
         if (co_noteon_on[0] > 0.5)
             return;
         if (co_noteon_on[0] < -0.5)
@@ -571,7 +571,7 @@
             processConnection(c[i]);
     }
 
-    protected void processControlLogic() {
+    void processControlLogic() {
         if (stopping) {
             active = false;
             stopping = false;
@@ -760,9 +760,9 @@
 
     }
 
-    protected void mixAudioStream(SoftAudioBuffer in, SoftAudioBuffer out,
-            SoftAudioBuffer dout,
-            float amp_from, float amp_to) {
+    void mixAudioStream(SoftAudioBuffer in, SoftAudioBuffer out,
+                                SoftAudioBuffer dout, float amp_from,
+                                float amp_to) {
         int bufferlen = in.getSize();
         if (amp_from < 0.000000001 && amp_to < 0.000000001)
             return;
@@ -815,7 +815,7 @@
 
     }
 
-    protected void processAudioLogic(SoftAudioBuffer[] buffer) {
+    void processAudioLogic(SoftAudioBuffer[] buffer) {
         if (!audiostarted)
             return;
 
--- a/src/share/classes/com/sun/media/sound/StandardMidiFileReader.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/StandardMidiFileReader.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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
@@ -26,22 +26,13 @@
 package com.sun.media.sound;
 
 import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.PipedInputStream;
-import java.io.PipedOutputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.ByteArrayInputStream;
-import java.io.SequenceInputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.InputStream;
 import java.io.IOException;
 import java.io.EOFException;
-import java.io.OutputStream;
-import java.io.RandomAccessFile;
 import java.io.BufferedInputStream;
 import java.net.URL;
-import java.net.MalformedURLException;
 
 import javax.sound.midi.MidiFileFormat;
 import javax.sound.midi.InvalidMidiDataException;
@@ -49,7 +40,6 @@
 import javax.sound.midi.MidiEvent;
 import javax.sound.midi.MidiMessage;
 import javax.sound.midi.Sequence;
-import javax.sound.midi.ShortMessage;
 import javax.sound.midi.SysexMessage;
 import javax.sound.midi.Track;
 import javax.sound.midi.spi.MidiFileReader;
@@ -64,23 +54,12 @@
  * @author Florian Bomers
  */
 
-public class StandardMidiFileReader extends MidiFileReader {
+public final class StandardMidiFileReader extends MidiFileReader {
 
     private static final int MThd_MAGIC = 0x4d546864;  // 'MThd'
 
-    private static final int MIDI_TYPE_0 = 0;
-    private static final int MIDI_TYPE_1 = 1;
-
     private static final int bisBufferSize = 1024; // buffer size in buffered input streams
 
-    /**
-     * MIDI parser types
-     */
-    private static final int types[] = {
-        MIDI_TYPE_0,
-        MIDI_TYPE_1
-    };
-
     public MidiFileFormat getMidiFileFormat(InputStream stream) throws InvalidMidiDataException, IOException {
         return getMidiFileFormatFromStream(stream, MidiFileFormat.UNKNOWN_LENGTH, null);
     }
@@ -253,7 +232,7 @@
 /**
  * State variables during parsing of a MIDI file
  */
-class SMFParser {
+final class SMFParser {
     private static final int MTrk_MAGIC = 0x4d54726b;  // 'MTrk'
 
     // set to true to not allow corrupt MIDI files tombe loaded
@@ -268,7 +247,7 @@
     private byte[] trackData = null;
     private int pos = 0;
 
-    public SMFParser() {
+    SMFParser() {
     }
 
     private int readUnsigned() throws IOException {
--- a/src/share/classes/com/sun/media/sound/StandardMidiFileWriter.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/StandardMidiFileWriter.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,6 @@
 
 package com.sun.media.sound;
 
-import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.PipedInputStream;
 import java.io.PipedOutputStream;
@@ -34,18 +33,13 @@
 import java.io.SequenceInputStream;
 import java.io.File;
 import java.io.FileOutputStream;
-import java.io.BufferedOutputStream;
 import java.io.InputStream;
 import java.io.IOException;
-import java.lang.IllegalArgumentException;
 import java.io.OutputStream;
-import java.util.Vector;
 
-import javax.sound.midi.MidiFileFormat;
 import javax.sound.midi.InvalidMidiDataException;
 import javax.sound.midi.MidiEvent;
 import javax.sound.midi.MetaMessage;
-import javax.sound.midi.MidiMessage;
 import javax.sound.midi.Sequence;
 import javax.sound.midi.ShortMessage;
 import javax.sound.midi.SysexMessage;
@@ -59,7 +53,7 @@
  * @author Kara Kytle
  * @author Jan Borgersen
  */
-public class StandardMidiFileWriter extends MidiFileWriter {
+public final class StandardMidiFileWriter extends MidiFileWriter {
 
     private static final int MThd_MAGIC = 0x4d546864;  // 'MThd'
     private static final int MTrk_MAGIC = 0x4d54726b;  // 'MTrk'
--- a/src/share/classes/com/sun/media/sound/SunCodec.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SunCodec.java	Wed Jun 19 11:52:12 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,6 @@
 
 package com.sun.media.sound;
 
-import java.io.InputStream;
-
 import javax.sound.sampled.AudioFormat;
 import javax.sound.sampled.AudioInputStream;
 
@@ -48,14 +46,14 @@
  */
 abstract class SunCodec extends FormatConversionProvider {
 
-    AudioFormat.Encoding[] inputEncodings;
-    AudioFormat.Encoding[] outputEncodings;
+    private final AudioFormat.Encoding[] inputEncodings;
+    private final AudioFormat.Encoding[] outputEncodings;
 
     /**
      * Constructs a new codec object.
      */
-    protected SunCodec(AudioFormat.Encoding[] inputEncodings, AudioFormat.Encoding[] outputEncodings) {
-
+    SunCodec(final AudioFormat.Encoding[] inputEncodings,
+             final AudioFormat.Encoding[] outputEncodings) {
         this.inputEncodings = inputEncodings;
         this.outputEncodings = outputEncodings;
     }
@@ -63,16 +61,14 @@
 
     /**
      */
-    public AudioFormat.Encoding[] getSourceEncodings() {
-
+    public final AudioFormat.Encoding[] getSourceEncodings() {
         AudioFormat.Encoding[] encodings = new AudioFormat.Encoding[inputEncodings.length];
         System.arraycopy(inputEncodings, 0, encodings, 0, inputEncodings.length);
         return encodings;
     }
     /**
      */
-    public AudioFormat.Encoding[] getTargetEncodings() {
-
+    public final AudioFormat.Encoding[] getTargetEncodings() {
         AudioFormat.Encoding[] encodings = new AudioFormat.Encoding[outputEncodings.length];
         System.arraycopy(outputEncodings, 0, encodings, 0, outputEncodings.length);
         return encodings;
--- a/src/share/classes/com/sun/media/sound/SunFileReader.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SunFileReader.java	Wed Jun 19 11:52:12 2013 +0100
@@ -27,7 +27,6 @@
 
 import java.io.File;
 import java.io.InputStream;
-import java.io.OutputStream;
 import java.io.IOException;
 import java.io.DataInputStream;
 import java.net.URL;
@@ -52,7 +51,7 @@
     /**
      * Constructs a new SunFileReader object.
      */
-    public SunFileReader() {
+    SunFileReader() {
     }
 
 
@@ -167,7 +166,7 @@
      * @return 32 bits swapped value.
      * @exception IOException
      */
-    protected int rllong(DataInputStream dis) throws IOException {
+    final int rllong(DataInputStream dis) throws IOException {
 
         int b1, b2, b3, b4 ;
         int i = 0;
@@ -190,7 +189,7 @@
      * @param int
      * @return 32 bits swapped value
      */
-    protected int big2little(int i) {
+    final int big2little(int i) {
 
         int b1, b2, b3, b4 ;
 
@@ -211,7 +210,7 @@
      * @return the swapped value.
      * @exception IOException
      */
-    protected short rlshort(DataInputStream dis)  throws IOException {
+    final short rlshort(DataInputStream dis)  throws IOException {
 
         short s=0;
         short high, low;
@@ -232,7 +231,7 @@
      * @param int
      * @return 16 bits swapped value
      */
-    protected short big2littleShort(short i) {
+    final short big2littleShort(short i) {
 
         short high, low;
 
@@ -244,16 +243,14 @@
         return i;
     }
 
-
-        /** Calculates the frame size for PCM frames.
-         * Note that this method is appropriate for non-packed samples.
-         * For instance, 12 bit, 2 channels will return 4 bytes, not 3.
-         * @param sampleSizeInBits the size of a single sample in bits
-         * @param channels the number of channels
-         * @return the size of a PCM frame in bytes.
-         */
-        protected static int calculatePCMFrameSize(int sampleSizeInBits,
-                                                                                        int channels) {
-                return ((sampleSizeInBits + 7) / 8) * channels;
-        }
+    /** Calculates the frame size for PCM frames.
+     * Note that this method is appropriate for non-packed samples.
+     * For instance, 12 bit, 2 channels will return 4 bytes, not 3.
+     * @param sampleSizeInBits the size of a single sample in bits
+     * @param channels the number of channels
+     * @return the size of a PCM frame in bytes.
+     */
+    static final int calculatePCMFrameSize(int sampleSizeInBits, int channels) {
+        return ((sampleSizeInBits + 7) / 8) * channels;
+    }
 }
--- a/src/share/classes/com/sun/media/sound/SunFileWriter.java	Wed Jun 19 02:46:50 2013 -0700
+++ b/src/share/classes/com/sun/media/sound/SunFileWriter.java	Wed Jun 19 11:52:12 2013 +0100
@@ -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
@@ -69,8 +69,7 @@
 
     // new, 10.27.99
 
-    public AudioFileFormat.Type[] getAudioFileTypes(){
-
+    public final AudioFileFormat.Type[] getAudioFileTypes(){
         AudioFileFormat.Type[] localArray = new AudioFileFormat.Type[types.length];
         System.arraycopy(types, 0, localArray, 0, types.length);
         return localArray;
@@ -95,7 +94,7 @@
      * @return 32 bits swapped value.
      * @exception IOException
      */
-    protected int rllong(DataInputStream dis) throws IOException {
+    final int rllong(DataInputStream dis) throws IOException {
 
         int b1, b2, b3, b4 ;
         int i = 0;
@@ -118,7 +117,7 @@
      * @param int
      * @return 32 bits swapped value
      */
-    protected int big2little(int i) {
+    final int big2little(int i) {