changeset 5040:c68342532e2e jdk8-b27

Merge
author lana
date Sat, 18 Feb 2012 16:11:47 -0800
parents 4196fc971f65 2a3f026b3a29
children 7d683ab46571 f525c1e9e12c 6a5d6b2800f6 f959bde6990a 75247b827d6c e4f3f5ceb082
files src/linux/doc/man/apt.1 src/linux/doc/man/ja/apt.1 src/share/classes/com/sun/management/DiagnosticCommandArgumentInfo.java src/share/classes/com/sun/management/DiagnosticCommandInfo.java src/share/classes/sun/nio/ch/SctpMessageInfoImpl.java src/share/classes/sun/nio/ch/SctpStdSocketOption.java src/solaris/classes/sun/nio/ch/SctpAssocChange.java src/solaris/classes/sun/nio/ch/SctpAssociationImpl.java src/solaris/classes/sun/nio/ch/SctpChannelImpl.java src/solaris/classes/sun/nio/ch/SctpMultiChannelImpl.java src/solaris/classes/sun/nio/ch/SctpNet.java src/solaris/classes/sun/nio/ch/SctpNotification.java src/solaris/classes/sun/nio/ch/SctpPeerAddrChange.java src/solaris/classes/sun/nio/ch/SctpResultContainer.java src/solaris/classes/sun/nio/ch/SctpSendFailed.java src/solaris/classes/sun/nio/ch/SctpServerChannelImpl.java src/solaris/classes/sun/nio/ch/SctpShutdown.java src/solaris/doc/sun/man/man1/apt.1 src/solaris/doc/sun/man/man1/ja/apt.1 src/solaris/native/sun/nio/ch/Sctp.h src/solaris/native/sun/nio/ch/SctpChannelImpl.c src/solaris/native/sun/nio/ch/SctpNet.c src/solaris/native/sun/nio/ch/SctpServerChannelImpl.c src/windows/classes/sun/nio/ch/SctpChannelImpl.java src/windows/classes/sun/nio/ch/SctpMultiChannelImpl.java src/windows/classes/sun/nio/ch/SctpServerChannelImpl.java test/com/sun/management/HotSpotDiagnosticMXBean/ExecuteDiagnosticCommand.java test/com/sun/management/HotSpotDiagnosticMXBean/GetDiagnosticCommandInfo.java test/com/sun/management/HotSpotDiagnosticMXBean/GetDiagnosticCommands.java
diffstat 162 files changed, 7532 insertions(+), 7934 deletions(-) [+]
line wrap: on
line diff
--- a/make/com/sun/Makefile	Thu Feb 16 13:01:36 2012 -0800
+++ b/make/com/sun/Makefile	Sat Feb 18 16:11:47 2012 -0800
@@ -47,7 +47,6 @@
                      org rowset net/httpserver
 SUBDIRS_misc       = $(SCRIPT_SUBDIR) tracing servicetag nio demo
 
-# Omit mirror since it's built with the apt tool.
 SUBDIRS_tools      = tools
 
 include $(BUILDDIR)/common/Subdirs.gmk
--- a/make/com/sun/nio/sctp/Exportedfiles.gmk	Thu Feb 16 13:01:36 2012 -0800
+++ b/make/com/sun/nio/sctp/Exportedfiles.gmk	Sat Feb 18 16:11:47 2012 -0800
@@ -29,11 +29,11 @@
 
 ifneq ($(PLATFORM), windows)
 FILES_export = \
-    sun/nio/ch/SctpAssocChange.java \
-    sun/nio/ch/SctpChannelImpl.java \
-    sun/nio/ch/SctpNet.java \
-    sun/nio/ch/SctpPeerAddrChange.java \
-    sun/nio/ch/SctpResultContainer.java \
-    sun/nio/ch/SctpServerChannelImpl.java \
-    sun/nio/ch/SctpStdSocketOption.java
+    sun/nio/ch/sctp/AssociationChange.java \
+    sun/nio/ch/sctp/SctpChannelImpl.java \
+    sun/nio/ch/sctp/SctpNet.java \
+    sun/nio/ch/sctp/PeerAddrChange.java \
+    sun/nio/ch/sctp/ResultContainer.java \
+    sun/nio/ch/sctp/SctpServerChannelImpl.java \
+    sun/nio/ch/sctp/SctpStdSocketOption.java
 endif
--- a/make/com/sun/nio/sctp/FILES_java.gmk	Thu Feb 16 13:01:36 2012 -0800
+++ b/make/com/sun/nio/sctp/FILES_java.gmk	Sat Feb 18 16:11:47 2012 -0800
@@ -42,25 +42,25 @@
 	com/sun/nio/sctp/SendFailedNotification.java \
 	com/sun/nio/sctp/ShutdownNotification.java \
 	\
-	sun/nio/ch/SctpMessageInfoImpl.java \
-	sun/nio/ch/SctpStdSocketOption.java
+	sun/nio/ch/sctp/MessageInfoImpl.java \
+	sun/nio/ch/sctp/SctpStdSocketOption.java
 
 ifneq ($(PLATFORM), windows)
 FILES_java += \
-	sun/nio/ch/SctpAssocChange.java \
-	sun/nio/ch/SctpAssociationImpl.java \
-	sun/nio/ch/SctpChannelImpl.java \
-	sun/nio/ch/SctpMultiChannelImpl.java \
-	sun/nio/ch/SctpNet.java \
-	sun/nio/ch/SctpNotification.java \
-	sun/nio/ch/SctpPeerAddrChange.java \
-	sun/nio/ch/SctpResultContainer.java \
-	sun/nio/ch/SctpSendFailed.java \
-	sun/nio/ch/SctpServerChannelImpl.java \
-	sun/nio/ch/SctpShutdown.java
+	sun/nio/ch/sctp/AssociationChange.java \
+	sun/nio/ch/sctp/AssociationImpl.java \
+	sun/nio/ch/sctp/PeerAddrChange.java \
+	sun/nio/ch/sctp/ResultContainer.java \
+	sun/nio/ch/sctp/SctpChannelImpl.java \
+	sun/nio/ch/sctp/SctpMultiChannelImpl.java \
+	sun/nio/ch/sctp/SctpNet.java \
+	sun/nio/ch/sctp/SctpNotification.java \
+	sun/nio/ch/sctp/SctpServerChannelImpl.java \
+	sun/nio/ch/sctp/SendFailed.java \
+	sun/nio/ch/sctp/Shutdown.java
 else
 FILES_java += \
-	sun/nio/ch/SctpChannelImpl.java \
-	sun/nio/ch/SctpMultiChannelImpl.java \
-	sun/nio/ch/SctpServerChannelImpl.java
+	sun/nio/ch/sctp/SctpChannelImpl.java \
+	sun/nio/ch/sctp/SctpMultiChannelImpl.java \
+	sun/nio/ch/sctp/SctpServerChannelImpl.java
 endif
--- a/make/com/sun/nio/sctp/Makefile	Thu Feb 16 13:01:36 2012 -0800
+++ b/make/com/sun/nio/sctp/Makefile	Sat Feb 18 16:11:47 2012 -0800
@@ -47,14 +47,16 @@
 #
 # Find platform-specific C source files
 #
-vpath %.c $(PLATFORM_SRC)/native/sun/nio/ch
+vpath %.c $(PLATFORM_SRC)/native/sun/nio/ch/sctp
 
 #
 # Include nio.h, net_util.h, sun_nio_ch_IOStatus.h, etc
 #
 OTHER_INCLUDES += \
   -I$(SHARE_SRC)/native/sun/nio/ch \
+  -I$(SHARE_SRC)/native/sun/nio/ch/sctp \
   -I$(SHARE_SRC)/native/java/net \
+  -I$(PLATFORM_SRC)/native/sun/nio/ch \
   -I$(PLATFORM_SRC)/native/java/net \
   -I$(CLASSHDRDIR)/../../../../java/java.nio/nio/CClassHeaders
 
@@ -75,5 +77,5 @@
 
 clean clobber::
 	$(RM) -r $(CLASSDESTDIR)/com/sun/nio/sctp
-	$(RM) -r $(CLASSDESTDIR)/sun/nio/ch
+	$(RM) -r $(CLASSDESTDIR)/sun/nio/ch/sctp
 
--- a/make/com/sun/nio/sctp/mapfile-vers	Thu Feb 16 13:01:36 2012 -0800
+++ b/make/com/sun/nio/sctp/mapfile-vers	Sat Feb 18 16:11:47 2012 -0800
@@ -25,30 +25,30 @@
 
 SUNWprivate_1.1 {
 	global:
-		Java_sun_nio_ch_SctpNet_init;
-		Java_sun_nio_ch_SctpNet_socket0;
-		Java_sun_nio_ch_SctpNet_bindx;
-		Java_sun_nio_ch_SctpNet_branch0;
-		Java_sun_nio_ch_SctpNet_listen0;
-		Java_sun_nio_ch_SctpNet_connect0;
-		Java_sun_nio_ch_SctpNet_close0;
-		Java_sun_nio_ch_SctpNet_preClose0;
-		Java_sun_nio_ch_SctpNet_getLocalAddresses0;
-		Java_sun_nio_ch_SctpNet_getRemoteAddresses0;
-		Java_sun_nio_ch_SctpNet_getPrimAddrOption0;
-		Java_sun_nio_ch_SctpNet_setPrimAddrOption0;
-		Java_sun_nio_ch_SctpNet_setPeerPrimAddrOption0;
-		Java_sun_nio_ch_SctpNet_getInitMsgOption0;
-		Java_sun_nio_ch_SctpNet_setInitMsgOption0;
-		Java_sun_nio_ch_SctpNet_getIntOption0;
-		Java_sun_nio_ch_SctpNet_setIntOption0;
-		Java_sun_nio_ch_SctpNet_shutdown0;
-		Java_sun_nio_ch_SctpChannelImpl_initIDs;
-		Java_sun_nio_ch_SctpChannelImpl_checkConnect;
-		Java_sun_nio_ch_SctpChannelImpl_receive0;
-		Java_sun_nio_ch_SctpChannelImpl_send0;
-		Java_sun_nio_ch_SctpServerChannelImpl_initIDs;
-		Java_sun_nio_ch_SctpServerChannelImpl_accept0;
+		Java_sun_nio_ch_sctp_SctpNet_init;
+		Java_sun_nio_ch_sctp_SctpNet_socket0;
+		Java_sun_nio_ch_sctp_SctpNet_bindx;
+		Java_sun_nio_ch_sctp_SctpNet_branch0;
+		Java_sun_nio_ch_sctp_SctpNet_listen0;
+		Java_sun_nio_ch_sctp_SctpNet_connect0;
+		Java_sun_nio_ch_sctp_SctpNet_close0;
+		Java_sun_nio_ch_sctp_SctpNet_preClose0;
+		Java_sun_nio_ch_sctp_SctpNet_getLocalAddresses0;
+		Java_sun_nio_ch_sctp_SctpNet_getRemoteAddresses0;
+		Java_sun_nio_ch_sctp_SctpNet_getPrimAddrOption0;
+		Java_sun_nio_ch_sctp_SctpNet_setPrimAddrOption0;
+		Java_sun_nio_ch_sctp_SctpNet_setPeerPrimAddrOption0;
+		Java_sun_nio_ch_sctp_SctpNet_getInitMsgOption0;
+		Java_sun_nio_ch_sctp_SctpNet_setInitMsgOption0;
+		Java_sun_nio_ch_sctp_SctpNet_getIntOption0;
+		Java_sun_nio_ch_sctp_SctpNet_setIntOption0;
+		Java_sun_nio_ch_sctp_SctpNet_shutdown0;
+		Java_sun_nio_ch_sctp_SctpChannelImpl_initIDs;
+		Java_sun_nio_ch_sctp_SctpChannelImpl_checkConnect;
+		Java_sun_nio_ch_sctp_SctpChannelImpl_receive0;
+		Java_sun_nio_ch_sctp_SctpChannelImpl_send0;
+		Java_sun_nio_ch_sctp_SctpServerChannelImpl_initIDs;
+		Java_sun_nio_ch_sctp_SctpServerChannelImpl_accept0;
                 JNI_OnLoad;
 	local:
 		*;
--- a/make/common/Release.gmk	Thu Feb 16 13:01:36 2012 -0800
+++ b/make/common/Release.gmk	Sat Feb 18 16:11:47 2012 -0800
@@ -132,7 +132,6 @@
 JDK_MAN_PAGES =            \
 	$(JRE_MAN_PAGES)   \
 	appletviewer.1     \
-        apt.1              \
 	extcheck.1         \
 	idlj.1             \
 	jar.1              \
@@ -264,7 +263,6 @@
 	com/sun/java/swing		\
 	com/sun/javadoc			\
 	com/sun/jmx			\
-	com/sun/mirror			\
 	com/sun/source			\
 	com/sun/naming			\
 	com/sun/security/auth		\
@@ -346,7 +344,6 @@
 	com/sun/javadoc		\
 	com/sun/jdi		\
 	com/sun/jarsigner	\
-	com/sun/mirror		\
 	com/sun/source          \
 	com/sun/tools/classfile \
 	com/sun/tools/doclets   \
@@ -356,16 +353,16 @@
 	com/sun/tools/hat       \
 	com/sun/tools/javac     \
 	com/sun/tools/javadoc   \
-	com/sun/tools/apt       \
 	com/sun/tools/javah     \
 	com/sun/tools/javap     \
 	com/sun/tools/corba     \
 	com/sun/tools/internal/xjc       \
 	com/sun/tools/internal/ws       \
-	META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory \
-	META-INF/services/com.sun.tools.xjc.Plugin \
+	META-INF/services/com.sun.tools.internal.ws.wscompile.Plugin \
+	META-INF/services/com.sun.tools.internal.xjc.Plugin \
 	com/sun/istack/internal/tools       \
-	com/sun/istack/internal/ws       \
+	com/sun/tools/internal/jxc/ap   \
+	com/sun/tools/internal/ws/wscompile/plugin/at_generated \
         com/sun/codemodel       \
         com/sun/tools/internal/jxc             \
         com/sun/xml/internal/rngom       \
@@ -438,7 +435,6 @@
 	java-rmi.cgi \
 	javac$(EXE_SUFFIX) \
 	javadoc$(EXE_SUFFIX) \
-	apt$(EXE_SUFFIX) \
 	javah$(EXE_SUFFIX) \
 	javap$(EXE_SUFFIX) \
 	jcmd$(EXE_SUFFIX) \
@@ -525,13 +521,10 @@
 	$(ECHO) "com/sun/javadoc/" >> $@
 	$(ECHO) "com/sun/jdi/" >> $@
 	$(ECHO) "com/sun/jarsigner/" >> $@
-	$(ECHO) "com/sun/mirror/" >> $@
 	$(ECHO) "com/sun/source/" >> $@
 	$(ECHO) "com/sun/istack/internal/tools/" >> $@
-	$(ECHO) "com/sun/istack/internal/ws/" >> $@
 	$(ECHO) "META-INF/services/com.sun.jdi.connect.Connector" >> $@
 	$(ECHO) "META-INF/services/com.sun.jdi.connect.spi.TransportService" >> $@
-	$(ECHO) "META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory" >> $@
 	$(ECHO) "META-INF/services/com.sun.tools.xjc.Plugin" >> $@
 	$(ECHO) "com/sun/tools/" >> $@
 	$(ECHO) "sun/jvmstat/" >> $@
@@ -1000,7 +993,7 @@
 	@#
 	@# files that might not exist need to be touched.
 	@#
-	$(TOUCH) $(CLASSBINDIR)/META-INF/services/com.sun.tools.xjc.Plugin
+	$(TOUCH) $(CLASSBINDIR)/META-INF/services/com.sun.tools.internal.xjc.Plugin
 	@#
 	@# lib/tools.jar
 	@#
--- a/make/common/internal/Defs-jaxws.gmk	Thu Feb 16 13:01:36 2012 -0800
+++ b/make/common/internal/Defs-jaxws.gmk	Sat Feb 18 16:11:47 2012 -0800
@@ -34,7 +34,6 @@
      javax/xml/ws \
      javax/jws \
      javax/annotation \
-     com/sun/istack/internal \
      com/sun/xml/internal/bind \
      com/sun/xml/internal/fastinfoset \
      com/sun/xml/internal/messaging \
@@ -42,13 +41,13 @@
      com/sun/xml/internal/txw2 \
      com/sun/xml/internal/ws \
      com/sun/xml/internal/stream/buffer
+
 NOT_USED_PACKAGES += \
      com/sun/tools/internal/txw2
 
 IMPORT_TOOLS_PACKAGES += \
      com/sun/codemodel \
      com/sun/istack/internal/tools \
-     com/sun/istack/internal/ws \
      com/sun/xml/internal/rngom \
      com/sun/xml/internal/xsom \
      com/sun/xml/internal/dtdparser \
@@ -56,6 +55,9 @@
      com/sun/tools/internal/ws \
      com/sun/tools/internal/jxc \
      org/relaxng \
-     META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory \
-     META-INF/services/com.sun.tools.internal.xjc.Plugin
+     META-INF/services/com.sun.tools.internal.ws.wscompile.Plugin \
+     META-INF/services/com.sun.tools.internal.xjc.Plugin \
+     com/sun/tools/internal/jxc/ap \
+     com/sun/tools/internal/ws/wscompile/plugin/at_generated
 
+
--- a/make/common/internal/Defs-langtools.gmk	Thu Feb 16 13:01:36 2012 -0800
+++ b/make/common/internal/Defs-langtools.gmk	Sat Feb 18 16:11:47 2012 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -32,9 +32,7 @@
 
 IMPORT_TOOLS_PACKAGES +=            \
       com/sun/javadoc               \
-      com/sun/mirror                \
       com/sun/source                \
-      com/sun/tools/apt             \
       com/sun/tools/classfile       \
       com/sun/tools/doclets         \
       com/sun/tools/javac           \
--- a/make/docs/Makefile	Thu Feb 16 13:01:36 2012 -0800
+++ b/make/docs/Makefile	Sat Feb 18 16:11:47 2012 -0800
@@ -1,4 +1,4 @@
-# Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -358,64 +358,6 @@
 
 #############################################################
 #
-# mirrordocs
-#
-
-# Part of langtools
-ifdef LANGTOOLS_DIST
-  ALL_OTHER_TARGETS += mirrordocs
-endif
-
-MIRROR_DOCDIR      := $(JDK_API_DOCSDIR)/apt/mirror
-MIRROR2COREAPI     := ../../$(JDKJRE2COREAPI)
-MIRROR_DOCTITLE    := Mirror API
-MIRROR_WINDOWTITLE := Mirror API
-MIRROR_HEADER      := <strong>Mirror API</strong>
-MIRROR_BOTTOM      := $(call CommonBottom,$(MIRROR_FIRST_COPYRIGHT_YEAR))
-MIRROR_GROUPNAME   := Packages
-MIRROR_OVERVIEW    := $(IMPORTSRCDIR)/com/sun/mirror/overview.html
-MIRROR_REGEXP      := com.sun.mirror.*
-# MIRROR_PKGS is located in NON_CORE_PKGS.gmk
-
-# The index.html, options, and packages files
-MIRROR_INDEX_FILE    = $(MIRROR_DOCDIR)/index.html
-MIRROR_OPTIONS_FILE  = $(DOCSTMPDIR)/mirror.options
-MIRROR_PACKAGES_FILE = $(DOCSTMPDIR)/mirror.packages
-
-mirrordocs: $(MIRROR_INDEX_FILE)
-
-# Set relative location to core api document root
-$(MIRROR_INDEX_FILE): GET2DOCSDIR=$(MIRROR2COREAPI)/..
-
-# Run javadoc if the index file is out of date or missing
-$(MIRROR_INDEX_FILE): $(MIRROR_OPTIONS_FILE) $(MIRROR_PACKAGES_FILE)
-	$(prep-javadoc)
-	$(call JavadocSummary,$(MIRROR_OPTIONS_FILE),$(MIRROR_PACKAGES_FILE))
-	$(JAVADOC_CMD) $(JAVADOC_VM_MEMORY_FLAGS) -d $(@D) \
-	  @$(MIRROR_OPTIONS_FILE) @$(MIRROR_PACKAGES_FILE)
-
-# Create file with javadoc options in it
-$(MIRROR_OPTIONS_FILE): $(MIRROR_OVERVIEW)
-	$(prep-target)
-	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS))			; \
-	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH))	; \
-	  $(call OptionPair,-encoding,ascii)				; \
-	  $(call OptionPair,-overview,$(MIRROR_OVERVIEW))		; \
-	  $(call OptionPair,-doctitle,$(MIRROR_DOCTITLE))		; \
-	  $(call OptionPair,-windowtitle,$(MIRROR_WINDOWTITLE) $(DRAFT_WINTITLE));\
-	  $(call OptionPair,-header,$(MIRROR_HEADER)$(DRAFT_HEADER))	; \
-	  $(call OptionPair,-bottom,$(MIRROR_BOTTOM)$(DRAFT_BOTTOM)) 	; \
-	  $(call OptionTrip,-group,$(MIRROR_GROUPNAME),$(MIRROR_REGEXP)); \
-	  $(call OptionTrip,-linkoffline,$(MIRROR2COREAPI),$(COREAPI_DOCSDIR)); \
-        ) >> $@
-
-# Create a file with the package names in it
-$(MIRROR_PACKAGES_FILE): $(DIRECTORY_CACHE) $(call PackageDependencies,$(MIRROR_PKGS))
-	$(prep-target)
-	$(call PackageFilter,$(MIRROR_PKGS))
-
-#############################################################
-#
 # docletapidocs
 #
 
--- a/make/docs/NON_CORE_PKGS.gmk	Thu Feb 16 13:01:36 2012 -0800
+++ b/make/docs/NON_CORE_PKGS.gmk	Sat Feb 18 16:11:47 2012 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -71,11 +71,6 @@
 
 TAGLETAPI_FILE   = com/sun/tools/doclets/Taglet.java
 
-MIRROR_PKGS      = com.sun.mirror.apt           \
-                   com.sun.mirror.declaration   \
-                   com.sun.mirror.type          \
-                   com.sun.mirror.util
-
 ATTACH_PKGS      = com.sun.tools.attach         \
                    com.sun.tools.attach.spi
 
--- a/make/java/management/mapfile-vers	Thu Feb 16 13:01:36 2012 -0800
+++ b/make/java/management/mapfile-vers	Sat Feb 18 16:11:47 2012 -0800
@@ -54,9 +54,6 @@
 	    Java_sun_management_GcInfoBuilder_getLastGcInfo0;
 	    Java_sun_management_GcInfoBuilder_getNumGcExtAttributes;
 	    Java_sun_management_HotSpotDiagnostic_dumpHeap;
-	    Java_sun_management_HotSpotDiagnostic_executeDiagnosticCommand0;
-	    Java_sun_management_HotSpotDiagnostic_getDiagnosticCommandInfo0;
-	    Java_sun_management_HotSpotDiagnostic_getDiagnosticCommands0;
 	    Java_sun_management_HotspotThread_getInternalThreadCount;
 	    Java_sun_management_HotspotThread_getInternalThreadTimes0;
 	    Java_sun_management_MemoryImpl_getMemoryManagers0;
--- a/make/launchers/Makefile	Thu Feb 16 13:01:36 2012 -0800
+++ b/make/launchers/Makefile	Sat Feb 18 16:11:47 2012 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -55,7 +55,6 @@
 
 define make-all-launchers
 $(make-appletviewer)
-$(call make-launcher, apt, com.sun.tools.apt.Main, , )
 $(call make-launcher, extcheck, com.sun.tools.extcheck.Main, , )
 $(call make-launcher, idlj, com.sun.tools.corba.se.idl.toJavaPortable.Compile, , )
 $(call make-launcher, jar, sun.tools.jar.Main, , )
--- a/make/launchers/Makefile.launcher	Thu Feb 16 13:01:36 2012 -0800
+++ b/make/launchers/Makefile.launcher	Sat Feb 18 16:11:47 2012 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -47,10 +47,6 @@
 endif
 
 # Some tools need the wildcard expansion option
-ifeq ($(PROGRAM),apt)
-  WILDCARDS=true
-  NEVER_ACT_AS_SERVER_CLASS_MACHINE=true
-endif
 ifeq ($(PROGRAM),javac)
   WILDCARDS=true
   MAIN_JAVA_ARGS += -J-Xss4m -J-ea:com.sun.tools...
--- a/src/linux/doc/man/apt.1	Thu Feb 16 13:01:36 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,153 +0,0 @@
-." Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
-." DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-."
-." This code is free software; you can redistribute it and/or modify it
-." under the terms of the GNU General Public License version 2 only, as
-." published by the Free Software Foundation.
-."
-." This code is distributed in the hope that it will be useful, but WITHOUT
-." ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-." FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-." version 2 for more details (a copy is included in the LICENSE file that
-." accompanied this code).
-."
-." You should have received a copy of the GNU General Public License version
-." 2 along with this work; if not, write to the Free Software Foundation,
-." Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-."
-." Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-." or visit www.oracle.com if you need additional information or have any
-." questions.
-."
-.TH apt 1 "10 May 2011"
-
-.LP
-.SH "NAME"
-.LP
-.LP
-\f2apt\fP \- annotation processing tool
-.LP
-.SH "SYNOPSIS"
-.LP
-.LP
-\f2apt [\-classpath \fP\f2classpath\fP] [\-sourcepath \f2sourcepath\fP] [\-d \f2directory\fP] [\-s \f2directory\fP] [\-factorypath \f2path\fP] [\-factory \f2class\fP] [\-print] [\-nocompile] [\-A\f2key\fP[\f2=val\fP] ...] [\f2javac option\fP] sourcefiles [@files]
-.LP
-.SH "PARAMETERS"
-.LP
-.LP
-Options may be in any order. For a discussion of parameters which apply to a specific option, see OPTIONS below.
-.LP
-.RS 3
-.TP 3
-sourcefiles 
-Zero or more source files to be processed. 
-.TP 3
-@files 
-One or more files that list source files or other options 
-.RE
-
-.LP
-.SH "DESCRIPTION"
-.LP
-.LP
-\f3Note\fP: The \f2apt\fP tool and its associated API contained in the package \f2com.sun.mirror\fP have been deprecated since JDK 7 and are planned to be removed in the next major JDK release. Use the options available in the \f2javac(1)\fP tool and the APIs contained in the packages \f2javax.annotation.processing\fP and \f2javax.lang.model\fP to process annotations.
-.LP
-.LP
-The tool \f2apt\fP, annotation processing tool, includes reflective APIs and supporting infrastructure to process program annotations. The \f2apt\fP reflective APIs provide a build\-time, source\-based, read\-only view of program structure. These reflective APIs are designed to cleanly model the Java(TM) programming language's type system after the addition of generics. First, \f2apt\fP runs annotation processors that can produce new source code and other files. Next, \f2apt\fP can cause compilation of both original and generated source files, easing development. The reflective APIs and other APIs used to interact with the tool are subpackages of \f2com.sun.mirror\fP.
-.LP
-.LP
-A fuller discussion of how the tool operates as well as instructions for developing with \f2apt\fP are in 
-.na
-\f4Getting Started with \fP\f4apt\fP. @
-.fi
-http://download.oracle.com/javase/7/docs/technotes/guides/apt/GettingStarted.html
-.LP
-.SH "OPTIONS"
-.LP
-.SS 
-apt specific options
-.LP
-.RS 3
-.TP 3
-\-s dir 
-Specify the directory root under which processor\-generated source files will be placed; files are placed in subdirectories based on package namespace. 
-.TP 3
-\-nocompile 
-Do not compile source files to class files. 
-.TP 3
-\-print 
-Print out textual representation of specified types; perform no annotation processing or compilation. 
-.TP 3
-\-A[key[=val]] 
-Options to pass to annotation processors \-\- these are not interpreted by \f2apt\fP directly, but are made available for use by individual processors 
-.TP 3
-\-factorypath path 
-Specify where to find annotation processor factories; if this option is used, the classpath is \f2not\fP searched for factories. 
-.TP 3
-\-factory classname 
-Name of annotation processor factory to use; bypasses default discovery process 
-.TP 3
-\-version 
-Print version information. 
-.TP 3
-\-X 
-Display information about non\-standard options. 
-.RE
-
-.LP
-.SS 
-Options shared with javac
-.LP
-.RS 3
-.TP 3
-\-d dir 
-Specify where to place processor and javac generated class files 
-.TP 3
-\-cp path or \-classpath path 
-Specify where to find user class files and annotation processor factories. If \f2\-factorypath\fP is given, the classpath is not searched for factories. 
-.RE
-
-.LP
-.LP
-Consult the javac(1) man page for information on \f2javac\fP options.
-.LP
-.SS 
-Non\-Standard Options
-.LP
-.RS 3
-.TP 3
-\-XListAnnotationTypes 
-List found annotation types. 
-.TP 3
-\-XListDeclarations 
-List specified and included declarations. 
-.TP 3
-\-XPrintAptRounds 
-Print information about initial and recursive \f2apt\fP rounds. 
-.TP 3
-\-XPrintFactoryInfo 
-Print information about which annotations a factory is asked to process. 
-.TP 3
-\-XclassesAsDecls 
-Treat both class and source files as declarations to process. 
-.RE
-
-.LP
-.LP
-\f3Note\fP: Because these options are non\-standard, they are subject to change without notice.
-.LP
-.SH "NOTES"
-.LP
-.LP
-The \f2apt\fP tool and its associated API contained in the package \f2com.sun.mirror\fP have been deprecated since JDK 7 and are planned to be removed in the next major JDK release. Use the options available in the \f2javac(1)\fP tool and the APIs contained in the packages \f2javax.annotation.processing\fP and \f2javax.lang.model\fP to process annotations.
-.LP
-.SH "SEE ALSO"
-.LP
-.RS 3
-.TP 2
-o
-javac(1), java(1) 
-.RE
-
-.LP
- 
--- a/src/linux/doc/man/ja/apt.1	Thu Feb 16 13:01:36 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,153 +0,0 @@
-." Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
-." DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-."
-." This code is free software; you can redistribute it and/or modify it
-." under the terms of the GNU General Public License version 2 only, as
-." published by the Free Software Foundation.
-."
-." This code is distributed in the hope that it will be useful, but WITHOUT
-." ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-." FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-." version 2 for more details (a copy is included in the LICENSE file that
-." accompanied this code).
-."
-." You should have received a copy of the GNU General Public License version
-." 2 along with this work; if not, write to the Free Software Foundation,
-." Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-."
-." Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-." or visit www.oracle.com if you need additional information or have any
-." questions.
-."
-.TH apt 1 "07 May 2011"
-
-.LP
-.SH "NAME"
-.LP
-.LP
-\f2apt\fP \- 注釈処理ツール
-.LP
-.SH "形式"
-.LP
-.LP
-\f2apt [\-classpath \fP\f2classpath\fP] [\-sourcepath \f2sourcepath\fP] [\-d \f2directory\fP] [\-s \f2directory\fP] [\-factorypath \f2path\fP] [\-factory \f2class\fP] [\-print] [\-nocompile] [\-A\f2key\fP[\f2=val\fP] ...] [\f2javac option\fP] sourcefiles [@files]
-.LP
-.SH "パラメータ"
-.LP
-.LP
-オプションの指定順序に決まりはありません。特定のオプションに適用されるパラメータについては、下記の「オプション」を参照してください。
-.LP
-.RS 3
-.TP 3
-sourcefiles 
-ゼロ、1 つ、または複数の処理対象のソースファイル 
-.TP 3
-@files 
-ソースファイルまたは他のオプションを一覧表示する 1 つまたは複数のファイル 
-.RE
-
-.LP
-.SH "説明"
-.LP
-.LP
-\f3注\fP: \f2apt\fP ツールと、パッケージ \f2com.sun.mirror\fP に含まれているそれに関連した API は、JDK 7 以降非推奨になっており、JDK の次のメジャーリリースで削除される予定です。\f2javac(1)\fP ツールで利用可能なオプションと、パッケージ \f2javax.annotation.processing\fP および \f2javax.lang.model\fP に含まれている API を使用して、注釈を処理してください。
-.LP
-.LP
-注釈処理ツール \f2apt\fP は、リフレクト API とサポートインフラストラクチャーから構成され、プログラム注釈を処理します。\f2apt\fP リフレクト API は、 構築時のソースベースで、プログラム構造に関する読み取り専用ビューを提供します。これらのリフレクト API は、総称を追加した後に、Java(TM) プログラミング言語の型システムを正しくモデル化するように設計されています。最初に、\f2apt\fP は、新しいソースコードと他のファイルを作成する注釈プロセッサを実行します。次に、\f2apt\fP は、元のソースファイルと生成したソースファイルの両方をコンパイルするため、開発が楽になります。ツールとのインタフェースに使用されるリフレクト API などの API は、\f2com.sun.mirror\fP のサブパッケージです。
-.LP
-.LP
-ツールの機能に関する詳細と、\f2apt\fP を使用した開発方法については、
-.na
-\f4「apt 入門」\fP @
-.fi
-http://java.sun.com/javase/6/docs/technotes/guides/apt/GettingStarted.htmlを参照してください。
-.LP
-.SH "オプション"
-.LP
-.SS 
-apt 固有のオプション
-.LP
-.RS 3
-.TP 3
-\-s dir 
-プロセッサの生成するソースファイルを置くディレクトリルートを指定します。 ファイルは、パッケージの名前空間に基づいてサブディレクトリに置かれます。 
-.TP 3
-\-nocompile 
-ソースファイルをクラスファイルにコンパイルしません。 
-.TP 3
-\-print 
-指定したタイプのテキスト表現を出力します。 注釈処理またはコンパイルは行いません。 
-.TP 3
-\-A[key[=val]] 
-注釈プロセッサへ渡すオプションです。 このオプションは、\f2apt\fP が直接解釈するのではなく、それぞれのプロセッサによって使用できるように変えられます。 
-.TP 3
-\-factorypath path 
-注釈プロセッサファクトリを検索する場所を指定します。 このオプションを使用する場合、クラスパスのファクトリは検索されません。 
-.TP 3
-\-factory classname 
-使用する注釈プロセッサファクトリの名前です。 デフォルトの検出プロセスを省略します。 
-.TP 3
-\-version 
-バージョン情報を出力します。 
-.TP 3
-\-X 
-非標準オプションに関する情報を表示します。 
-.RE
-
-.LP
-.SS 
-javac と共用するオプション
-.LP
-.RS 3
-.TP 3
-\-d dir 
-プロセッサと javac 生成のクラスファイルを置く場所を指定します。 
-.TP 3
-\-cp path または \-classpath path 
-ユーザークラスファイルと注釈プロセッサファクトリを検索する場所を指定します。\f2\-factorypath\fP が指定されている場合、クラスパスのファクトリは検索されません。 
-.RE
-
-.LP
-.LP
-\f2javac\fP オプションの詳細については、javac(1) のマニュアルページを参照してください。
-.LP
-.SS 
-非標準オプション
-.LP
-.RS 3
-.TP 3
-\-XListAnnotationTypes 
-注釈の型に検出されるリスト. 
-.TP 3
-\-XListDeclarations 
-指定および宣言がインクルードされるリスト. 
-.TP 3
-\-XPrintAptRounds 
-初期および再帰的な \f2apt\fP ラウンドに関する情報を出力する. 
-.TP 3
-\-XPrintFactoryInfo 
-処理を要求するファクトリの注釈に関する情報を出力する. 
-.TP 3
-\-XclassesAsDecls 
-クラスファイルとソースファイルの両方を、処理対象の宣言として処理します。 
-.RE
-
-.LP
-.LP
-\f3注\fP: これらは非標準オプションなので、予告なく変更される可能性があります。
-.LP
-.SH "注"
-.LP
-.LP
-\f2apt\fP ツールと、パッケージ \f2com.sun.mirror\fP に含まれているそれに関連した API は、JDK 7 以降非推奨になっており、JDK の次のメジャーリリースで削除される予定です。\f2javac(1)\fP ツールで利用可能なオプションと、パッケージ \f2javax.annotation.processing\fP および \f2javax.lang.model\fP に含まれている API を使用して、注釈を処理してください。
-.LP
-.SH "関連項目"
-.LP
-.RS 3
-.TP 2
-o
-javac(1), java(1) 
-.RE
-
-.LP
- 
--- a/src/share/classes/com/sun/crypto/provider/PBEKey.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/com/sun/crypto/provider/PBEKey.java	Sat Feb 18 16:11:47 2012 -0800
@@ -55,9 +55,12 @@
             // Should allow an empty password.
             passwd = new char[0];
         }
-        for (int i=0; i<passwd.length; i++) {
-            if ((passwd[i] < '\u0020') || (passwd[i] > '\u007E')) {
-                throw new InvalidKeySpecException("Password is not ASCII");
+        // Accept "\0" to signify "zero-length password with no terminator".
+        if (!(passwd.length == 1 && passwd[0] == 0)) {
+            for (int i=0; i<passwd.length; i++) {
+                if ((passwd[i] < '\u0020') || (passwd[i] > '\u007E')) {
+                    throw new InvalidKeySpecException("Password is not ASCII");
+                }
             }
         }
         this.key = new byte[passwd.length];
--- a/src/share/classes/com/sun/crypto/provider/PKCS12PBECipherCore.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/com/sun/crypto/provider/PKCS12PBECipherCore.java	Sat Feb 18 16:11:47 2012 -0800
@@ -60,11 +60,16 @@
 
     static byte[] derive(char[] chars, byte[] salt,
                          int ic, int n, int type) {
-        // Add in trailing NULL terminator.
+        // Add in trailing NULL terminator.  Special case:
+        // no terminator if password is "\0".
         int length = chars.length*2;
-        if (length != 0) {
+        if (length == 2 && chars[0] == 0) {
+            chars = new char[0];
+            length = 0;
+        } else {
             length += 2;
         }
+
         byte[] passwd = new byte[length];
         for (int i = 0, j = 0; i < chars.length; i++, j+=2) {
             passwd[j] = (byte) ((chars[i] >>> 8) & 0xFF);
@@ -133,6 +138,9 @@
     }
 
     private static void concat(byte[] src, byte[] dst, int start, int len) {
+        if (src.length == 0) {
+            return;
+        }
         int loop = len / src.length;
         int off, i;
         for (i = 0, off = 0; i < loop; i++, off += src.length)
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsProgressBarUI.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsProgressBarUI.java	Sat Feb 18 16:11:47 2012 -0800
@@ -137,6 +137,11 @@
                 g.setColor(progressBar.getForeground());
                 barRectHeight -= 2;
                 barRectWidth -= 2;
+
+                if (barRectWidth <= 0 || barRectHeight <= 0) {
+                    return;
+                }
+
                 Graphics2D g2 = (Graphics2D)g;
                 g2.setStroke(new BasicStroke((float)(vertical ? barRectWidth : barRectHeight),
                                              BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
--- a/src/share/classes/com/sun/management/DiagnosticCommandArgumentInfo.java	Thu Feb 16 13:01:36 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.management;
-
-import java.beans.ConstructorProperties;
-
-/**
- * Diagnostic Command Argument information. It contains the description
- * of one parameter of the diagnostic command. A parameter can either be an
- * option or an argument. Options are identified by the option name while
- * arguments are identified by their position in the command line. The generic
- * syntax of a diagnostic command is:
- *  <blockquote>
- *    &lt;command name&gt; [&lt;option&gt;=&lt;value&gt;] [&lt;argument_value&gt;]
- * </blockquote>
- * Example:
- * <blockquote>
- * command_name option1=value1 option2=value argumentA argumentB argumentC
- * </blockquote>
- * In this command line, the diagnostic command receives five parameters, two
- * options named {@code option1} and {@code option2}, and three arguments.
- * argumentA's position is 0, argumentB's position is 1 and argumentC's
- * position is 2.
- *
- * @author  Frederic Parain
- * @since   7u4
- */
-
-public class DiagnosticCommandArgumentInfo {
-    private final String name;
-    private final String description;
-    private final String type;
-    private final String defaultValue;
-    private final boolean mandatory;
-    private final boolean option;
-    private final int position;
-
-    /**
-     * Returns the argument name
-     *
-     * @return the argument name
-     */
-    public String getName() {
-        return name;
-    }
-
-   /**
-     * Returns the argument description
-     *
-     * @return the argument description
-     */
-    public String getDescription() {
-        return description;
-    }
-
-    /**
-     * Returns the argument type
-     *
-     * @return the argument type
-     */
-    public String getType() {
-        return type;
-    }
-
-    /**
-     * Returns the default value as a String if a default value
-     * is defined, null otherwise.
-     *
-     * @return the default value as a String if a default value
-     * is defined, null otherwise.
-     */
-    public String getDefault() {
-        return defaultValue;
-    }
-
-    /**
-     * Returns {@code true} if the argument is mandatory,
-     *         {@code false} otherwise
-     *
-     * @return {@code true} if the argument is mandatory,
-     *         {@code false} otherwise
-     */
-    public boolean isMandatory() {
-        return mandatory;
-    }
-
-    /**
-     * Returns {@code true} if the argument is an option,
-     *         {@code false} otherwise. Options have to be specified using the
-     *         &lt;key&gt;=&lt;value&gt; syntax on the command line, while other
-     *         arguments are specified with a single &lt;value&gt; field and are
-     *         identified by their position on command line.
-     *
-     * @return {@code true} if the argument is an option,
-     *         {@code false} otherwise
-     */
-    public boolean isOption() {
-        return option;
-    }
-
-    /**
-     * Returns the expected position of this argument if it is not an option,
-     *         -1 otherwise. Argument position if defined from left to right,
-     *         starting at zero and ignoring the diagnostic command name and
-     *         options.
-     *
-     * @return the expected position of this argument if it is not an option,
-     *         -1 otherwise.
-     */
-    public int getPosition() {
-        return position;
-    }
-
-    @ConstructorProperties({"name","description","type","default",
-                "mandatory","option","position"})
-    public DiagnosticCommandArgumentInfo(String name, String description,
-                                         String type, String defaultValue,
-                                         boolean mandatory, boolean option,
-                                         int position) {
-        this.name = name;
-        this.description = description;
-        this.type = type;
-        this.defaultValue = defaultValue;
-        this.mandatory = mandatory;
-        this.option = option;
-        this.position = position;
-    }
-}
--- a/src/share/classes/com/sun/management/DiagnosticCommandInfo.java	Thu Feb 16 13:01:36 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.management;
-
-import java.beans.ConstructorProperties;
-import java.util.List;
-
-/**
- * Diagnostic command information. It contains the description of a
- * diagnostic command.
- *
- * @author  Frederic Parain
- * @since   7u4
- */
-
-public class DiagnosticCommandInfo {
-    private final String name;
-    private final String description;
-    private final String impact;
-    private final boolean enabled;
-    private final List<DiagnosticCommandArgumentInfo> arguments;
-
-    /**
-     * Returns the diagnostic command name
-     *
-     * @return the diagnostic command name
-     */
-    public String getName() {
-        return name;
-    }
-
-   /**
-     * Returns the diagnostic command description
-     *
-     * @return the diagnostic command description
-     */
-    public String getDescription() {
-        return description;
-    }
-
-     /**
-     * Returns the potential impact of the diagnostic command execution
-     *         on the Java virtual machine behavior
-     *
-     * @return the potential impact of the diagnostic command execution
-     *         on the Java virtual machine behavior
-     */
-    public String getImpact() {
-        return impact;
-    }
-
-    /**
-     * Returns {@code true} if the diagnostic command is enabled,
-     *         {@code false} otherwise. The enabled/disabled
-     *         status of a diagnostic command can evolve during
-     *         the lifetime of the Java virtual machine.
-     *
-     * @return {@code true} if the diagnostic command is enabled,
-     *         {@code false} otherwise
-     */
-    public boolean isEnabled() {
-        return enabled;
-    }
-
-    /**
-     * Returns the list of the diagnostic command arguments description.
-     * If the diagnostic command has no arguments, it returns an empty list.
-     *
-     * @return a list of the diagnostic command arguments description
-     */
-    public List<DiagnosticCommandArgumentInfo> getArgumentsInfo() {
-        return arguments;
-    }
-
-    @ConstructorProperties({"name", "description","impact","enabled",
-                "argumentsInfo"})
-    public DiagnosticCommandInfo(String name, String description,
-                                 String impact, boolean enabled,
-                                 List<DiagnosticCommandArgumentInfo> arguments)
-    {
-        this.name = name;
-        this.description = description;
-        this.impact = impact;
-        this.enabled = enabled;
-        this.arguments = arguments;
-    }
-}
--- a/src/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java	Sat Feb 18 16:11:47 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,11 +31,6 @@
 /**
  * Diagnostic management interface for the HotSpot Virtual Machine.
  *
- * <p>{@linkplain #getDiagnosticCommands Diagnostic commands}
- * are actions that can be invoked dynamically and
- * executed in a target Java virtual machine, mainly for troubleshooting
- * and diagnosis.
- *
  * <p>The diagnostic MBean is registered to the platform MBeanServer
  * as are other platform MBeans.
  *
@@ -116,108 +111,4 @@
      *     ManagementPermission("control").
      */
     public void setVMOption(String name, String value);
-
-    /**
-     * Returns the {@linkplain DiagnosticCommandInfo#getName() names}
-     * of all diagnostic commands.
-     * A diagnostic command is an action that can be invoked dynamically
-     * mainly for troubleshooting and diagnosis.  The list of diagnostic
-     * commands may change at runtime.  A diagnostic command may be
-     * {@linkplain DiagnosticCommandInfo#isEnabled disabled} but will
-     * not be removed from a previously returned list.
-     *
-     * @return the names of all diagnostic commands.
-     *
-     * @since 7u4
-     */
-    public List<String> getDiagnosticCommands();
-
-    /**
-     * Returns a {@code DiagnosticCommandInfo} object describing the
-     * diagnostic command of the specified name {@code command}
-     *
-     * @param command a diagnostic command name
-     * @return a {@code DiagnosticCommandInfo} object
-     * @throws java.lang.IllegalArgumentException if the {@code command}
-     *         doesn't match any diagnostic command registered in the
-     *         targeted Java virtual machine.
-     *
-     * @since 7u4
-     */
-    public DiagnosticCommandInfo getDiagnosticCommandInfo(String command);
-
-    /**
-     * Returns a list of {@code DiagnosticCommandInfo} object describing
-     * all diagnostic commands available on the targeted Java virtual machine
-     *
-     * @return a list of {@code DiagnosticCommandInfo} objects
-     *
-     * @since 7u4
-     */
-    public List<DiagnosticCommandInfo> getDiagnosticCommandInfo();
-
-    /**
-     * Returns a list of {@code DiagnosticCommandInfo} object describing
-     * all diagnostic commands specified in the {@code commands} list.
-     *
-     * @param commands {@code List} of {@code String} containing diagnostic
-     *        command names
-     * @return a {@code List} of {@code DiagnosticCommandInfo} objects
-     *
-     * @throws java.lang.IllegalArgumentException if at least one
-     *         command specified in the {@code commands } list
-     *         doesn't match any diagnostic command registered in the
-     *         targeted Java virtual machine.
-     *
-     * @since 7u4
-     */
-    public List<DiagnosticCommandInfo> getDiagnosticCommandInfo(List<String> commands);
-
-    /**
-     * Executes the command line {@code commandLine}. The command line must
-     * start with a diagnostic command name, optionally followed by parameters.
-     * Each command has its own syntax but the generic syntax for a diagnostic
-     * command line is:
-     * <blockquote>
-     *    &lt;command name&gt; [&lt;option&gt;=&lt;value&gt;] [&lt;argument_value&gt;]
-     * </blockquote>
-     *
-     * @param commandLine command line to execute
-     * @return a {@code String} object containing the diagnostic command
-     *         output.
-     *
-     * @throws java.lang.IllegalArgumentException if the command line doesn't
-     *         match any diagnostic command registered in the virtual machine
-     *         of if the parameters don't match the diagnostic command syntax.
-     * @throws java.lang.SecurityException
-     *         if a security manager exists and the caller does not have
-     *         ManagementPermission("control").
-     *
-     * @since 7u4
-     */
-    public String execute(String commandLine);
-
-    /**
-     * Invokes the diagnostic command named {@code cmd} with the parameters
-     * specified in {@code args}. Each command has its own syntax but
-     * the generic syntax for parameters is:
-     * <blockquote>
-     *    [&lt;option&gt;=&lt;value&gt;] [&lt;argument_value&gt;]
-     * </blockquote>
-     *
-     * @param cmd a diagnostic command name
-     * @param args the command parameters
-     * @return a {@code String} object containing the diagnostic command
-     *         output.
-     *
-     * @throws java.lang.IllegalArgumentException if the command line doesn't
-     *         match any diagnostic command registered in the virtual machine
-     *         of if the parameters don't match the diagnostic command syntax.
-     * @throws java.lang.SecurityException
-     *         if a security manager exists and the caller does not have
-     *         ManagementPermission("control").
-     *
-     * @since 7u4
-     */
-    public String execute(String cmd, String... args);
 }
--- a/src/share/classes/com/sun/nio/sctp/MessageInfo.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/com/sun/nio/sctp/MessageInfo.java	Sat Feb 18 16:11:47 2012 -0800
@@ -94,7 +94,7 @@
         if (streamNumber < 0 || streamNumber > 65536)
             throw new IllegalArgumentException("Invalid stream number");
 
-        return new sun.nio.ch.SctpMessageInfoImpl(null, address, streamNumber);
+        return new sun.nio.ch.sctp.MessageInfoImpl(null, address, streamNumber);
     }
     /**
      * Creates a {@code MessageInfo} instance suitable for use when
@@ -133,8 +133,8 @@
         if (streamNumber < 0 || streamNumber > 65536)
             throw new IllegalArgumentException("Invalid stream number");
 
-        return new sun.nio.ch.SctpMessageInfoImpl(association, address,
-                streamNumber);
+        return new sun.nio.ch.sctp.MessageInfoImpl(association,
+                                                   address, streamNumber);
     }
 
     /**
--- a/src/share/classes/com/sun/nio/sctp/SctpChannel.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/com/sun/nio/sctp/SctpChannel.java	Sat Feb 18 16:11:47 2012 -0800
@@ -162,7 +162,7 @@
      */
     public static SctpChannel open() throws
         IOException {
-        return new sun.nio.ch.SctpChannelImpl((SelectorProvider)null);
+        return new sun.nio.ch.sctp.SctpChannelImpl((SelectorProvider)null);
     }
 
     /**
--- a/src/share/classes/com/sun/nio/sctp/SctpMultiChannel.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/com/sun/nio/sctp/SctpMultiChannel.java	Sat Feb 18 16:11:47 2012 -0800
@@ -162,7 +162,7 @@
      */
     public static SctpMultiChannel open() throws
         IOException {
-        return new sun.nio.ch.SctpMultiChannelImpl((SelectorProvider)null);
+        return new sun.nio.ch.sctp.SctpMultiChannelImpl((SelectorProvider)null);
     }
 
     /**
--- a/src/share/classes/com/sun/nio/sctp/SctpServerChannel.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/com/sun/nio/sctp/SctpServerChannel.java	Sat Feb 18 16:11:47 2012 -0800
@@ -98,7 +98,7 @@
      */
     public static SctpServerChannel open() throws
         IOException {
-        return new sun.nio.ch.SctpServerChannelImpl((SelectorProvider)null);
+        return new sun.nio.ch.sctp.SctpServerChannelImpl((SelectorProvider)null);
     }
 
     /**
--- a/src/share/classes/com/sun/nio/sctp/SctpStandardSocketOptions.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/com/sun/nio/sctp/SctpStandardSocketOptions.java	Sat Feb 18 16:11:47 2012 -0800
@@ -25,7 +25,7 @@
 package com.sun.nio.sctp;
 
 import java.net.SocketAddress;
-import sun.nio.ch.SctpStdSocketOption;
+import sun.nio.ch.sctp.SctpStdSocketOption;
 
 /**
  * SCTP channels supports the socket options defined by this class
@@ -50,7 +50,7 @@
      */
     public static final SctpSocketOption<Boolean> SCTP_DISABLE_FRAGMENTS = new
         SctpStdSocketOption<Boolean>("SCTP_DISABLE_FRAGMENTS", Boolean.class,
-        sun.nio.ch.SctpStdSocketOption.SCTP_DISABLE_FRAGMENTS);
+        sun.nio.ch.sctp.SctpStdSocketOption.SCTP_DISABLE_FRAGMENTS);
 
     /**
      * Enables or disables explicit message completion.
@@ -69,7 +69,7 @@
      */
     public static final SctpSocketOption<Boolean> SCTP_EXPLICIT_COMPLETE = new
         SctpStdSocketOption<Boolean>("SCTP_EXPLICIT_COMPLETE", Boolean.class,
-        sun.nio.ch.SctpStdSocketOption.SCTP_EXPLICIT_COMPLETE);
+        sun.nio.ch.sctp.SctpStdSocketOption.SCTP_EXPLICIT_COMPLETE);
 
     /**
      * Fragmented interleave controls how the presentation of messages occur
@@ -120,7 +120,7 @@
     public static final SctpSocketOption<Integer> SCTP_FRAGMENT_INTERLEAVE =
             new SctpStdSocketOption<Integer>("SCTP_FRAGMENT_INTERLEAVE",
                   Integer.class,
-                  sun.nio.ch.SctpStdSocketOption.SCTP_FRAGMENT_INTERLEAVE);
+                  sun.nio.ch.sctp.SctpStdSocketOption.SCTP_FRAGMENT_INTERLEAVE);
 
     /**
      * The maximum number of streams requested by the local endpoint during
@@ -171,7 +171,7 @@
      */
     public static final SctpSocketOption<Boolean> SCTP_NODELAY =
         new SctpStdSocketOption<Boolean>("SCTP_NODELAY", Boolean.class,
-        sun.nio.ch.SctpStdSocketOption.SCTP_NODELAY);
+        sun.nio.ch.sctp.SctpStdSocketOption.SCTP_NODELAY);
 
     /**
      * Requests that the local SCTP stack use the given peer address as
@@ -246,7 +246,7 @@
      */
     public static final SctpSocketOption<Integer> SO_SNDBUF =
         new SctpStdSocketOption<Integer>("SO_SNDBUF", Integer.class,
-        sun.nio.ch.SctpStdSocketOption.SO_SNDBUF);
+        sun.nio.ch.sctp.SctpStdSocketOption.SO_SNDBUF);
 
     /**
      * The size of the socket receive buffer.
@@ -273,7 +273,7 @@
      */
     public static final SctpSocketOption<Integer> SO_RCVBUF =
         new SctpStdSocketOption<Integer>("SO_RCVBUF", Integer.class,
-        sun.nio.ch.SctpStdSocketOption.SO_RCVBUF);
+        sun.nio.ch.sctp.SctpStdSocketOption.SO_RCVBUF);
 
     /**
      * Linger on close if data is present.
@@ -304,7 +304,7 @@
      */
     public static final SctpSocketOption<Integer> SO_LINGER =
         new SctpStdSocketOption<Integer>("SO_LINGER", Integer.class,
-        sun.nio.ch.SctpStdSocketOption.SO_LINGER);
+        sun.nio.ch.sctp.SctpStdSocketOption.SO_LINGER);
 
     /**
      * This class is used to set the maximum number of inbound/outbound streams
--- a/src/share/classes/java/awt/List.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/java/awt/List.java	Sat Feb 18 16:11:47 2012 -0800
@@ -115,7 +115,7 @@
      * @see #addItem(String)
      * @see #getItem(int)
      */
-    Vector      items = new Vector();
+    Vector<String>      items = new Vector<>();
 
     /**
      * This field will represent the number of visible rows in the
@@ -306,7 +306,7 @@
     //       to insure that it cannot be overridden by client subclasses.
     //       DO NOT INVOKE CLIENT CODE ON THIS THREAD!
     final String getItemImpl(int index) {
-        return (String)items.elementAt(index);
+        return items.elementAt(index);
     }
 
     /**
@@ -415,7 +415,7 @@
         if (peer != null) {
             peer.removeAll();
         }
-        items = new Vector();
+        items = new Vector<>();
         selected = new int[0];
     }
 
@@ -490,9 +490,9 @@
     public synchronized int[] getSelectedIndexes() {
         ListPeer peer = (ListPeer)this.peer;
         if (peer != null) {
-            selected = ((ListPeer)peer).getSelectedIndexes();
+            selected = peer.getSelectedIndexes();
         }
-        return (int[])selected.clone();
+        return selected.clone();
     }
 
     /**
@@ -908,7 +908,7 @@
      * @since 1.4
      */
     public synchronized ItemListener[] getItemListeners() {
-        return (ItemListener[])(getListeners(ItemListener.class));
+        return getListeners(ItemListener.class);
     }
 
     /**
@@ -975,7 +975,7 @@
      * @since 1.4
      */
     public synchronized ActionListener[] getActionListeners() {
-        return (ActionListener[])(getListeners(ActionListener.class));
+        return getListeners(ActionListener.class);
     }
 
     /**
--- a/src/share/classes/java/awt/Window.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/java/awt/Window.java	Sat Feb 18 16:11:47 2012 -0800
@@ -398,10 +398,10 @@
             initIDs();
         }
 
-        String s = (String) java.security.AccessController.doPrivileged(
+        String s = java.security.AccessController.doPrivileged(
             new GetPropertyAction("java.awt.syncLWRequests"));
         systemSyncLWRequests = (s != null && s.equals("true"));
-        s = (String) java.security.AccessController.doPrivileged(
+        s = java.security.AccessController.doPrivileged(
             new GetPropertyAction("java.awt.Window.locationByPlatform"));
         locationByPlatformProp = (s != null && s.equals("true"));
     }
@@ -1378,7 +1378,7 @@
                 // make sure the privileged action is only
                 // for getting the property! We don't want the
                 // above checkTopLevelWindow call to always succeed!
-                warningString = (String) AccessController.doPrivileged(
+                warningString = AccessController.doPrivileged(
                       new GetPropertyAction("awt.appletWarning",
                                             "Java Applet Window"));
             }
--- a/src/share/classes/java/awt/color/ICC_Profile.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/java/awt/color/ICC_Profile.java	Sat Feb 18 16:11:47 2012 -0800
@@ -921,9 +921,9 @@
      */
     private static ICC_Profile getStandardProfile(final String name) {
 
-        return (ICC_Profile) AccessController.doPrivileged(
-            new PrivilegedAction() {
-                 public Object run() {
+        return AccessController.doPrivileged(
+            new PrivilegedAction<ICC_Profile>() {
+                 public ICC_Profile run() {
                      ICC_Profile p = null;
                      try {
                          p = getInstance (name);
--- a/src/share/classes/java/awt/event/InputEvent.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/java/awt/event/InputEvent.java	Sat Feb 18 16:11:47 2012 -0800
@@ -321,14 +321,15 @@
      * @param when         a long int that gives the time the event occurred.
      *                     Passing negative or zero value
      *                     is not recommended
-     * @param modifiers    the modifier keys down during event (e.g. shift, ctrl,
-     *                     alt, meta)
-     *                     Passing negative parameter is not recommended.
-     *                     Zero value means no modifiers.
-     *                     Either extended _DOWN_MASK or old _MASK modifiers
-     *                     should be used, but both models should not be mixed
-     *                     in one event. Use of the extended modifiers is
-     *                     preferred
+     * @param modifiers    a modifier mask describing the modifier keys and mouse
+     *                     buttons (for example, shift, ctrl, alt, and meta) that
+     *                     are down during the event.
+     *                     Only extended modifiers are allowed to be used as a
+     *                     value for this parameter (see the {@link InputEvent#getModifiersEx}
+     *                     class for the description of extended modifiers).
+     *                     Passing negative parameter
+     *                     is not recommended.
+     *                     Zero value means that no modifiers were passed
      * @throws IllegalArgumentException if <code>source</code> is null
      * @see #getSource()
      * @see #getID()
@@ -416,9 +417,13 @@
 
     /**
      * Returns the extended modifier mask for this event.
+     * <P>
+     * Extended modifiers are the modifiers that ends with the _DOWN_MASK suffix,
+     * such as ALT_DOWN_MASK, BUTTON1_DOWN_MASK, and others.
+     * <P>
      * Extended modifiers represent the state of all modal keys,
      * such as ALT, CTRL, META, and the mouse buttons just after
-     * the event occurred
+     * the event occurred.
      * <P>
      * For example, if the user presses <b>button 1</b> followed by
      * <b>button 2</b>, and then releases them in the same order,
--- a/src/share/classes/java/awt/event/MouseEvent.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/java/awt/event/MouseEvent.java	Sat Feb 18 16:11:47 2012 -0800
@@ -488,14 +488,15 @@
      * @param when         A long integer that gives the time the event occurred.
      *                     Passing negative or zero value
      *                     is not recommended
-     * @param modifiers    The modifier keys down during event (e.g. shift, ctrl,
-     *                     alt, meta)
+     * @param modifiers    a modifier mask describing the modifier keys and mouse
+     *                     buttons (for example, shift, ctrl, alt, and meta) that
+     *                     are down during the event.
+     *                     Only extended modifiers are allowed to be used as a
+     *                     value for this parameter (see the {@link InputEvent#getModifiersEx}
+     *                     class for the description of extended modifiers).
      *                     Passing negative parameter
      *                     is not recommended.
-     *                     Zero value means that no modifiers were passed.
-     *                     Use either an extended _DOWN_MASK or old _MASK modifiers,
-     *                     however do not mix models in the one event.
-     *                     The extended modifiers are preferred for using
+     *                     Zero value means that no modifiers were passed
      * @param x            The horizontal x coordinate for the mouse location.
      *                       It is allowed to pass negative values
      * @param y            The vertical y coordinate for the mouse location.
@@ -586,14 +587,15 @@
      * @param when         A long integer that gives the time the event occurred.
      *                     Passing negative or zero value
      *                     is not recommended
-     * @param modifiers    The modifier keys down during event (e.g. shift, ctrl,
-     *                     alt, meta)
+     * @param modifiers    a modifier mask describing the modifier keys and mouse
+     *                     buttons (for example, shift, ctrl, alt, and meta) that
+     *                     are down during the event.
+     *                     Only extended modifiers are allowed to be used as a
+     *                     value for this parameter (see the {@link InputEvent#getModifiersEx}
+     *                     class for the description of extended modifiers).
      *                     Passing negative parameter
      *                     is not recommended.
-     *                     Zero value means that no modifiers were passed.
-     *                     Use either an extended _DOWN_MASK or old _MASK modifiers,
-     *                     however do not mix models in the one event.
-     *                     The extended modifiers are preferred for using
+     *                     Zero value means that no modifiers were passed
      * @param x            The horizontal x coordinate for the mouse location.
      *                       It is allowed to pass negative values
      * @param y            The vertical y coordinate for the mouse location.
@@ -657,14 +659,15 @@
      * @param when         A long integer that gives the time the event occurred.
      *                     Passing negative or zero value
      *                     is not recommended
-     * @param modifiers    The modifier keys down during event (e.g. shift, ctrl,
-     *                     alt, meta)
+     * @param modifiers    a modifier mask describing the modifier keys and mouse
+     *                     buttons (for example, shift, ctrl, alt, and meta) that
+     *                     are down during the event.
+     *                     Only extended modifiers are allowed to be used as a
+     *                     value for this parameter (see the {@link InputEvent#getModifiersEx}
+     *                     class for the description of extended modifiers).
      *                     Passing negative parameter
      *                     is not recommended.
-     *                     Zero value means that no modifiers were passed.
-     *                     Use either an extended _DOWN_MASK or old _MASK modifiers,
-     *                     however do not mix models in the one event.
-     *                     The extended modifiers are preferred for using
+     *                     Zero value means that no modifiers were passed
      * @param x            The horizontal x coordinate for the mouse location.
      *                       It is allowed to pass negative values
      * @param y            The vertical y coordinate for the mouse location.
--- a/src/share/classes/java/lang/management/ManagementPermission.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/java/lang/management/ManagementPermission.java	Sat Feb 18 16:11:47 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -46,12 +46,17 @@
  * <tr>
  *   <td>control</td>
  *   <td>Ability to control the runtime characteristics of the Java virtual
- *       machine, for example, setting the -verbose:gc and -verbose:class flag,
- *       setting the threshold of a memory pool, and enabling and disabling
- *       the thread contention monitoring support.
+ *       machine, for example, enabling and disabling the verbose output for
+ *       the class loading or memory system, setting the threshold of a memory
+ *       pool, and enabling and disabling the thread contention monitoring
+ *       support. Some actions controlled by this permission can disclose
+ *       information about the running application, like the -verbose:class
+ *       flag.
  *   </td>
  *   <td>This allows an attacker to control the runtime characteristics
- *       of the Java virtual machine and cause the system to misbehave.
+ *       of the Java virtual machine and cause the system to misbehave. An
+ *       attacker can also access some information related to the running
+ *       application.
  *   </td>
  * </tr>
  * <tr>
--- a/src/share/classes/java/util/jar/Attributes.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/java/util/jar/Attributes.java	Sat Feb 18 16:11:47 2012 -0800
@@ -71,7 +71,7 @@
      * @param size the initial number of attributes
      */
     public Attributes(int size) {
-        map = new HashMap(size);
+        map = new HashMap<>(size);
     }
 
     /**
@@ -81,7 +81,7 @@
      * @param attr the specified Attributes
      */
     public Attributes(Attributes attr) {
-        map = new HashMap(attr);
+        map = new HashMap<>(attr);
     }
 
 
@@ -296,9 +296,9 @@
      * XXX Need to handle UTF8 values and break up lines longer than 72 bytes
      */
      void write(DataOutputStream os) throws IOException {
-        Iterator it = entrySet().iterator();
+        Iterator<Map.Entry<Object, Object>> it = entrySet().iterator();
         while (it.hasNext()) {
-            Map.Entry e = (Map.Entry)it.next();
+            Map.Entry<Object, Object> e = it.next();
             StringBuffer buffer = new StringBuffer(
                                         ((Name)e.getKey()).toString());
             buffer.append(": ");
@@ -340,9 +340,9 @@
 
         // write out all attributes except for the version
         // we wrote out earlier
-        Iterator it = entrySet().iterator();
+        Iterator<Map.Entry<Object, Object>> it = entrySet().iterator();
         while (it.hasNext()) {
-            Map.Entry e = (Map.Entry)it.next();
+            Map.Entry<Object, Object> e = it.next();
             String name = ((Name)e.getKey()).toString();
             if ((version != null) && ! (name.equalsIgnoreCase(vername))) {
 
@@ -499,7 +499,7 @@
          */
         public boolean equals(Object o) {
             if (o instanceof Name) {
-                Comparator c = ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER;
+                Comparator<String> c = ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER;
                 return c.compare(name, ((Name)o).name) == 0;
             } else {
                 return false;
--- a/src/share/classes/java/util/jar/JarOutputStream.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/java/util/jar/JarOutputStream.java	Sat Feb 18 16:11:47 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -135,7 +135,7 @@
      * The bytes are assumed to be in Intel (little-endian) byte order.
      */
     private static int get16(byte[] b, int off) {
-        return (b[off] & 0xff) | ((b[off+1] & 0xff) << 8);
+        return Byte.toUnsignedInt(b[off]) | ( Byte.toUnsignedInt(b[off+1]) << 8);
     }
 
     /*
--- a/src/share/classes/java/util/jar/JarVerifier.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/java/util/jar/JarVerifier.java	Sat Feb 18 16:11:47 2012 -0800
@@ -48,21 +48,21 @@
 
     /* a table mapping names to code signers, for jar entries that have
        had their actual hashes verified */
-    private Hashtable verifiedSigners;
+    private Hashtable<String, CodeSigner[]> verifiedSigners;
 
     /* a table mapping names to code signers, for jar entries that have
        passed the .SF/.DSA/.EC -> MANIFEST check */
-    private Hashtable sigFileSigners;
+    private Hashtable<String, CodeSigner[]> sigFileSigners;
 
     /* a hash table to hold .SF bytes */
-    private Hashtable sigFileData;
+    private Hashtable<String, byte[]> sigFileData;
 
     /** "queue" of pending PKCS7 blocks that we couldn't parse
      *  until we parsed the .SF file */
-    private ArrayList pendingBlocks;
+    private ArrayList<SignatureFileVerifier> pendingBlocks;
 
     /* cache of CodeSigner objects */
-    private ArrayList signerCache;
+    private ArrayList<CodeSigner[]> signerCache;
 
     /* Are we parsing a block? */
     private boolean parsingBlockOrSF = false;
@@ -94,10 +94,10 @@
 
     public JarVerifier(byte rawBytes[]) {
         manifestRawBytes = rawBytes;
-        sigFileSigners = new Hashtable();
-        verifiedSigners = new Hashtable();
-        sigFileData = new Hashtable(11);
-        pendingBlocks = new ArrayList();
+        sigFileSigners = new Hashtable<>();
+        verifiedSigners = new Hashtable<>();
+        sigFileData = new Hashtable<>(11);
+        pendingBlocks = new ArrayList<>();
         baos = new ByteArrayOutputStream();
         manifestDigests = new ArrayList<>();
     }
@@ -248,10 +248,9 @@
                     sigFileData.put(key, bytes);
                     // check pending blocks, we can now process
                     // anyone waiting for this .SF file
-                    Iterator it = pendingBlocks.iterator();
+                    Iterator<SignatureFileVerifier> it = pendingBlocks.iterator();
                     while (it.hasNext()) {
-                        SignatureFileVerifier sfv =
-                            (SignatureFileVerifier) it.next();
+                        SignatureFileVerifier sfv = it.next();
                         if (sfv.needSignatureFile(key)) {
                             if (debug != null) {
                                 debug.println(
@@ -270,7 +269,7 @@
                 String key = uname.substring(0, uname.lastIndexOf("."));
 
                 if (signerCache == null)
-                    signerCache = new ArrayList();
+                    signerCache = new ArrayList<>();
 
                 if (manDig == null) {
                     synchronized(manifestRawBytes) {
@@ -287,7 +286,7 @@
 
                 if (sfv.needSignatureFileBytes()) {
                     // see if we have already parsed an external .SF file
-                    byte[] bytes = (byte[]) sigFileData.get(key);
+                    byte[] bytes = sigFileData.get(key);
 
                     if (bytes == null) {
                         // put this block on queue for later processing
@@ -343,7 +342,7 @@
      */
     public CodeSigner[] getCodeSigners(String name)
     {
-        return (CodeSigner[])verifiedSigners.get(name);
+        return verifiedSigners.get(name);
     }
 
     public CodeSigner[] getCodeSigners(JarFile jar, JarEntry entry)
@@ -376,15 +375,14 @@
         CodeSigner[] signers) {
 
         if (signers != null) {
-            ArrayList certChains = new ArrayList();
+            ArrayList<java.security.cert.Certificate> certChains = new ArrayList<>();
             for (int i = 0; i < signers.length; i++) {
                 certChains.addAll(
                     signers[i].getSignerCertPath().getCertificates());
             }
 
             // Convert into a Certificate[]
-            return (java.security.cert.Certificate[])
-                certChains.toArray(
+            return certChains.toArray(
                     new java.security.cert.Certificate[certChains.size()]);
         }
         return null;
@@ -418,8 +416,8 @@
         // MANIFEST.MF is always treated as signed and verified,
         // move its signers from sigFileSigners to verifiedSigners.
         if (sigFileSigners.containsKey(JarFile.MANIFEST_NAME)) {
-            verifiedSigners.put(JarFile.MANIFEST_NAME,
-                    sigFileSigners.remove(JarFile.MANIFEST_NAME));
+            CodeSigner[] codeSigners = sigFileSigners.remove(JarFile.MANIFEST_NAME);
+            verifiedSigners.put(JarFile.MANIFEST_NAME, codeSigners);
         }
     }
 
@@ -493,10 +491,10 @@
 
     // Extended JavaUtilJarAccess CodeSource API Support
 
-    private Map urlToCodeSourceMap = new HashMap();
-    private Map signerToCodeSource = new HashMap();
+    private Map<URL, Map<CodeSigner[], CodeSource>> urlToCodeSourceMap = new HashMap<>();
+    private Map<CodeSigner[], CodeSource> signerToCodeSource = new HashMap<>();
     private URL lastURL;
-    private Map lastURLMap;
+    private Map<CodeSigner[], CodeSource> lastURLMap;
 
     /*
      * Create a unique mapping from codeSigner cache entries to CodeSource.
@@ -504,19 +502,19 @@
      * and shared JAR file although in practice there will be a single URL in use.
      */
     private synchronized CodeSource mapSignersToCodeSource(URL url, CodeSigner[] signers) {
-        Map map;
+        Map<CodeSigner[], CodeSource> map;
         if (url == lastURL) {
             map = lastURLMap;
         } else {
-            map = (Map) urlToCodeSourceMap.get(url);
+            map = urlToCodeSourceMap.get(url);
             if (map == null) {
-                map = new HashMap();
+                map = new HashMap<>();
                 urlToCodeSourceMap.put(url, map);
             }
             lastURLMap = map;
             lastURL = url;
         }
-        CodeSource cs = (CodeSource) map.get(signers);
+        CodeSource cs = map.get(signers);
         if (cs == null) {
             cs = new VerifierCodeSource(csdomain, url, signers);
             signerToCodeSource.put(signers, cs);
@@ -524,16 +522,16 @@
         return cs;
     }
 
-    private CodeSource[] mapSignersToCodeSources(URL url, List signers, boolean unsigned) {
-        List sources = new ArrayList();
+    private CodeSource[] mapSignersToCodeSources(URL url, List<CodeSigner[]> signers, boolean unsigned) {
+        List<CodeSource> sources = new ArrayList<>();
 
         for (int i = 0; i < signers.size(); i++) {
-            sources.add(mapSignersToCodeSource(url, (CodeSigner[]) signers.get(i)));
+            sources.add(mapSignersToCodeSource(url, signers.get(i)));
         }
         if (unsigned) {
             sources.add(mapSignersToCodeSource(url, null));
         }
-        return (CodeSource[]) sources.toArray(new CodeSource[sources.size()]);
+        return sources.toArray(new CodeSource[sources.size()]);
     }
     private CodeSigner[] emptySigner = new CodeSigner[0];
 
@@ -553,7 +551,7 @@
          * but this handles a CodeSource of any type, just in case.
          */
         CodeSource[] sources = mapSignersToCodeSources(cs.getLocation(), getJarCodeSigners(), true);
-        List sourceList = new ArrayList();
+        List<CodeSource> sourceList = new ArrayList<>();
         for (int i = 0; i < sources.length; i++) {
             sourceList.add(sources[i]);
         }
@@ -574,6 +572,7 @@
      * signing data that can be compared by object reference identity.
      */
     private static class VerifierCodeSource extends CodeSource {
+        private static final long serialVersionUID = -9047366145967768825L;
 
         URL vlocation;
         CodeSigner[] vsigners;
@@ -641,16 +640,16 @@
             return vcerts;
         }
     }
-    private Map signerMap;
+    private Map<String, CodeSigner[]> signerMap;
 
-    private synchronized Map signerMap() {
+    private synchronized Map<String, CodeSigner[]> signerMap() {
         if (signerMap == null) {
             /*
              * Snapshot signer state so it doesn't change on us. We care
              * only about the asserted signatures. Verification of
              * signature validity happens via the JarEntry apis.
              */
-            signerMap = new HashMap(verifiedSigners.size() + sigFileSigners.size());
+            signerMap = new HashMap<>(verifiedSigners.size() + sigFileSigners.size());
             signerMap.putAll(verifiedSigners);
             signerMap.putAll(sigFileSigners);
         }
@@ -658,15 +657,15 @@
     }
 
     public synchronized Enumeration<String> entryNames(JarFile jar, final CodeSource[] cs) {
-        final Map map = signerMap();
-        final Iterator itor = map.entrySet().iterator();
+        final Map<String, CodeSigner[]> map = signerMap();
+        final Iterator<Map.Entry<String, CodeSigner[]>> itor = map.entrySet().iterator();
         boolean matchUnsigned = false;
 
         /*
          * Grab a single copy of the CodeSigner arrays. Check
          * to see if we can optimize CodeSigner equality test.
          */
-        List req = new ArrayList(cs.length);
+        List<CodeSigner[]> req = new ArrayList<>(cs.length);
         for (int i = 0; i < cs.length; i++) {
             CodeSigner[] match = findMatchingSigners(cs[i]);
             if (match != null) {
@@ -678,8 +677,8 @@
             }
         }
 
-        final List signersReq = req;
-        final Enumeration enum2 = (matchUnsigned) ? unsignedEntryNames(jar) : emptyEnumeration;
+        final List<CodeSigner[]> signersReq = req;
+        final Enumeration<String> enum2 = (matchUnsigned) ? unsignedEntryNames(jar) : emptyEnumeration;
 
         return new Enumeration<String>() {
 
@@ -691,14 +690,14 @@
                 }
 
                 while (itor.hasNext()) {
-                    Map.Entry e = (Map.Entry) itor.next();
-                    if (signersReq.contains((CodeSigner[]) e.getValue())) {
-                        name = (String) e.getKey();
+                    Map.Entry<String, CodeSigner[]> e = itor.next();
+                    if (signersReq.contains(e.getValue())) {
+                        name = e.getKey();
                         return true;
                     }
                 }
                 while (enum2.hasMoreElements()) {
-                    name = (String) enum2.nextElement();
+                    name = enum2.nextElement();
                     return true;
                 }
                 return false;
@@ -719,13 +718,13 @@
      * Like entries() but screens out internal JAR mechanism entries
      * and includes signed entries with no ZIP data.
      */
-    public Enumeration<JarEntry> entries2(final JarFile jar, Enumeration e) {
-        final Map map = new HashMap();
+    public Enumeration<JarEntry> entries2(final JarFile jar, Enumeration<? extends ZipEntry> e) {
+        final Map<String, CodeSigner[]> map = new HashMap<>();
         map.putAll(signerMap());
-        final Enumeration enum_ = e;
+        final Enumeration<? extends ZipEntry> enum_ = e;
         return new Enumeration<JarEntry>() {
 
-            Enumeration signers = null;
+            Enumeration<String> signers = null;
             JarEntry entry;
 
             public boolean hasMoreElements() {
@@ -733,7 +732,7 @@
                     return true;
                 }
                 while (enum_.hasMoreElements()) {
-                    ZipEntry ze = (ZipEntry) enum_.nextElement();
+                    ZipEntry ze = enum_.nextElement();
                     if (JarVerifier.isSigningRelated(ze.getName())) {
                         continue;
                     }
@@ -744,7 +743,7 @@
                     signers = Collections.enumeration(map.keySet());
                 }
                 while (signers.hasMoreElements()) {
-                    String name = (String) signers.nextElement();
+                    String name = signers.nextElement();
                     entry = jar.newEntry(new ZipEntry(name));
                     return true;
                 }
@@ -764,7 +763,7 @@
             }
         };
     }
-    private Enumeration emptyEnumeration = new Enumeration<String>() {
+    private Enumeration<String> emptyEnumeration = new Enumeration<String>() {
 
         public boolean hasMoreElements() {
             return false;
@@ -797,8 +796,8 @@
     }
 
     private Enumeration<String> unsignedEntryNames(JarFile jar) {
-        final Map map = signerMap();
-        final Enumeration entries = jar.entries();
+        final Map<String, CodeSigner[]> map = signerMap();
+        final Enumeration<JarEntry> entries = jar.entries();
         return new Enumeration<String>() {
 
             String name;
@@ -813,7 +812,7 @@
                 }
                 while (entries.hasMoreElements()) {
                     String value;
-                    ZipEntry e = (ZipEntry) entries.nextElement();
+                    ZipEntry e = entries.nextElement();
                     value = e.getName();
                     if (e.isDirectory() || isSigningRelated(value)) {
                         continue;
@@ -836,14 +835,14 @@
             }
         };
     }
-    private List jarCodeSigners;
+    private List<CodeSigner[]> jarCodeSigners;
 
-    private synchronized List getJarCodeSigners() {
+    private synchronized List<CodeSigner[]> getJarCodeSigners() {
         CodeSigner[] signers;
         if (jarCodeSigners == null) {
-            HashSet set = new HashSet();
+            HashSet<CodeSigner[]> set = new HashSet<>();
             set.addAll(signerMap().values());
-            jarCodeSigners = new ArrayList();
+            jarCodeSigners = new ArrayList<>();
             jarCodeSigners.addAll(set);
         }
         return jarCodeSigners;
@@ -858,7 +857,7 @@
     public CodeSource getCodeSource(URL url, String name) {
         CodeSigner[] signers;
 
-        signers = (CodeSigner[]) signerMap().get(name);
+        signers = signerMap().get(name);
         return mapSignersToCodeSource(url, signers);
     }
 
--- a/src/share/classes/java/util/jar/Manifest.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/java/util/jar/Manifest.java	Sat Feb 18 16:11:47 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -339,7 +339,7 @@
                     return -1;
                 }
             }
-            return buf[pos++] & 0xff;
+            return Byte.toUnsignedInt(buf[pos++]);
         }
 
         public int read(byte[] b, int off, int len) throws IOException {
--- a/src/share/classes/java/util/zip/InflaterInputStream.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/java/util/zip/InflaterInputStream.java	Sat Feb 18 16:11:47 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -119,7 +119,7 @@
      */
     public int read() throws IOException {
         ensureOpen();
-        return read(singleByteBuf, 0, 1) == -1 ? -1 : singleByteBuf[0] & 0xff;
+        return read(singleByteBuf, 0, 1) == -1 ? -1 : Byte.toUnsignedInt(singleByteBuf[0]);
     }
 
     /**
--- a/src/share/classes/java/util/zip/ZipInputStream.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/java/util/zip/ZipInputStream.java	Sat Feb 18 16:11:47 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -435,7 +435,7 @@
      * The bytes are assumed to be in Intel (little-endian) byte order.
      */
     private static final int get16(byte b[], int off) {
-        return (b[off] & 0xff) | ((b[off+1] & 0xff) << 8);
+        return Byte.toUnsignedInt(b[off]) | (Byte.toUnsignedInt(b[off+1]) << 8);
     }
 
     /*
--- a/src/share/classes/javax/crypto/CipherSpi.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/javax/crypto/CipherSpi.java	Sat Feb 18 16:11:47 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -775,7 +775,7 @@
             int outOfs = output.arrayOffset() + outPos;
             byte[] inArray = new byte[getTempArraySize(inLen)];
             int total = 0;
-            while (inLen > 0) {
+            do {
                 int chunk = Math.min(inLen, inArray.length);
                 input.get(inArray, 0, chunk);
                 int n;
@@ -787,7 +787,7 @@
                 total += n;
                 outOfs += n;
                 inLen -= chunk;
-            }
+            } while (inLen > 0);
             output.position(outPos + total);
             return total;
         } else { // output is not backed by an accessible byte[]
@@ -804,7 +804,7 @@
             int outSize = outArray.length;
             int total = 0;
             boolean resized = false;
-            while (inLen > 0) {
+            do {
                 int chunk = Math.min(inLen, outSize);
                 if ((a1 == false) && (resized == false)) {
                     input.get(inArray, 0, chunk);
@@ -834,7 +834,7 @@
                     int newOut = engineGetOutputSize(chunk);
                     outArray = new byte[newOut];
                 }
-            }
+            } while (inLen > 0);
             input.position(inLimit);
             return total;
         }
--- a/src/share/classes/javax/net/ssl/ExtendedSSLSession.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/javax/net/ssl/ExtendedSSLSession.java	Sat Feb 18 16:11:47 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,7 @@
      * The signature algorithm name must be a standard Java Security
      * name (such as "SHA1withRSA", "SHA256withECDSA", and so on).
      * See Appendix A in the <a href=
-     * "../../../technotes/guides/security/crypto/CryptoSpec.html#AppA">
+     * "{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html#AppA">
      * Java Cryptography Architecture API Specification &amp; Reference </a>
      * for information about standard algorithm names.
      * <p>
@@ -71,7 +71,7 @@
      * The signature algorithm name must be a standard Java Security
      * name (such as "SHA1withRSA", "SHA256withECDSA", and so on).
      * See Appendix A in the <a href=
-     * "../../../technotes/guides/security/crypto/CryptoSpec.html#AppA">
+     * "{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html#AppA">
      * Java Cryptography Architecture API Specification &amp; Reference </a>
      * for information about standard algorithm names.
      *
--- a/src/share/classes/javax/net/ssl/SSLParameters.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/javax/net/ssl/SSLParameters.java	Sat Feb 18 16:11:47 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -242,7 +242,7 @@
      *
      * @param algorithm The standard string name of the endpoint
      *     identification algorithm (or null).  See Appendix A in the <a href=
-     *     "../../../technotes/guides/security/crypto/CryptoSpec.html#AppA">
+     *   "{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html#AppA">
      *     Java Cryptography Architecture API Specification &amp; Reference </a>
      *     for information about standard algorithm names.
      *
--- a/src/share/classes/javax/print/attribute/standard/PrinterStateReasons.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/javax/print/attribute/standard/PrinterStateReasons.java	Sat Feb 18 16:11:47 2012 -0800
@@ -180,8 +180,7 @@
         if (severity == null) {
             throw new NullPointerException("severity is null");
         }
-        return super.put((PrinterStateReason) reason,
-                         (Severity) severity);
+        return super.put(reason, severity);
     }
 
     /**
--- a/src/share/classes/javax/print/attribute/standard/ReferenceUriSchemesSupported.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/javax/print/attribute/standard/ReferenceUriSchemesSupported.java	Sat Feb 18 16:11:47 2012 -0800
@@ -141,7 +141,7 @@
      * Returns the string table for class ReferenceUriSchemesSupported.
      */
     protected String[] getStringTable() {
-        return (String[])myStringTable.clone();
+        return myStringTable.clone();
     }
 
     /**
--- a/src/share/classes/javax/security/auth/x500/X500Principal.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/javax/security/auth/x500/X500Principal.java	Sat Feb 18 16:11:47 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -107,10 +107,17 @@
      * defined in RFC 1779 and RFC 2253
      * (and listed in {@link #getName(String format) getName(String format)}),
      * as well as the T, DNQ or DNQUALIFIER, SURNAME, GIVENNAME, INITIALS,
-     * GENERATION, EMAILADDRESS, and SERIALNUMBER keywords whose OIDs are
-     * defined in RFC 3280 and its successor.
+     * GENERATION, EMAILADDRESS, and SERIALNUMBER keywords whose Object
+     * Identifiers (OIDs) are defined in RFC 3280 and its successor.
      * Any other attribute type must be specified as an OID.
      *
+     * <p>This implementation enforces a more restrictive OID syntax than
+     * defined in RFC 1779 and 2253. It uses the more correct syntax defined in
+     * <a href="http://www.ietf.org/rfc/rfc4512.txt">RFC 4512</a>, which
+     * specifies that OIDs contain at least 2 digits:
+     *
+     * <p>{@code numericoid = number 1*( DOT number ) }
+     *
      * @param name an X.500 distinguished name in RFC 1779 or RFC 2253 format
      * @exception NullPointerException if the <code>name</code>
      *                  is <code>null</code>
@@ -135,10 +142,17 @@
      * keywords recognized by <code>X500Principal(String)</code>. Keywords
      * MUST be specified in all upper-case, otherwise they will be ignored.
      * Improperly specified keywords are ignored; however if a keyword in the
-     * name maps to an improperly specified OID, an
+     * name maps to an improperly specified Object Identifier (OID), an
      * <code>IllegalArgumentException</code> is thrown. It is permissible to
      * have 2 different keywords that map to the same OID.
      *
+     * <p>This implementation enforces a more restrictive OID syntax than
+     * defined in RFC 1779 and 2253. It uses the more correct syntax defined in
+     * <a href="http://www.ietf.org/rfc/rfc4512.txt">RFC 4512</a>, which
+     * specifies that OIDs contain at least 2 digits:
+     *
+     * <p>{@code numericoid = number 1*( DOT number ) }
+     *
      * @param name an X.500 distinguished name in RFC 1779 or RFC 2253 format
      * @param keywordMap an attribute type keyword map, where each key is a
      *   keyword String that maps to a corresponding object identifier in String
--- a/src/share/classes/javax/security/auth/x500/package.html	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/javax/security/auth/x500/package.html	Sat Feb 18 16:11:47 2012 -0800
@@ -2,7 +2,7 @@
 <html>
 <head>
 <!--
-Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
 This code is free software; you can redistribute it and/or modify it
@@ -30,17 +30,26 @@
 <body bgcolor="white">
 
     This package contains the classes that should be used to store 
-    X500 Principal and X500 Private Crendentials in a
+    X500 Principal and X500 Private Credentials in a
     <i>Subject</i>.
 
-<!--
 <h2>Package Specification</h2>
 
-##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
 <ul>
-  <li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
+  <li><a href="http://www.ietf.org/rfc/rfc1779.txt">
+    RFC 1779: A String Representation of Distinguished Names</a></li>
+  <li><a href="http://www.ietf.org/rfc/rfc2253.txt">
+    RFC 2253: Lightweight Directory Access Protocol (v3):
+    UTF-8 String Representation of Distinguished Names</a></li>
+  <li><a href="http://www.ietf.org/rfc/rfc3280.txt">
+    RFC 3280: Internet X.509 Public Key Infrastructure
+    Certificate and Certificate Revocation List (CRL) Profile</a></li>
+  <li><a href="http://www.ietf.org/rfc/rfc4512.txt">
+    RFC 4512: Lightweight Directory Access Protocol (LDAP):
+    Directory Information Models</a></li>
 </ul>
 
+<!--
 <h2>Related Documentation</h2>
 
 For overviews, tutorials, examples, guides, and tool documentation, please see:
--- a/src/share/classes/javax/swing/JOptionPane.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/javax/swing/JOptionPane.java	Sat Feb 18 16:11:47 2012 -0800
@@ -34,7 +34,6 @@
 import java.awt.Frame;
 import java.awt.Point;
 import java.awt.HeadlessException;
-import java.awt.Toolkit;
 import java.awt.Window;
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
@@ -994,8 +993,7 @@
                 // if the user closed the window without selecting a button
                 // (newValue = null in that case).  Otherwise, close the dialog.
                 if (dialog.isVisible() && event.getSource() == JOptionPane.this &&
-                        (event.getPropertyName().equals(VALUE_PROPERTY) ||
-                                event.getPropertyName().equals(INPUT_VALUE_PROPERTY)) &&
+                        (event.getPropertyName().equals(VALUE_PROPERTY)) &&
                         event.getNewValue() != null &&
                         event.getNewValue() != JOptionPane.UNINITIALIZED_VALUE) {
                     dialog.setVisible(false);
--- a/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java	Sat Feb 18 16:11:47 2012 -0800
@@ -1236,6 +1236,7 @@
                 int       index = list.locationToIndex(e.getPoint());
 
                 optionPane.setInputValue(list.getModel().getElementAt(index));
+                optionPane.setValue(JOptionPane.OK_OPTION);
             }
         }
 
--- a/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java	Sat Feb 18 16:11:47 2012 -0800
@@ -434,6 +434,8 @@
 
         // Empty out the renderer pane, allowing renderers to be gc'ed.
         rendererPane.removeAll();
+
+        paintContext = null;
     }
 
     private void configureRenderer(SynthContext context) {
--- a/src/share/classes/javax/swing/tree/DefaultTreeCellRenderer.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/javax/swing/tree/DefaultTreeCellRenderer.java	Sat Feb 18 16:11:47 2012 -0800
@@ -156,7 +156,7 @@
     protected Color borderSelectionColor;
 
     private boolean isDropCell;
-    private boolean fillBackground = true;
+    private boolean fillBackground;
 
     /**
      * Set to true after the constructor has run.
--- a/src/share/classes/sun/awt/image/OffScreenImageSource.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/sun/awt/image/OffScreenImageSource.java	Sat Feb 18 16:11:47 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -185,6 +185,7 @@
             theConsumer.setDimensions(image.getWidth(), image.getHeight());
             theConsumer.setProperties(properties);
             sendPixels();
+            theConsumer.imageComplete(ImageConsumer.SINGLEFRAMEDONE);
             theConsumer.imageComplete(ImageConsumer.STATICIMAGEDONE);
         } catch (NullPointerException e) {
             if (theConsumer != null) {
--- a/src/share/classes/sun/beans/infos/ComponentBeanInfo.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/sun/beans/infos/ComponentBeanInfo.java	Sat Feb 18 16:11:47 2012 -0800
@@ -32,7 +32,7 @@
  */
 
 public class ComponentBeanInfo extends SimpleBeanInfo {
-    private static final Class beanClass = java.awt.Component.class;
+    private static final Class<java.awt.Component> beanClass = java.awt.Component.class;
 
     public PropertyDescriptor[] getPropertyDescriptors() {
         try {
--- a/src/share/classes/sun/font/FileFont.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/sun/font/FileFont.java	Sat Feb 18 16:11:47 2012 -0800
@@ -163,7 +163,9 @@
                 }
             }
         }
-        scaler.dispose();
+        if (scaler != null) {
+            scaler.dispose();
+        }
         scaler = FontScaler.getNullScaler();
     }
 
--- a/src/share/classes/sun/font/StandardGlyphVector.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/sun/font/StandardGlyphVector.java	Sat Feb 18 16:11:47 2012 -0800
@@ -1740,8 +1740,9 @@
                                                      tx,
                                                      sgv.font.getStyle(),
                                                      aa, fm);
-
-            FontStrike strike = sgv.font2D.getStrike(desc);  // !!! getStrike(desc, false)
+            // Get the strike via the handle. Shouldn't matter
+            // if we've invalidated the font but its an extra precaution.
+            FontStrike strike = sgv.font2D.handle.font2D.getStrike(desc);  // !!! getStrike(desc, false)
 
             return new GlyphStrike(sgv, strike, dx, dy);
         }
--- a/src/share/classes/sun/font/SunFontManager.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/sun/font/SunFontManager.java	Sat Feb 18 16:11:47 2012 -0800
@@ -2619,6 +2619,9 @@
         physicalFonts.remove(oldFont.fullName);
         fullNameToFont.remove(oldFont.fullName.toLowerCase(Locale.ENGLISH));
         FontFamily.remove(oldFont);
+        if (oldFont instanceof FileFont) {
+            ((FileFont)oldFont).deregisterFontAndClearStrikeCache();
+        }
 
         if (localeFullNamesToFont != null) {
             Map.Entry[] mapEntries =
--- a/src/share/classes/sun/font/TrueTypeFont.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/sun/font/TrueTypeFont.java	Sat Feb 18 16:11:47 2012 -0800
@@ -1037,6 +1037,9 @@
             if (head_Table != null && head_Table.capacity() >= 18) {
                 ShortBuffer sb = head_Table.asShortBuffer();
                 upem = sb.get(9) & 0xffff;
+                if (upem < 16 || upem > 16384) {
+                    upem = 2048;
+                }
             }
 
             ByteBuffer os2_Table = getTableBuffer(os_2Tag);
--- a/src/share/classes/sun/management/HotSpotDiagnostic.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/sun/management/HotSpotDiagnostic.java	Sat Feb 18 16:11:47 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,13 +27,9 @@
 
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
 import java.util.List;
 import javax.management.ObjectName;
 
-import com.sun.management.DiagnosticCommandInfo;
-import com.sun.management.DiagnosticCommandArgumentInfo;
 import com.sun.management.HotSpotDiagnosticMXBean;
 import com.sun.management.VMOption;
 
@@ -120,54 +116,7 @@
         }
     }
 
-    public List<String> getDiagnosticCommands() {
-        String[] commands = getDiagnosticCommands0();
-        return commands == null ? Collections.<String>emptyList() :
-            Arrays.asList(commands);
-    }
-
-    public DiagnosticCommandInfo getDiagnosticCommandInfo(String command) {
-        String[] array = new String[] { command };
-        return getDiagnosticCommandInfo0(array)[0];
-    }
-
-    public List<DiagnosticCommandInfo> getDiagnosticCommandInfo() {
-        String[] commands = getDiagnosticCommands0();
-        return Arrays.asList(getDiagnosticCommandInfo0(commands));
-    }
-
-    public List<DiagnosticCommandInfo> getDiagnosticCommandInfo(
-        List<String> commands) {
-        return Arrays.asList(getDiagnosticCommandInfo0(
-            commands.toArray(new String[commands.size()])));
-    }
-
-    public String execute(String command) {
-        Util.checkControlAccess();
-        return executeDiagnosticCommand0(command);
-    }
-
-    public String execute(String cmd, String... arguments) {
-        if(cmd == null) {
-            throw new NullPointerException("Missing command name");
-        }
-        StringBuilder sb = new StringBuilder();
-        sb.append(cmd);
-        sb.append(" ");
-        for(String arg : arguments) {
-            sb.append(arg);
-            sb.append(" ");
-        }
-        return execute(sb.toString());
-    }
-
     public ObjectName getObjectName() {
         return Util.newObjectName("com.sun.management:type=HotSpotDiagnostic");
     }
-
-    private native String[] getDiagnosticCommands0();
-    private native DiagnosticCommandInfo[] getDiagnosticCommandInfo0(
-        String[] commands) throws IllegalArgumentException;
-    private native String executeDiagnosticCommand0(String command)
-        throws IllegalArgumentException;
 }
--- a/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java	Sat Feb 18 16:11:47 2012 -0800
@@ -270,7 +270,7 @@
     protected Proxy instProxy;
 
     private CookieHandler cookieHandler;
-    private ResponseCache cacheHandler;
+    private final ResponseCache cacheHandler;
 
     // the cached response, and cached response headers and body
     protected CacheResponse cachedResponse;
@@ -1579,7 +1579,7 @@
 
                 if (respCode == 200 || respCode == 203 || respCode == 206 ||
                     respCode == 300 || respCode == 301 || respCode == 410) {
-                    if (cacheHandler != null) {
+                    if (cacheHandler != null && getUseCaches()) {
                         // give cache a chance to save response in cache
                         URI uri = ParseUtil.toURI(url);
                         if (uri != null) {
--- a/src/share/classes/sun/nio/ch/AbstractPollArrayWrapper.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/sun/nio/ch/AbstractPollArrayWrapper.java	Sat Feb 18 16:11:47 2012 -0800
@@ -35,15 +35,15 @@
  * @since 1.4
  */
 
-abstract class AbstractPollArrayWrapper {
+public abstract class AbstractPollArrayWrapper {
 
     // Event masks
-    static final short POLLIN       = 0x0001;
-    static final short POLLOUT      = 0x0004;
-    static final short POLLERR      = 0x0008;
-    static final short POLLHUP      = 0x0010;
-    static final short POLLNVAL     = 0x0020;
-    static final short POLLREMOVE   = 0x0800;
+    public static final short POLLIN       = 0x0001;
+    public static final short POLLOUT      = 0x0004;
+    public static final short POLLERR      = 0x0008;
+    public static final short POLLHUP      = 0x0010;
+    public static final short POLLNVAL     = 0x0020;
+    public static final short POLLREMOVE   = 0x0800;
 
     // Miscellaneous constants
     static final short SIZE_POLLFD   = 8;
--- a/src/share/classes/sun/nio/ch/AbstractPollSelectorImpl.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/sun/nio/ch/AbstractPollSelectorImpl.java	Sat Feb 18 16:11:47 2012 -0800
@@ -67,7 +67,7 @@
         this.channelOffset = offset;
     }
 
-    void putEventOps(SelectionKeyImpl sk, int ops) {
+    public void putEventOps(SelectionKeyImpl sk, int ops) {
         synchronized (closeLock) {
             if (closed)
                 throw new ClosedSelectorException();
--- a/src/share/classes/sun/nio/ch/IOStatus.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/sun/nio/ch/IOStatus.java	Sat Feb 18 16:11:47 2012 -0800
@@ -28,16 +28,16 @@
 
 // Constants for reporting I/O status
 
-final class IOStatus {
+public final class IOStatus {
 
     private IOStatus() { }
 
-    static final int EOF = -1;              // End of file
-    static final int UNAVAILABLE = -2;      // Nothing available (non-blocking)
-    static final int INTERRUPTED = -3;      // System call interrupted
-    static final int UNSUPPORTED = -4;      // Operation not supported
-    static final int THROWN = -5;           // Exception thrown in JNI code
-    static final int UNSUPPORTED_CASE = -6; // This case not supported
+    public static final int EOF = -1;              // End of file
+    public static final int UNAVAILABLE = -2;      // Nothing available (non-blocking)
+    public static final int INTERRUPTED = -3;      // System call interrupted
+    public static final int UNSUPPORTED = -4;      // Operation not supported
+    public static final int THROWN = -5;           // Exception thrown in JNI code
+    public static final int UNSUPPORTED_CASE = -6; // This case not supported
 
     // The following two methods are for use in try/finally blocks where a
     // status value needs to be normalized before being returned to the invoker
@@ -55,28 +55,28 @@
     //     }
     //
 
-    static int normalize(int n) {
+    public static int normalize(int n) {
         if (n == UNAVAILABLE)
             return 0;
         return n;
     }
 
-    static boolean check(int n) {
+    public static boolean check(int n) {
         return (n >= UNAVAILABLE);
     }
 
-    static long normalize(long n) {
+    public static long normalize(long n) {
         if (n == UNAVAILABLE)
             return 0;
         return n;
     }
 
-    static boolean check(long n) {
+    public static boolean check(long n) {
         return (n >= UNAVAILABLE);
     }
 
     // Return true iff n is not one of the IOStatus values
-    static boolean checkAll(long n) {
+    public static boolean checkAll(long n) {
         return ((n > EOF) || (n < UNSUPPORTED_CASE));
     }
 
--- a/src/share/classes/sun/nio/ch/IOUtil.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/sun/nio/ch/IOUtil.java	Sat Feb 18 16:11:47 2012 -0800
@@ -34,7 +34,7 @@
  * File-descriptor based I/O utilities that are shared by NIO classes.
  */
 
-class IOUtil {
+public class IOUtil {
 
     private IOUtil() { }                // No instantiation
 
@@ -309,7 +309,7 @@
         }
     }
 
-    static FileDescriptor newFD(int i) {
+    public static FileDescriptor newFD(int i) {
         FileDescriptor fd = new FileDescriptor();
         setfdVal(fd, i);
         return fd;
@@ -326,10 +326,11 @@
 
     static native boolean drain(int fd) throws IOException;
 
-    static native void configureBlocking(FileDescriptor fd, boolean blocking)
+    public static native void configureBlocking(FileDescriptor fd,
+                                                boolean blocking)
         throws IOException;
 
-    static native int fdVal(FileDescriptor fd);
+    public static native int fdVal(FileDescriptor fd);
 
     static native void setfdVal(FileDescriptor fd, int value);
 
--- a/src/share/classes/sun/nio/ch/Net.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/sun/nio/ch/Net.java	Sat Feb 18 16:11:47 2012 -0800
@@ -33,7 +33,7 @@
 import java.security.PrivilegedAction;
 
 
-class Net {                                             // package-private
+public class Net {
 
     private Net() { }
 
@@ -75,7 +75,7 @@
         return canJoin6WithIPv4Group0();
     }
 
-    static InetSocketAddress checkAddress(SocketAddress sa) {
+    public static InetSocketAddress checkAddress(SocketAddress sa) {
         if (sa == null)
             throw new NullPointerException();
         if (!(sa instanceof InetSocketAddress))
@@ -330,7 +330,7 @@
     // Due to oddities SO_REUSEADDR on windows reuse is ignored
     private static native int socket0(boolean preferIPv6, boolean stream, boolean reuse);
 
-    static void bind(FileDescriptor fd, InetAddress addr, int port)
+    public static void bind(FileDescriptor fd, InetAddress addr, int port)
         throws IOException
     {
         bind(UNSPEC, fd, addr, port);
@@ -383,7 +383,7 @@
     private static native InetAddress localInetAddress(FileDescriptor fd)
         throws IOException;
 
-    static InetSocketAddress localAddress(FileDescriptor fd)
+    public static InetSocketAddress localAddress(FileDescriptor fd)
         throws IOException
     {
         return new InetSocketAddress(localInetAddress(fd), localPort(fd));
--- a/src/share/classes/sun/nio/ch/SctpMessageInfoImpl.java	Thu Feb 16 13:01:36 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,170 +0,0 @@
-/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.nio.ch;
-
-import java.net.SocketAddress;
-import com.sun.nio.sctp.MessageInfo;
-import com.sun.nio.sctp.Association;
-
-/**
- * An implementation of a MessageInfo.
- */
-public class SctpMessageInfoImpl extends MessageInfo {
-    private final SocketAddress address;
-    private final int bytes;          /* 0 */
-
-    private Association association;
-    private int assocId;
-    private int streamNumber;
-    private boolean complete = true;
-    private boolean unordered;  /* false */
-    private long timeToLive;    /* 0L */
-    private int ppid;           /* 0 */
-
-    public SctpMessageInfoImpl(Association association,
-                               SocketAddress address,
-                               int streamNumber) {
-        this.association = association;
-        this.address = address;
-        this.streamNumber = streamNumber;
-        bytes = 0;
-    }
-
-    /* Invoked from native */
-    private SctpMessageInfoImpl(int assocId,
-                                SocketAddress address,
-                                int bytes,
-                                int streamNumber,
-                                boolean complete,
-                                boolean unordered,
-                                int ppid) {
-        this.assocId = assocId;
-        this.address = address;
-        this.bytes = bytes;
-        this.streamNumber = streamNumber;
-        this.complete = complete;
-        this.unordered = unordered;
-        this.ppid = ppid;
-    }
-
-    @Override
-    public Association association() {
-        return association;
-    }
-
-    /**
-     * SctpMessageInfoImpl instances created from native will need to have their
-     * association set from the channel.
-     */
-    void setAssociation(Association association) {
-        this.association = association;
-    }
-
-    int associationID() {
-        return assocId;
-    }
-
-    @Override
-    public SocketAddress address() {
-        return address;
-    }
-
-    @Override
-    public int bytes() {
-        return bytes;
-    }
-
-    @Override
-    public int streamNumber() {
-        return streamNumber;
-    }
-
-    @Override
-    public MessageInfo streamNumber(int streamNumber) {
-        if (streamNumber < 0 || streamNumber > 65536)
-            throw new IllegalArgumentException("Invalid stream number");
-
-        this.streamNumber = streamNumber;
-        return this;
-    }
-
-    @Override
-    public int payloadProtocolID() {
-        return ppid;
-    }
-
-    @Override
-    public MessageInfo payloadProtocolID(int ppid) {
-        this.ppid = ppid;
-        return this;
-    }
-
-    @Override
-    public boolean isComplete() {
-        return complete;
-    }
-
-    @Override
-    public MessageInfo complete(boolean complete) {
-        this.complete = complete;
-        return this;
-    }
-
-    @Override
-    public boolean isUnordered() {
-        return unordered;
-    }
-
-    @Override
-    public MessageInfo unordered(boolean unordered) {
-        this.unordered = unordered;
-        return this;
-    }
-
-    @Override
-    public long timeToLive() {
-        return timeToLive;
-    }
-
-    @Override
-    public MessageInfo timeToLive(long millis) {
-        timeToLive = millis;
-        return this;
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder sb = new StringBuilder(super.toString());
-        sb.append( "[Address: ").append(address)
-          .append(", Association: ").append(association)
-          .append(", Assoc ID: ").append(assocId)
-          .append(", Bytes: ").append(bytes)
-          .append(", Stream Number: ").append(streamNumber)
-          .append(", Complete: ").append(complete)
-          .append(", isUnordered: ").append(unordered)
-          .append("]");
-        return sb.toString();
-    }
-}
--- a/src/share/classes/sun/nio/ch/SctpStdSocketOption.java	Thu Feb 16 13:01:36 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.nio.ch;
-
-import com.sun.nio.sctp.SctpSocketOption;
-
-public class SctpStdSocketOption<T>
-    implements SctpSocketOption<T>
-{
-    /* for native mapping of int options */
-    public static final int SCTP_DISABLE_FRAGMENTS = 1;
-    public static final int SCTP_EXPLICIT_COMPLETE = 2;
-    public static final int SCTP_FRAGMENT_INTERLEAVE = 3;
-    public static final int SCTP_NODELAY = 4;
-    public static final int SO_SNDBUF = 5;
-    public static final int SO_RCVBUF = 6;
-    public static final int SO_LINGER = 7;
-
-    private final String name;
-    private final Class<T> type;
-
-    /* for native mapping of int options */
-    private int constValue;
-
-    public SctpStdSocketOption(String name, Class<T> type) {
-        this.name = name;
-        this.type = type;
-    }
-
-    public SctpStdSocketOption(String name, Class<T> type, int constValue) {
-        this.name = name;
-        this.type = type;
-        this.constValue = constValue;
-    }
-
-    @Override
-    public String name() {
-        return name;
-    }
-
-    @Override
-    public Class<T> type() {
-        return type;
-    }
-
-    @Override
-    public String toString() {
-        return name;
-    }
-
-    int constValue() {
-        return constValue;
-    }
-}
--- a/src/share/classes/sun/nio/ch/SelChImpl.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/sun/nio/ch/SelChImpl.java	Sat Feb 18 16:11:47 2012 -0800
@@ -36,7 +36,7 @@
  * @since 1.4
  */
 
-interface SelChImpl extends Channel {
+public interface SelChImpl extends Channel {
 
     FileDescriptor getFD();
 
--- a/src/share/classes/sun/nio/ch/SelectionKeyImpl.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/sun/nio/ch/SelectionKeyImpl.java	Sat Feb 18 16:11:47 2012 -0800
@@ -34,12 +34,12 @@
  * An implementation of SelectionKey for Solaris.
  */
 
-class SelectionKeyImpl
+public class SelectionKeyImpl
     extends AbstractSelectionKey
 {
 
     final SelChImpl channel;                            // package-private
-    final SelectorImpl selector;                        // package-private
+    public final SelectorImpl selector;
 
     // Index for a pollfd array in Selector that this key is registered with
     private int index;
@@ -91,15 +91,15 @@
     // The nio versions of these operations do not care if a key
     // has been invalidated. They are for internal use by nio code.
 
-    void nioReadyOps(int ops) {                 // package-private
+    public void nioReadyOps(int ops) {
         readyOps = ops;
     }
 
-    int nioReadyOps() {                         // package-private
+    public int nioReadyOps() {
         return readyOps;
     }
 
-    SelectionKey nioInterestOps(int ops) {      // package-private
+    public SelectionKey nioInterestOps(int ops) {
         if ((ops & ~channel().validOps()) != 0)
             throw new IllegalArgumentException();
         channel.translateAndSetInterestOps(ops, this);
@@ -107,7 +107,7 @@
         return this;
     }
 
-    int nioInterestOps() {                       // package-private
+    public int nioInterestOps() {
         return interestOps;
     }
 
--- a/src/share/classes/sun/nio/ch/SelectorImpl.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/sun/nio/ch/SelectorImpl.java	Sat Feb 18 16:11:47 2012 -0800
@@ -36,7 +36,7 @@
  * Base Selector implementation class.
  */
 
-abstract class SelectorImpl
+public abstract class SelectorImpl
     extends AbstractSelector
 {
 
@@ -118,7 +118,7 @@
 
     protected abstract void implClose() throws IOException;
 
-    void putEventOps(SelectionKeyImpl sk, int ops) { }
+    public void putEventOps(SelectionKeyImpl sk, int ops) { }
 
     protected final SelectionKey register(AbstractSelectableChannel ch,
                                           int ops,
--- a/src/share/classes/sun/nio/ch/Util.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/sun/nio/ch/Util.java	Sat Feb 18 16:11:47 2012 -0800
@@ -40,7 +40,7 @@
 import sun.security.action.GetPropertyAction;
 
 
-class Util {
+public class Util {
 
     // -- Caches --
 
@@ -158,7 +158,7 @@
     /**
      * Returns a temporary buffer of at least the given size
      */
-    static ByteBuffer getTemporaryDirectBuffer(int size) {
+    public static ByteBuffer getTemporaryDirectBuffer(int size) {
         BufferCache cache = bufferCache.get();
         ByteBuffer buf = cache.get(size);
         if (buf != null) {
@@ -178,7 +178,7 @@
     /**
      * Releases a temporary buffer by returning to the cache or freeing it.
      */
-    static void releaseTemporaryDirectBuffer(ByteBuffer buf) {
+    public static void releaseTemporaryDirectBuffer(ByteBuffer buf) {
         offerFirstTemporaryDirectBuffer(buf);
     }
 
@@ -467,7 +467,7 @@
 
     private static boolean loaded = false;
 
-    static void load() {
+    public static void load() {
         synchronized (Util.class) {
             if (loaded)
                 return;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/sun/nio/ch/sctp/MessageInfoImpl.java	Sat Feb 18 16:11:47 2012 -0800
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package sun.nio.ch.sctp;
+
+import java.net.SocketAddress;
+import com.sun.nio.sctp.MessageInfo;
+import com.sun.nio.sctp.Association;
+
+/**
+ * An implementation of a MessageInfo.
+ */
+public class MessageInfoImpl extends MessageInfo {
+    private final SocketAddress address;
+    private final int bytes;          /* 0 */
+
+    private Association association;
+    private int assocId;
+    private int streamNumber;
+    private boolean complete = true;
+    private boolean unordered;  /* false */
+    private long timeToLive;    /* 0L */
+    private int ppid;           /* 0 */
+
+    public MessageInfoImpl(Association association,
+                           SocketAddress address,
+                           int streamNumber) {
+        this.association = association;
+        this.address = address;
+        this.streamNumber = streamNumber;
+        bytes = 0;
+    }
+
+    /* Invoked from native */
+    private MessageInfoImpl(int assocId,
+                            SocketAddress address,
+                            int bytes,
+                            int streamNumber,
+                            boolean complete,
+                            boolean unordered,
+                            int ppid) {
+        this.assocId = assocId;
+        this.address = address;
+        this.bytes = bytes;
+        this.streamNumber = streamNumber;
+        this.complete = complete;
+        this.unordered = unordered;
+        this.ppid = ppid;
+    }
+
+    @Override
+    public Association association() {
+        return association;
+    }
+
+    /**
+     * MessageInfoImpl instances created from native will need to have their
+     * association set from the channel.
+     */
+    void setAssociation(Association association) {
+        this.association = association;
+    }
+
+    int associationID() {
+        return assocId;
+    }
+
+    @Override
+    public SocketAddress address() {
+        return address;
+    }
+
+    @Override
+    public int bytes() {
+        return bytes;
+    }
+
+    @Override
+    public int streamNumber() {
+        return streamNumber;
+    }
+
+    @Override
+    public MessageInfo streamNumber(int streamNumber) {
+        if (streamNumber < 0 || streamNumber > 65536)
+            throw new IllegalArgumentException("Invalid stream number");
+
+        this.streamNumber = streamNumber;
+        return this;
+    }
+
+    @Override
+    public int payloadProtocolID() {
+        return ppid;
+    }
+
+    @Override
+    public MessageInfo payloadProtocolID(int ppid) {
+        this.ppid = ppid;
+        return this;
+    }
+
+    @Override
+    public boolean isComplete() {
+        return complete;
+    }
+
+    @Override
+    public MessageInfo complete(boolean complete) {
+        this.complete = complete;
+        return this;
+    }
+
+    @Override
+    public boolean isUnordered() {
+        return unordered;
+    }
+
+    @Override
+    public MessageInfo unordered(boolean unordered) {
+        this.unordered = unordered;
+        return this;
+    }
+
+    @Override
+    public long timeToLive() {
+        return timeToLive;
+    }
+
+    @Override
+    public MessageInfo timeToLive(long millis) {
+        timeToLive = millis;
+        return this;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder(super.toString());
+        sb.append( "[Address: ").append(address)
+          .append(", Association: ").append(association)
+          .append(", Assoc ID: ").append(assocId)
+          .append(", Bytes: ").append(bytes)
+          .append(", Stream Number: ").append(streamNumber)
+          .append(", Complete: ").append(complete)
+          .append(", isUnordered: ").append(unordered)
+          .append("]");
+        return sb.toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/sun/nio/ch/sctp/SctpStdSocketOption.java	Sat Feb 18 16:11:47 2012 -0800
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package sun.nio.ch.sctp;
+
+import com.sun.nio.sctp.SctpSocketOption;
+
+public class SctpStdSocketOption<T>
+    implements SctpSocketOption<T>
+{
+    /* for native mapping of int options */
+    public static final int SCTP_DISABLE_FRAGMENTS = 1;
+    public static final int SCTP_EXPLICIT_COMPLETE = 2;
+    public static final int SCTP_FRAGMENT_INTERLEAVE = 3;
+    public static final int SCTP_NODELAY = 4;
+    public static final int SO_SNDBUF = 5;
+    public static final int SO_RCVBUF = 6;
+    public static final int SO_LINGER = 7;
+
+    private final String name;
+    private final Class<T> type;
+
+    /* for native mapping of int options */
+    private int constValue;
+
+    public SctpStdSocketOption(String name, Class<T> type) {
+        this.name = name;
+        this.type = type;
+    }
+
+    public SctpStdSocketOption(String name, Class<T> type, int constValue) {
+        this.name = name;
+        this.type = type;
+        this.constValue = constValue;
+    }
+
+    @Override
+    public String name() {
+        return name;
+    }
+
+    @Override
+    public Class<T> type() {
+        return type;
+    }
+
+    @Override
+    public String toString() {
+        return name;
+    }
+
+    int constValue() {
+        return constValue;
+    }
+}
--- a/src/share/classes/sun/security/pkcs/PKCS7.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/sun/security/pkcs/PKCS7.java	Sat Feb 18 16:11:47 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -72,16 +72,19 @@
 
     /*
      * Random number generator for creating nonce values
+     * (Lazy initialization)
      */
-    private static final SecureRandom RANDOM;
-    static {
-        SecureRandom tmp = null;
-        try {
-            tmp = SecureRandom.getInstance("SHA1PRNG");
-        } catch (NoSuchAlgorithmException e) {
-            // should not happen
+    private static class SecureRandomHolder {
+        static final SecureRandom RANDOM;
+        static {
+            SecureRandom tmp = null;
+            try {
+                tmp = SecureRandom.getInstance("SHA1PRNG");
+            } catch (NoSuchAlgorithmException e) {
+                // should not happen
+            }
+            RANDOM = tmp;
         }
-        RANDOM = tmp;
     }
 
     /*
@@ -862,8 +865,8 @@
 
         // Generate a nonce
         BigInteger nonce = null;
-        if (RANDOM != null) {
-            nonce = new BigInteger(64, RANDOM);
+        if (SecureRandomHolder.RANDOM != null) {
+            nonce = new BigInteger(64, SecureRandomHolder.RANDOM);
             tsQuery.setNonce(nonce);
         }
         tsQuery.requestCertificate(true);
--- a/src/share/classes/sun/security/pkcs12/PKCS12KeyStore.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/sun/security/pkcs12/PKCS12KeyStore.java	Sat Feb 18 16:11:47 2012 -0800
@@ -253,11 +253,25 @@
         }
 
         try {
-            // Use JCE
-            SecretKey skey = getPBEKey(password);
-            Cipher cipher = Cipher.getInstance(algOid.toString());
-            cipher.init(Cipher.DECRYPT_MODE, skey, algParams);
-            byte[] privateKeyInfo = cipher.doFinal(encryptedKey);
+            byte[] privateKeyInfo;
+            while (true) {
+                try {
+                    // Use JCE
+                    SecretKey skey = getPBEKey(password);
+                    Cipher cipher = Cipher.getInstance(algOid.toString());
+                    cipher.init(Cipher.DECRYPT_MODE, skey, algParams);
+                    privateKeyInfo = cipher.doFinal(encryptedKey);
+                    break;
+                } catch (Exception e) {
+                    if (password.length == 0) {
+                        // Retry using an empty password
+                        // without a NULL terminator.
+                        password = new char[1];
+                        continue;
+                    }
+                    throw e;
+                }
+            }
 
             PKCS8EncodedKeySpec kspec = new PKCS8EncodedKeySpec(privateKeyInfo);
 
@@ -1251,16 +1265,24 @@
                 ObjectIdentifier algOid = in.getOID();
                 AlgorithmParameters algParams = parseAlgParameters(in);
 
-                try {
-                    // Use JCE
-                    SecretKey skey = getPBEKey(password);
-                    Cipher cipher = Cipher.getInstance(algOid.toString());
-                    cipher.init(Cipher.DECRYPT_MODE, skey, algParams);
-                    safeContentsData = cipher.doFinal(safeContentsData);
-
-                } catch (Exception e) {
-                    throw new IOException("failed to decrypt safe"
-                            + " contents entry: " + e, e);
+                while (true) {
+                    try {
+                        // Use JCE
+                        SecretKey skey = getPBEKey(password);
+                        Cipher cipher = Cipher.getInstance(algOid.toString());
+                        cipher.init(Cipher.DECRYPT_MODE, skey, algParams);
+                        safeContentsData = cipher.doFinal(safeContentsData);
+                        break;
+                    } catch (Exception e) {
+                        if (password.length == 0) {
+                            // Retry using an empty password
+                            // without a NULL terminator.
+                            password = new char[1];
+                            continue;
+                        }
+                        throw new IOException(
+                                "failed to decrypt safe contents entry: " + e, e);
+                    }
                 }
             } else {
                 throw new IOException("public key protected PKCS12" +
--- a/src/share/classes/sun/tools/jar/CommandLine.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/sun/tools/jar/CommandLine.java	Sat Feb 18 16:11:47 2012 -0800
@@ -55,7 +55,7 @@
     public static String[] parse(String[] args)
         throws IOException
     {
-        ArrayList newArgs = new ArrayList(args.length);
+        List<String> newArgs = new ArrayList<>(args.length);
         for (int i = 0; i < args.length; i++) {
             String arg = args[i];
             if (arg.length() > 1 && arg.charAt(0) == '@') {
@@ -69,10 +69,10 @@
                 newArgs.add(arg);
             }
         }
-        return (String[])newArgs.toArray(new String[newArgs.size()]);
+        return newArgs.toArray(new String[newArgs.size()]);
     }
 
-    private static void loadCmdFile(String name, List args)
+    private static void loadCmdFile(String name, List<String> args)
         throws IOException
     {
         Reader r = new BufferedReader(new FileReader(name));
@@ -83,7 +83,7 @@
         st.commentChar('#');
         st.quoteChar('"');
         st.quoteChar('\'');
-        while (st.nextToken() != st.TT_EOF) {
+        while (st.nextToken() != StreamTokenizer.TT_EOF) {
             args.add(st.sval);
         }
         r.close();
--- a/src/share/classes/sun/tools/jar/Manifest.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/sun/tools/jar/Manifest.java	Sat Feb 18 16:11:47 2012 -0800
@@ -47,10 +47,10 @@
     /* list of headers that all pertain to a particular
      * file in the archive
      */
-    private Vector entries = new Vector();
+    private Vector<MessageHeader> entries = new Vector<>();
     private byte[] tmpbuf = new byte[512];
     /* a hashtable of entries, for fast lookup */
-    private Hashtable tableEntries = new Hashtable();
+    private Hashtable<String, MessageHeader> tableEntries = new Hashtable<>();
 
     static final String[] hashes = {"SHA"};
     static final byte[] EOL = {(byte)'\r', (byte)'\n'};
@@ -115,14 +115,14 @@
     }
 
     public MessageHeader getEntry(String name) {
-        return (MessageHeader) tableEntries.get(name);
+        return tableEntries.get(name);
     }
 
     public MessageHeader entryAt(int i) {
-        return (MessageHeader) entries.elementAt(i);
+        return entries.elementAt(i);
     }
 
-    public Enumeration entries() {
+    public Enumeration<MessageHeader> entries() {
         return entries.elements();
     }
 
@@ -214,7 +214,7 @@
         /* the first header in the file should be the global one.
          * It should say "Manifest-Version: x.x"; if not add it
          */
-        MessageHeader globals = (MessageHeader) entries.elementAt(0);
+        MessageHeader globals = entries.elementAt(0);
 
         if (globals.findValue("Manifest-Version") == null) {
             /* Assume this is a user-defined manifest.  If it has a Name: <..>
@@ -238,7 +238,7 @@
         globals.print(ps);
 
         for (int i = 1; i < entries.size(); ++i) {
-            MessageHeader mh = (MessageHeader) entries.elementAt(i);
+            MessageHeader mh = entries.elementAt(i);
             mh.print(ps);
         }
     }
--- a/src/share/classes/sun/tools/jar/SignatureFile.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/classes/sun/tools/jar/SignatureFile.java	Sat Feb 18 16:11:47 2012 -0800
@@ -47,7 +47,7 @@
  *
  * <p>Each entry section contains the name of an entry (which must
  * have a counterpart in the manifest). Like the manifest it contains
- * a hash, the hash of the manifest section correspondind to the
+ * a hash, the hash of the manifest section corresponding to the
  * name. Since the manifest entry contains the hash of the data, this
  * is equivalent to a signature of the data, plus the attributes of
  * the manifest entry.
@@ -66,7 +66,7 @@
 
     /* list of headers that all pertain to a particular file in the
      * archive */
-    private Vector entries = new Vector();
+    private Vector<MessageHeader> entries = new Vector<>();
 
     /* Right now we only support SHA hashes */
     static final String[] hashes = {"SHA"};
@@ -98,7 +98,7 @@
      * character in length.  */
     private SignatureFile(String name) throws JarException {
 
-        entries = new Vector();
+        entries = new Vector<>();
 
         if (name != null) {
             if (name.length() > 8 || name.indexOf('.') != -1) {
@@ -142,9 +142,9 @@
         this(name, true);
 
         this.manifest = manifest;
-        Enumeration enum_ = manifest.entries();
+        Enumeration<MessageHeader> enum_ = manifest.entries();
         while (enum_.hasMoreElements()) {
-            MessageHeader mh = (MessageHeader)enum_.nextElement();
+            MessageHeader mh = enum_.nextElement();
             String entryName = mh.findValue("Name");
             if (entryName != null) {
                 add(entryName);
@@ -269,9 +269,9 @@
      *the entry does not exist.
      */
     public MessageHeader getEntry(String name) {
-        Enumeration enum_ = entries();
+        Enumeration<MessageHeader> enum_ = entries();
         while(enum_.hasMoreElements()) {
-            MessageHeader mh = (MessageHeader)enum_.nextElement();
+            MessageHeader mh = enum_.nextElement();
             if (name.equals(mh.findValue("Name"))) {
                 return mh;
             }
@@ -282,13 +282,13 @@
     /**
      * Returns the n-th entry. The global header is a entry 0.  */
     public MessageHeader entryAt(int n) {
-        return (MessageHeader) entries.elementAt(n);
+        return entries.elementAt(n);
     }
 
     /**
      * Returns an enumeration of the entries.
      */
-    public Enumeration entries() {
+    public Enumeration<MessageHeader> entries() {
         return entries.elements();
     }
 
@@ -322,11 +322,11 @@
         }
     }
 
-    private Hashtable digests = new Hashtable();
+    private Hashtable<String, MessageDigest> digests = new Hashtable<>();
 
     private MessageDigest getDigest(String algorithm)
     throws NoSuchAlgorithmException {
-        MessageDigest dig = (MessageDigest)digests.get(algorithm);
+        MessageDigest dig = digests.get(algorithm);
         if (dig == null) {
             dig = MessageDigest.getInstance(algorithm);
             digests.put(algorithm, dig);
@@ -344,7 +344,7 @@
         /* the first header in the file should be the global one.
          * It should say "SignatureFile-Version: x.x"; barf if not
          */
-        MessageHeader globals = (MessageHeader) entries.elementAt(0);
+        MessageHeader globals = entries.elementAt(0);
         if (globals.findValue("Signature-Version") == null) {
             throw new JarException("Signature file requires " +
                             "Signature-Version: 1.0 in 1st header");
@@ -354,7 +354,7 @@
         globals.print(ps);
 
         for (int i = 1; i < entries.size(); ++i) {
-            MessageHeader mh = (MessageHeader) entries.elementAt(i);
+            MessageHeader mh = entries.elementAt(i);
             mh.print(ps);
         }
     }
--- a/src/share/demo/management/MemoryMonitor/MemoryMonitor.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/demo/management/MemoryMonitor/MemoryMonitor.java	Sat Feb 18 16:11:47 2012 -0800
@@ -213,10 +213,10 @@
 
             // Calculate remaining size
             float ssH = ascent + descent;
-            float remainingHeight = (float) (y2 - (ssH*2) - 0.5f);
+            float remainingHeight = y2 - (ssH*2) - 0.5f;
             float blockHeight = remainingHeight/10;
             float blockWidth = 20.0f;
-            float remainingWidth = (float) (x2 - blockWidth - 10);
+            float remainingWidth = x2 - blockWidth - 10;
 
             // .. Memory Free ..
             big.setColor(mfColor);
@@ -224,7 +224,7 @@
             int i = 0;
             for ( ; i < MemUsage ; i++) {
                 mfRect.setRect(x1+5,(float) y1+ssH+i*blockHeight,
-                                blockWidth,(float) blockHeight-1);
+                                blockWidth, blockHeight-1);
                 big.fill(mfRect);
             }
 
@@ -232,13 +232,13 @@
             big.setColor(Color.green);
             for ( ; i < 10; i++)  {
                 muRect.setRect(x1+5,(float) y1 + ssH+i*blockHeight,
-                                blockWidth,(float) blockHeight-1);
+                                blockWidth, blockHeight-1);
                 big.fill(muRect);
             }
 
             // .. Draw History Graph ..
             if (remainingWidth <= 30) remainingWidth = (float)30;
-            if (remainingHeight <= ssH) remainingHeight = (float)ssH;
+            if (remainingHeight <= ssH) remainingHeight = ssH;
             big.setColor(graphColor);
             int graphX = x1+30;
             int graphY = y1 + (int) ssH;
@@ -347,8 +347,8 @@
                     big = bimg.createGraphics();
                     big.setFont(font);
                     FontMetrics fm = big.getFontMetrics(font);
-                    ascent = (int) fm.getAscent();
-                    descent = (int) fm.getDescent();
+                    ascent = fm.getAscent();
+                    descent = fm.getDescent();
                 }
                 repaint();
                 try {
--- a/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipConstants.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipConstants.java	Sat Feb 18 16:11:47 2012 -0800
@@ -185,11 +185,11 @@
      */
     ///////////////////////////////////////////////////////
     static final int CH(byte[] b, int n) {
-       return b[n] & 0xff;
+        return Byte.toUnsignedInt(b[n]);
     }
 
     static final int SH(byte[] b, int n) {
-        return (b[n] & 0xff) | ((b[n + 1] & 0xff) << 8);
+        return Byte.toUnsignedInt(b[n]) | (Byte.toUnsignedInt(b[n + 1]) << 8);
     }
 
     static final long LG(byte[] b, int n) {
--- a/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileStore.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileStore.java	Sat Feb 18 16:11:47 2012 -0800
@@ -61,7 +61,7 @@
     private final ZipFileSystem zfs;
 
     ZipFileStore(ZipPath zpath) {
-        this.zfs = (ZipFileSystem)zpath.getFileSystem();
+        this.zfs = zpath.getFileSystem();
     }
 
     @Override
--- a/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java	Sat Feb 18 16:11:47 2012 -0800
@@ -1609,7 +1609,7 @@
         synchronized (inflaters) {
             int size = inflaters.size();
             if (size > 0) {
-                Inflater inf = (Inflater)inflaters.remove(size - 1);
+                Inflater inf = inflaters.remove(size - 1);
                 return inf;
             } else {
                 return new Inflater(true);
@@ -1638,7 +1638,7 @@
         synchronized (deflaters) {
             int size = deflaters.size();
             if (size > 0) {
-                Deflater def = (Deflater)deflaters.remove(size - 1);
+                Deflater def = deflaters.remove(size - 1);
                 return def;
             } else {
                 return new Deflater(Deflater.DEFAULT_COMPRESSION, true);
--- a/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystemProvider.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystemProvider.java	Sat Feb 18 16:11:47 2012 -0800
@@ -211,7 +211,7 @@
     public <V extends FileAttributeView> V
         getFileAttributeView(Path path, Class<V> type, LinkOption... options)
     {
-        return (V)ZipFileAttributeView.get(toZipPath(path), type);
+        return ZipFileAttributeView.get(toZipPath(path), type);
     }
 
     @Override
--- a/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipInfo.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipInfo.java	Sat Feb 18 16:11:47 2012 -0800
@@ -78,12 +78,12 @@
                 // twice
                 long len = LOCHDR + CENNAM(cen, pos) + CENEXT(cen, pos) + CENHDR;
                 if (zfs.readFullyAt(buf, 0, len, locoff(cen, pos)) != len)
-                    zfs.zerror("read loc header failed");
+                    ZipFileSystem.zerror("read loc header failed");
                 if (LOCEXT(buf) > CENEXT(cen, pos) + CENHDR) {
                     // have to read the second time;
                     len = LOCHDR + LOCNAM(buf) + LOCEXT(buf);
                     if (zfs.readFullyAt(buf, 0, len, locoff(cen, pos)) != len)
-                        zfs.zerror("read loc header failed");
+                        ZipFileSystem.zerror("read loc header failed");
                 }
                 printLOC(buf);
                 pos += CENHDR + CENNAM(cen, pos) + CENEXT(cen, pos) + CENCOM(cen, pos);
--- a/src/share/native/sun/management/HotSpotDiagnostic.c	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/share/native/sun/management/HotSpotDiagnostic.c	Sat Feb 18 16:11:47 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,141 +34,3 @@
 {
     jmm_interface->DumpHeap0(env, outputfile, live);
 }
-
-JNIEXPORT jobjectArray JNICALL
-Java_sun_management_HotSpotDiagnostic_getDiagnosticCommands0
-  (JNIEnv *env, jobject dummy)
-{
-  if ((jmm_version > JMM_VERSION_1_2_1)
-      || (jmm_version == JMM_VERSION_1_2 && ((jmm_version&0xFF)>=2))) {
-    return jmm_interface->GetDiagnosticCommands(env);
-  }
-  JNU_ThrowByName(env, "java/lang/UnsupportedOperationException",
-                  "Diagnostic commands are not supported by this VM");
-}
-
-jobject getDiagnosticCommandArgumentInfoArray(JNIEnv *env, jstring command,
-                                              int num_arg) {
-  int i;
-  jobject obj;
-  jobjectArray result;
-  dcmdArgInfo* dcmd_arg_info_array;
-  jclass dcmdArgInfoCls;
-  jclass arraysCls;
-  jmethodID mid;
-  jobject resultList;
-
-  dcmd_arg_info_array = (dcmdArgInfo*) malloc(num_arg * sizeof(dcmdArgInfo));
-  if (dcmd_arg_info_array == NULL) {
-    return NULL;
-  }
-  jmm_interface->GetDiagnosticCommandArgumentsInfo(env, command,
-                                                   dcmd_arg_info_array);
-  dcmdArgInfoCls = (*env)->FindClass(env,
-                                     "com/sun/management/DiagnosticCommandArgumentInfo");
-  result = (*env)->NewObjectArray(env, num_arg, dcmdArgInfoCls, NULL);
-  if (result == NULL) {
-    free(dcmd_arg_info_array);
-    return NULL;
-  }
-  for (i=0; i<num_arg; i++) {
-    obj = JNU_NewObjectByName(env,
-                              "com/sun/management/DiagnosticCommandArgumentInfo",
-                              "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZI)V",
-                              (*env)->NewStringUTF(env,dcmd_arg_info_array[i].name),
-                              (*env)->NewStringUTF(env,dcmd_arg_info_array[i].description),
-                              (*env)->NewStringUTF(env,dcmd_arg_info_array[i].type),
-                              dcmd_arg_info_array[i].default_string == NULL ? NULL:
-                              (*env)->NewStringUTF(env, dcmd_arg_info_array[i].default_string),
-                              dcmd_arg_info_array[i].mandatory,
-                              dcmd_arg_info_array[i].option,
-                              dcmd_arg_info_array[i].position);
-    if (obj == NULL) {
-      free(dcmd_arg_info_array);
-      return NULL;
-    }
-    (*env)->SetObjectArrayElement(env, result, i, obj);
-  }
-  free(dcmd_arg_info_array);
-  arraysCls = (*env)->FindClass(env, "java/util/Arrays");
-  mid = (*env)->GetStaticMethodID(env, arraysCls,
-                                  "asList", "([Ljava/lang/Object;)Ljava/util/List;");
-  resultList = (*env)->CallStaticObjectMethod(env, arraysCls, mid, result);
-  return resultList;
-}
-
-/* Throws IllegalArgumentException if at least one the diagnostic command
- * passed in argument is not supported by the JVM
- */
-JNIEXPORT jobjectArray JNICALL
-Java_sun_management_HotSpotDiagnostic_getDiagnosticCommandInfo0
-(JNIEnv *env, jobject dummy, jobjectArray commands)
-{
-  int i;
-  jclass dcmdInfoCls;
-  jobject result;
-  jobjectArray args;
-  jobject obj;
-
-  if (commands == NULL) {
-    JNU_ThrowNullPointerException(env, "Invalid String Array");
-    return NULL;
-  }
-  if ((jmm_version > JMM_VERSION_1_2_1)
-      || (jmm_version == JMM_VERSION_1_2 && ((jmm_version&0xFF)>=2))) {
-    jsize num_commands = (*env)->GetArrayLength(env, commands);
-    dcmdInfo* dcmd_info_array = (dcmdInfo*) malloc(num_commands *
-                                                   sizeof(dcmdInfo));
-    if (dcmd_info_array == NULL) {
-      JNU_ThrowOutOfMemoryError(env, NULL);
-    }
-    jmm_interface->GetDiagnosticCommandInfo(env, commands, dcmd_info_array);
-    dcmdInfoCls = (*env)->FindClass(env,
-                                    "com/sun/management/DiagnosticCommandInfo");
-    result = (*env)->NewObjectArray(env, num_commands, dcmdInfoCls, NULL);
-    if (result == NULL) {
-      free(dcmd_info_array);
-      JNU_ThrowOutOfMemoryError(env, 0);
-    }
-    for (i=0; i<num_commands; i++) {
-      args = getDiagnosticCommandArgumentInfoArray(env,
-                                                   (*env)->GetObjectArrayElement(env,commands,i),
-                                                   dcmd_info_array[i].num_arguments);
-      if (args == NULL) {
-        free(dcmd_info_array);
-        JNU_ThrowOutOfMemoryError(env, 0);
-      }
-      obj = JNU_NewObjectByName(env,
-                                "com/sun/management/DiagnosticCommandInfo",
-                                "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLjava/util/List;)V",
-                                (*env)->NewStringUTF(env,dcmd_info_array[i].name),
-                                (*env)->NewStringUTF(env,dcmd_info_array[i].description),
-                                (*env)->NewStringUTF(env,dcmd_info_array[i].impact),
-                                dcmd_info_array[i].enabled,
-                                args);
-      if (obj == NULL) {
-        free(dcmd_info_array);
-        JNU_ThrowOutOfMemoryError(env, 0);
-      }
-      (*env)->SetObjectArrayElement(env, result, i, obj);
-    }
-    free(dcmd_info_array);
-    return result;
-  }
-  JNU_ThrowByName(env, "java/lang/UnsupportedOperationException",
-                  "Diagnostic commands are not supported by this VM");
-}
-
-/* Throws IllegalArgumentException if the diagnostic command
- * passed in argument is not supported by the JVM
- */
-JNIEXPORT jstring JNICALL
-Java_sun_management_HotSpotDiagnostic_executeDiagnosticCommand0
-(JNIEnv *env, jobject dummy, jstring command) {
-  if((jmm_version > JMM_VERSION_1_2_1 )
-     || (jmm_version == JMM_VERSION_1_2 && ((jmm_version&0xFF)>=2))) {
-    return jmm_interface->ExecuteDiagnosticCommand(env, command);
-  }
-  JNU_ThrowByName(env, "java/lang/UnsupportedOperationException",
-                  "Diagnostic commands are not supported by this VM");
-}
--- a/src/solaris/classes/sun/nio/ch/DevPollSelectorImpl.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/solaris/classes/sun/nio/ch/DevPollSelectorImpl.java	Sat Feb 18 16:11:47 2012 -0800
@@ -180,7 +180,7 @@
             ((SelChImpl)selch).kill();
     }
 
-    void putEventOps(SelectionKeyImpl sk, int ops) {
+    public void putEventOps(SelectionKeyImpl sk, int ops) {
         if (closed)
             throw new ClosedSelectorException();
         int fd = IOUtil.fdVal(sk.channel.getFD());
--- a/src/solaris/classes/sun/nio/ch/EPollSelectorImpl.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/solaris/classes/sun/nio/ch/EPollSelectorImpl.java	Sat Feb 18 16:11:47 2012 -0800
@@ -181,7 +181,7 @@
             ((SelChImpl)selch).kill();
     }
 
-    void putEventOps(SelectionKeyImpl sk, int ops) {
+    public void putEventOps(SelectionKeyImpl sk, int ops) {
         if (closed)
             throw new ClosedSelectorException();
         pollWrapper.setInterest(sk.channel, ops);
--- a/src/solaris/classes/sun/nio/ch/NativeThread.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/solaris/classes/sun/nio/ch/NativeThread.java	Sat Feb 18 16:11:47 2012 -0800
@@ -37,21 +37,21 @@
 // always returns -1 and the signal(long) method has no effect.
 
 
-class NativeThread {
+public class NativeThread {
 
     // Returns an opaque token representing the native thread underlying the
     // invoking Java thread.  On systems that do not require signalling, this
     // method always returns -1.
     //
-    static native long current();
+    public static native long current();
 
     // Signals the given native thread so as to release it from a blocking I/O
     // operation.  On systems that do not require signalling, this method has
     // no effect.
     //
-    static native void signal(long nt);
+    public static native void signal(long nt);
 
-    static native void init();
+    private static native void init();
 
     static {
         Util.load();
--- a/src/solaris/classes/sun/nio/ch/PollArrayWrapper.java	Thu Feb 16 13:01:36 2012 -0800
+++ b/src/solaris/classes/sun/nio/ch/PollArrayWrapper.java	Sat Feb 18 16:11:47 2012 -0800
@@ -41,9 +41,9 @@
  * @since 1.4
  */
 
-class PollArrayWrapper extends AbstractPollArrayWrapper {
+public class PollArrayWrapper extends AbstractPollArrayWrapper {
 
-    static final short POLLCONN = POLLOUT;
+    public static final short POLLCONN = POLLOUT;
 
     // File descriptor to write for interrupt
     int interruptFD;
--- a/src/solaris/classes/sun/nio/ch/SctpAssocChange.java	Thu Feb 16 13:01:36 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.nio.ch;
-
-import com.sun.nio.sctp.Association;
-import com.sun.nio.sctp.AssociationChangeNotification;
-
-/**
- * An implementation of AssociationChangeNotification
- */
-public class SctpAssocChange extends AssociationChangeNotification
-    implements SctpNotification
-{
-    /* static final ints so that they can be referenced from native */
-    private final static int SCTP_COMM_UP = 1;
-    private final static int SCTP_COMM_LOST = 2;
-    private final static int SCTP_RESTART = 3;
-    private final static int SCTP_SHUTDOWN = 4;
-    private final static int SCTP_CANT_START = 5;
-
-    private Association association;
-
-    /* assocId is used to lookup the association before the notification is
-     * returned to user code */
-    private int assocId;
-    private AssocChangeEvent event;
-    private int maxOutStreams;
-    private int maxInStreams;
-
-    /* Invoked from native */
-    private SctpAssocChange(int assocId,
-                            int intEvent,
-                            int maxOutStreams,
-                            int maxInStreams) {
-        switch (intEvent) {
-            case SCTP_COMM_UP :
-                this.event = AssocChangeEvent.COMM_UP;
-                break;
-            case SCTP_COMM_LOST :
-                this.event = AssocChangeEvent.COMM_LOST;
-                break;
-            case SCTP_RESTART :
-                this.event = AssocChangeEvent.RESTART;
-                break;
-            case SCTP_SHUTDOWN :
-                this.event = AssocChangeEvent.SHUTDOWN;
-                break;
-            case SCTP_CANT_START :
-                this.event = AssocChangeEvent.CANT_START;
-                break;
-            default :
-                throw new AssertionError(
-                      "Unknown Association Change Event type: " + intEvent);
-        }
-
-        this.assocId = assocId;
-        this.maxOutStreams = maxOutStreams;
-        this.maxInStreams = maxInStreams;
-    }
-
-    @Override
-    public int assocId() {
-        return assocId;
-    }
-
-    @Override
-    public void setAssociation(Association association) {
-        this.association = association;
-    }
-
-    @Override
-    public Association association() {
-        assert association != null;
-        return association;
-    }
-
-    @Override
-    public AssocChangeEvent event() {
-        return event;
-    }
-
-    int maxOutStreams() {
-        return maxOutStreams;
-    }
-
-    int maxInStreams() {
-        return maxInStreams;
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder sb = new StringBuilder();
-        sb.append(super.toString()).append(" [");
-        sb.append("Association:").append(association);
-        sb.append(", Event: ").append(event).append("]");
-        return sb.toString();
-    }
-}
--- a/src/solaris/classes/sun/nio/ch/SctpAssociationImpl.java	Thu Feb 16 13:01:36 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.nio.ch;
-
-import com.sun.nio.sctp.Association;
-
-/**
- * An implementation of Association
- */
-public class SctpAssociationImpl extends Association {
-    public SctpAssociationImpl(int associationID,
-                               int maxInStreams,
-                               int maxOutStreams) {
-        super(associationID, maxInStreams, maxOutStreams);
-    }
-
-    @Override
-    public String toString() {
-        StringBuffer sb = new StringBuffer(super.toString());
-        return sb.append("[associationID:")
-                 .append(associationID())
-                 .append(", maxIn:")
-                 .append(maxInboundStreams())
-                 .append(", maxOut:")
-                 .append(maxOutboundStreams())
-                 .append("]")
-                 .toString();
-    }
-}
-
--- a/src/solaris/classes/sun/nio/ch/SctpChannelImpl.java	Thu Feb 16 13:01:36 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1097 +0,0 @@
-/*
- * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.nio.ch;
-
-import java.net.InetAddress;
-import java.net.SocketAddress;
-import java.net.SocketException;
-import java.net.InetSocketAddress;
-import java.io.FileDescriptor;
-import java.io.IOException;
-import java.util.Collections;
-import java.util.Set;
-import java.util.HashSet;
-import java.nio.ByteBuffer;
-import java.nio.channels.SelectionKey;
-import java.nio.channels.ClosedChannelException;
-import java.nio.channels.ConnectionPendingException;
-import java.nio.channels.NoConnectionPendingException;
-import java.nio.channels.AlreadyConnectedException;
-import java.nio.channels.NotYetBoundException;
-import java.nio.channels.NotYetConnectedException;
-import java.nio.channels.spi.SelectorProvider;
-import com.sun.nio.sctp.AbstractNotificationHandler;
-import com.sun.nio.sctp.Association;
-import com.sun.nio.sctp.AssociationChangeNotification;
-import com.sun.nio.sctp.HandlerResult;
-import com.sun.nio.sctp.IllegalReceiveException;
-import com.sun.nio.sctp.InvalidStreamException;
-import com.sun.nio.sctp.IllegalUnbindException;
-import com.sun.nio.sctp.MessageInfo;
-import com.sun.nio.sctp.NotificationHandler;
-import com.sun.nio.sctp.SctpChannel;
-import com.sun.nio.sctp.SctpSocketOption;
-import static com.sun.nio.sctp.SctpStandardSocketOptions.*;
-import static sun.nio.ch.SctpResultContainer.SEND_FAILED;
-import static sun.nio.ch.SctpResultContainer.ASSOCIATION_CHANGED;
-import static sun.nio.ch.SctpResultContainer.PEER_ADDRESS_CHANGED;
-import static sun.nio.ch.SctpResultContainer.SHUTDOWN;
-
-/**
- * An implementation of an SctpChannel
- */
-public class SctpChannelImpl extends SctpChannel
-    implements SelChImpl
-{
-    private final FileDescriptor fd;
-
-    private final int fdVal;
-
-    /* IDs of native threads doing send and receivess, for signalling */
-    private volatile long receiverThread = 0;
-    private volatile long senderThread = 0;
-
-    /* Lock held by current receiving or connecting thread */
-    private final Object receiveLock = new Object();
-
-    /* Lock held by current sending or connecting thread */
-    private final Object sendLock = new Object();
-
-    private final ThreadLocal<Boolean> receiveInvoked =
-        new ThreadLocal<Boolean>() {
-             @Override protected Boolean initialValue() {
-                 return Boolean.FALSE;
-            }
-    };
-
-    /* Lock held by any thread that modifies the state fields declared below
-       DO NOT invoke a blocking I/O operation while holding this lock! */
-    private final Object stateLock = new Object();
-
-    private enum ChannelState {
-        UNINITIALIZED,
-        UNCONNECTED,
-        PENDING,
-        CONNECTED,
-        KILLPENDING,
-        KILLED,
-    }
-    /* -- The following fields are protected by stateLock -- */
-    private ChannelState state = ChannelState.UNINITIALIZED;
-
-    /* Binding; Once bound the port will remain constant. */
-    int port = -1;
-    private HashSet<InetSocketAddress> localAddresses = new HashSet<InetSocketAddress>();
-    /* Has the channel been bound to the wildcard address */
-    private boolean wildcard; /* false */
-    //private InetSocketAddress remoteAddress = null;
-
-    /* Input/Output open */
-    private boolean readyToConnect;
-
-    /* Shutdown */
-    private boolean isShutdown;
-
-    private Association association;
-
-    private Set<SocketAddress> remoteAddresses = Collections.emptySet();
-
-    /* -- End of fields protected by stateLock -- */
-
-    /**
-     * Constructor for normal connecting sockets
-     */
-    public SctpChannelImpl(SelectorProvider provider) throws IOException {
-        //TODO: update provider remove public modifier
-        super(provider);
-        this.fd = SctpNet.socket(true);
-        this.fdVal = IOUtil.fdVal(fd);
-        this.state = ChannelState.UNCONNECTED;
-    }
-
-    /**
-     * Constructor for sockets obtained from server sockets
-     */
-    public SctpChannelImpl(SelectorProvider provider, FileDescriptor fd)
-         throws IOException {
-        this(provider, fd, null);
-    }
-
-    /**
-     * Constructor for sockets obtained from branching
-     */
-    public SctpChannelImpl(SelectorProvider provider,
-                           FileDescriptor fd,
-                           Association association)
-            throws IOException {
-        super(provider);
-        this.fd = fd;
-        this.fdVal = IOUtil.fdVal(fd);
-        this.state = ChannelState.CONNECTED;
-        port = (Net.localAddress(fd)).getPort();
-
-        if (association != null) { /* branched */
-            this.association = association;
-        } else { /* obtained from server channel */
-            /* Receive COMM_UP */
-            ByteBuffer buf = Util.getTemporaryDirectBuffer(50);
-            try {
-                receive(buf, null, null, true);
-            } finally {
-                Util.releaseTemporaryDirectBuffer(buf);
-            }
-        }
-    }
-
-    /**
-     * Binds the channel's socket to a local address.
-     */
-    @Override
-    public SctpChannel bind(SocketAddress local) throws IOException {
-        synchronized (receiveLock) {
-            synchronized (sendLock) {
-                synchronized (stateLock) {
-                    ensureOpenAndUnconnected();
-                    if (isBound())
-                        SctpNet.throwAlreadyBoundException();
-                    InetSocketAddress isa = (local == null) ?
-                        new InetSocketAddress(0) : Net.checkAddress(local);
-                    Net.bind(fd, isa.getAddress(), isa.getPort());
-                    InetSocketAddress boundIsa = Net.localAddress(fd);
-                    port = boundIsa.getPort();
-                    localAddresses.add(isa);
-                    if (isa.getAddress().isAnyLocalAddress())
-                        wildcard = true;
-                }
-            }
-        }
-        return this;
-    }
-
-    @Override
-    public SctpChannel bindAddress(InetAddress address)
-            throws IOException {
-        bindUnbindAddress(address, true);
-        localAddresses.add(new InetSocketAddress(address, port));
-        return this;
-    }
-
-    @Override
-    public SctpChannel unbindAddress(InetAddress address)
-            throws IOException {
-        bindUnbindAddress(address, false);
-        localAddresses.remove(new InetSocketAddress(address, port));
-        return this;
-    }
-
-    private SctpChannel bindUnbindAddress(InetAddress address, boolean add)
-            throws IOException {
-        if (address == null)
-            throw new IllegalArgumentException();
-
-        synchronized (receiveLock) {
-            synchronized (sendLock) {
-                synchronized (stateLock) {
-                    if (!isOpen())
-                        throw new ClosedChannelException();
-                    if (!isBound())
-                        throw new NotYetBoundException();
-                    if (wildcard)
-                        throw new IllegalStateException(
-                                "Cannot add or remove addresses from a channel that is bound to the wildcard address");
-                    if (address.isAnyLocalAddress())
-                        throw new IllegalArgumentException(
-                                "Cannot add or remove the wildcard address");
-                    if (add) {
-                        for (InetSocketAddress addr : localAddresses) {
-                            if (addr.getAddress().equals(address)) {
-                                SctpNet.throwAlreadyBoundException();
-                            }
-                        }
-                    } else { /*removing */
-                        /* Verify that there is more than one address
-                         * and that address is already bound */
-                        if (localAddresses.size() <= 1)
-                            throw new IllegalUnbindException("Cannot remove address from a channel with only one address bound");
-                        boolean foundAddress = false;
-                        for (InetSocketAddress addr : localAddresses) {
-                            if (addr.getAddress().equals(address)) {
-                                foundAddress = true;
-                                break;
-                            }
-                        }
-                        if (!foundAddress )
-                            throw new IllegalUnbindException("Cannot remove address from a channel that is not bound to that address");
-                    }
-
-                    SctpNet.bindx(fdVal, new InetAddress[]{address}, port, add);
-
-                    /* Update our internal Set to reflect the addition/removal */
-                    if (add)
-                        localAddresses.add(new InetSocketAddress(address, port));
-                    else {
-                        for (InetSocketAddress addr : localAddresses) {
-                            if (addr.getAddress().equals(address)) {
-                                localAddresses.remove(addr);
-                                break;
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        return this;
-    }
-
-    private boolean isBound() {
-        synchronized (stateLock) {
-            return port == -1 ? false : true;
-        }
-    }
-
-    private boolean isConnected() {
-        synchronized (stateLock) {
-            return (state == ChannelState.CONNECTED);
-        }
-    }
-
-    private void ensureOpenAndUnconnected() throws IOException {
-        synchronized (stateLock) {
-            if (!isOpen())
-                throw new ClosedChannelException();
-            if (isConnected())
-                throw new AlreadyConnectedException();
-            if (state == ChannelState.PENDING)
-                throw new ConnectionPendingException();
-        }
-    }
-
-    private boolean ensureReceiveOpen() throws ClosedChannelException {
-        synchronized (stateLock) {
-            if (!isOpen())
-                throw new ClosedChannelException();
-            if (!isConnected())
-                throw new NotYetConnectedException();
-            else
-                return true;
-        }
-    }
-
-    private void ensureSendOpen() throws ClosedChannelException {
-        synchronized (stateLock) {
-            if (!isOpen())
-                throw new ClosedChannelException();
-            if (isShutdown)
-                throw new ClosedChannelException();
-            if (!isConnected())
-                throw new NotYetConnectedException();
-        }
-    }
-
-    private void receiverCleanup() throws IOException {
-        synchronized (stateLock) {
-            receiverThread = 0;
-            if (state == ChannelState.KILLPENDING)
-                kill();
-        }
-    }
-
-    private void senderCleanup() throws IOException {
-        synchronized (stateLock) {
-            senderThread = 0;
-            if (state == ChannelState.KILLPENDING)
-                kill();
-        }
-    }
-
-    @Override
-    public Association association() throws ClosedChannelException {
-        synchronized (stateLock) {
-            if (!isOpen())
-                throw new ClosedChannelException();
-            if (!isConnected())
-                return null;
-
-            return association;
-        }
-    }
-
-    @Override
-    public boolean connect(SocketAddress endpoint) throws IOException {
-        synchronized (receiveLock) {
-            synchronized (sendLock) {
-                ensureOpenAndUnconnected();
-                InetSocketAddress isa = Net.checkAddress(endpoint);
-                SecurityManager sm = System.getSecurityManager();
-                if (sm != null)
-                    sm.checkConnect(isa.getAddress().getHostAddress(),
-                                    isa.getPort());
-                synchronized (blockingLock()) {
-                    int n = 0;
-                    try {
-                        try {
-                            begin();
-                            synchronized (stateLock) {
-                                if (!isOpen()) {
-                                    return false;
-                                }
-                                receiverThread = NativeThread.current();
-                            }
-                            for (;;) {
-                                InetAddress ia = isa.getAddress();
-                                if (ia.isAnyLocalAddress())
-                                    ia = InetAddress.getLocalHost();
-                                n = SctpNet.connect(fdVal, ia, isa.getPort());
-                                if (  (n == IOStatus.INTERRUPTED)
-                                      && isOpen())
-                                    continue;
-                                break;
-                            }
-                        } finally {
-                            receiverCleanup();
-                            end((n > 0) || (n == IOStatus.UNAVAILABLE));
-                            assert IOStatus.check(n);
-                        }
-                    } catch (IOException x) {
-                        /* If an exception was thrown, close the channel after
-                         * invoking end() so as to avoid bogus
-                         * AsynchronousCloseExceptions */
-                        close();
-                        throw x;
-                    }
-
-                    if (n > 0) {
-                        synchronized (stateLock) {
-                            /* Connection succeeded */
-                            state = ChannelState.CONNECTED;
-                            if (!isBound()) {
-                                InetSocketAddress boundIsa =
-                                        Net.localAddress(fd);
-                                port = boundIsa.getPort();
-                            }
-
-                            /* Receive COMM_UP */
-                            ByteBuffer buf = Util.getTemporaryDirectBuffer(50);
-                            try {
-                                receive(buf, null, null, true);
-                            } finally {
-                                Util.releaseTemporaryDirectBuffer(buf);
-                            }
-
-                            /* cache remote addresses */
-                            try {
-                                remoteAddresses = getRemoteAddresses();
-                            } catch (IOException unused) { /* swallow exception */ }
-
-                            return true;
-                        }
-                    } else  {
-                        synchronized (stateLock) {
-                            /* If nonblocking and no exception then connection
-                             * pending; disallow another invocation */
-                            if (!isBlocking())
-                                state = ChannelState.PENDING;
-                            else
-                                assert false;
-                        }
-                    }
-                }
-                return false;
-            }
-        }
-    }
-
-    @Override
-    public boolean connect(SocketAddress endpoint,
-                           int maxOutStreams,
-                           int maxInStreams)
-            throws IOException {
-        ensureOpenAndUnconnected();
-        return setOption(SCTP_INIT_MAXSTREAMS, InitMaxStreams.
-                create(maxInStreams, maxOutStreams)).connect(endpoint);
-
-    }
-
-    @Override
-    public boolean isConnectionPending() {
-        synchronized (stateLock) {
-            return (state == ChannelState.PENDING);
-        }
-    }
-
-    @Override
-    public boolean finishConnect() throws IOException {
-        synchronized (receiveLock) {
-            synchronized (sendLock) {
-                synchronized (stateLock) {
-                    if (!isOpen())
-                        throw new ClosedChannelException();
-                    if (isConnected())
-                        return true;
-                    if (state != ChannelState.PENDING)
-                        throw new NoConnectionPendingException();
-                }
-                int n = 0;
-                try {
-                    try {
-                        begin();
-                        synchronized (blockingLock()) {
-                            synchronized (stateLock) {
-                                if (!isOpen()) {
-                                    return false;
-                                }
-                                receiverThread = NativeThread.current();
-                            }
-                            if (!isBlocking()) {
-                                for (;;) {
-                                    n = checkConnect(fd, false, readyToConnect);
-                                    if (  (n == IOStatus.INTERRUPTED)
-                                          && isOpen())
-                                        continue;
-                                    break;
-                                }
-                            } else {
-                                for (;;) {
-                                    n = checkConnect(fd, true, readyToConnect);
-                                    if (n == 0) {
-                                        // Loop in case of
-                                        // spurious notifications
-                                        continue;
-                                    }
-                                    if (  (n == IOStatus.INTERRUPTED)
-                                          && isOpen())
-                                        continue;
-                                    break;
-                                }
-                            }
-                        }
-                    } finally {
-                        synchronized (stateLock) {
-                            receiverThread = 0;
-                            if (state == ChannelState.KILLPENDING) {
-                                kill();
-                                /* poll()/getsockopt() does not report
-                                 * error (throws exception, with n = 0)
-                                 * on Linux platform after dup2 and
-                                 * signal-wakeup. Force n to 0 so the
-                                 * end() can throw appropriate exception */
-                                n = 0;
-                            }
-                        }
-                        end((n > 0) || (n == IOStatus.UNAVAILABLE));
-                        assert IOStatus.check(n);
-                    }
-                } catch (IOException x) {
-                    /* If an exception was thrown, close the channel after
-                     * invoking end() so as to avoid bogus
-                     * AsynchronousCloseExceptions */
-                    close();
-                    throw x;
-                }
-
-                if (n > 0) {
-                    synchronized (stateLock) {
-                        state = ChannelState.CONNECTED;
-                        if (!isBound()) {
-                            InetSocketAddress boundIsa =
-                                    Net.localAddress(fd);
-                            port = boundIsa.getPort();
-                        }
-
-                        /* Receive COMM_UP */
-                        ByteBuffer buf = Util.getTemporaryDirectBuffer(50);
-                        try {
-                            receive(buf, null, null, true);
-                        } finally {
-                            Util.releaseTemporaryDirectBuffer(buf);
-                        }
-
-                        /* cache remote addresses */
-                        try {
-                            remoteAddresses = getRemoteAddresses();
-                        } catch (IOException unused) { /* swallow exception */ }
-
-                        return true;
-                    }
-                }
-            }
-        }
-        return false;
-    }
-
-    @Override
-    protected void implConfigureBlocking(boolean block) throws IOException {
-        IOUtil.configureBlocking(fd, block);
-    }
-
-    @Override
-    public void implCloseSelectableChannel() throws IOException {
-        synchronized (stateLock) {
-            SctpNet.preClose(fdVal);
-
-            if (receiverThread != 0)
-                NativeThread.signal(receiverThread);
-
-            if (senderThread != 0)
-                NativeThread.signal(senderThread);
-
-            if (!isRegistered())
-                kill();
-        }
-    }
-
-    @Override
-    public FileDescriptor getFD() {
-        return fd;
-    }
-
-    @Override
-    public int getFDVal() {
-        return fdVal;
-    }
-
-    /**
-     * Translates native poll revent ops into a ready operation ops
-     */
-    private boolean translateReadyOps(int ops, int initialOps, SelectionKeyImpl sk) {
-        int intOps = sk.nioInterestOps();
-        int oldOps = sk.nioReadyOps();
-        int newOps = initialOps;
-
-        if ((ops & PollArrayWrapper.POLLNVAL) != 0) {
-            /* This should only happen if this channel is pre-closed while a
-             * selection operation is in progress
-             * ## Throw an error if this channel has not been pre-closed */
-            return false;
-        }
-
-        if ((ops & (PollArrayWrapper.POLLERR
-                    | PollArrayWrapper.POLLHUP)) != 0) {
-            newOps = intOps;
-            sk.nioReadyOps(newOps);
-            /* No need to poll again in checkConnect,
-             * the error will be detected there */
-            readyToConnect = true;
-            return (newOps & ~oldOps) != 0;
-        }
-
-        if (((ops & PollArrayWrapper.POLLIN) != 0) &&
-            ((intOps & SelectionKey.OP_READ) != 0) &&
-            isConnected())
-            newOps |= SelectionKey.OP_READ;
-
-        if (((ops & PollArrayWrapper.POLLCONN) != 0) &&
-            ((intOps & SelectionKey.OP_CONNECT) != 0) &&
-            ((state == ChannelState.UNCONNECTED) || (state == ChannelState.PENDING))) {
-            newOps |= SelectionKey.OP_CONNECT;
-            readyToConnect = true;
-        }
-
-        if (((ops & PollArrayWrapper.POLLOUT) != 0) &&
-            ((intOps & SelectionKey.OP_WRITE) != 0) &&
-            isConnected())
-            newOps |= SelectionKey.OP_WRITE;
-
-        sk.nioReadyOps(newOps);
-        return (newOps & ~oldOps) != 0;
-    }
-
-    @Override
-    public boolean translateAndUpdateReadyOps(int ops, SelectionKeyImpl sk) {
-        return translateReadyOps(ops, sk.nioReadyOps(), sk);
-    }
-
-    @Override
-    @SuppressWarnings("all")
-    public boolean translateAndSetReadyOps(int ops, SelectionKeyImpl sk) {
-        return translateReadyOps(ops, 0, sk);
-    }
-
-    @Override
-    public void translateAndSetInterestOps(int ops, SelectionKeyImpl sk) {
-        int newOps = 0;
-        if ((ops & SelectionKey.OP_READ) != 0)
-            newOps |= PollArrayWrapper.POLLIN;
-        if ((ops & SelectionKey.OP_WRITE) != 0)
-            newOps |= PollArrayWrapper.POLLOUT;
-        if ((ops & SelectionKey.OP_CONNECT) != 0)
-            newOps |= PollArrayWrapper.POLLCONN;
-        sk.selector.putEventOps(sk, newOps);
-    }
-
-    @Override
-    public void kill() throws IOException {
-        synchronized (stateLock) {
-            if (state == ChannelState.KILLED)
-                return;
-            if (state == ChannelState.UNINITIALIZED) {
-                state = ChannelState.KILLED;
-                return;
-            }
-            assert !isOpen() && !isRegistered();
-
-            /* Postpone the kill if there is a waiting reader
-             * or writer thread. */
-            if (receiverThread == 0 && senderThread == 0) {
-                SctpNet.close(fdVal);
-                state = ChannelState.KILLED;
-            } else {
-                state = ChannelState.KILLPENDING;
-            }
-        }
-    }
-
-    @Override
-    public <T> SctpChannel setOption(SctpSocketOption<T> name, T value)
-            throws IOException {
-        if (name == null)
-            throw new NullPointerException();
-        if (!supportedOptions().contains(name))
-            throw new UnsupportedOperationException("'" + name + "' not supported");
-
-        synchronized (stateLock) {
-            if (!isOpen())
-                throw new ClosedChannelException();
-
-            SctpNet.setSocketOption(fdVal, name, value, 0 /*oneToOne*/);
-        }
-        return this;
-    }
-
-    @Override
-    @SuppressWarnings("unchecked")
-    public <T> T getOption(SctpSocketOption<T> name) throws IOException {
-        if (name == null)
-            throw new NullPointerException();
-        if (!supportedOptions().contains(name))
-            throw new UnsupportedOperationException("'" + name + "' not supported");
-
-        synchronized (stateLock) {
-            if (!isOpen())
-                throw new ClosedChannelException();
-
-            return (T)SctpNet.getSocketOption(fdVal, name, 0 /*oneToOne*/);
-        }
-    }
-
-    private static class DefaultOptionsHolder {
-        static final Set<SctpSocketOption<?>> defaultOptions = defaultOptions();
-
-        private static Set<SctpSocketOption<?>> defaultOptions() {
-            HashSet<SctpSocketOption<?>> set = new HashSet<SctpSocketOption<?>>(10);
-            set.add(SCTP_DISABLE_FRAGMENTS);
-            set.add(SCTP_EXPLICIT_COMPLETE);
-            set.add(SCTP_FRAGMENT_INTERLEAVE);
-            set.add(SCTP_INIT_MAXSTREAMS);
-            set.add(SCTP_NODELAY);
-            set.add(SCTP_PRIMARY_ADDR);
-            set.add(SCTP_SET_PEER_PRIMARY_ADDR);
-            set.add(SO_SNDBUF);
-            set.add(SO_RCVBUF);
-            set.add(SO_LINGER);
-            return Collections.unmodifiableSet(set);
-        }
-    }
-
-    @Override
-    public final Set<SctpSocketOption<?>> supportedOptions() {
-        return DefaultOptionsHolder.defaultOptions;
-    }
-
-    @Override
-    public <T> MessageInfo receive(ByteBuffer buffer,
-                                   T attachment,
-                                   NotificationHandler<T> handler)
-            throws IOException {
-        return receive(buffer, attachment, handler, false);
-    }
-
-    private <T> MessageInfo receive(ByteBuffer buffer,
-                                    T attachment,
-                                    NotificationHandler<T> handler,
-                                    boolean fromConnect)
-            throws IOException {
-        if (buffer == null)
-            throw new IllegalArgumentException("buffer cannot be null");
-
-        if (buffer.isReadOnly())
-            throw new IllegalArgumentException("Read-only buffer");
-
-        if (receiveInvoked.get())
-            throw new IllegalReceiveException(
-                    "cannot invoke receive from handler");
-        receiveInvoked.set(Boolean.TRUE);
-
-        try {
-            SctpResultContainer resultContainer = new SctpResultContainer();
-            do {
-                resultContainer.clear();
-                synchronized (receiveLock) {
-                    if (!ensureReceiveOpen())
-                        return null;
-
-                    int n = 0;
-                    try {
-                        begin();
-
-                        synchronized (stateLock) {
-                            if(!isOpen())
-                                return null;
-                            receiverThread = NativeThread.current();
-                        }
-
-                        do {
-                            n = receive(fdVal, buffer, resultContainer, fromConnect);
-                        } while ((n == IOStatus.INTERRUPTED) && isOpen());
-                    } finally {
-                        receiverCleanup();
-                        end((n > 0) || (n == IOStatus.UNAVAILABLE));
-                        assert IOStatus.check(n);
-                    }
-
-                    if (!resultContainer.isNotification()) {
-                        /* message or nothing */
-                        if (resultContainer.hasSomething()) {
-                            /* Set the association before returning */
-                            SctpMessageInfoImpl info =
-                                    resultContainer.getMessageInfo();
-                            synchronized (stateLock) {
-                                assert association != null;
-                                info.setAssociation(association);
-                            }
-                            return info;
-                        } else
-                            /* Non-blocking may return null if nothing available*/
-                            return null;
-                    } else { /* notification */
-                        synchronized (stateLock) {
-                            handleNotificationInternal(
-                                    resultContainer);
-                        }
-                    }
-
-                    if (fromConnect)  {
-                        /* If we reach here, then it was connect that invoked
-                         * receive and received the COMM_UP. We have already
-                         * handled the COMM_UP with the internal notification
-                         * handler. Simply return. */
-                        return null;
-                    }
-                }  /* receiveLock */
-            } while (handler == null ? true :
-                (invokeNotificationHandler(resultContainer, handler, attachment)
-                 == HandlerResult.CONTINUE));
-
-            return null;
-        } finally {
-            receiveInvoked.set(Boolean.FALSE);
-        }
-    }
-
-    private int receive(int fd,
-                        ByteBuffer dst,
-                        SctpResultContainer resultContainer,
-                        boolean peek)
-            throws IOException {
-        int pos = dst.position();
-        int lim = dst.limit();
-        assert (pos <= lim);
-        int rem = (pos <= lim ? lim - pos : 0);
-        if (dst instanceof DirectBuffer && rem > 0)
-            return receiveIntoNativeBuffer(fd, resultContainer, dst, rem, pos, peek);
-
-        /* Substitute a native buffer */
-        int newSize = Math.max(rem, 1);
-        ByteBuffer bb = Util.getTemporaryDirectBuffer(newSize);
-        try {
-            int n = receiveIntoNativeBuffer(fd, resultContainer, bb, newSize, 0, peek);
-            bb.flip();
-            if (n > 0 && rem > 0)
-                dst.put(bb);
-            return n;
-        } finally {
-            Util.releaseTemporaryDirectBuffer(bb);
-        }
-    }
-
-    private int receiveIntoNativeBuffer(int fd,
-                                        SctpResultContainer resultContainer,
-                                        ByteBuffer bb,
-                                        int rem,
-                                        int pos,
-                                        boolean peek)
-        throws IOException
-    {
-        int n = receive0(fd, resultContainer, ((DirectBuffer)bb).address() + pos, rem, peek);
-
-        if (n > 0)
-            bb.position(pos + n);
-        return n;
-    }
-
-    private InternalNotificationHandler internalNotificationHandler =
-            new InternalNotificationHandler();
-
-    private void handleNotificationInternal(SctpResultContainer resultContainer)
-    {
-        invokeNotificationHandler(resultContainer,
-                internalNotificationHandler, null);
-    }
-
-    private class InternalNotificationHandler
-            extends AbstractNotificationHandler<Object>
-    {
-        @Override
-        public HandlerResult handleNotification(
-                AssociationChangeNotification not, Object unused) {
-            if (not.event().equals(
-                    AssociationChangeNotification.AssocChangeEvent.COMM_UP) &&
-                    association == null) {
-                SctpAssocChange sac = (SctpAssocChange) not;
-                association = new SctpAssociationImpl
-                       (sac.assocId(), sac.maxInStreams(), sac.maxOutStreams());
-            }
-            return HandlerResult.CONTINUE;
-        }
-    }
-
-    private <T> HandlerResult invokeNotificationHandler
-                                 (SctpResultContainer resultContainer,
-                                  NotificationHandler<T> handler,
-                                  T attachment) {
-        SctpNotification notification = resultContainer.notification();
-        synchronized (stateLock) {
-            notification.setAssociation(association);
-        }
-
-        if (!(handler instanceof AbstractNotificationHandler)) {
-            return handler.handleNotification(notification, attachment);
-        }
-
-        /* AbstractNotificationHandler */
-        AbstractNotificationHandler<T> absHandler =
-                (AbstractNotificationHandler<T>)handler;
-        switch(resultContainer.type()) {
-            case ASSOCIATION_CHANGED :
-                return absHandler.handleNotification(
-                        resultContainer.getAssociationChanged(), attachment);
-            case PEER_ADDRESS_CHANGED :
-                return absHandler.handleNotification(
-                        resultContainer.getPeerAddressChanged(), attachment);
-            case SEND_FAILED :
-                return absHandler.handleNotification(
-                        resultContainer.getSendFailed(), attachment);
-            case SHUTDOWN :
-                return absHandler.handleNotification(
-                        resultContainer.getShutdown(), attachment);
-            default :
-                /* implementation specific handlers */
-                return absHandler.handleNotification(
-                        resultContainer.notification(), attachment);
-        }
-    }
-
-    private void checkAssociation(Association sendAssociation) {
-        synchronized (stateLock) {
-            if (sendAssociation != null && !sendAssociation.equals(association)) {
-                throw new IllegalArgumentException(
-                        "Cannot send to another association");
-            }
-        }
-    }
-
-    private void checkStreamNumber(int streamNumber) {
-        synchronized (stateLock) {
-            if (association != null) {
-                if (streamNumber < 0 ||
-                      streamNumber >= association.maxOutboundStreams())
-                    throw new InvalidStreamException();
-            }
-        }
-    }
-
-    /* TODO: Add support for ttl and isComplete to both 121 12M
-     *       SCTP_EOR not yet supported on reference platforms
-     *       TTL support limited...
-     */
-    @Override
-    public int send(ByteBuffer buffer, MessageInfo messageInfo)
-            throws IOException {
-        if (buffer == null)
-            throw new IllegalArgumentException("buffer cannot be null");
-
-        if (messageInfo == null)
-            throw new IllegalArgumentException("messageInfo cannot be null");
-
-        checkAssociation(messageInfo.association());
-        checkStreamNumber(messageInfo.streamNumber());
-
-        synchronized (sendLock) {
-            ensureSendOpen();
-
-            int n = 0;
-            try {
-                begin();
-
-                synchronized (stateLock) {
-                    if(!isOpen())
-                        return 0;
-                    senderThread = NativeThread.current();
-                }
-
-                do {
-                    n = send(fdVal, buffer, messageInfo);
-                } while ((n == IOStatus.INTERRUPTED) && isOpen());
-
-                return IOStatus.normalize(n);
-            } finally {
-                senderCleanup();
-                end((n > 0) || (n == IOStatus.UNAVAILABLE));
-                assert IOStatus.check(n);
-            }
-        }
-    }
-
-    private int send(int fd, ByteBuffer src, MessageInfo messageInfo)
-            throws IOException {
-        int streamNumber = messageInfo.streamNumber();
-        SocketAddress target = messageInfo.address();
-        boolean unordered = messageInfo.isUnordered();
-        int ppid = messageInfo.payloadProtocolID();
-
-        if (src instanceof DirectBuffer)
-            return sendFromNativeBuffer(fd, src, target, streamNumber,
-                    unordered, ppid);
-
-        /* Substitute a native buffer */
-        int pos = src.position();
-        int lim = src.limit();
-        assert (pos <= lim && streamNumber >= 0);
-
-        int rem = (pos <= lim ? lim - pos : 0);
-        ByteBuffer bb = Util.getTemporaryDirectBuffer(rem);
-        try {
-            bb.put(src);
-            bb.flip();
-            /* Do not update src until we see how many bytes were written */
-            src.position(pos);
-
-            int n = sendFromNativeBuffer(fd, bb, target, streamNumber,
-                    unordered, ppid);
-            if (n > 0) {
-                /* now update src */
-                src.position(pos + n);
-            }
-            return n;
-        } finally {
-            Util.releaseTemporaryDirectBuffer(bb);
-        }
-    }
-
-    private int sendFromNativeBuffer(int fd,
-                                     ByteBuffer bb,
-                                     SocketAddress target,
-                                     int streamNumber,
-                                     boolean unordered,
-                                     int ppid)
-            throws IOException {
-        int pos = bb.position();
-        int lim = bb.limit();
-        assert (pos <= lim);
-        int rem = (pos <= lim ? lim - pos : 0);
-
-        int written = send0(fd, ((DirectBuffer)bb).address() + pos,
-                            rem, target, -1 /*121*/, streamNumber, unordered, ppid);
-        if (written > 0)
-            bb.position(pos + written);
-        return written;
-    }
-
-    @Override
-    public SctpChannel shutdown() throws IOException {
-        synchronized(stateLock) {
-            if (isShutdown)
-                return this;
-
-            ensureSendOpen();
-            SctpNet.shutdown(fdVal, -1);
-            if (senderThread != 0)
-                NativeThread.signal(senderThread);
-            isShutdown = true;
-        }
-        return this;
-    }
-
-    @Override
-    public Set<SocketAddress> getAllLocalAddresses()
-            throws IOException {
-        synchronized (stateLock) {
-            if (!isOpen())
-                throw new ClosedChannelException();
-            if (!isBound())
-                return Collections.emptySet();
-
-            return SctpNet.getLocalAddresses(fdVal);
-        }
-    }
-
-    @Override
-    public Set<SocketAddress> getRemoteAddresses()
-            throws IOException {
-        synchronized (stateLock) {
-            if (!isOpen())
-                throw new ClosedChannelException();
-            if (!isConnected() || isShutdown)
-                return Collections.emptySet();
-
-            try {
-                return SctpNet.getRemoteAddresses(fdVal, 0/*unused*/);
-            } catch (SocketException unused) {
-                /* an open connected channel should always have remote addresses */
-                return remoteAddresses;
-            }
-        }
-    }
-
-    /* Native */
-    private static native void initIDs();
-
-    static native int receive0(int fd, SctpResultContainer resultContainer,
-            long address, int length, boolean peek) throws IOException;
-
-    static native int send0(int fd, long address, int length,
-            SocketAddress target, int assocId, int streamNumber,
-            boolean unordered, int ppid) throws IOException;
-
-    private static native int checkConnect(FileDescriptor fd, boolean block,
-            boolean ready) throws IOException;
-
-    static {
-        Util.load();   /* loads nio & net native libraries */
-        java.security.AccessController.doPrivileged(
-                new sun.security.action.LoadLibraryAction("sctp"));
-        initIDs();
-    }
-}
--- a/src/solaris/classes/sun/nio/ch/SctpMultiChannelImpl.java	Thu Feb 16 13:01:36 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,985 +0,0 @@
-/*
- * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.nio.ch;
-
-import java.net.InetAddress;
-import java.net.SocketAddress;
-import java.net.SocketException;
-import java.net.InetSocketAddress;
-import java.io.FileDescriptor;
-import java.io.IOException;
-import java.util.Collections;
-import java.util.Map.Entry;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.HashMap;
-import java.nio.ByteBuffer;
-import java.nio.channels.SelectionKey;
-import java.nio.channels.ClosedChannelException;
-import java.nio.channels.NotYetBoundException;
-import java.nio.channels.spi.SelectorProvider;
-import com.sun.nio.sctp.AbstractNotificationHandler;
-import com.sun.nio.sctp.Association;
-import com.sun.nio.sctp.AssociationChangeNotification;
-import com.sun.nio.sctp.HandlerResult;
-import com.sun.nio.sctp.IllegalReceiveException;
-import com.sun.nio.sctp.InvalidStreamException;
-import com.sun.nio.sctp.IllegalUnbindException;
-import com.sun.nio.sctp.NotificationHandler;
-import com.sun.nio.sctp.MessageInfo;
-import com.sun.nio.sctp.SctpChannel;
-import com.sun.nio.sctp.SctpMultiChannel;
-import com.sun.nio.sctp.SctpSocketOption;
-import static com.sun.nio.sctp.SctpStandardSocketOptions.*;
-import static sun.nio.ch.SctpResultContainer.*;
-
-/**
- * An implementation of SctpMultiChannel
- */
-public class SctpMultiChannelImpl extends SctpMultiChannel
-    implements SelChImpl
-{
-    private final FileDescriptor fd;
-
-    private final int fdVal;
-
-    /* IDs of native threads doing send and receives, for signalling */
-    private volatile long receiverThread = 0;
-    private volatile long senderThread = 0;
-
-    /* Lock held by current receiving thread */
-    private final Object receiveLock = new Object();
-
-    /* Lock held by current sending thread */
-    private final Object sendLock = new Object();
-
-    /* Lock held by any thread that modifies the state fields declared below
-     * DO NOT invoke a blocking I/O operation while holding this lock! */
-    private final Object stateLock = new Object();
-
-    private enum ChannelState {
-        UNINITIALIZED,
-        KILLPENDING,
-        KILLED,
-    }
-
-    /* -- The following fields are protected by stateLock -- */
-    private ChannelState state = ChannelState.UNINITIALIZED;
-
-    /* Binding: Once bound the port will remain constant. */
-    int port = -1;
-    private HashSet<InetSocketAddress> localAddresses = new HashSet<InetSocketAddress>();
-    /* Has the channel been bound to the wildcard address */
-    private boolean wildcard; /* false */
-
-    /* Keeps a map of addresses to association, and visa versa */
-    private HashMap<SocketAddress, Association> addressMap =
-                         new HashMap<SocketAddress, Association>();
-    private HashMap<Association, Set<SocketAddress>> associationMap =
-                         new HashMap<Association, Set<SocketAddress>>();
-
-    /* -- End of fields protected by stateLock -- */
-
-    /* If an association has been shutdown mark it for removal after
-     * the user handler has been invoked */
-    private final ThreadLocal<Association> associationToRemove =
-        new ThreadLocal<Association>() {
-             @Override protected Association initialValue() {
-                 return null;
-            }
-    };
-
-    /* A notification handler cannot invoke receive */
-    private final ThreadLocal<Boolean> receiveInvoked =
-        new ThreadLocal<Boolean>() {
-             @Override protected Boolean initialValue() {
-                 return Boolean.FALSE;
-            }
-    };
-
-    public SctpMultiChannelImpl(SelectorProvider provider)
-            throws IOException {
-        //TODO: update provider, remove public modifier
-        super(provider);
-        this.fd = SctpNet.socket(false /*one-to-many*/);
-        this.fdVal = IOUtil.fdVal(fd);
-    }
-
-    @Override
-    public SctpMultiChannel bind(SocketAddress local, int backlog)
-            throws IOException {
-        synchronized (receiveLock) {
-            synchronized (sendLock) {
-                synchronized (stateLock) {
-                    ensureOpen();
-                    if (isBound())
-                        SctpNet.throwAlreadyBoundException();
-                    InetSocketAddress isa = (local == null) ?
-                        new InetSocketAddress(0) : Net.checkAddress(local);
-
-                    SecurityManager sm = System.getSecurityManager();
-                    if (sm != null)
-                        sm.checkListen(isa.getPort());
-                    Net.bind(fd, isa.getAddress(), isa.getPort());
-
-                    InetSocketAddress boundIsa = Net.localAddress(fd);
-                    port = boundIsa.getPort();
-                    localAddresses.add(isa);
-                    if (isa.getAddress().isAnyLocalAddress())
-                        wildcard = true;
-
-                    SctpNet.listen(fdVal, backlog < 1 ? 50 : backlog);
-                }
-            }
-        }
-        return this;
-    }
-
-    @Override
-    public SctpMultiChannel bindAddress(InetAddress address)
-            throws IOException {
-        return bindUnbindAddress(address, true);
-    }
-
-    @Override
-    public SctpMultiChannel unbindAddress(InetAddress address)
-            throws IOException {
-        return bindUnbindAddress(address, false);
-    }
-
-    private SctpMultiChannel bindUnbindAddress(InetAddress address,
-                                               boolean add)
-            throws IOException {
-        if (address == null)
-            throw new IllegalArgumentException();
-
-        synchronized (receiveLock) {
-            synchronized (sendLock) {
-                synchronized (stateLock) {
-                    if (!isOpen())
-                        throw new ClosedChannelException();
-                    if (!isBound())
-                        throw new NotYetBoundException();
-                    if (wildcard)
-                        throw new IllegalStateException(
-                                "Cannot add or remove addresses from a channel that is bound to the wildcard address");
-                    if (address.isAnyLocalAddress())
-                        throw new IllegalArgumentException(
-                                "Cannot add or remove the wildcard address");
-                    if (add) {
-                        for (InetSocketAddress addr : localAddresses) {
-                            if (addr.getAddress().equals(address)) {
-                                SctpNet.throwAlreadyBoundException();
-                            }
-                        }
-                    } else { /*removing */
-                        /* Verify that there is more than one address
-                         * and that address is already bound */
-                        if (localAddresses.size() <= 1)
-                            throw new IllegalUnbindException("Cannot remove address from a channel with only one address bound");
-                        boolean foundAddress = false;
-                        for (InetSocketAddress addr : localAddresses) {
-                            if (addr.getAddress().equals(address)) {
-                                foundAddress = true;
-                                break;
-                            }
-                        }
-                        if (!foundAddress )
-                            throw new IllegalUnbindException("Cannot remove address from a channel that is not bound to that address");
-                    }
-
-                    SctpNet.bindx(fdVal, new InetAddress[]{address}, port, add);
-
-                    /* Update our internal Set to reflect the addition/removal */
-                    if (add)
-                        localAddresses.add(new InetSocketAddress(address, port));
-                    else {
-                        for (InetSocketAddress addr : localAddresses) {
-                            if (addr.getAddress().equals(address)) {
-                                localAddresses.remove(addr);
-                                break;
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        return this;
-    }
-
-    @Override
-    public Set<Association> associations()
-            throws ClosedChannelException, NotYetBoundException {
-        synchronized (stateLock) {
-            if (!isOpen())
-                throw new ClosedChannelException();
-            if (!isBound())
-                throw new NotYetBoundException();
-
-            return Collections.unmodifiableSet(associationMap.keySet());
-        }
-    }
-
-    private boolean isBound() {
-        synchronized (stateLock) {
-            return port == -1 ? false : true;
-        }
-    }
-
-    private void ensureOpen() throws IOException {
-        synchronized (stateLock) {
-            if (!isOpen())
-                throw new ClosedChannelException();
-        }
-    }
-
-    private void receiverCleanup() throws IOException {
-        synchronized (stateLock) {
-            receiverThread = 0;
-            if (state == ChannelState.KILLPENDING)
-                kill();
-        }
-    }
-
-    private void senderCleanup() throws IOException {
-        synchronized (stateLock) {
-            senderThread = 0;
-            if (state == ChannelState.KILLPENDING)
-                kill();
-        }
-    }
-
-    @Override
-    protected void implConfigureBlocking(boolean block) throws IOException {
-        IOUtil.configureBlocking(fd, block);
-    }
-
-    @Override
-    public void implCloseSelectableChannel() throws IOException {
-        synchronized (stateLock) {
-            SctpNet.preClose(fdVal);
-
-            if (receiverThread != 0)
-                NativeThread.signal(receiverThread);
-
-            if (senderThread != 0)
-                NativeThread.signal(senderThread);
-
-            if (!isRegistered())
-                kill();
-        }
-    }
-
-    @Override
-    public FileDescriptor getFD() {
-        return fd;
-    }
-
-    @Override
-    public int getFDVal() {
-        return fdVal;
-    }
-
-    /**
-     * Translates native poll revent ops into a ready operation ops
-     */
-    private boolean translateReadyOps(int ops, int initialOps,
-                                      SelectionKeyImpl sk) {
-        int intOps = sk.nioInterestOps();
-        int oldOps = sk.nioReadyOps();
-        int newOps = initialOps;
-
-        if ((ops & PollArrayWrapper.POLLNVAL) != 0) {
-            /* This should only happen if this channel is pre-closed while a
-             * selection operation is in progress
-             * ## Throw an error if this channel has not been pre-closed */
-            return false;
-        }
-
-        if ((ops & (PollArrayWrapper.POLLERR
-                    | PollArrayWrapper.POLLHUP)) != 0) {
-            newOps = intOps;
-            sk.nioReadyOps(newOps);
-            return (newOps & ~oldOps) != 0;
-        }
-
-        if (((ops & PollArrayWrapper.POLLIN) != 0) &&
-            ((intOps & SelectionKey.OP_READ) != 0))
-            newOps |= SelectionKey.OP_READ;
-
-        if (((ops & PollArrayWrapper.POLLOUT) != 0) &&
-            ((intOps & SelectionKey.OP_WRITE) != 0))
-            newOps |= SelectionKey.OP_WRITE;
-
-        sk.nioReadyOps(newOps);
-        return (newOps & ~oldOps) != 0;
-    }
-
-    @Override
-    public boolean translateAndUpdateReadyOps(int ops, SelectionKeyImpl sk) {
-        return translateReadyOps(ops, sk.nioReadyOps(), sk);
-    }
-
-    @Override
-    public boolean translateAndSetReadyOps(int ops, SelectionKeyImpl sk) {
-        return translateReadyOps(ops, 0, sk);
-    }
-
-    @Override
-    public void translateAndSetInterestOps(int ops, SelectionKeyImpl sk) {
-        int newOps = 0;
-        if ((ops & SelectionKey.OP_READ) != 0)
-            newOps |= PollArrayWrapper.POLLIN;
-        if ((ops & SelectionKey.OP_WRITE) != 0)
-            newOps |= PollArrayWrapper.POLLOUT;
-        sk.selector.putEventOps(sk, newOps);
-    }
-
-    @Override
-    public void kill() throws IOException {
-        synchronized (stateLock) {
-            if (state == ChannelState.KILLED)
-                return;
-            if (state == ChannelState.UNINITIALIZED) {
-                state = ChannelState.KILLED;
-                return;
-            }
-            assert !isOpen() && !isRegistered();
-
-            /* Postpone the kill if there is a thread sending or receiving. */
-            if (receiverThread == 0 && senderThread == 0) {
-                SctpNet.close(fdVal);
-                state = ChannelState.KILLED;
-            } else {
-                state = ChannelState.KILLPENDING;
-            }
-        }
-    }
-
-    @Override
-    public <T> SctpMultiChannel setOption(SctpSocketOption<T> name,
-                                          T value,
-                                          Association association)
-            throws IOException {
-        if (name == null)
-            throw new NullPointerException();
-        if (!(supportedOptions().contains(name)))
-            throw new UnsupportedOperationException("'" + name + "' not supported");
-
-        synchronized (stateLock) {
-            if (association != null && (name.equals(SCTP_PRIMARY_ADDR) ||
-                    name.equals(SCTP_SET_PEER_PRIMARY_ADDR))) {
-                checkAssociation(association);
-            }
-            if (!isOpen())
-                throw new ClosedChannelException();
-
-            int assocId = association == null ? 0 : association.associationID();
-            SctpNet.setSocketOption(fdVal, name, value, assocId);
-        }
-        return this;
-    }
-
-    @Override
-    @SuppressWarnings("unchecked")
-    public <T> T getOption(SctpSocketOption<T> name, Association association)
-            throws IOException {
-        if (name == null)
-            throw new NullPointerException();
-        if (!supportedOptions().contains(name))
-            throw new UnsupportedOperationException("'" + name + "' not supported");
-
-        synchronized (stateLock) {
-            if (association != null && (name.equals(SCTP_PRIMARY_ADDR) ||
-                    name.equals(SCTP_SET_PEER_PRIMARY_ADDR))) {
-                checkAssociation(association);
-            }
-            if (!isOpen())
-                throw new ClosedChannelException();
-
-            int assocId = association == null ? 0 : association.associationID();
-            return (T)SctpNet.getSocketOption(fdVal, name, assocId);
-        }
-    }
-
-    private static class DefaultOptionsHolder {
-        static final Set<SctpSocketOption<?>> defaultOptions = defaultOptions();
-
-        private static Set<SctpSocketOption<?>> defaultOptions() {
-            HashSet<SctpSocketOption<?>> set = new HashSet<SctpSocketOption<?>>(10);
-            set.add(SCTP_DISABLE_FRAGMENTS);
-            set.add(SCTP_EXPLICIT_COMPLETE);
-            set.add(SCTP_FRAGMENT_INTERLEAVE);
-            set.add(SCTP_INIT_MAXSTREAMS);
-            set.add(SCTP_NODELAY);
-            set.add(SCTP_PRIMARY_ADDR);
-            set.add(SCTP_SET_PEER_PRIMARY_ADDR);
-            set.add(SO_SNDBUF);
-            set.add(SO_RCVBUF);
-            set.add(SO_LINGER);
-            return Collections.unmodifiableSet(set);
-        }
-    }
-
-    @Override
-    public final Set<SctpSocketOption<?>> supportedOptions() {
-        return DefaultOptionsHolder.defaultOptions;
-    }
-
-    @Override
-    public <T> MessageInfo receive(ByteBuffer buffer,
-                                   T attachment,
-                                   NotificationHandler<T> handler)
-            throws IOException {
-        if (buffer == null)
-            throw new IllegalArgumentException("buffer cannot be null");
-
-        if (buffer.isReadOnly())
-            throw new IllegalArgumentException("Read-only buffer");
-
-        if (receiveInvoked.get())
-            throw new IllegalReceiveException(
-                    "cannot invoke receive from handler");
-        receiveInvoked.set(Boolean.TRUE);
-
-        try {
-            SctpResultContainer resultContainer = new SctpResultContainer();
-            do {
-                resultContainer.clear();
-                synchronized (receiveLock) {
-                    ensureOpen();
-                    if (!isBound())
-                        throw new NotYetBoundException();
-
-                    int n = 0;
-                    try {
-                        begin();
-
-                        synchronized (stateLock) {
-                            if(!isOpen())
-                                return null;
-                            receiverThread = NativeThread.current();
-                        }
-
-                        do {
-                            n = receive(fdVal, buffer, resultContainer);
-                        } while ((n == IOStatus.INTERRUPTED) && isOpen());
-
-                    } finally {
-                        receiverCleanup();
-                        end((n > 0) || (n == IOStatus.UNAVAILABLE));
-                        assert IOStatus.check(n);
-                    }
-
-                    if (!resultContainer.isNotification()) {
-                        /* message or nothing */
-                        if (resultContainer.hasSomething()) {
-                            /* Set the association before returning */
-                            SctpMessageInfoImpl info =
-                                    resultContainer.getMessageInfo();
-                            info.setAssociation(lookupAssociation(info.
-                                    associationID()));
-                            SecurityManager sm = System.getSecurityManager();
-                            if (sm != null) {
-                                InetSocketAddress isa  = (InetSocketAddress)info.address();
-                                if (!addressMap.containsKey(isa)) {
-                                    /* must be a new association */
-                                    try {
-                                        sm.checkAccept(isa.getAddress().getHostAddress(),
-                                                       isa.getPort());
-                                    } catch (SecurityException se) {
-                                        buffer.clear();
-                                        throw se;
-                                    }
-                                }
-                            }
-
-                            assert info.association() != null;
-                            return info;
-                        } else  {
-                          /* Non-blocking may return null if nothing available*/
-                            return null;
-                        }
-                    } else { /* notification */
-                        synchronized (stateLock) {
-                            handleNotificationInternal(
-                                    resultContainer);
-                        }
-                    }
-                } /* receiveLock */
-            } while (handler == null ? true :
-                (invokeNotificationHandler(resultContainer, handler, attachment)
-                 == HandlerResult.CONTINUE));
-        } finally {
-            receiveInvoked.set(Boolean.FALSE);
-        }
-
-        return null;
-    }
-
-    private int receive(int fd,
-                        ByteBuffer dst,
-                        SctpResultContainer resultContainer)
-            throws IOException {
-        int pos = dst.position();
-        int lim = dst.limit();
-        assert (pos <= lim);
-        int rem = (pos <= lim ? lim - pos : 0);
-        if (dst instanceof DirectBuffer && rem > 0)
-            return receiveIntoNativeBuffer(fd, resultContainer, dst, rem, pos);
-
-        /* Substitute a native buffer. */
-        int newSize = Math.max(rem, 1);
-        ByteBuffer bb = Util.getTemporaryDirectBuffer(newSize);
-        try {
-            int n = receiveIntoNativeBuffer(fd, resultContainer, bb, newSize, 0);
-            bb.flip();
-            if (n > 0 && rem > 0)
-                dst.put(bb);
-            return n;
-        } finally {
-            Util.releaseTemporaryDirectBuffer(bb);
-        }
-    }
-
-    private int receiveIntoNativeBuffer(int fd,
-                                        SctpResultContainer resultContainer,
-                                        ByteBuffer bb,
-                                        int rem,
-                                        int pos)
-            throws IOException {
-        int n = receive0(fd, resultContainer, ((DirectBuffer)bb).address() + pos, rem);
-        if (n > 0)
-            bb.position(pos + n);
-        return n;
-    }
-
-    private InternalNotificationHandler internalNotificationHandler =
-            new InternalNotificationHandler();
-
-    private void handleNotificationInternal(SctpResultContainer resultContainer)
-    {
-        invokeNotificationHandler(resultContainer,
-                internalNotificationHandler, null);
-    }
-
-    private class InternalNotificationHandler
-            extends AbstractNotificationHandler<Object>
-    {
-        @Override
-        public HandlerResult handleNotification(
-                AssociationChangeNotification not, Object unused) {
-            SctpAssocChange sac = (SctpAssocChange) not;
-
-            /* Update map to reflect change in association */
-            switch (not.event()) {
-                case COMM_UP :
-                    Association newAssociation = new SctpAssociationImpl
-                       (sac.assocId(), sac.maxInStreams(), sac.maxOutStreams());
-                    addAssociation(newAssociation);
-                    break;
-                case SHUTDOWN :
-                case COMM_LOST :
-                //case RESTART: ???
-                    /* mark association for removal after user handler invoked*/
-                    associationToRemove.set(lookupAssociation(sac.assocId()));
-            }
-            return HandlerResult.CONTINUE;
-        }
-    }
-
-    private <T> HandlerResult invokeNotificationHandler(
-                                   SctpResultContainer resultContainer,
-                                   NotificationHandler<T> handler,
-                                   T attachment) {
-        HandlerResult result;
-        SctpNotification notification = resultContainer.notification();
-        notification.setAssociation(lookupAssociation(notification.assocId()));
-
-        if (!(handler instanceof AbstractNotificationHandler)) {
-            result = handler.handleNotification(notification, attachment);
-        } else { /* AbstractNotificationHandler */
-            AbstractNotificationHandler<T> absHandler =
-                    (AbstractNotificationHandler<T>)handler;
-            switch(resultContainer.type()) {
-                case ASSOCIATION_CHANGED :
-                    result = absHandler.handleNotification(
-                            resultContainer.getAssociationChanged(), attachment);
-                    break;
-                case PEER_ADDRESS_CHANGED :
-                    result = absHandler.handleNotification(
-                            resultContainer.getPeerAddressChanged(), attachment);
-                    break;
-                case SEND_FAILED :
-                    result = absHandler.handleNotification(
-                            resultContainer.getSendFailed(), attachment);
-                    break;
-                case SHUTDOWN :
-                    result =  absHandler.handleNotification(
-                            resultContainer.getShutdown(), attachment);
-                    break;
-                default :
-                    /* implementation specific handlers */
-                    result =  absHandler.handleNotification(
-                            resultContainer.notification(), attachment);
-            }
-        }
-
-        if (!(handler instanceof InternalNotificationHandler)) {
-            /* Only remove associations after user handler
-             * has finished with them */
-            Association assoc = associationToRemove.get();
-            if (assoc != null) {
-                removeAssociation(assoc);
-                associationToRemove.set(null);
-            }
-
-        }
-
-        return result;
-    }
-
-    private Association lookupAssociation(int assocId) {
-        /* Lookup the association in our internal map */
-        synchronized (stateLock) {
-            Set<Association> assocs = associationMap.keySet();
-            for (Association a : assocs) {
-                if (a.associationID() == assocId) {
-                    return a;
-                }
-            }
-        }
-        return null;
-    }
-
-    private void addAssociation(Association association) {
-        synchronized (stateLock) {
-            int assocId = association.associationID();
-            Set<SocketAddress> addresses = null;
-
-            try {
-                addresses = SctpNet.getRemoteAddresses(fdVal, assocId);
-            } catch (IOException unused) {
-                /* OK, determining connected addresses may not be possible
-                 * shutdown, connection lost, etc */
-            }
-
-            associationMap.put(association, addresses);
-            if (addresses != null) {
-                for (SocketAddress addr : addresses)
-                    addressMap.put(addr, association);
-            }
-        }
-    }
-
-    private void removeAssociation(Association association) {
-        synchronized (stateLock) {
-            int assocId = association.associationID();
-            Set<SocketAddress> addresses = null;
-
-             try {
-                addresses = SctpNet.getRemoteAddresses(fdVal, assocId);
-            } catch (IOException unused) {
-                /* OK, determining connected addresses may not be possible
-                 * shutdown, connection lost, etc */
-            }
-
-            Set<Association> assocs = associationMap.keySet();
-            for (Association a : assocs) {
-                if (a.associationID() == assocId) {
-                    associationMap.remove(a);
-                    break;
-                }
-            }
-            if (addresses != null) {
-                for (SocketAddress addr : addresses)
-                    addressMap.remove(addr);
-            } else {
-                /* We cannot determine the connected addresses */
-                Set<java.util.Map.Entry<SocketAddress, Association>> addrAssocs =
-                        addressMap.entrySet();
-                Iterator<Entry<SocketAddress, Association>> iterator = addrAssocs.iterator();
-                while (iterator.hasNext()) {
-                    Entry<SocketAddress, Association> entry = iterator.next();
-                    if (entry.getValue().equals(association)) {
-                        iterator.remove();
-                    }
-                }
-            }
-        }
-    }
-
-    /**
-     * @throws  IllegalArgumentException
-     *          If the given association is not controlled by this channel
-     *
-     * @return  {@code true} if, and only if, the given association is one
-     *          of the current associations controlled by this channel
-     */
-    private boolean checkAssociation(Association messageAssoc) {
-        synchronized (stateLock) {
-            for (Association association : associationMap.keySet()) {
-                if (messageAssoc.equals(association)) {
-                    return true;
-                }
-            }
-        }
-        throw new IllegalArgumentException(
-              "Given Association is not controlled by this channel");
-    }
-
-    private void checkStreamNumber(Association assoc, int streamNumber) {
-        synchronized (stateLock) {
-            if (streamNumber < 0 || streamNumber >= assoc.maxOutboundStreams())
-                throw new InvalidStreamException();
-        }
-    }
-
-    /* TODO: Add support for ttl and isComplete to both 121 12M
-     *       SCTP_EOR not yet supported on reference platforms
-     *       TTL support limited...
-     */
-    @Override
-    public int send(ByteBuffer buffer, MessageInfo messageInfo)
-            throws IOException {
-        if (buffer == null)
-            throw new IllegalArgumentException("buffer cannot be null");
-
-        if (messageInfo == null)
-            throw new IllegalArgumentException("messageInfo cannot be null");
-
-        synchronized (sendLock) {
-            ensureOpen();
-
-            if (!isBound())
-                bind(null, 0);
-
-            int n = 0;
-            try {
-                int assocId = -1;
-                SocketAddress address = null;
-                begin();
-
-                synchronized (stateLock) {
-                    if(!isOpen())
-                        return 0;
-                    senderThread = NativeThread.current();
-
-                    /* Determine what address or association to send to */
-                    Association assoc = messageInfo.association();
-                    InetSocketAddress addr = (InetSocketAddress)messageInfo.address();
-                    if (assoc != null) {
-                        checkAssociation(assoc);
-                        checkStreamNumber(assoc, messageInfo.streamNumber());
-                        assocId = assoc.associationID();
-                        /* have we also got a preferred address */
-                        if (addr != null) {
-                            if (!assoc.equals(addressMap.get(addr)))
-                                throw new IllegalArgumentException("given preferred address is not part of this association");
-                            address = addr;
-                        }
-                    } else if (addr != null) {
-                        address = addr;
-                        Association association = addressMap.get(addr);
-                        if (association != null) {
-                            checkStreamNumber(association, messageInfo.streamNumber());
-                            assocId = association.associationID();
-
-                        } else { /* must be new association */
-                            SecurityManager sm = System.getSecurityManager();
-                            if (sm != null)
-                                sm.checkConnect(addr.getAddress().getHostAddress(),
-                                                addr.getPort());
-                        }
-                    } else {
-                        throw new AssertionError(
-                            "Both association and address cannot be null");
-                    }
-                }
-
-                do {
-                    n = send(fdVal, buffer, assocId, address, messageInfo);
-                } while ((n == IOStatus.INTERRUPTED) && isOpen());
-
-                return IOStatus.normalize(n);
-            } finally {
-                senderCleanup();
-                end((n > 0) || (n == IOStatus.UNAVAILABLE));
-                assert IOStatus.check(n);
-            }
-        }
-    }
-
-    private int send(int fd,
-                     ByteBuffer src,
-                     int assocId,
-                     SocketAddress target,
-                     MessageInfo messageInfo)
-            throws IOException {
-        int streamNumber = messageInfo.streamNumber();
-        boolean unordered = messageInfo.isUnordered();
-        int ppid = messageInfo.payloadProtocolID();
-
-        if (src instanceof DirectBuffer)
-            return sendFromNativeBuffer(fd, src, target, assocId,
-                    streamNumber, unordered, ppid);
-
-        /* Substitute a native buffer */
-        int pos = src.position();
-        int lim = src.limit();
-        assert (pos <= lim && streamNumber >= 0);
-
-        int rem = (pos <= lim ? lim - pos : 0);
-        ByteBuffer bb = Util.getTemporaryDirectBuffer(rem);
-        try {
-            bb.put(src);
-            bb.flip();
-            /* Do not update src until we see how many bytes were written */
-            src.position(pos);
-
-            int n = sendFromNativeBuffer(fd, bb, target, assocId,
-                    streamNumber, unordered, ppid);
-            if (n > 0) {
-                /* now update src */
-                src.position(pos + n);
-            }
-            return n;
-        } finally {
-            Util.releaseTemporaryDirectBuffer(bb);
-        }
-    }
-
-    private int sendFromNativeBuffer(int fd,
-                                     ByteBuffer bb,
-                                     SocketAddress target,
-                                     int assocId,
-                                     int streamNumber,
-                                     boolean unordered,
-                                     int ppid)
-            throws IOException {
-        int pos = bb.position();
-        int lim = bb.limit();
-        assert (pos <= lim);
-        int rem = (pos <= lim ? lim - pos : 0);
-
-        int written = send0(fd, ((DirectBuffer)bb).address() + pos,
-                            rem, target, assocId, streamNumber, unordered, ppid);
-        if (written > 0)
-            bb.position(pos + written);
-        return written;
-    }
-
-    @Override
-    public SctpMultiChannel shutdown(Association association)
-            throws IOException {
-        synchronized (stateLock) {
-            checkAssociation(association);
-            if (!isOpen())
-                throw new ClosedChannelException();
-
-            SctpNet.shutdown(fdVal, association.associationID());
-        }
-        return this;
-    }
-
-    @Override
-    public Set<SocketAddress> getAllLocalAddresses()
-            throws IOException {
-        synchronized (stateLock) {
-            if (!isOpen())
-                throw new ClosedChannelException();
-            if (!isBound())
-                return Collections.emptySet();
-
-            return SctpNet.getLocalAddresses(fdVal);
-        }
-    }
-
-    @Override
-    public Set<SocketAddress> getRemoteAddresses(Association association)
-            throws IOException {
-        synchronized (stateLock) {
-            checkAssociation(association);
-            if (!isOpen())
-                throw new ClosedChannelException();
-
-            try {
-                return SctpNet.getRemoteAddresses(fdVal, association.associationID());
-            } catch (SocketException se) {
-                /* a valid association should always have remote addresses */
-                Set<SocketAddress> addrs = associationMap.get(association);
-                return addrs != null ? addrs : Collections.<SocketAddress>emptySet();
-            }
-        }
-    }
-
-    @Override
-    public SctpChannel branch(Association association)
-            throws IOException {
-        synchronized (stateLock) {
-            checkAssociation(association);
-            if (!isOpen())
-                throw new ClosedChannelException();
-
-            FileDescriptor bFd = SctpNet.branch(fdVal,
-                                                association.associationID());
-            /* successfully branched, we can now remove it from assoc list */
-            removeAssociation(association);
-
-            return new SctpChannelImpl(provider(), bFd, association);
-        }
-    }
-
-    /* Use common native implementation shared between
-     * one-to-one and one-to-many */
-    private static int receive0(int fd,
-                                SctpResultContainer resultContainer,
-                                long address,
-                                int length)
-            throws IOException{
-        return SctpChannelImpl.receive0(fd, resultContainer, address,
-                length, false /*peek */);
-    }
-
-    private static int send0(int fd,
-                             long address,
-                             int length,
-                             SocketAddress target,
-                             int assocId,
-                             int streamNumber,
-                             boolean unordered,
-                             int ppid)
-            throws IOException {
-        return SctpChannelImpl.send0(fd, address, length, target, assocId,
-                streamNumber, unordered, ppid);
-    }
-
-    static {
-        Util.load();   /* loads nio & net native libraries */
-        java.security.AccessController.doPrivileged(
-                new sun.security.action.LoadLibraryAction("sctp"));
-    }
-}
--- a/src/solaris/classes/sun/nio/ch/SctpNet.java	Thu Feb 16 13:01:36 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,313 +0,0 @@
-/*
- * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.nio.ch;
-
-import java.io.FileDescriptor;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.SocketAddress;
-import java.nio.channels.AlreadyBoundException;
-import java.util.Set;
-import java.util.HashSet;
-import java.security.AccessController;
-import sun.security.action.GetPropertyAction;
-import com.sun.nio.sctp.SctpSocketOption;
-import static com.sun.nio.sctp.SctpStandardSocketOptions.*;
-
-public class SctpNet {
-    static final String osName = AccessController.doPrivileged(
-                    new GetPropertyAction("os.name"));
-
-    /* -- Miscellaneous SCTP utilities -- */
-
-    private static boolean IPv4MappedAddresses() {
-        if ("SunOS".equals(osName)) {
-            /* Solaris supports IPv4Mapped Addresses with bindx */
-            return true;
-        } /* else {  //other OS/implementations  */
-
-        /* lksctp/linux requires Ipv4 addresses */
-        return false;
-    }
-
-    static boolean throwAlreadyBoundException() throws IOException {
-        throw new AlreadyBoundException();
-    }
-
-    static void listen(int fd, int backlog) throws IOException {
-        listen0(fd, backlog);
-    }
-
-    static int connect(int fd, InetAddress remote, int remotePort)
-            throws IOException {
-        return connect0(fd, remote, remotePort);
-    }
-
-    static void close(int fd) throws IOException {
-        close0(fd);
-    }
-
-    static void preClose(int fd) throws IOException {
-        preClose0(fd);
-    }
-
-    /**
-     * @param  oneToOne
-     *         if {@code true} returns a one-to-one sctp socket, otherwise
-     *         returns a one-to-many sctp socket
-     */
-    static FileDescriptor socket(boolean oneToOne) throws IOException {
-        int nativefd = socket0(oneToOne);
-        return IOUtil.newFD(nativefd);
-    }
-
-    static void bindx(int fd, InetAddress[] addrs, int port, boolean add)
-            throws IOException {
-        bindx(fd, addrs, port, addrs.length, add,
-                IPv4MappedAddresses());
-    }
-
-    static Set<SocketAddress> getLocalAddresses(int fd)
-            throws IOException {
-        HashSet<SocketAddress> set = null;
-        SocketAddress[] saa = getLocalAddresses0(fd);
-
-        if (saa != null) {
-            set = new HashSet<SocketAddress>(saa.length);
-            for (SocketAddress sa : saa)
-                set.add(sa);
-        }
-
-        return set;
-    }
-
-    static Set<SocketAddress> getRemoteAddresses(int fd, int assocId)
-            throws IOException {
-        HashSet<SocketAddress> set = null;
-        SocketAddress[] saa = getRemoteAddresses0(fd, assocId);
-
-        if (saa != null) {
-            set = new HashSet<SocketAddress>(saa.length);
-            for (SocketAddress sa : saa)
-                set.add(sa);
-        }
-
-        return set;
-    }
-
-    static <T> void setSocketOption(int fd,
-                                    SctpSocketOption<T> name,
-                                    T value,
-                                    int assocId)
-            throws IOException {
-        if (value == null)
-            throw new IllegalArgumentException("Invalid option value");
-
-        if (name.equals(SCTP_INIT_MAXSTREAMS)) {
-            InitMaxStreams maxStreamValue = (InitMaxStreams)value;
-            SctpNet.setInitMsgOption0(fd,
-                 maxStreamValue.maxInStreams(), maxStreamValue.maxOutStreams());
-        } else if (name.equals(SCTP_PRIMARY_ADDR) ||
-                   name.equals(SCTP_SET_PEER_PRIMARY_ADDR)) {
-
-            SocketAddress addr  = (SocketAddress) value;
-            if (addr == null)
-                throw new IllegalArgumentException("Invalid option value");
-
-            Net.checkAddress(addr);
-            InetSocketAddress netAddr = (InetSocketAddress)addr;
-
-            if (name.equals(SCTP_PRIMARY_ADDR)) {
-                setPrimAddrOption0(fd,
-                                   assocId,
-                                   netAddr.getAddress(),
-                                   netAddr.getPort());
-            } else {
-                setPeerPrimAddrOption0(fd,
-                                       assocId,
-                                       netAddr.getAddress(),
-                                       netAddr.getPort(),
-                                       IPv4MappedAddresses());
-            }
-        } else if (name.equals(SCTP_DISABLE_FRAGMENTS) ||
-            name.equals(SCTP_EXPLICIT_COMPLETE) ||
-            name.equals(SCTP_FRAGMENT_INTERLEAVE) ||
-            name.equals(SCTP_NODELAY) ||
-            name.equals(SO_SNDBUF) ||
-            name.equals(SO_RCVBUF) ||
-            name.equals(SO_LINGER)) {
-            setIntOption(fd, name, value);
-        } else {
-            throw new AssertionError("Unknown socket option");
-        }
-    }
-
-    static Object getSocketOption(int fd, SctpSocketOption<?> name, int assocId)
-             throws IOException {
-         if (name.equals(SCTP_SET_PEER_PRIMARY_ADDR)) {
-            throw new IllegalArgumentException(
-                    "SCTP_SET_PEER_PRIMARY_ADDR cannot be retrieved");
-        } else if (name.equals(SCTP_INIT_MAXSTREAMS)) {
-            /* container for holding maxIn/Out streams */
-            int[] values = new int[2];
-            SctpNet.getInitMsgOption0(fd, values);
-            return InitMaxStreams.create(values[0], values[1]);
-        } else if (name.equals(SCTP_PRIMARY_ADDR)) {
-            return getPrimAddrOption0(fd, assocId);
-        } else if (name.equals(SCTP_DISABLE_FRAGMENTS) ||
-            name.equals(SCTP_EXPLICIT_COMPLETE) ||
-            name.equals(SCTP_FRAGMENT_INTERLEAVE) ||
-            name.equals(SCTP_NODELAY) ||
-            name.equals(SO_SNDBUF) ||
-            name.equals(SO_RCVBUF) ||
-            name.equals(SO_LINGER)) {
-            return getIntOption(fd, name);
-        } else {
-            throw new AssertionError("Unknown socket option");
-        }
-    }
-
-    static void setIntOption(int fd, SctpSocketOption<?> name, Object value)
-            throws IOException {
-        if (value == null)
-            throw new IllegalArgumentException("Invalid option value");
-
-        Class<?> type = name.type();
-        if (type != Integer.class && type != Boolean.class)
-            throw new AssertionError("Should not reach here");
-
-        if (name == SO_RCVBUF ||
-            name == SO_SNDBUF)
-        {
-            int i = ((Integer)value).intValue();
-            if (i < 0)
-                throw new IllegalArgumentException(
-                        "Invalid send/receive buffer size");
-        } else if (name == SO_LINGER) {
-            int i = ((Integer)value).intValue();
-            if (i < 0)
-                value = Integer.valueOf(-1);
-            if (i > 65535)
-                value = Integer.valueOf(65535);
-        } else if (name.equals(SCTP_FRAGMENT_INTERLEAVE)) {
-            int i = ((Integer)value).intValue();
-            if (i < 0 || i > 2)
-                throw new IllegalArgumentException(
-                        "Invalid value for SCTP_FRAGMENT_INTERLEAVE");
-        }
-
-        int arg;
-        if (type == Integer.class) {
-            arg = ((Integer)value).intValue();
-        } else {
-            boolean b = ((Boolean)value).booleanValue();
-            arg = (b) ? 1 : 0;
-        }
-
-        setIntOption0(fd, ((SctpStdSocketOption)name).constValue(), arg);
-    }
-
-    static Object getIntOption(int fd, SctpSocketOption<?> name)
-            throws IOException {
-        Class<?> type = name.type();
-
-        if (type != Integer.class && type != Boolean.class)
-            throw new AssertionError("Should not reach here");
-
-        if (!(name instanceof SctpStdSocketOption))
-            throw new AssertionError("Should not reach here");
-
-        int value = getIntOption0(fd,
-                ((SctpStdSocketOption)name).constValue());
-
-        if (type == Integer.class) {
-            return Integer.valueOf(value);
-        } else {
-            return (value == 0) ? Boolean.FALSE : Boolean.TRUE;
-        }
-    }
-
-    static void shutdown(int fd, int assocId)
-            throws IOException {
-        shutdown0(fd, assocId);
-    }
-
-    static FileDescriptor branch(int fd, int assocId) throws IOException {
-        int nativefd = branch0(fd, assocId);
-        return IOUtil.newFD(nativefd);
-    }
-
-    /* Native Methods */
-    static native int socket0(boolean oneToOne) throws IOException;
-
-    static native void listen0(int fd, int backlog) throws IOException;
-
-    static native int connect0(int fd, InetAddress remote, int remotePort)
-        throws IOException;
-
-    static native void close0(int fd) throws IOException;
-
-    static native void preClose0(int fd) throws IOException;
-
-    static native void bindx(int fd, InetAddress[] addrs, int port, int length,
-            boolean add, boolean preferIPv6) throws IOException;
-
-    static native int getIntOption0(int fd, int opt) throws IOException;
-
-    static native void setIntOption0(int fd, int opt, int arg)
-        throws IOException;
-
-    static native SocketAddress[] getLocalAddresses0(int fd) throws IOException;
-
-    static native SocketAddress[] getRemoteAddresses0(int fd, int assocId)
-            throws IOException;
-
-    static native int branch0(int fd, int assocId) throws IOException;
-
-    static native void setPrimAddrOption0(int fd, int assocId, InetAddress ia,
-            int port) throws IOException;
-
-    static native void setPeerPrimAddrOption0(int fd, int assocId,
-            InetAddress ia, int port, boolean preferIPv6) throws IOException;
-
-    static native SocketAddress getPrimAddrOption0(int fd, int assocId)
-            throws IOException;
-
-    /* retVals [0] maxInStreams, [1] maxOutStreams */
-    static native void getInitMsgOption0(int fd, int[] retVals) throws IOException;
-
-    static native void setInitMsgOption0(int fd, int arg1, int arg2)
-            throws IOException;
-
-    static native void shutdown0(int fd, int assocId);
-
-    static native void init();
-
-    static {
-        init();
-    }
-}
-
--- a/src/solaris/classes/sun/nio/ch/SctpNotification.java	Thu Feb 16 13:01:36 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.nio.ch;
-
-import com.sun.nio.sctp.Association;
-import com.sun.nio.sctp.Notification;
-
-/**
- * All Notification implemenations MUST implement this interface to provide
- * access to the native association identidier.
- */
-interface SctpNotification extends Notification {
-    int assocId();
-    void setAssociation(Association association);
-}
--- a/src/solaris/classes/sun/nio/ch/SctpPeerAddrChange.java	Thu Feb 16 13:01:36 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +0,0 @@
-/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.nio.ch;
-
-import java.net.SocketAddress;
-import com.sun.nio.sctp.Association;
-import com.sun.nio.sctp.PeerAddressChangeNotification;
-
-/**
- * An implementation of PeerAddressChangeNotification
- */
-public class SctpPeerAddrChange extends PeerAddressChangeNotification
-    implements SctpNotification
-{
-    /* static final ints so that they can be referenced from native */
-    private final static int SCTP_ADDR_AVAILABLE = 1;
-    private final static int SCTP_ADDR_UNREACHABLE = 2;
-    private final static int SCTP_ADDR_REMOVED = 3;
-    private final static int SCTP_ADDR_ADDED = 4;
-    private final static int SCTP_ADDR_MADE_PRIM = 5;
-    private final static int SCTP_ADDR_CONFIRMED =6;
-
-    private Association association;
-
-    /* assocId is used to lookup the association before the notification is
-     * returned to user code */
-    private int assocId;
-    private SocketAddress address;
-    private AddressChangeEvent event;
-
-    /* Invoked from native */
-    private SctpPeerAddrChange(int assocId, SocketAddress address, int intEvent) {
-        switch (intEvent) {
-            case SCTP_ADDR_AVAILABLE :
-                this.event = AddressChangeEvent.ADDR_AVAILABLE;
-                break;
-            case SCTP_ADDR_UNREACHABLE :
-                this.event = AddressChangeEvent.ADDR_UNREACHABLE;
-                break;
-            case SCTP_ADDR_REMOVED :
-                this.event = AddressChangeEvent.ADDR_REMOVED;
-                break;
-            case SCTP_ADDR_ADDED :
-                this.event = AddressChangeEvent.ADDR_ADDED;
-                break;
-            case SCTP_ADDR_MADE_PRIM :
-                this.event = AddressChangeEvent.ADDR_MADE_PRIMARY;
-                break;
-            case SCTP_ADDR_CONFIRMED :
-                this.event = AddressChangeEvent.ADDR_CONFIRMED;
-                break;
-            default:
-                throw new AssertionError("Unknown event type");
-        }
-        this.assocId = assocId;
-        this.address = address;
-    }
-
-    @Override
-    public int assocId() {
-        return assocId;
-    }
-
-    @Override
-    public void setAssociation(Association association) {
-        this.association = association;
-    }
-
-    @Override
-    public SocketAddress address() {
-        assert address != null;
-        return address;
-    }
-
-    @Override
-    public Association association() {
-        assert association != null;
-        return association;
-    }
-
-    @Override
-    public AddressChangeEvent event() {
-        assert event != null;
-        return event;
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder sb = new StringBuilder();
-        sb.append(super.toString()).append(" [");
-        sb.append("Address: ").append(address);
-        sb.append(", Association:").append(association);
-        sb.append(", Event: ").append(event).append("]");
-        return sb.toString();
-    }
-}
-
--- a/src/solaris/classes/sun/nio/ch/SctpResultContainer.java	Thu Feb 16 13:01:36 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,128 +0,0 @@
-/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.nio.ch;
-
-/**
- * Wraps the actual message or notification so that it can be
- * set and returned from the native receive implementation.
- */
-public class SctpResultContainer {
-    /* static final ints so that they can be referenced from native */
-    static final int NOTHING = 0;
-    static final int MESSAGE = 1;
-    static final int SEND_FAILED = 2;
-    static final int ASSOCIATION_CHANGED = 3;
-    static final int PEER_ADDRESS_CHANGED = 4;
-    static final int SHUTDOWN = 5;
-
-    private Object value;
-    private int type;
-
-    int type() {
-        return type;
-    }
-
-    boolean hasSomething() {
-        return type() != NOTHING;
-    }
-
-    boolean isNotification() {
-        return type() != MESSAGE && type() != NOTHING ? true : false;
-    }
-
-    void clear() {
-        type = NOTHING;
-        value = null;
-    }
-
-    SctpNotification notification() {
-        assert type() != MESSAGE && type() != NOTHING;
-
-        return (SctpNotification) value;
-    }
-
-    SctpMessageInfoImpl getMessageInfo() {
-        assert type() == MESSAGE;
-
-        if (value instanceof SctpMessageInfoImpl)
-            return (SctpMessageInfoImpl) value;
-
-        return null;
-    }
-
-    SctpSendFailed getSendFailed() {
-        assert type() == SEND_FAILED;
-
-        if (value instanceof SctpSendFailed)
-            return (SctpSendFailed) value;
-
-        return null;
-    }
-
-    SctpAssocChange getAssociationChanged() {
-        assert type() == ASSOCIATION_CHANGED;
-
-        if (value instanceof SctpAssocChange)
-            return (SctpAssocChange) value;
-
-        return null;
-    }
-
-    SctpPeerAddrChange getPeerAddressChanged() {
-        assert type() == PEER_ADDRESS_CHANGED;
-
-        if (value instanceof SctpPeerAddrChange)
-            return (SctpPeerAddrChange) value;
-
-        return null;
-    }
-
-    SctpShutdown getShutdown() {
-        assert type() == SHUTDOWN;
-
-        if (value instanceof SctpShutdown)
-            return (SctpShutdown) value;
-
-        return null;
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder sb = new StringBuilder();
-        sb.append("Type: ");
-        switch (type) {
-            case NOTHING:              sb.append("NOTHING");             break;
-            case MESSAGE:              sb.append("MESSAGE");             break;
-            case SEND_FAILED:          sb.append("SEND FAILED");         break;
-            case ASSOCIATION_CHANGED:  sb.append("ASSOCIATION CHANGE");  break;
-            case PEER_ADDRESS_CHANGED: sb.append("PEER ADDRESS CHANGE"); break;
-            case SHUTDOWN:             sb.append("SHUTDOWN");            break;
-            default :                  sb.append("Unknown result type");
-        }
-        sb.append(", Value: ");
-        sb.append((value == null) ? "null" : value.toString());
-        return sb.toString();
-    }
-}
--- a/src/solaris/classes/sun/nio/ch/SctpSendFailed.java	Thu Feb 16 13:01:36 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.nio.ch;
-
-import java.nio.ByteBuffer;
-import java.net.SocketAddress;
-import com.sun.nio.sctp.Association;
-import com.sun.nio.sctp.SendFailedNotification;
-
-/**
- * An implementation of SendFailedNotification
- */
-public class SctpSendFailed extends SendFailedNotification
-    implements SctpNotification
-{
-    private Association association;
-    /* assocId is used to lookup the association before the notification is
-     * returned to user code */
-    private int assocId;
-    private SocketAddress address;
-    private ByteBuffer buffer;
-    private int errorCode;
-    private int streamNumber;
-
-    /* Invoked from native */
-    private SctpSendFailed(int assocId,
-                           SocketAddress address,
-                           ByteBuffer buffer,
-                           int errorCode,
-                           int streamNumber) {
-        this.assocId = assocId;
-        this.errorCode = errorCode;
-        this.streamNumber = streamNumber;
-        this.address = address;
-        this.buffer = buffer;
-    }
-
-    @Override
-    public int assocId() {
-        return assocId;
-    }
-
-    @Override
-    public void setAssociation(Association association) {
-        this.association = association;
-    }
-
-    @Override
-    public Association association() {
-        /* may be null */
-        return association;
-    }
-
-    @Override
-    public SocketAddress address() {
-        assert address != null;
-        return address;
-    }
-
-    @Override
-    public ByteBuffer buffer() {
-        assert buffer != null;
-        return buffer;
-    }
-
-    @Override
-    public int errorCode() {
-        return errorCode;
-    }
-
-    @Override
-    public int streamNumber() {
-        return streamNumber;
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder sb = new StringBuilder();
-        sb.append(super.toString()).append(" [");
-        sb.append("Association:").append(association);
-        sb.append(", Address: ").append(address);
-        sb.append(", buffer: ").append(buffer);
-        sb.append(", errorCode: ").append(errorCode);
-        sb.append(", streamNumber: ").append(streamNumber);
-        sb.append("]");
-        return sb.toString();
-    }
-}
--- a/src/solaris/classes/sun/nio/ch/SctpServerChannelImpl.java	Thu Feb 16 13:01:36 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,425 +0,0 @@
-/*
- * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.nio.ch;
-
-import java.net.SocketAddress;
-import java.net.InetSocketAddress;
-import java.net.InetAddress;
-import java.io.FileDescriptor;
-import java.io.IOException;
-import java.util.Collections;
-import java.util.Set;
-import java.util.HashSet;
-import java.nio.channels.SelectionKey;
-import java.nio.channels.ClosedChannelException;
-import java.nio.channels.NotYetBoundException;
-import java.nio.channels.spi.SelectorProvider;
-import com.sun.nio.sctp.IllegalUnbindException;
-import com.sun.nio.sctp.SctpChannel;
-import com.sun.nio.sctp.SctpServerChannel;
-import com.sun.nio.sctp.SctpSocketOption;
-import com.sun.nio.sctp.SctpStandardSocketOptions;
-
-/**
- * An implementation of SctpServerChannel
- */
-public class SctpServerChannelImpl extends SctpServerChannel
-    implements SelChImpl
-{
-    private final FileDescriptor fd;
-
-    private final int fdVal;
-
-    /* IDs of native thread doing accept, for signalling */
-    private volatile long thread = 0;
-
-    /* Lock held by thread currently blocked in this channel */
-    private final Object lock = new Object();
-
-    /* Lock held by any thread that modifies the state fields declared below
-     * DO NOT invoke a blocking I/O operation while holding this lock! */
-    private final Object stateLock = new Object();
-
-    private enum ChannelState {
-        UNINITIALIZED,
-        INUSE,
-        KILLPENDING,
-        KILLED,
-    }
-    /* -- The following fields are protected by stateLock -- */
-    private ChannelState state = ChannelState.UNINITIALIZED;
-
-    /* Binding: Once bound the port will remain constant. */
-    int port = -1;
-    private HashSet<InetSocketAddress> localAddresses = new HashSet<InetSocketAddress>();
-    /* Has the channel been bound to the wildcard address */
-    private boolean wildcard; /* false */
-
-    /* -- End of fields protected by stateLock -- */
-
-    /**
-     * Initializes a new instance of this class.
-     */
-    public SctpServerChannelImpl(SelectorProvider provider)
-            throws IOException {
-        //TODO: update provider remove public modifier
-        super(provider);
-        this.fd = SctpNet.socket(true);
-        this.fdVal = IOUtil.fdVal(fd);
-        this.state = ChannelState.INUSE;
-    }
-
-    @Override
-    public SctpServerChannel bind(SocketAddress local, int backlog)
-            throws IOException {
-        synchronized (lock) {
-            synchronized (stateLock) {
-                if (!isOpen())
-                    throw new ClosedChannelException();
-                if (isBound())
-                    SctpNet.throwAlreadyBoundException();
-
-                InetSocketAddress isa = (local == null) ?
-                    new InetSocketAddress(0) : Net.checkAddress(local);
-                SecurityManager sm = System.getSecurityManager();
-                if (sm != null)
-                    sm.checkListen(isa.getPort());
-                Net.bind(fd, isa.getAddress(), isa.getPort());
-
-                InetSocketAddress boundIsa = Net.localAddress(fd);
-                port = boundIsa.getPort();
-                localAddresses.add(isa);
-                    if (isa.getAddress().isAnyLocalAddress())
-                        wildcard = true;
-
-                SctpNet.listen(fdVal, backlog < 1 ? 50 : backlog);
-            }
-        }
-        return this;
-    }
-
-    @Override
-    public SctpServerChannel bindAddress(InetAddress address)
-            throws IOException {
-        return bindUnbindAddress(address, true);
-    }
-
-    @Override
-    public SctpServerChannel unbindAddress(InetAddress address)
-            throws IOException {
-        return bindUnbindAddress(address, false);
-    }
-
-    private SctpServerChannel bindUnbindAddress(InetAddress address, boolean add)
-            throws IOException {
-        if (address == null)
-            throw new IllegalArgumentException();
-
-        synchronized (lock) {
-            synchronized (stateLock) {
-                if (!isOpen())
-                    throw new ClosedChannelException();
-                if (!isBound())
-                    throw new NotYetBoundException();
-                if (wildcard)
-                    throw new IllegalStateException(
-                            "Cannot add or remove addresses from a channel that is bound to the wildcard address");
-                if (address.isAnyLocalAddress())
-                    throw new IllegalArgumentException(
-                            "Cannot add or remove the wildcard address");
-                if (add) {
-                    for (InetSocketAddress addr : localAddresses) {
-                        if (addr.getAddress().equals(address)) {
-                            SctpNet.throwAlreadyBoundException();
-                        }
-                    }
-                } else { /*removing */
-                    /* Verify that there is more than one address
-                     * and that address is already bound */
-                    if (localAddresses.size() <= 1)
-                        throw new IllegalUnbindException("Cannot remove address from a channel with only one address bound");
-                    boolean foundAddress = false;
-                    for (InetSocketAddress addr : localAddresses) {
-                        if (addr.getAddress().equals(address)) {
-                            foundAddress = true;
-                            break;
-                        }
-                    }
-                    if (!foundAddress )
-                        throw new IllegalUnbindException("Cannot remove address from a channel that is not bound to that address");
-                }
-
-                SctpNet.bindx(fdVal, new InetAddress[]{address}, port, add);
-
-                /* Update our internal Set to reflect the addition/removal */
-                if (add)
-                    localAddresses.add(new InetSocketAddress(address, port));
-                else {
-                    for (InetSocketAddress addr : localAddresses) {
-                        if (addr.getAddress().equals(address)) {
-                            localAddresses.remove(addr);
-                            break;
-                        }
-                    }
-                }
-            }
-        }
-        return this;
-    }
-
-    private boolean isBound() {
-        synchronized (stateLock) {
-            return port == -1 ? false : true;
-        }
-    }
-
-    private void acceptCleanup() throws IOException {
-        synchronized (stateLock) {
-            thread = 0;
-            if (state == ChannelState.KILLPENDING)
-                kill();
-        }
-    }
-
-    @Override
-    public SctpChannel accept() throws IOException {
-        synchronized (lock) {
-            if (!isOpen())
-                throw new ClosedChannelException();
-            if (!isBound())
-                throw new NotYetBoundException();
-            SctpChannel sc = null;
-
-            int n = 0;
-            FileDescriptor newfd = new FileDescriptor();
-            InetSocketAddress[] isaa = new InetSocketAddress[1];
-
-            try {
-                begin();
-                if (!isOpen())
-                    return null;
-                thread = NativeThread.current();
-                for (;;) {
-                    n = accept0(fd, newfd, isaa);
-                    if ((n == IOStatus.INTERRUPTED) && isOpen())
-                        continue;
-                    break;
-                }
-            } finally {
-                acceptCleanup();
-                end(n > 0);
-                assert IOStatus.check(n);
-            }
-
-            if (n < 1)
-                return null;
-
-            IOUtil.configureBlocking(newfd, true);
-            InetSocketAddress isa = isaa[0];
-            sc = new SctpChannelImpl(provider(), newfd);
-
-            SecurityManager sm = System.getSecurityManager();
-            if (sm != null)
-                sm.checkAccept(isa.getAddress().getHostAddress(),
-                               isa.getPort());
-
-            return sc;
-        }
-    }
-
-    @Override
-    protected void implConfigureBlocking(boolean block) throws IOException {
-        IOUtil.configureBlocking(fd, block);
-    }
-
-    @Override
-    public void implCloseSelectableChannel() throws IOException {
-        synchronized (stateLock) {
-            SctpNet.preClose(fdVal);
-            if (thread != 0)
-                NativeThread.signal(thread);
-            if (!isRegistered())
-                kill();
-        }
-    }
-
-    @Override
-    public void kill() throws IOException {
-        synchronized (stateLock) {
-            if (state == ChannelState.KILLED)
-                return;
-            if (state == ChannelState.UNINITIALIZED) {
-                state = ChannelState.KILLED;
-                return;
-            }
-            assert !isOpen() && !isRegistered();
-
-            // Postpone the kill if there is a thread in accept
-            if (thread == 0) {
-                SctpNet.close(fdVal);
-                state = ChannelState.KILLED;
-            } else {
-                state = ChannelState.KILLPENDING;
-            }
-        }
-    }
-
-    @Override
-    public FileDescriptor getFD() {
-        return fd;
-    }
-
-    @Override
-    public int getFDVal() {
-        return fdVal;
-    }
-
-    /**
-     * Translates native poll revent ops into a ready operation ops
-     */
-    private boolean translateReadyOps(int ops, int initialOps,
-                                     SelectionKeyImpl sk) {
-        int intOps = sk.nioInterestOps();
-        int oldOps = sk.nioReadyOps();
-        int newOps = initialOps;
-
-        if ((ops & PollArrayWrapper.POLLNVAL) != 0) {
-            /* This should only happen if this channel is pre-closed while a
-             * selection operation is in progress
-             * ## Throw an error if this channel has not been pre-closed */
-            return false;
-        }
-
-        if ((ops & (PollArrayWrapper.POLLERR
-                    | PollArrayWrapper.POLLHUP)) != 0) {
-            newOps = intOps;
-            sk.nioReadyOps(newOps);
-            return (newOps & ~oldOps) != 0;
-        }
-
-        if (((ops & PollArrayWrapper.POLLIN) != 0) &&
-            ((intOps & SelectionKey.OP_ACCEPT) != 0))
-                newOps |= SelectionKey.OP_ACCEPT;
-
-        sk.nioReadyOps(newOps);
-        return (newOps & ~oldOps) != 0;
-    }
-
-    @Override
-    public boolean translateAndUpdateReadyOps(int ops, SelectionKeyImpl sk) {
-        return translateReadyOps(ops, sk.nioReadyOps(), sk);
-    }
-
-    @Override
-    public boolean translateAndSetReadyOps(int ops, SelectionKeyImpl sk) {
-        return translateReadyOps(ops, 0, sk);
-    }
-
-    @Override
-    public void translateAndSetInterestOps(int ops, SelectionKeyImpl sk) {
-        int newOps = 0;
-
-        /* Translate ops */
-        if ((ops & SelectionKey.OP_ACCEPT) != 0)
-            newOps |= PollArrayWrapper.POLLIN;
-        /* Place ops into pollfd array */
-        sk.selector.putEventOps(sk, newOps);
-
-    }
-
-    @Override
-    public <T> SctpServerChannel setOption(SctpSocketOption<T> name, T value)
-            throws IOException {
-        if (name == null)
-            throw new NullPointerException();
-        if (!supportedOptions().contains(name))
-            throw new UnsupportedOperationException("'" + name + "' not supported");
-
-        synchronized (stateLock) {
-            if (!isOpen())
-                throw new ClosedChannelException();
-
-            SctpNet.setSocketOption(fdVal, name, value, 0 /*oneToOne*/);
-            return this;
-        }
-    }
-
-    @Override
-    @SuppressWarnings("unchecked")
-    public <T> T getOption(SctpSocketOption<T> name) throws IOException {
-        if (name == null)
-            throw new NullPointerException();
-        if (!supportedOptions().contains(name))
-            throw new UnsupportedOperationException("'" + name + "' not supported");
-
-        synchronized (stateLock) {
-            if (!isOpen())
-                throw new ClosedChannelException();
-
-            return (T) SctpNet.getSocketOption(fdVal, name, 0 /*oneToOne*/);
-        }
-    }
-
-    private static class DefaultOptionsHolder {
-        static final Set<SctpSocketOption<?>> defaultOptions = defaultOptions();
-
-        private static Set<SctpSocketOption<?>> defaultOptions() {
-            HashSet<SctpSocketOption<?>> set = new HashSet<SctpSocketOption<?>>(1);
-            set.add(SctpStandardSocketOptions.SCTP_INIT_MAXSTREAMS);
-            return Collections.unmodifiableSet(set);
-        }
-    }
-
-    @Override
-    public final Set<SctpSocketOption<?>> supportedOptions() {
-        return DefaultOptionsHolder.defaultOptions;
-    }
-
-    @Override
-    public Set<SocketAddress> getAllLocalAddresses()
-            throws IOException {
-        synchronized (stateLock) {
-            if (!isOpen())
-                throw new ClosedChannelException();
-            if (!isBound())
-                return Collections.emptySet();
-
-            return SctpNet.getLocalAddresses(fdVal);
-        }
-    }
-
-    /* Native */
-    private static native void initIDs();
-
-    private static native int accept0(FileDescriptor ssfd,
-        FileDescriptor newfd, InetSocketAddress[] isaa) throws IOException;
-
-    static {
-        Util.load();   // loads nio & net native libraries
-        java.security.AccessController.doPrivileged(
-                new sun.security.action.LoadLibraryAction("sctp"));
-        initIDs();
-    }
-}
--- a/src/solaris/classes/sun/nio/ch/SctpShutdown.java	Thu Feb 16 13:01:36 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.nio.ch;
-
-import com.sun.nio.sctp.Association;
-import com.sun.nio.sctp.ShutdownNotification;
-
-/**
- * An implementation of ShutdownNotification
- */
-public class SctpShutdown extends ShutdownNotification
-    implements SctpNotification
-{
-    private Association association;
-    /* assocId is used to lookup the association before the notification is
-     * returned to user code */
-    private int assocId;
-
-    /* Invoked from native */
-    private SctpShutdown(int assocId) {
-        this.assocId = assocId;
-    }
-
-    @Override
-    public int assocId() {
-        return assocId;
-    }
-
-    @Override
-    public void setAssociation(Association association) {
-        this.association = association;
-    }
-
-    @Override
-    public Association association() {
-        assert association != null;
-        return association;
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder sb = new StringBuilder();
-        sb.append(super.toString()).append(" [");
-        sb.append("Association:").append(association).append("]");
-        return sb.toString();
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/solaris/classes/sun/nio/ch/sctp/AssociationChange.java	Sat Feb 18 16:11:47 2012 -0800
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package sun.nio.ch.sctp;
+
+import com.sun.nio.sctp.Association;
+import com.sun.nio.sctp.AssociationChangeNotification;
+
+/**
+ * An implementation of AssociationChangeNotification
+ */
+public class AssociationChange extends AssociationChangeNotification
+    implements SctpNotification
+{
+    /* static final ints so that they can be referenced from native */
+    private final static int SCTP_COMM_UP = 1;
+    private final static int SCTP_COMM_LOST = 2;
+    private final static int SCTP_RESTART = 3;
+    private final static int SCTP_SHUTDOWN = 4;
+    private final static int SCTP_CANT_START = 5;
+
+    private Association association;
+
+    /* assocId is used to lookup the association before the notification is
+     * returned to user code */
+    private int assocId;
+    private AssocChangeEvent event;
+    private int maxOutStreams;
+    private int maxInStreams;
+
+    /* Invoked from native */
+    private AssociationChange(int assocId,
+                              int intEvent,
+                              int maxOutStreams,
+                              int maxInStreams) {
+        switch (intEvent) {
+            case SCTP_COMM_UP :
+                this.event = AssocChangeEvent.COMM_UP;
+                break;
+            case SCTP_COMM_LOST :
+                this.event = AssocChangeEvent.COMM_LOST;
+                break;
+            case SCTP_RESTART :
+                this.event = AssocChangeEvent.RESTART;
+                break;
+            case SCTP_SHUTDOWN :
+                this.event = AssocChangeEvent.SHUTDOWN;
+                break;
+            case SCTP_CANT_START :
+                this.event = AssocChangeEvent.CANT_START;
+                break;
+            default :
+                throw new AssertionError(
+                      "Unknown Association Change Event type: " + intEvent);
+        }
+
+        this.assocId = assocId;
+        this.maxOutStreams = maxOutStreams;
+        this.maxInStreams = maxInStreams;
+    }
+
+    @Override
+    public int assocId() {
+        return assocId;
+    }
+
+    @Override
+    public void setAssociation(Association association) {
+        this.association = association;
+    }
+
+    @Override
+    public Association association() {
+        assert association != null;
+        return association;
+    }
+
+    @Override
+    public AssocChangeEvent event() {
+        return event;
+    }
+
+    int maxOutStreams() {
+        return maxOutStreams;
+    }
+
+    int maxInStreams() {
+        return maxInStreams;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(super.toString()).append(" [");
+        sb.append("Association:").append(association);
+        sb.append(", Event: ").append(event).append("]");
+        return sb.toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/solaris/classes/sun/nio/ch/sctp/AssociationImpl.java	Sat Feb 18 16:11:47 2012 -0800
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package sun.nio.ch.sctp;
+
+import com.sun.nio.sctp.Association;
+
+/**
+ * An implementation of Association
+ */
+public class AssociationImpl extends Association {
+    public AssociationImpl(int associationID,
+                           int maxInStreams,
+                           int maxOutStreams) {
+        super(associationID, maxInStreams, maxOutStreams);
+    }
+
+    @Override
+    public String toString() {
+        StringBuffer sb = new StringBuffer(super.toString());
+        return sb.append("[associationID:")
+                 .append(associationID())
+                 .append(", maxIn:")
+                 .append(maxInboundStreams())
+                 .append(", maxOut:")
+                 .append(maxOutboundStreams())
+                 .append("]")
+                 .toString();
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/solaris/classes/sun/nio/ch/sctp/PeerAddrChange.java	Sat Feb 18 16:11:47 2012 -0800
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package sun.nio.ch.sctp;
+
+import java.net.SocketAddress;
+import com.sun.nio.sctp.Association;
+import com.sun.nio.sctp.PeerAddressChangeNotification;
+
+/**
+ * An implementation of PeerAddressChangeNotification
+ */
+public class PeerAddrChange extends PeerAddressChangeNotification
+    implements SctpNotification
+{
+    /* static final ints so that they can be referenced from native */
+    private final static int SCTP_ADDR_AVAILABLE = 1;
+    private final static int SCTP_ADDR_UNREACHABLE = 2;
+    private final static int SCTP_ADDR_REMOVED = 3;
+    private final static int SCTP_ADDR_ADDED = 4;
+    private final static int SCTP_ADDR_MADE_PRIM = 5;
+    private final static int SCTP_ADDR_CONFIRMED =6;
+
+    private Association association;
+
+    /* assocId is used to lookup the association before the notification is
+     * returned to user code */
+    private int assocId;
+    private SocketAddress address;
+    private AddressChangeEvent event;
+
+    /* Invoked from native */
+    private PeerAddrChange(int assocId, SocketAddress address, int intEvent) {
+        switch (intEvent) {
+            case SCTP_ADDR_AVAILABLE :
+                this.event = AddressChangeEvent.ADDR_AVAILABLE;
+                break;
+            case SCTP_ADDR_UNREACHABLE :
+                this.event = AddressChangeEvent.ADDR_UNREACHABLE;
+                break;
+            case SCTP_ADDR_REMOVED :
+                this.event = AddressChangeEvent.ADDR_REMOVED;
+                break;
+            case SCTP_ADDR_ADDED :
+                this.event = AddressChangeEvent.ADDR_ADDED;
+                break;
+            case SCTP_ADDR_MADE_PRIM :
+                this.event = AddressChangeEvent.ADDR_MADE_PRIMARY;
+                break;
+            case SCTP_ADDR_CONFIRMED :
+                this.event = AddressChangeEvent.ADDR_CONFIRMED;
+                break;
+            default:
+                throw new AssertionError("Unknown event type");
+        }
+        this.assocId = assocId;
+        this.address = address;
+    }
+
+    @Override
+    public int assocId() {
+        return assocId;
+    }
+
+    @Override
+    public void setAssociation(Association association) {
+        this.association = association;
+    }
+
+    @Override
+    public SocketAddress address() {
+        assert address != null;
+        return address;
+    }
+
+    @Override
+    public Association association() {
+        assert association != null;
+        return association;
+    }
+
+    @Override
+    public AddressChangeEvent event() {
+        assert event != null;
+        return event;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(super.toString()).append(" [");
+        sb.append("Address: ").append(address);
+        sb.append(", Association:").append(association);
+        sb.append(", Event: ").append(event).append("]");
+        return sb.toString();
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/solaris/classes/sun/nio/ch/sctp/ResultContainer.java	Sat Feb 18 16:11:47 2012 -0800
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package sun.nio.ch.sctp;
+
+/**
+ * Wraps the actual message or notification so that it can be
+ * set and returned from the native receive implementation.
+ */
+public class ResultContainer {
+    /* static final ints so that they can be referenced from native */
+    static final int NOTHING = 0;
+    static final int MESSAGE = 1;
+    static final int SEND_FAILED = 2;
+    static final int ASSOCIATION_CHANGED = 3;
+    static final int PEER_ADDRESS_CHANGED = 4;
+    static final int SHUTDOWN = 5;
+
+    private Object value;
+    private int type;
+
+    int type() {
+        return type;
+    }
+
+    boolean hasSomething() {
+        return type() != NOTHING;
+    }
+
+    boolean isNotification() {
+        return type() != MESSAGE && type() != NOTHING ? true : false;
+    }
+
+    void clear() {
+        type = NOTHING;
+        value = null;
+    }
+
+    SctpNotification notification() {
+        assert type() != MESSAGE && type() != NOTHING;
+
+        return (SctpNotification) value;
+    }
+
+    MessageInfoImpl getMessageInfo() {
+        assert type() == MESSAGE;
+
+        if (value instanceof MessageInfoImpl)
+            return (MessageInfoImpl) value;
+
+        return null;
+    }
+
+    SendFailed getSendFailed() {
+        assert type() == SEND_FAILED;
+
+        if (value instanceof SendFailed)
+            return (SendFailed) value;
+
+        return null;
+    }
+
+    AssociationChange getAssociationChanged() {
+        assert type() == ASSOCIATION_CHANGED;
+
+        if (value instanceof AssociationChange)
+            return (AssociationChange) value;
+
+        return null;
+    }
+
+    PeerAddrChange getPeerAddressChanged() {
+        assert type() == PEER_ADDRESS_CHANGED;
+
+        if (value instanceof PeerAddrChange)
+            return (PeerAddrChange) value;
+
+        return null;
+    }
+
+    Shutdown getShutdown() {
+        assert type() == SHUTDOWN;
+
+        if (value instanceof Shutdown)
+            return (Shutdown) value;
+
+        return null;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append("Type: ");
+        switch (type) {
+            case NOTHING:              sb.append("NOTHING");             break;
+            case MESSAGE:              sb.append("MESSAGE");             break;
+            case SEND_FAILED:          sb.append("SEND FAILED");         break;
+            case ASSOCIATION_CHANGED:  sb.append("ASSOCIATION CHANGE");  break;
+            case PEER_ADDRESS_CHANGED: sb.append("PEER ADDRESS CHANGE"); break;
+            case SHUTDOWN:             sb.append("SHUTDOWN");            break;
+            default :                  sb.append("Unknown result type");
+        }
+        sb.append(", Value: ");
+        sb.append((value == null) ? "null" : value.toString());
+        return sb.toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/solaris/classes/sun/nio/ch/sctp/SctpChannelImpl.java	Sat Feb 18 16:11:47 2012 -0800
@@ -0,0 +1,1106 @@
+/*
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package sun.nio.ch.sctp;
+
+import java.net.InetAddress;
+import java.net.SocketAddress;
+import java.net.SocketException;
+import java.net.InetSocketAddress;
+import java.io.FileDescriptor;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.Set;
+import java.util.HashSet;
+import java.nio.ByteBuffer;
+import java.nio.channels.SelectionKey;
+import java.nio.channels.ClosedChannelException;
+import java.nio.channels.ConnectionPendingException;
+import java.nio.channels.NoConnectionPendingException;
+import java.nio.channels.AlreadyConnectedException;
+import java.nio.channels.NotYetBoundException;
+import java.nio.channels.NotYetConnectedException;
+import java.nio.channels.spi.SelectorProvider;
+import com.sun.nio.sctp.AbstractNotificationHandler;
+import com.sun.nio.sctp.Association;
+import com.sun.nio.sctp.AssociationChangeNotification;
+import com.sun.nio.sctp.HandlerResult;
+import com.sun.nio.sctp.IllegalReceiveException;
+import com.sun.nio.sctp.InvalidStreamException;
+import com.sun.nio.sctp.IllegalUnbindException;
+import com.sun.nio.sctp.MessageInfo;
+import com.sun.nio.sctp.NotificationHandler;
+import com.sun.nio.sctp.SctpChannel;
+import com.sun.nio.sctp.SctpSocketOption;
+import sun.nio.ch.DirectBuffer;
+import sun.nio.ch.IOStatus;
+import sun.nio.ch.IOUtil;
+import sun.nio.ch.NativeThread;
+import sun.nio.ch.Net;
+import sun.nio.ch.PollArrayWrapper;
+import sun.nio.ch.SelChImpl;
+import sun.nio.ch.SelectionKeyImpl;
+import sun.nio.ch.Util;
+import static com.sun.nio.sctp.SctpStandardSocketOptions.*;
+import static sun.nio.ch.sctp.ResultContainer.SEND_FAILED;
+import static sun.nio.ch.sctp.ResultContainer.ASSOCIATION_CHANGED;
+import static sun.nio.ch.sctp.ResultContainer.PEER_ADDRESS_CHANGED;
+import static sun.nio.ch.sctp.ResultContainer.SHUTDOWN;
+
+/**
+ * An implementation of an SctpChannel
+ */
+public class SctpChannelImpl extends SctpChannel
+    implements SelChImpl
+{
+    private final FileDescriptor fd;
+
+    private final int fdVal;
+
+    /* IDs of native threads doing send and receivess, for signalling */
+    private volatile long receiverThread = 0;
+    private volatile long senderThread = 0;
+
+    /* Lock held by current receiving or connecting thread */
+    private final Object receiveLock = new Object();
+
+    /* Lock held by current sending or connecting thread */
+    private final Object sendLock = new Object();
+
+    private final ThreadLocal<Boolean> receiveInvoked =
+        new ThreadLocal<Boolean>() {
+             @Override protected Boolean initialValue() {
+                 return Boolean.FALSE;
+            }
+    };
+
+    /* Lock held by any thread that modifies the state fields declared below
+       DO NOT invoke a blocking I/O operation while holding this lock! */
+    private final Object stateLock = new Object();
+
+    private enum ChannelState {
+        UNINITIALIZED,
+        UNCONNECTED,
+        PENDING,
+        CONNECTED,
+        KILLPENDING,
+        KILLED,
+    }
+    /* -- The following fields are protected by stateLock -- */
+    private ChannelState state = ChannelState.UNINITIALIZED;
+
+    /* Binding; Once bound the port will remain constant. */
+    int port = -1;
+    private HashSet<InetSocketAddress> localAddresses = new HashSet<InetSocketAddress>();
+    /* Has the channel been bound to the wildcard address */
+    private boolean wildcard; /* false */
+    //private InetSocketAddress remoteAddress = null;
+
+    /* Input/Output open */
+    private boolean readyToConnect;
+
+    /* Shutdown */
+    private boolean isShutdown;
+
+    private Association association;
+
+    private Set<SocketAddress> remoteAddresses = Collections.emptySet();
+
+    /* -- End of fields protected by stateLock -- */
+
+    /**
+     * Constructor for normal connecting sockets
+     */
+    public SctpChannelImpl(SelectorProvider provider) throws IOException {
+        //TODO: update provider remove public modifier
+        super(provider);
+        this.fd = SctpNet.socket(true);
+        this.fdVal = IOUtil.fdVal(fd);
+        this.state = ChannelState.UNCONNECTED;
+    }
+
+    /**
+     * Constructor for sockets obtained from server sockets
+     */
+    public SctpChannelImpl(SelectorProvider provider, FileDescriptor fd)
+         throws IOException {
+        this(provider, fd, null);
+    }
+
+    /**
+     * Constructor for sockets obtained from branching
+     */
+    public SctpChannelImpl(SelectorProvider provider,
+                           FileDescriptor fd,
+                           Association association)
+            throws IOException {
+        super(provider);
+        this.fd = fd;
+        this.fdVal = IOUtil.fdVal(fd);
+        this.state = ChannelState.CONNECTED;
+        port = (Net.localAddress(fd)).getPort();
+
+        if (association != null) { /* branched */
+            this.association = association;
+        } else { /* obtained from server channel */
+            /* Receive COMM_UP */
+            ByteBuffer buf = Util.getTemporaryDirectBuffer(50);
+            try {
+                receive(buf, null, null, true);
+            } finally {
+                Util.releaseTemporaryDirectBuffer(buf);
+            }
+        }
+    }
+
+    /**
+     * Binds the channel's socket to a local address.
+     */
+    @Override
+    public SctpChannel bind(SocketAddress local) throws IOException {
+        synchronized (receiveLock) {
+            synchronized (sendLock) {
+                synchronized (stateLock) {
+                    ensureOpenAndUnconnected();
+                    if (isBound())
+                        SctpNet.throwAlreadyBoundException();
+                    InetSocketAddress isa = (local == null) ?
+                        new InetSocketAddress(0) : Net.checkAddress(local);
+                    Net.bind(fd, isa.getAddress(), isa.getPort());
+                    InetSocketAddress boundIsa = Net.localAddress(fd);
+                    port = boundIsa.getPort();
+                    localAddresses.add(isa);
+                    if (isa.getAddress().isAnyLocalAddress())
+                        wildcard = true;
+                }
+            }
+        }
+        return this;
+    }
+
+    @Override
+    public SctpChannel bindAddress(InetAddress address)
+            throws IOException {
+        bindUnbindAddress(address, true);
+        localAddresses.add(new InetSocketAddress(address, port));
+        return this;
+    }
+
+    @Override
+    public SctpChannel unbindAddress(InetAddress address)
+            throws IOException {
+        bindUnbindAddress(address, false);
+        localAddresses.remove(new InetSocketAddress(address, port));
+        return this;
+    }
+
+    private SctpChannel bindUnbindAddress(InetAddress address, boolean add)
+            throws IOException {
+        if (address == null)
+            throw new IllegalArgumentException();
+
+        synchronized (receiveLock) {
+            synchronized (sendLock) {
+                synchronized (stateLock) {
+                    if (!isOpen())
+                        throw new ClosedChannelException();
+                    if (!isBound())
+                        throw new NotYetBoundException();
+                    if (wildcard)
+                        throw new IllegalStateException(
+                                "Cannot add or remove addresses from a channel that is bound to the wildcard address");
+                    if (address.isAnyLocalAddress())
+                        throw new IllegalArgumentException(
+                                "Cannot add or remove the wildcard address");
+                    if (add) {
+                        for (InetSocketAddress addr : localAddresses) {
+                            if (addr.getAddress().equals(address)) {
+                                SctpNet.throwAlreadyBoundException();
+                            }
+                        }
+                    } else { /*removing */
+                        /* Verify that there is more than one address
+                         * and that address is already bound */
+                        if (localAddresses.size() <= 1)
+                            throw new IllegalUnbindException("Cannot remove address from a channel with only one address bound");
+                        boolean foundAddress = false;
+                        for (InetSocketAddress addr : localAddresses) {
+                            if (addr.getAddress().equals(address)) {
+                                foundAddress = true;
+                                break;
+                            }
+                        }
+                        if (!foundAddress )
+                            throw new IllegalUnbindException("Cannot remove address from a channel that is not bound to that address");
+                    }
+
+                    SctpNet.bindx(fdVal, new InetAddress[]{address}, port, add);
+
+                    /* Update our internal Set to reflect the addition/removal */
+                    if (add)
+                        localAddresses.add(new InetSocketAddress(address, port));
+                    else {
+                        for (InetSocketAddress addr : localAddresses) {
+                            if (addr.getAddress().equals(address)) {
+                                localAddresses.remove(addr);
+                                break;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        return this;
+    }
+
+    private boolean isBound() {
+        synchronized (stateLock) {
+            return port == -1 ? false : true;
+        }
+    }
+
+    private boolean isConnected() {
+        synchronized (stateLock) {
+            return (state == ChannelState.CONNECTED);
+        }
+    }
+
+    private void ensureOpenAndUnconnected() throws IOException {
+        synchronized (stateLock) {
+            if (!isOpen())
+                throw new ClosedChannelException();
+            if (isConnected())
+                throw new AlreadyConnectedException();
+            if (state == ChannelState.PENDING)
+                throw new ConnectionPendingException();
+        }
+    }
+
+    private boolean ensureReceiveOpen() throws ClosedChannelException {
+        synchronized (stateLock) {
+            if (!isOpen())
+                throw new ClosedChannelException();
+            if (!isConnected())
+                throw new NotYetConnectedException();
+            else
+                return true;
+        }
+    }
+
+    private void ensureSendOpen() throws ClosedChannelException {
+        synchronized (stateLock) {
+            if (!isOpen())
+                throw new ClosedChannelException();
+            if (isShutdown)
+                throw new ClosedChannelException();
+            if (!isConnected())
+                throw new NotYetConnectedException();
+        }
+    }
+
+    private void receiverCleanup() throws IOException {
+        synchronized (stateLock) {
+            receiverThread = 0;
+            if (state == ChannelState.KILLPENDING)
+                kill();
+        }
+    }
+
+    private void senderCleanup() throws IOException {
+        synchronized (stateLock) {
+            senderThread = 0;
+            if (state == ChannelState.KILLPENDING)
+                kill();
+        }
+    }
+
+    @Override
+    public Association association() throws ClosedChannelException {
+        synchronized (stateLock) {
+            if (!isOpen())
+                throw new ClosedChannelException();
+            if (!isConnected())
+                return null;
+
+            return association;
+        }
+    }
+
+    @Override
+    public boolean connect(SocketAddress endpoint) throws IOException {
+        synchronized (receiveLock) {
+            synchronized (sendLock) {
+                ensureOpenAndUnconnected();
+                InetSocketAddress isa = Net.checkAddress(endpoint);
+                SecurityManager sm = System.getSecurityManager();
+                if (sm != null)
+                    sm.checkConnect(isa.getAddress().getHostAddress(),
+                                    isa.getPort());
+                synchronized (blockingLock()) {
+                    int n = 0;
+                    try {
+                        try {
+                            begin();
+                            synchronized (stateLock) {
+                                if (!isOpen()) {
+                                    return false;
+                                }
+                                receiverThread = NativeThread.current();
+                            }
+                            for (;;) {
+                                InetAddress ia = isa.getAddress();
+                                if (ia.isAnyLocalAddress())
+                                    ia = InetAddress.getLocalHost();
+                                n = SctpNet.connect(fdVal, ia, isa.getPort());
+                                if (  (n == IOStatus.INTERRUPTED)
+                                      && isOpen())
+                                    continue;
+                                break;
+                            }
+                        } finally {
+                            receiverCleanup();
+                            end((n > 0) || (n == IOStatus.UNAVAILABLE));
+                            assert IOStatus.check(n);
+                        }
+                    } catch (IOException x) {
+                        /* If an exception was thrown, close the channel after
+                         * invoking end() so as to avoid bogus
+                         * AsynchronousCloseExceptions */
+                        close();
+                        throw x;
+                    }
+
+                    if (n > 0) {
+                        synchronized (stateLock) {
+                            /* Connection succeeded */
+                            state = ChannelState.CONNECTED;
+                            if (!isBound()) {
+                                InetSocketAddress boundIsa =
+                                        Net.localAddress(fd);
+                                port = boundIsa.getPort();
+                            }
+
+                            /* Receive COMM_UP */
+                            ByteBuffer buf = Util.getTemporaryDirectBuffer(50);
+                            try {
+                                receive(buf, null, null, true);
+                            } finally {
+                                Util.releaseTemporaryDirectBuffer(buf);
+                            }
+
+                            /* cache remote addresses */
+                            try {
+                                remoteAddresses = getRemoteAddresses();
+                            } catch (IOException unused) { /* swallow exception */ }
+
+                            return true;
+                        }
+                    } else  {
+                        synchronized (stateLock) {
+                            /* If nonblocking and no exception then connection
+                             * pending; disallow another invocation */
+                            if (!isBlocking())
+                                state = ChannelState.PENDING;
+                            else
+                                assert false;
+                        }
+                    }
+                }
+                return false;
+            }
+        }
+    }
+
+    @Override
+    public boolean connect(SocketAddress endpoint,
+                           int maxOutStreams,
+                           int maxInStreams)
+            throws IOException {
+        ensureOpenAndUnconnected();
+        return setOption(SCTP_INIT_MAXSTREAMS, InitMaxStreams.
+                create(maxInStreams, maxOutStreams)).connect(endpoint);
+
+    }
+
+    @Override
+    public boolean isConnectionPending() {
+        synchronized (stateLock) {
+            return (state == ChannelState.PENDING);
+        }
+    }
+
+    @Override
+    public boolean finishConnect() throws IOException {
+        synchronized (receiveLock) {
+            synchronized (sendLock) {
+                synchronized (stateLock) {
+                    if (!isOpen())
+                        throw new ClosedChannelException();
+                    if (isConnected())
+                        return true;
+                    if (state != ChannelState.PENDING)
+                        throw new NoConnectionPendingException();
+                }
+                int n = 0;
+                try {
+                    try {
+                        begin();
+                        synchronized (blockingLock()) {
+                            synchronized (stateLock) {
+                                if (!isOpen()) {
+                                    return false;
+                                }
+                                receiverThread = NativeThread.current();
+                            }
+                            if (!isBlocking()) {
+                                for (;;) {
+                                    n = checkConnect(fd, false, readyToConnect);
+                                    if (  (n == IOStatus.INTERRUPTED)
+                                          && isOpen())
+                                        continue;
+                                    break;
+                                }
+                            } else {
+                                for (;;) {
+                                    n = checkConnect(fd, true, readyToConnect);
+                                    if (n == 0) {
+                                        // Loop in case of
+                                        // spurious notifications
+                                        continue;
+                                    }
+                                    if (  (n == IOStatus.INTERRUPTED)
+                                          && isOpen())
+                                        continue;
+                                    break;
+                                }
+                            }
+                        }
+                    } finally {
+                        synchronized (stateLock) {
+                            receiverThread = 0;
+                            if (state == ChannelState.KILLPENDING) {
+                                kill();
+                                /* poll()/getsockopt() does not report
+                                 * error (throws exception, with n = 0)
+                                 * on Linux platform after dup2 and
+                                 * signal-wakeup. Force n to 0 so the
+                                 * end() can throw appropriate exception */
+                                n = 0;
+                            }
+                        }
+                        end((n > 0) || (n == IOStatus.UNAVAILABLE));
+                        assert IOStatus.check(n);
+                    }
+                } catch (IOException x) {
+                    /* If an exception was thrown, close the channel after
+                     * invoking end() so as to avoid bogus
+                     * AsynchronousCloseExceptions */
+                    close();
+                    throw x;
+                }
+
+                if (n > 0) {
+                    synchronized (stateLock) {
+                        state = ChannelState.CONNECTED;
+                        if (!isBound()) {
+                            InetSocketAddress boundIsa =
+                                    Net.localAddress(fd);
+                            port = boundIsa.getPort();
+                        }
+
+                        /* Receive COMM_UP */
+                        ByteBuffer buf = Util.getTemporaryDirectBuffer(50);
+                        try {
+                            receive(buf, null, null, true);
+                        } finally {
+                            Util.releaseTemporaryDirectBuffer(buf);
+                        }
+
+                        /* cache remote addresses */
+                        try {
+                            remoteAddresses = getRemoteAddresses();
+                        } catch (IOException unused) { /* swallow exception */ }
+
+                        return true;
+                    }
+                }
+            }
+        }
+        return false;
+    }
+
+    @Override
+    protected void implConfigureBlocking(boolean block) throws IOException {
+        IOUtil.configureBlocking(fd, block);
+    }
+
+    @Override
+    public void implCloseSelectableChannel() throws IOException {
+        synchronized (stateLock) {
+            SctpNet.preClose(fdVal);
+
+            if (receiverThread != 0)
+                NativeThread.signal(receiverThread);
+
+            if (senderThread != 0)
+                NativeThread.signal(senderThread);
+
+            if (!isRegistered())
+                kill();
+        }
+    }
+
+    @Override
+    public FileDescriptor getFD() {
+        return fd;
+    }
+
+    @Override
+    public int getFDVal() {
+        return fdVal;
+    }
+
+    /**
+     * Translates native poll revent ops into a ready operation ops
+     */
+    private boolean translateReadyOps(int ops, int initialOps, SelectionKeyImpl sk) {
+        int intOps = sk.nioInterestOps();
+        int oldOps = sk.nioReadyOps();
+        int newOps = initialOps;
+
+        if ((ops & PollArrayWrapper.POLLNVAL) != 0) {
+            /* This should only happen if this channel is pre-closed while a
+             * selection operation is in progress
+             * ## Throw an error if this channel has not been pre-closed */
+            return false;
+        }
+
+        if ((ops & (PollArrayWrapper.POLLERR
+                    | PollArrayWrapper.POLLHUP)) != 0) {
+            newOps = intOps;
+            sk.nioReadyOps(newOps);
+            /* No need to poll again in checkConnect,
+             * the error will be detected there */
+            readyToConnect = true;
+            return (newOps & ~oldOps) != 0;
+        }
+
+        if (((ops & PollArrayWrapper.POLLIN) != 0) &&
+            ((intOps & SelectionKey.OP_READ) != 0) &&
+            isConnected())
+            newOps |= SelectionKey.OP_READ;
+
+        if (((ops & PollArrayWrapper.POLLCONN) != 0) &&
+            ((intOps & SelectionKey.OP_CONNECT) != 0) &&
+            ((state == ChannelState.UNCONNECTED) || (state == ChannelState.PENDING))) {
+            newOps |= SelectionKey.OP_CONNECT;
+            readyToConnect = true;
+        }
+
+        if (((ops & PollArrayWrapper.POLLOUT) != 0) &&
+            ((intOps & SelectionKey.OP_WRITE) != 0) &&
+            isConnected())
+            newOps |= SelectionKey.OP_WRITE;
+
+        sk.nioReadyOps(newOps);
+        return (newOps & ~oldOps) != 0;
+    }
+
+    @Override
+    public boolean translateAndUpdateReadyOps(int ops, SelectionKeyImpl sk) {
+        return translateReadyOps(ops, sk.nioReadyOps(), sk);
+    }
+
+    @Override
+    @SuppressWarnings("all")
+    public boolean translateAndSetReadyOps(int ops, SelectionKeyImpl sk) {
+        return translateReadyOps(ops, 0, sk);
+    }
+
+    @Override
+    public void translateAndSetInterestOps(int ops, SelectionKeyImpl sk) {
+        int newOps = 0;
+        if ((ops & SelectionKey.OP_READ) != 0)
+            newOps |= PollArrayWrapper.POLLIN;
+        if ((ops & SelectionKey.OP_WRITE) != 0)
+            newOps |= PollArrayWrapper.POLLOUT;
+        if ((ops & SelectionKey.OP_CONNECT) != 0)
+            newOps |= PollArrayWrapper.POLLCONN;
+        sk.selector.putEventOps(sk, newOps);
+    }
+
+    @Override
+    public void kill() throws IOException {
+        synchronized (stateLock) {
+            if (state == ChannelState.KILLED)
+                return;
+            if (state == ChannelState.UNINITIALIZED) {
+                state = ChannelState.KILLED;
+                return;
+            }
+            assert !isOpen() && !isRegistered();
+
+            /* Postpone the kill if there is a waiting reader
+             * or writer thread. */
+            if (receiverThread == 0 && senderThread == 0) {
+                SctpNet.close(fdVal);
+                state = ChannelState.KILLED;
+            } else {
+                state = ChannelState.KILLPENDING;
+            }
+        }
+    }
+
+    @Override
+    public <T> SctpChannel setOption(SctpSocketOption<T> name, T value)
+            throws IOException {
+        if (name == null)
+            throw new NullPointerException();
+        if (!supportedOptions().contains(name))
+            throw new UnsupportedOperationException("'" + name + "' not supported");
+
+        synchronized (stateLock) {
+            if (!isOpen())
+                throw new ClosedChannelException();
+
+            SctpNet.setSocketOption(fdVal, name, value, 0 /*oneToOne*/);
+        }
+        return this;
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public <T> T getOption(SctpSocketOption<T> name) throws IOException {
+        if (name == null)
+            throw new NullPointerException();
+        if (!supportedOptions().contains(name))
+            throw new UnsupportedOperationException("'" + name + "' not supported");
+
+        synchronized (stateLock) {
+            if (!isOpen())
+                throw new ClosedChannelException();
+
+            return (T)SctpNet.getSocketOption(fdVal, name, 0 /*oneToOne*/);
+        }
+    }
+
+    private static class DefaultOptionsHolder {
+        static final Set<SctpSocketOption<?>> defaultOptions = defaultOptions();
+
+        private static Set<SctpSocketOption<?>> defaultOptions() {
+            HashSet<SctpSocketOption<?>> set = new HashSet<SctpSocketOption<?>>(10);
+            set.add(SCTP_DISABLE_FRAGMENTS);
+            set.add(SCTP_EXPLICIT_COMPLETE);
+            set.add(SCTP_FRAGMENT_INTERLEAVE);
+            set.add(SCTP_INIT_MAXSTREAMS);
+            set.add(SCTP_NODELAY);
+            set.add(SCTP_PRIMARY_ADDR);
+            set.add(SCTP_SET_PEER_PRIMARY_ADDR);
+            set.add(SO_SNDBUF);
+            set.add(SO_RCVBUF);
+            set.add(SO_LINGER);
+            return Collections.unmodifiableSet(set);
+        }
+    }
+
+    @Override
+    public final Set<SctpSocketOption<?>> supportedOptions() {
+        return DefaultOptionsHolder.defaultOptions;
+    }
+
+    @Override
+    public <T> MessageInfo receive(ByteBuffer buffer,
+                                   T attachment,
+                                   NotificationHandler<T> handler)
+            throws IOException {
+        return receive(buffer, attachment, handler, false);
+    }
+
+    private <T> MessageInfo receive(ByteBuffer buffer,
+                                    T attachment,
+                                    NotificationHandler<T> handler,
+                                    boolean fromConnect)
+            throws IOException {
+        if (buffer == null)
+            throw new IllegalArgumentException("buffer cannot be null");
+
+        if (buffer.isReadOnly())
+            throw new IllegalArgumentException("Read-only buffer");
+
+        if (receiveInvoked.get())
+            throw new IllegalReceiveException(
+                    "cannot invoke receive from handler");
+        receiveInvoked.set(Boolean.TRUE);
+
+        try {
+            ResultContainer resultContainer = new ResultContainer();
+            do {
+                resultContainer.clear();
+                synchronized (receiveLock) {
+                    if (!ensureReceiveOpen())
+                        return null;
+
+                    int n = 0;
+                    try {
+                        begin();
+
+                        synchronized (stateLock) {
+                            if(!isOpen())
+                                return null;
+                            receiverThread = NativeThread.current();
+                        }
+
+                        do {
+                            n = receive(fdVal, buffer, resultContainer, fromConnect);
+                        } while ((n == IOStatus.INTERRUPTED) && isOpen());
+                    } finally {
+                        receiverCleanup();
+                        end((n > 0) || (n == IOStatus.UNAVAILABLE));
+                        assert IOStatus.check(n);
+                    }
+
+                    if (!resultContainer.isNotification()) {
+                        /* message or nothing */
+                        if (resultContainer.hasSomething()) {
+                            /* Set the association before returning */
+                            MessageInfoImpl info =
+                                    resultContainer.getMessageInfo();
+                            synchronized (stateLock) {
+                                assert association != null;
+                                info.setAssociation(association);
+                            }
+                            return info;
+                        } else
+                            /* Non-blocking may return null if nothing available*/
+                            return null;
+                    } else { /* notification */
+                        synchronized (stateLock) {
+                            handleNotificationInternal(
+                                    resultContainer);
+                        }
+                    }
+
+                    if (fromConnect)  {
+                        /* If we reach here, then it was connect that invoked
+                         * receive and received the COMM_UP. We have already
+                         * handled the COMM_UP with the internal notification
+                         * handler. Simply return. */
+                        return null;
+                    }
+                }  /* receiveLock */
+            } while (handler == null ? true :
+                (invokeNotificationHandler(resultContainer, handler, attachment)
+                 == HandlerResult.CONTINUE));
+
+            return null;
+        } finally {
+            receiveInvoked.set(Boolean.FALSE);
+        }
+    }
+
+    private int receive(int fd,
+                        ByteBuffer dst,
+                        ResultContainer resultContainer,
+                        boolean peek)
+            throws IOException {
+        int pos = dst.position();
+        int lim = dst.limit();
+        assert (pos <= lim);
+        int rem = (pos <= lim ? lim - pos : 0);
+        if (dst instanceof DirectBuffer && rem > 0)
+            return receiveIntoNativeBuffer(fd, resultContainer, dst, rem, pos, peek);
+
+        /* Substitute a native buffer */
+        int newSize = Math.max(rem, 1);
+        ByteBuffer bb = Util.getTemporaryDirectBuffer(newSize);
+        try {
+            int n = receiveIntoNativeBuffer(fd, resultContainer, bb, newSize, 0, peek);
+            bb.flip();
+            if (n > 0 && rem > 0)
+                dst.put(bb);
+            return n;
+        } finally {
+            Util.releaseTemporaryDirectBuffer(bb);
+        }
+    }
+
+    private int receiveIntoNativeBuffer(int fd,
+                                        ResultContainer resultContainer,
+                                        ByteBuffer bb,
+                                        int rem,
+                                        int pos,
+                                        boolean peek)
+        throws IOException
+    {
+        int n = receive0(fd, resultContainer, ((DirectBuffer)bb).address() + pos, rem, peek);
+
+        if (n > 0)
+            bb.position(pos + n);
+        return n;
+    }
+
+    private InternalNotificationHandler internalNotificationHandler =
+            new InternalNotificationHandler();
+
+    private void handleNotificationInternal(ResultContainer resultContainer)
+    {
+        invokeNotificationHandler(resultContainer,
+                internalNotificationHandler, null);
+    }
+
+    private class InternalNotificationHandler
+            extends AbstractNotificationHandler<Object>
+    {
+        @Override
+        public HandlerResult handleNotification(
+                AssociationChangeNotification not, Object unused) {
+            if (not.event().equals(
+                    AssociationChangeNotification.AssocChangeEvent.COMM_UP) &&
+                    association == null) {
+                AssociationChange sac = (AssociationChange) not;
+                association = new AssociationImpl
+                       (sac.assocId(), sac.maxInStreams(), sac.maxOutStreams());
+            }
+            return HandlerResult.CONTINUE;
+        }
+    }
+
+    private <T> HandlerResult invokeNotificationHandler
+                                 (ResultContainer resultContainer,
+                                  NotificationHandler<T> handler,
+                                  T attachment) {
+        SctpNotification notification = resultContainer.notification();
+        synchronized (stateLock) {
+            notification.setAssociation(association);
+        }
+
+        if (!(handler instanceof AbstractNotificationHandler)) {
+            return handler.handleNotification(notification, attachment);
+        }
+
+        /* AbstractNotificationHandler */
+        AbstractNotificationHandler<T> absHandler =
+                (AbstractNotificationHandler<T>)handler;
+        switch(resultContainer.type()) {
+            case ASSOCIATION_CHANGED :
+                return absHandler.handleNotification(
+                        resultContainer.getAssociationChanged(), attachment);
+            case PEER_ADDRESS_CHANGED :
+                return absHandler.handleNotification(
+                        resultContainer.getPeerAddressChanged(), attachment);
+            case SEND_FAILED :
+                return absHandler.handleNotification(
+                        resultContainer.getSendFailed(), attachment);
+            case SHUTDOWN :
+                return absHandler.handleNotification(
+                        resultContainer.getShutdown(), attachment);
+            default :
+                /* implementation specific handlers */
+                return absHandler.handleNotification(
+                        resultContainer.notification(), attachment);
+        }
+    }
+
+    private void checkAssociation(Association sendAssociation) {
+        synchronized (stateLock) {
+            if (sendAssociation != null && !sendAssociation.equals(association)) {
+                throw new IllegalArgumentException(
+                        "Cannot send to another association");
+            }
+        }
+    }
+
+    private void checkStreamNumber(int streamNumber) {
+        synchronized (stateLock) {
+            if (association != null) {
+                if (streamNumber < 0 ||
+                      streamNumber >= association.maxOutboundStreams())
+                    throw new InvalidStreamException();
+            }
+        }
+    }
+
+    /* TODO: Add support for ttl and isComplete to both 121 12M
+     *       SCTP_EOR not yet supported on reference platforms
+     *       TTL support limited...
+     */
+    @Override
+    public int send(ByteBuffer buffer, MessageInfo messageInfo)
+            throws IOException {
+        if (buffer == null)
+            throw new IllegalArgumentException("buffer cannot be null");
+
+        if (messageInfo == null)
+            throw new IllegalArgumentException("messageInfo cannot be null");
+
+        checkAssociation(messageInfo.association());
+        checkStreamNumber(messageInfo.streamNumber());
+
+        synchronized (sendLock) {
+            ensureSendOpen();
+
+            int n = 0;
+            try {
+                begin();
+
+                synchronized (stateLock) {
+                    if(!isOpen())
+                        return 0;
+                    senderThread = NativeThread.current();
+                }
+
+                do {
+                    n = send(fdVal, buffer, messageInfo);
+                } while ((n == IOStatus.INTERRUPTED) && isOpen());
+
+                return IOStatus.normalize(n);
+            } finally {
+                senderCleanup();
+                end((n > 0) || (n == IOStatus.UNAVAILABLE));
+                assert IOStatus.check(n);
+            }
+        }
+    }
+
+    private int send(int fd, ByteBuffer src, MessageInfo messageInfo)
+            throws IOException {
+        int streamNumber = messageInfo.streamNumber();
+        SocketAddress target = messageInfo.address();
+        boolean unordered = messageInfo.isUnordered();
+        int ppid = messageInfo.payloadProtocolID();
+
+        if (src instanceof DirectBuffer)
+            return sendFromNativeBuffer(fd, src, target, streamNumber,
+                    unordered, ppid);
+
+        /* Substitute a native buffer */
+        int pos = src.position();
+        int lim = src.limit();
+        assert (pos <= lim && streamNumber >= 0);
+
+        int rem = (pos <= lim ? lim - pos : 0);
+        ByteBuffer bb = Util.getTemporaryDirectBuffer(rem);
+        try {
+            bb.put(src);
+            bb.flip();
+            /* Do not update src until we see how many bytes were written */
+            src.position(pos);
+
+            int n = sendFromNativeBuffer(fd, bb, target, streamNumber,
+                    unordered, ppid);
+            if (n > 0) {
+                /* now update src */
+                src.position(pos + n);
+            }
+            return n;
+        } finally {
+            Util.releaseTemporaryDirectBuffer(bb);
+        }
+    }
+
+    private int sendFromNativeBuffer(int fd,
+                                     ByteBuffer bb,
+                                     SocketAddress target,
+                                     int streamNumber,
+                                     boolean unordered,
+                                     int ppid)
+            throws IOException {
+        int pos = bb.position();
+        int lim = bb.limit();
+        assert (pos <= lim);
+        int rem = (pos <= lim ? lim - pos : 0);
+
+        int written = send0(fd, ((DirectBuffer)bb).address() + pos,
+                            rem, target, -1 /*121*/, streamNumber, unordered, ppid);
+        if (written > 0)
+            bb.position(pos + written);
+        return written;
+    }
+
+    @Override
+    public SctpChannel shutdown() throws IOException {
+        synchronized(stateLock) {
+            if (isShutdown)
+                return this;
+
+            ensureSendOpen();
+            SctpNet.shutdown(fdVal, -1);
+            if (senderThread != 0)
+                NativeThread.signal(senderThread);
+            isShutdown = true;
+        }
+        return this;
+    }
+
+    @Override
+    public Set<SocketAddress> getAllLocalAddresses()
+            throws IOException {
+        synchronized (stateLock) {
+            if (!isOpen())
+                throw new ClosedChannelException();
+            if (!isBound())
+                return Collections.emptySet();
+
+            return SctpNet.getLocalAddresses(fdVal);
+        }
+    }
+
+    @Override
+    public Set<SocketAddress> getRemoteAddresses()
+            throws IOException {
+        synchronized (stateLock) {
+            if (!isOpen())
+                throw new ClosedChannelException();
+            if (!isConnected() || isShutdown)
+                return Collections.emptySet();
+
+            try {
+                return SctpNet.getRemoteAddresses(fdVal, 0/*unused*/);
+            } catch (SocketException unused) {
+                /* an open connected channel should always have remote addresses */
+                return remoteAddresses;
+            }
+        }
+    }
+
+    /* Native */
+    private static native void initIDs();
+
+    static native int receive0(int fd, ResultContainer resultContainer,
+            long address, int length, boolean peek) throws IOException;
+
+    static native int send0(int fd, long address, int length,
+            SocketAddress target, int assocId, int streamNumber,
+            boolean unordered, int ppid) throws IOException;
+
+    private static native int checkConnect(FileDescriptor fd, boolean block,
+            boolean ready) throws IOException;
+
+    static {
+        Util.load();   /* loads nio & net native libraries */
+        java.security.AccessController.doPrivileged(
+                new sun.security.action.LoadLibraryAction("sctp"));
+        initIDs();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/solaris/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java	Sat Feb 18 16:11:47 2012 -0800
@@ -0,0 +1,994 @@
+/*
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package sun.nio.ch.sctp;
+
+import java.net.InetAddress;
+import java.net.SocketAddress;
+import java.net.SocketException;
+import java.net.InetSocketAddress;
+import java.io.FileDescriptor;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.Map.Entry;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.HashMap;
+import java.nio.ByteBuffer;
+import java.nio.channels.SelectionKey;
+import java.nio.channels.ClosedChannelException;
+import java.nio.channels.NotYetBoundException;
+import java.nio.channels.spi.SelectorProvider;
+import com.sun.nio.sctp.AbstractNotificationHandler;
+import com.sun.nio.sctp.Association;
+import com.sun.nio.sctp.AssociationChangeNotification;
+import com.sun.nio.sctp.HandlerResult;
+import com.sun.nio.sctp.IllegalReceiveException;
+import com.sun.nio.sctp.InvalidStreamException;
+import com.sun.nio.sctp.IllegalUnbindException;
+import com.sun.nio.sctp.NotificationHandler;
+import com.sun.nio.sctp.MessageInfo;
+import com.sun.nio.sctp.SctpChannel;
+import com.sun.nio.sctp.SctpMultiChannel;
+import com.sun.nio.sctp.SctpSocketOption;
+import sun.nio.ch.DirectBuffer;
+import sun.nio.ch.NativeThread;
+import sun.nio.ch.IOStatus;
+import sun.nio.ch.IOUtil;
+import sun.nio.ch.Net;
+import sun.nio.ch.PollArrayWrapper;
+import sun.nio.ch.SelChImpl;
+import sun.nio.ch.SelectionKeyImpl;
+import sun.nio.ch.Util;
+import static com.sun.nio.sctp.SctpStandardSocketOptions.*;
+import static sun.nio.ch.sctp.ResultContainer.*;
+
+/**
+ * An implementation of SctpMultiChannel
+ */
+public class SctpMultiChannelImpl extends SctpMultiChannel
+    implements SelChImpl
+{
+    private final FileDescriptor fd;
+
+    private final int fdVal;
+
+    /* IDs of native threads doing send and receives, for signalling */
+    private volatile long receiverThread = 0;
+    private volatile long senderThread = 0;
+
+    /* Lock held by current receiving thread */
+    private final Object receiveLock = new Object();
+
+    /* Lock held by current sending thread */
+    private final Object sendLock = new Object();
+
+    /* Lock held by any thread that modifies the state fields declared below
+     * DO NOT invoke a blocking I/O operation while holding this lock! */
+    private final Object stateLock = new Object();
+
+    private enum ChannelState {
+        UNINITIALIZED,
+        KILLPENDING,
+        KILLED,
+    }
+
+    /* -- The following fields are protected by stateLock -- */
+    private ChannelState state = ChannelState.UNINITIALIZED;
+
+    /* Binding: Once bound the port will remain constant. */
+    int port = -1;
+    private HashSet<InetSocketAddress> localAddresses = new HashSet<InetSocketAddress>();
+    /* Has the channel been bound to the wildcard address */
+    private boolean wildcard; /* false */
+
+    /* Keeps a map of addresses to association, and visa versa */
+    private HashMap<SocketAddress, Association> addressMap =
+                         new HashMap<SocketAddress, Association>();
+    private HashMap<Association, Set<SocketAddress>> associationMap =
+                         new HashMap<Association, Set<SocketAddress>>();
+
+    /* -- End of fields protected by stateLock -- */
+
+    /* If an association has been shutdown mark it for removal after
+     * the user handler has been invoked */
+    private final ThreadLocal<Association> associationToRemove =
+        new ThreadLocal<Association>() {
+             @Override protected Association initialValue() {
+                 return null;
+            }
+    };
+
+    /* A notification handler cannot invoke receive */
+    private final ThreadLocal<Boolean> receiveInvoked =
+        new ThreadLocal<Boolean>() {
+             @Override protected Boolean initialValue() {
+                 return Boolean.FALSE;
+            }
+    };
+
+    public SctpMultiChannelImpl(SelectorProvider provider)
+            throws IOException {
+        //TODO: update provider, remove public modifier
+        super(provider);
+        this.fd = SctpNet.socket(false /*one-to-many*/);
+        this.fdVal = IOUtil.fdVal(fd);
+    }
+
+    @Override
+    public SctpMultiChannel bind(SocketAddress local, int backlog)
+            throws IOException {
+        synchronized (receiveLock) {
+            synchronized (sendLock) {
+                synchronized (stateLock) {
+                    ensureOpen();
+                    if (isBound())
+                        SctpNet.throwAlreadyBoundException();
+                    InetSocketAddress isa = (local == null) ?
+                        new InetSocketAddress(0) : Net.checkAddress(local);
+
+                    SecurityManager sm = System.getSecurityManager();
+                    if (sm != null)
+                        sm.checkListen(isa.getPort());
+                    Net.bind(fd, isa.getAddress(), isa.getPort());
+
+                    InetSocketAddress boundIsa = Net.localAddress(fd);
+                    port = boundIsa.getPort();
+                    localAddresses.add(isa);
+                    if (isa.getAddress().isAnyLocalAddress())
+                        wildcard = true;
+
+                    SctpNet.listen(fdVal, backlog < 1 ? 50 : backlog);
+                }
+            }
+        }
+        return this;
+    }
+
+    @Override
+    public SctpMultiChannel bindAddress(InetAddress address)
+            throws IOException {
+        return bindUnbindAddress(address, true);
+    }
+
+    @Override
+    public SctpMultiChannel unbindAddress(InetAddress address)
+            throws IOException {
+        return bindUnbindAddress(address, false);
+    }
+
+    private SctpMultiChannel bindUnbindAddress(InetAddress address,
+                                               boolean add)
+            throws IOException {
+        if (address == null)
+            throw new IllegalArgumentException();
+
+        synchronized (receiveLock) {
+            synchronized (sendLock) {
+                synchronized (stateLock) {
+                    if (!isOpen())
+                        throw new ClosedChannelException();
+                    if (!isBound())
+                        throw new NotYetBoundException();
+                    if (wildcard)
+                        throw new IllegalStateException(
+                                "Cannot add or remove addresses from a channel that is bound to the wildcard address");
+                    if (address.isAnyLocalAddress())
+                        throw new IllegalArgumentException(
+                                "Cannot add or remove the wildcard address");
+                    if (add) {
+                        for (InetSocketAddress addr : localAddresses) {
+                            if (addr.getAddress().equals(address)) {
+                                SctpNet.throwAlreadyBoundException();
+                            }
+                        }
+                    } else { /*removing */
+                        /* Verify that there is more than one address
+                         * and that address is already bound */
+                        if (localAddresses.size() <= 1)
+                            throw new IllegalUnbindException("Cannot remove address from a channel with only one address bound");
+                        boolean foundAddress = false;
+                        for (InetSocketAddress addr : localAddresses) {
+                            if (addr.getAddress().equals(address)) {
+                                foundAddress = true;
+                                break;
+                            }
+                        }
+                        if (!foundAddress )
+                            throw new IllegalUnbindException("Cannot remove address from a channel that is not bound to that address");
+                    }
+
+                    SctpNet.bindx(fdVal, new InetAddress[]{address}, port, add);
+
+                    /* Update our internal Set to reflect the addition/removal */
+                    if (add)
+                        localAddresses.add(new InetSocketAddress(address, port));
+                    else {
+                        for (InetSocketAddress addr : localAddresses) {
+                            if (addr.getAddress().equals(address)) {
+                                localAddresses.remove(addr);
+                                break;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        return this;
+    }
+
+    @Override
+    public Set<Association> associations()
+            throws ClosedChannelException, NotYetBoundException {
+        synchronized (stateLock) {
+            if (!isOpen())
+                throw new ClosedChannelException();
+            if (!isBound())
+                throw new NotYetBoundException();
+
+            return Collections.unmodifiableSet(associationMap.keySet());
+        }
+    }
+
+    private boolean isBound() {
+        synchronized (stateLock) {
+            return port == -1 ? false : true;
+        }
+    }
+
+    private void ensureOpen() throws IOException {
+        synchronized (stateLock) {
+            if (!isOpen())
+                throw new ClosedChannelException();
+        }
+    }
+
+    private void receiverCleanup() throws IOException {
+        synchronized (stateLock) {
+            receiverThread = 0;
+            if (state == ChannelState.KILLPENDING)
+                kill();
+        }
+    }
+
+    private void senderCleanup() throws IOException {
+        synchronized (stateLock) {
+            senderThread = 0;
+            if (state == ChannelState.KILLPENDING)
+                kill();
+        }
+    }
+
+    @Override
+    protected void implConfigureBlocking(boolean block) throws IOException {
+        IOUtil.configureBlocking(fd, block);
+    }
+
+    @Override
+    public void implCloseSelectableChannel() throws IOException {
+        synchronized (stateLock) {
+            SctpNet.preClose(fdVal);
+
+            if (receiverThread != 0)
+                NativeThread.signal(receiverThread);
+
+            if (senderThread != 0)
+                NativeThread.signal(senderThread);
+
+            if (!isRegistered())
+                kill();
+        }
+    }
+
+    @Override
+    public FileDescriptor getFD() {
+        return fd;
+    }
+
+    @Override
+    public int getFDVal() {
+        return fdVal;
+    }
+
+    /**
+     * Translates native poll revent ops into a ready operation ops
+     */
+    private boolean translateReadyOps(int ops, int initialOps,
+                                      SelectionKeyImpl sk) {
+        int intOps = sk.nioInterestOps();
+        int oldOps = sk.nioReadyOps();
+        int newOps = initialOps;
+
+        if ((ops & PollArrayWrapper.POLLNVAL) != 0) {
+            /* This should only happen if this channel is pre-closed while a
+             * selection operation is in progress
+             * ## Throw an error if this channel has not been pre-closed */
+            return false;
+        }
+
+        if ((ops & (PollArrayWrapper.POLLERR
+                    | PollArrayWrapper.POLLHUP)) != 0) {
+            newOps = intOps;
+            sk.nioReadyOps(newOps);
+            return (newOps & ~oldOps) != 0;
+        }
+
+        if (((ops & PollArrayWrapper.POLLIN) != 0) &&
+            ((intOps & SelectionKey.OP_READ) != 0))
+            newOps |= SelectionKey.OP_READ;
+
+        if (((ops & PollArrayWrapper.POLLOUT) != 0) &&
+            ((intOps & SelectionKey.OP_WRITE) != 0))
+            newOps |= SelectionKey.OP_WRITE;
+
+        sk.nioReadyOps(newOps);
+        return (newOps & ~oldOps) != 0;
+    }
+
+    @Override
+    public boolean translateAndUpdateReadyOps(int ops, SelectionKeyImpl sk) {
+        return translateReadyOps(ops, sk.nioReadyOps(), sk);
+    }
+
+    @Override
+    public boolean translateAndSetReadyOps(int ops, SelectionKeyImpl sk) {
+        return translateReadyOps(ops, 0, sk);
+    }
+
+    @Override
+    public void translateAndSetInterestOps(int ops, SelectionKeyImpl sk) {
+        int newOps = 0;
+        if ((ops & SelectionKey.OP_READ) != 0)
+            newOps |= PollArrayWrapper.POLLIN;
+        if ((ops & SelectionKey.OP_WRITE) != 0)
+            newOps |= PollArrayWrapper.POLLOUT;
+        sk.selector.putEventOps(sk, newOps);
+    }
+
+    @Override
+    public void kill() throws IOException {
+        synchronized (stateLock) {
+            if (state == ChannelState.KILLED)
+                return;
+            if (state == ChannelState.UNINITIALIZED) {
+                state = ChannelState.KILLED;
+                return;
+            }
+            assert !isOpen() && !isRegistered();
+
+            /* Postpone the kill if there is a thread sending or receiving. */
+            if (receiverThread == 0 && senderThread == 0) {
+                SctpNet.close(fdVal);
+                state = ChannelState.KILLED;
+            } else {
+                state = ChannelState.KILLPENDING;
+            }
+        }
+    }
+
+    @Override
+    public <T> SctpMultiChannel setOption(SctpSocketOption<T> name,
+                                          T value,
+                                          Association association)
+            throws IOException {
+        if (name == null)
+            throw new NullPointerException();
+        if (!(supportedOptions().contains(name)))
+            throw new UnsupportedOperationException("'" + name + "' not supported");
+
+        synchronized (stateLock) {
+            if (association != null && (name.equals(SCTP_PRIMARY_ADDR) ||
+                    name.equals(SCTP_SET_PEER_PRIMARY_ADDR))) {
+                checkAssociation(association);
+            }
+            if (!isOpen())
+                throw new ClosedChannelException();
+
+            int assocId = association == null ? 0 : association.associationID();
+            SctpNet.setSocketOption(fdVal, name, value, assocId);
+        }
+        return this;
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public <T> T getOption(SctpSocketOption<T> name, Association association)
+            throws IOException {
+        if (name == null)
+            throw new NullPointerException();
+        if (!supportedOptions().contains(name))
+            throw new UnsupportedOperationException("'" + name + "' not supported");
+
+        synchronized (stateLock) {
+            if (association != null && (name.equals(SCTP_PRIMARY_ADDR) ||
+                    name.equals(SCTP_SET_PEER_PRIMARY_ADDR))) {
+                checkAssociation(association);
+            }
+            if (!isOpen())
+                throw new ClosedChannelException();
+
+            int assocId = association == null ? 0 : association.associationID();
+            return (T)SctpNet.getSocketOption(fdVal, name, assocId);
+        }
+    }
+
+    private static class DefaultOptionsHolder {
+        static final Set<SctpSocketOption<?>> defaultOptions = defaultOptions();
+
+        private static Set<SctpSocketOption<?>> defaultOptions() {
+            HashSet<SctpSocketOption<?>> set = new HashSet<SctpSocketOption<?>>(10);
+            set.add(SCTP_DISABLE_FRAGMENTS);
+            set.add(SCTP_EXPLICIT_COMPLETE);
+            set.add(SCTP_FRAGMENT_INTERLEAVE);
+            set.add(SCTP_INIT_MAXSTREAMS);
+            set.add(SCTP_NODELAY);
+            set.add(SCTP_PRIMARY_ADDR);
+            set.add(SCTP_SET_PEER_PRIMARY_ADDR);
+            set.add(SO_SNDBUF);
+            set.add(SO_RCVBUF);
+            set.add(SO_LINGER);
+            return Collections.unmodifiableSet(set);
+        }
+    }
+
+    @Override
+    public final Set<SctpSocketOption<?>> supportedOptions() {
+        return DefaultOptionsHolder.defaultOptions;
+    }
+
+    @Override
+    public <T> MessageInfo receive(ByteBuffer buffer,
+                                   T attachment,
+                                   NotificationHandler<T> handler)
+            throws IOException {
+        if (buffer == null)
+            throw new IllegalArgumentException("buffer cannot be null");
+
+        if (buffer.isReadOnly())
+            throw new IllegalArgumentException("Read-only buffer");
+
+        if (receiveInvoked.get())
+            throw new IllegalReceiveException(
+                    "cannot invoke receive from handler");
+        receiveInvoked.set(Boolean.TRUE);
+
+        try {
+            ResultContainer resultContainer = new ResultContainer();
+            do {
+                resultContainer.clear();
+                synchronized (receiveLock) {
+                    ensureOpen();
+                    if (!isBound())
+                        throw new NotYetBoundException();
+
+                    int n = 0;
+                    try {
+                        begin();
+
+                        synchronized (stateLock) {
+                            if(!isOpen())
+                                return null;
+                            receiverThread = NativeThread.current();
+                        }
+
+                        do {
+                            n = receive(fdVal, buffer, resultContainer);
+                        } while ((n == IOStatus.INTERRUPTED) && isOpen());
+
+                    } finally {
+                        receiverCleanup();
+                        end((n > 0) || (n == IOStatus.UNAVAILABLE));
+                        assert IOStatus.check(n);
+                    }
+
+                    if (!resultContainer.isNotification()) {
+                        /* message or nothing */
+                        if (resultContainer.hasSomething()) {
+                            /* Set the association before returning */
+                            MessageInfoImpl info =
+                                    resultContainer.getMessageInfo();
+                            info.setAssociation(lookupAssociation(info.
+                                    associationID()));
+                            SecurityManager sm = System.getSecurityManager();
+                            if (sm != null) {
+                                InetSocketAddress isa  = (InetSocketAddress)info.address();
+                                if (!addressMap.containsKey(isa)) {
+                                    /* must be a new association */
+                                    try {
+                                        sm.checkAccept(isa.getAddress().getHostAddress(),
+                                                       isa.getPort());
+                                    } catch (SecurityException se) {
+                                        buffer.clear();
+                                        throw se;
+                                    }
+                                }
+                            }
+
+                            assert info.association() != null;
+                            return info;
+                        } else  {
+                          /* Non-blocking may return null if nothing available*/
+                            return null;
+                        }
+                    } else { /* notification */
+                        synchronized (stateLock) {
+                            handleNotificationInternal(
+                                    resultContainer);
+                        }
+                    }
+                } /* receiveLock */
+            } while (handler == null ? true :
+                (invokeNotificationHandler(resultContainer, handler, attachment)
+                 == HandlerResult.CONTINUE));
+        } finally {
+            receiveInvoked.set(Boolean.FALSE);
+        }
+
+        return null;
+    }
+
+    private int receive(int fd,
+                        ByteBuffer dst,
+                        ResultContainer resultContainer)
+            throws IOException {
+        int pos = dst.position();
+        int lim = dst.limit();
+        assert (pos <= lim);
+        int rem = (pos <= lim ? lim - pos : 0);
+        if (dst instanceof DirectBuffer && rem > 0)
+            return receiveIntoNativeBuffer(fd, resultContainer, dst, rem, pos);
+
+        /* Substitute a native buffer. */
+        int newSize = Math.max(rem, 1);
+        ByteBuffer bb = Util.getTemporaryDirectBuffer(newSize);
+        try {
+            int n = receiveIntoNativeBuffer(fd, resultContainer, bb, newSize, 0);
+            bb.flip();
+            if (n > 0 && rem > 0)
+                dst.put(bb);
+            return n;
+        } finally {
+            Util.releaseTemporaryDirectBuffer(bb);
+        }
+    }
+
+    private int receiveIntoNativeBuffer(int fd,
+                                        ResultContainer resultContainer,
+                                        ByteBuffer bb,
+                                        int rem,
+                                        int pos)
+            throws IOException {
+        int n = receive0(fd, resultContainer, ((DirectBuffer)bb).address() + pos, rem);
+        if (n > 0)
+            bb.position(pos + n);
+        return n;
+    }
+
+    private Interna