Merge jdk7-b143
authorlana
Wed, 18 May 2011 18:18:04 -0700
changeset 4275efbf75c24b0f
parent 4221 1be8850c7005
parent 4274 366fcac7ee01
child 4276 5f69702cf570
child 4279 be4b9e596352
child 4291 8d91855a1f4e
child 4295 d2081a1f417f
child 4300 1fbaf2b688a6
Merge
src/share/classes/com/sun/nio/sctp/SctpStandardSocketOption.java
src/share/classes/java/net/StandardSocketOption.java
src/share/classes/java/nio/charset/StandardCharset.java
src/share/classes/java/nio/file/StandardWatchEventKind.java
test/java/nio/charset/StandardCharset/Standard.java
     1.1 --- a/make/com/sun/nio/sctp/FILES_java.gmk	Wed May 18 16:32:05 2011 -0700
     1.2 +++ b/make/com/sun/nio/sctp/FILES_java.gmk	Wed May 18 18:18:04 2011 -0700
     1.3 @@ -38,7 +38,7 @@
     1.4  	com/sun/nio/sctp/SctpMultiChannel.java \
     1.5  	com/sun/nio/sctp/SctpServerChannel.java \
     1.6  	com/sun/nio/sctp/SctpSocketOption.java \
     1.7 -	com/sun/nio/sctp/SctpStandardSocketOption.java \
     1.8 +	com/sun/nio/sctp/SctpStandardSocketOptions.java \
     1.9  	com/sun/nio/sctp/SendFailedNotification.java \
    1.10  	com/sun/nio/sctp/ShutdownNotification.java \
    1.11  	\
     2.1 --- a/make/java/management/mapfile-vers	Wed May 18 16:32:05 2011 -0700
     2.2 +++ b/make/java/management/mapfile-vers	Wed May 18 18:18:04 2011 -0700
     2.3 @@ -49,6 +49,7 @@
     2.4  	    Java_sun_management_Flag_setStringValue;
     2.5  	    Java_sun_management_GarbageCollectorImpl_getCollectionCount;
     2.6  	    Java_sun_management_GarbageCollectorImpl_getCollectionTime;
     2.7 +	    Java_sun_management_GarbageCollectorImpl_setNotificationEnabled;
     2.8  	    Java_sun_management_GcInfoBuilder_fillGcAttributeInfo;
     2.9  	    Java_sun_management_GcInfoBuilder_getLastGcInfo0;
    2.10  	    Java_sun_management_GcInfoBuilder_getNumGcExtAttributes;
     3.1 --- a/make/java/nio/FILES_java.gmk	Wed May 18 16:32:05 2011 -0700
     3.2 +++ b/make/java/nio/FILES_java.gmk	Wed May 18 18:18:04 2011 -0700
     3.3 @@ -71,7 +71,7 @@
     3.4  	java/nio/charset/CoderMalfunctionError.java \
     3.5  	java/nio/charset/CodingErrorAction.java \
     3.6  	java/nio/charset/MalformedInputException.java \
     3.7 -	java/nio/charset/StandardCharset.java \
     3.8 +	java/nio/charset/StandardCharsets.java \
     3.9  	java/nio/charset/UnmappableCharacterException.java \
    3.10  	\
    3.11  	java/nio/charset/spi/CharsetProvider.java \
    3.12 @@ -116,7 +116,7 @@
    3.13  	java/nio/file/SimpleFileVisitor.java \
    3.14  	java/nio/file/StandardCopyOption.java \
    3.15  	java/nio/file/StandardOpenOption.java \
    3.16 -	java/nio/file/StandardWatchEventKind.java \
    3.17 +	java/nio/file/StandardWatchEventKinds.java \
    3.18  	java/nio/file/TempFileHelper.java \
    3.19  	java/nio/file/WatchEvent.java \
    3.20  	java/nio/file/WatchKey.java \
     4.1 --- a/make/sun/xawt/mapfile-vers	Wed May 18 16:32:05 2011 -0700
     4.2 +++ b/make/sun/xawt/mapfile-vers	Wed May 18 18:18:04 2011 -0700
     4.3 @@ -158,7 +158,6 @@
     4.4          Java_sun_awt_X11_XRobotPeer_mouseReleaseImpl;
     4.5          Java_sun_awt_X11_XRobotPeer_mouseWheelImpl;
     4.6          Java_sun_awt_X11_XRobotPeer_setup;
     4.7 -        Java_sun_awt_X11_XRobotPeer__1dispose;
     4.8          Java_sun_awt_X11_XToolkit_getNumberOfButtonsImpl;
     4.9          Java_java_awt_Component_initIDs;
    4.10          Java_java_awt_Container_initIDs;
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/src/share/classes/com/sun/management/GarbageCollectionNotificationInfo.java	Wed May 18 18:18:04 2011 -0700
     5.3 @@ -0,0 +1,237 @@
     5.4 +/*
     5.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
     5.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5.7 + *
     5.8 + * This code is free software; you can redistribute it and/or modify it
     5.9 + * under the terms of the GNU General Public License version 2 only, as
    5.10 + * published by the Free Software Foundation.  Oracle designates this
    5.11 + * particular file as subject to the "Classpath" exception as provided
    5.12 + * by Oracle in the LICENSE file that accompanied this code.
    5.13 + *
    5.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    5.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    5.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    5.17 + * version 2 for more details (a copy is included in the LICENSE file that
    5.18 + * accompanied this code).
    5.19 + *
    5.20 + * You should have received a copy of the GNU General Public License version
    5.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    5.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    5.23 + *
    5.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    5.25 + * or visit www.oracle.com if you need additional information or have any
    5.26 + * questions.
    5.27 + */
    5.28 +
    5.29 +package com.sun.management;
    5.30 +
    5.31 +import javax.management.Notification;
    5.32 +import javax.management.openmbean.CompositeData;
    5.33 +import javax.management.openmbean.CompositeDataView;
    5.34 +import javax.management.openmbean.CompositeType;
    5.35 +import java.util.Collection;
    5.36 +import java.util.Collections;
    5.37 +import sun.management.GarbageCollectionNotifInfoCompositeData;
    5.38 +
    5.39 +/**
    5.40 + * The information about a garbage collection
    5.41 + *
    5.42 + * <p>
    5.43 + * A garbage collection notification is emitted by {@link GarbageCollectorMXBean}
    5.44 + * when the Java virtual machine completes a garbage collection action
    5.45 + * The notification emitted will contain the garbage collection notification
    5.46 + * information about the status of the memory:
    5.47 + * <u1>
    5.48 + *   <li>The name of the garbage collector used perform the collection.</li>
    5.49 + *   <li>The action performed by the garbage collector.</li>
    5.50 + *   <li>The cause of the garbage collection action.</li>
    5.51 + *   <li>A {@link GcInfo} object containing some statistics about the GC cycle
    5.52 +          (start time, end time) and the memory usage before and after
    5.53 +          the GC cycle.</li>
    5.54 + * </u1>
    5.55 + *
    5.56 + * <p>
    5.57 + * A {@link CompositeData CompositeData} representing
    5.58 + * the {@code GarbageCollectionNotificationInfo} object
    5.59 + * is stored in the
    5.60 + * {@linkplain javax.management.Notification#setUserData userdata}
    5.61 + * of a {@linkplain javax.management.Notification notification}.
    5.62 + * The {@link #from from} method is provided to convert from
    5.63 + * a {@code CompositeData} to a {@code GarbageCollectionNotificationInfo}
    5.64 + * object. For example:
    5.65 + *
    5.66 + * <blockquote><pre>
    5.67 + *      Notification notif;
    5.68 + *
    5.69 + *      // receive the notification emitted by a GarbageCollectorMXBean and set to notif
    5.70 + *      ...
    5.71 + *
    5.72 + *      String notifType = notif.getType();
    5.73 + *      if (notifType.equals(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION)) {
    5.74 + *          // retrieve the garbage collection notification information
    5.75 + *          CompositeData cd = (CompositeData) notif.getUserData();
    5.76 + *          GarbageCollectionNotificationInfo info = GarbageCollectionNotificationInfo.from(cd);
    5.77 + *          ....
    5.78 + *      }
    5.79 + * </pre></blockquote>
    5.80 + *
    5.81 + * <p>
    5.82 + * The type of the notification emitted by a {@code GarbageCollectorMXBean} is:
    5.83 + * <ul>
    5.84 + *   <li>A {@linkplain #GARBAGE_COLLECTION_NOTIFICATION garbage collection notification}.
    5.85 + *       <br>Used by every notification emitted by the garbage collector, the details about
    5.86 + *             the notification are provided in the {@linkplain #getGcAction action} String
    5.87 + *       <p></li>
    5.88 + * </ul>
    5.89 + **/
    5.90 +
    5.91 +public class GarbageCollectionNotificationInfo implements  CompositeDataView {
    5.92 +
    5.93 +    private final String gcName;
    5.94 +    private final String gcAction;
    5.95 +    private final String gcCause;
    5.96 +    private final GcInfo gcInfo;
    5.97 +    private final CompositeData cdata;
    5.98 +
    5.99 +    /**
   5.100 +     * Notification type denoting that
   5.101 +     * the Java virtual machine has completed a garbage collection cycle.
   5.102 +     * This notification is emitted by a {@link GarbageCollectorMXBean}.
   5.103 +     * The value of this notification type is
   5.104 +     * {@code com.sun.management.gc.notification}.
   5.105 +     */
   5.106 +    public static final String GARBAGE_COLLECTION_NOTIFICATION =
   5.107 +        "com.sun.management.gc.notification";
   5.108 +
   5.109 +    /**
   5.110 +     * Constructs a {@code GarbageCollectionNotificationInfo} object.
   5.111 +     *
   5.112 +     * @param gcName The name of the garbage collector used to perform the collection
   5.113 +     * @param gcAction The name of the action performed by the garbage collector
   5.114 +     * @param gcCause The cause the garbage collection action
   5.115 +     * @param gcInfo  a GcInfo object providing statistics about the GC cycle
   5.116 +     */
   5.117 +    public GarbageCollectionNotificationInfo(String gcName,
   5.118 +                                             String gcAction,
   5.119 +                                             String gcCause,
   5.120 +                                             GcInfo gcInfo)  {
   5.121 +        if (gcName == null) {
   5.122 +            throw new NullPointerException("Null gcName");
   5.123 +        }
   5.124 +        if (gcAction == null) {
   5.125 +            throw new NullPointerException("Null gcAction");
   5.126 +        }
   5.127 +        if (gcCause == null) {
   5.128 +            throw new NullPointerException("Null gcCause");
   5.129 +        }
   5.130 +        this.gcName = gcName;
   5.131 +        this.gcAction = gcAction;
   5.132 +        this.gcCause = gcCause;
   5.133 +        this.gcInfo = gcInfo;
   5.134 +        this.cdata = new GarbageCollectionNotifInfoCompositeData(this);
   5.135 +    }
   5.136 +
   5.137 +    GarbageCollectionNotificationInfo(CompositeData cd) {
   5.138 +        GarbageCollectionNotifInfoCompositeData.validateCompositeData(cd);
   5.139 +
   5.140 +        this.gcName = GarbageCollectionNotifInfoCompositeData.getGcName(cd);
   5.141 +        this.gcAction = GarbageCollectionNotifInfoCompositeData.getGcAction(cd);
   5.142 +        this.gcCause = GarbageCollectionNotifInfoCompositeData.getGcCause(cd);
   5.143 +        this.gcInfo = GarbageCollectionNotifInfoCompositeData.getGcInfo(cd);
   5.144 +        this.cdata = cd;
   5.145 +    }
   5.146 +
   5.147 +    /**
   5.148 +     * Returns the name of the garbage collector used to perform the collection
   5.149 +     *
   5.150 +     * @return the name of the garbage collector used to perform the collection
   5.151 +     */
   5.152 +    public String getGcName() {
   5.153 +        return gcName;
   5.154 +    }
   5.155 +
   5.156 +    /**
   5.157 +     * Returns the action of the performed by the garbage collector
   5.158 +     *
   5.159 +     * @return the the action of the performed by the garbage collector
   5.160 +     */
   5.161 +    public String getGcAction() {
   5.162 +        return gcAction;
   5.163 +    }
   5.164 +
   5.165 +    /**
   5.166 +     * Returns the cause  the garbage collection
   5.167 +     *
   5.168 +     * @return the the cause  the garbage collection
   5.169 +     */
   5.170 +    public String getGcCause() {
   5.171 +        return gcCause;
   5.172 +    }
   5.173 +
   5.174 +    /**
   5.175 +     * Returns the GC information related to the last garbage collection
   5.176 +     *
   5.177 +     * @return the GC information related to the
   5.178 +     * last garbage collection
   5.179 +     */
   5.180 +    public GcInfo getGcInfo() {
   5.181 +        return gcInfo;
   5.182 +    }
   5.183 +
   5.184 +    /**
   5.185 +     * Returns a {@code GarbageCollectionNotificationInfo} object represented by the
   5.186 +     * given {@code CompositeData}.
   5.187 +     * The given {@code CompositeData} must contain
   5.188 +     * the following attributes:
   5.189 +     * <blockquote>
   5.190 +     * <table border>
   5.191 +     * <tr>
   5.192 +     *   <th align=left>Attribute Name</th>
   5.193 +     *   <th align=left>Type</th>
   5.194 +     * </tr>
   5.195 +     * <tr>
   5.196 +     *   <td>gcName</td>
   5.197 +     *   <td>{@code java.lang.String}</td>
   5.198 +     * </tr>
   5.199 +     * <tr>
   5.200 +     *   <td>gcAction</td>
   5.201 +     *   <td>{@code java.lang.String}</td>
   5.202 +     * </tr>
   5.203 +     * <tr>
   5.204 +     *   <td>gcCause</td>
   5.205 +     *   <td>{@code java.lang.String}</td>
   5.206 +     * </tr>
   5.207 +     * <tr>
   5.208 +     *   <td>gcInfo</td>
   5.209 +     *   <td>{@code javax.management.openmbean.CompositeData}</td>
   5.210 +     * </tr>
   5.211 +     * </table>
   5.212 +     * </blockquote>
   5.213 +     *
   5.214 +     * @param cd {@code CompositeData} representing a
   5.215 +     *           {@code GarbageCollectionNotificationInfo}
   5.216 +     *
   5.217 +     * @throws IllegalArgumentException if {@code cd} does not
   5.218 +     *   represent a {@code GarbaageCollectionNotificationInfo} object.
   5.219 +     *
   5.220 +     * @return a {@code GarbageCollectionNotificationInfo} object represented
   5.221 +     *         by {@code cd} if {@code cd} is not {@code null};
   5.222 +     *         {@code null} otherwise.
   5.223 +     */
   5.224 +    public static GarbageCollectionNotificationInfo from(CompositeData cd) {
   5.225 +        if (cd == null) {
   5.226 +            return null;
   5.227 +        }
   5.228 +
   5.229 +        if (cd instanceof GarbageCollectionNotifInfoCompositeData) {
   5.230 +            return ((GarbageCollectionNotifInfoCompositeData) cd).getGarbageCollectionNotifInfo();
   5.231 +        } else {
   5.232 +            return new GarbageCollectionNotificationInfo(cd);
   5.233 +        }
   5.234 +    }
   5.235 +
   5.236 +    public CompositeData toCompositeData(CompositeType ct) {
   5.237 +        return cdata;
   5.238 +    }
   5.239 +
   5.240 +}
     6.1 --- a/src/share/classes/com/sun/nio/sctp/MessageInfo.java	Wed May 18 16:32:05 2011 -0700
     6.2 +++ b/src/share/classes/com/sun/nio/sctp/MessageInfo.java	Wed May 18 18:18:04 2011 -0700
     6.3 @@ -179,7 +179,7 @@
     6.4       * completely received. For messages being sent {@code true} indicates that
     6.5       * the message is complete, {@code false} indicates that the message is not
     6.6       * complete. How the send channel interprets this value depends on the value
     6.7 -     * of its {@link SctpStandardSocketOption#SCTP_EXPLICIT_COMPLETE
     6.8 +     * of its {@link SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE
     6.9       * SCTP_EXPLICIT_COMPLETE} socket option.
    6.10       *
    6.11       * @return  {@code true} if, and only if, the message is complete
    6.12 @@ -192,7 +192,7 @@
    6.13       * <P> For messages being sent {@code true} indicates that
    6.14       * the message is complete, {@code false} indicates that the message is not
    6.15       * complete. How the send channel interprets this value depends on the value
    6.16 -     * of its {@link SctpStandardSocketOption#SCTP_EXPLICIT_COMPLETE
    6.17 +     * of its {@link SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE
    6.18       * SCTP_EXPLICIT_COMPLETE} socket option.
    6.19       *
    6.20       * @param  complete
     7.1 --- a/src/share/classes/com/sun/nio/sctp/SctpChannel.java	Wed May 18 16:32:05 2011 -0700
     7.2 +++ b/src/share/classes/com/sun/nio/sctp/SctpChannel.java	Wed May 18 18:18:04 2011 -0700
     7.3 @@ -65,55 +65,55 @@
     7.4   *     <th>Description</th>
     7.5   *   </tr>
     7.6   *   <tr>
     7.7 - *     <td> {@link SctpStandardSocketOption#SCTP_DISABLE_FRAGMENTS
     7.8 + *     <td> {@link SctpStandardSocketOptions#SCTP_DISABLE_FRAGMENTS
     7.9   *                                          SCTP_DISABLE_FRAGMENTS} </td>
    7.10   *     <td> Enables or disables message fragmentation </td>
    7.11   *   </tr>
    7.12   *   <tr>
    7.13 - *     <td> {@link SctpStandardSocketOption#SCTP_EXPLICIT_COMPLETE
    7.14 + *     <td> {@link SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE
    7.15   *                                          SCTP_EXPLICIT_COMPLETE} </td>
    7.16   *     <td> Enables or disables explicit message completion </td>
    7.17   *   </tr>
    7.18   *    <tr>
    7.19 - *     <td> {@link SctpStandardSocketOption#SCTP_FRAGMENT_INTERLEAVE
    7.20 + *     <td> {@link SctpStandardSocketOptions#SCTP_FRAGMENT_INTERLEAVE
    7.21   *                                          SCTP_FRAGMENT_INTERLEAVE} </td>
    7.22   *     <td> Controls how the presentation of messages occur for the message
    7.23   *          receiver </td>
    7.24   *   </tr>
    7.25   *   <tr>
    7.26 - *     <td> {@link SctpStandardSocketOption#SCTP_INIT_MAXSTREAMS
    7.27 + *     <td> {@link SctpStandardSocketOptions#SCTP_INIT_MAXSTREAMS
    7.28   *                                          SCTP_INIT_MAXSTREAMS} </td>
    7.29   *     <td> The maximum number of streams requested by the local endpoint during
    7.30   *          association initialization </td>
    7.31   *   </tr>
    7.32   *   <tr>
    7.33 - *     <td> {@link SctpStandardSocketOption#SCTP_NODELAY SCTP_NODELAY} </td>
    7.34 + *     <td> {@link SctpStandardSocketOptions#SCTP_NODELAY SCTP_NODELAY} </td>
    7.35   *     <td> Enables or disable a Nagle-like algorithm </td>
    7.36   *   </tr>
    7.37   *   <tr>
    7.38 - *     <td> {@link SctpStandardSocketOption#SCTP_PRIMARY_ADDR
    7.39 + *     <td> {@link SctpStandardSocketOptions#SCTP_PRIMARY_ADDR
    7.40   *                                          SCTP_PRIMARY_ADDR} </td>
    7.41   *     <td> Requests that the local SCTP stack use the given peer address as the
    7.42   *          association primary </td>
    7.43   *   </tr>
    7.44   *   <tr>
    7.45 - *     <td> {@link SctpStandardSocketOption#SCTP_SET_PEER_PRIMARY_ADDR
    7.46 + *     <td> {@link SctpStandardSocketOptions#SCTP_SET_PEER_PRIMARY_ADDR
    7.47   *                                          SCTP_SET_PEER_PRIMARY_ADDR} </td>
    7.48   *     <td> Requests that the peer mark the enclosed address as the association
    7.49   *          primary </td>
    7.50   *   </tr>
    7.51   *   <tr>
    7.52 - *     <td> {@link SctpStandardSocketOption#SO_SNDBUF
    7.53 + *     <td> {@link SctpStandardSocketOptions#SO_SNDBUF
    7.54   *                                          SO_SNDBUF} </td>
    7.55   *     <td> The size of the socket send buffer </td>
    7.56   *   </tr>
    7.57   *   <tr>
    7.58 - *     <td> {@link SctpStandardSocketOption#SO_RCVBUF
    7.59 + *     <td> {@link SctpStandardSocketOptions#SO_RCVBUF
    7.60   *                                          SO_RCVBUF} </td>
    7.61   *     <td> The size of the socket receive buffer </td>
    7.62   *   </tr>
    7.63   *   <tr>
    7.64 - *     <td> {@link SctpStandardSocketOption#SO_LINGER
    7.65 + *     <td> {@link SctpStandardSocketOptions#SO_LINGER
    7.66   *                                          SO_LINGER} </td>
    7.67   *     <td> Linger on close if data is present (when configured in blocking mode
    7.68   *          only) </td>
    7.69 @@ -449,7 +449,7 @@
    7.70       * <P> This is a convience method and is equivalent to evaluating the
    7.71       * following expression:
    7.72       * <blockquote><pre>
    7.73 -     * setOption(SctpStandardSocketOption.SCTP_INIT_MAXSTREAMS, SctpStandardSocketOption.InitMaxStreams.create(maxInStreams, maxOutStreams))
    7.74 +     * setOption(SctpStandardSocketOptions.SCTP_INIT_MAXSTREAMS, SctpStandardSocketOption.InitMaxStreams.create(maxInStreams, maxOutStreams))
    7.75       *  .connect(remote);
    7.76       * </pre></blockquote>
    7.77       *
    7.78 @@ -651,7 +651,7 @@
    7.79       * @throws  IOException
    7.80       *          If an I/O error occurs
    7.81       *
    7.82 -     * @see SctpStandardSocketOption
    7.83 +     * @see SctpStandardSocketOptions
    7.84       */
    7.85      public abstract <T> T getOption(SctpSocketOption<T> name)
    7.86          throws IOException;
    7.87 @@ -680,7 +680,7 @@
    7.88       * @throws  IOException
    7.89       *          If an I/O error occurs
    7.90       *
    7.91 -     * @see SctpStandardSocketOption
    7.92 +     * @see SctpStandardSocketOptions
    7.93       */
    7.94      public abstract <T> SctpChannel setOption(SctpSocketOption<T> name, T value)
    7.95          throws IOException;
    7.96 @@ -731,7 +731,7 @@
    7.97       * MessageInfo} will return {@code false}, and more invocations of this
    7.98       * method will be necessary to completely consume the messgae. Only
    7.99       * one message at a time will be partially delivered in any stream. The
   7.100 -     * socket option {@link SctpStandardSocketOption#SCTP_FRAGMENT_INTERLEAVE
   7.101 +     * socket option {@link SctpStandardSocketOptions#SCTP_FRAGMENT_INTERLEAVE
   7.102       * SCTP_FRAGMENT_INTERLEAVE} controls various aspects of what interlacing of
   7.103       * messages occurs.
   7.104       *
   7.105 @@ -804,7 +804,7 @@
   7.106       * and sufficient room becomes available, then the remaining bytes in the
   7.107       * given byte buffer are transmitted as a single message. Sending a message
   7.108       * is atomic unless explicit message completion {@link
   7.109 -     * SctpStandardSocketOption#SCTP_EXPLICIT_COMPLETE SCTP_EXPLICIT_COMPLETE}
   7.110 +     * SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE SCTP_EXPLICIT_COMPLETE}
   7.111       * socket option is enabled on this channel's socket.
   7.112       *
   7.113       * <P> The message is transferred from the byte buffer as if by a regular
     8.1 --- a/src/share/classes/com/sun/nio/sctp/SctpMultiChannel.java	Wed May 18 16:32:05 2011 -0700
     8.2 +++ b/src/share/classes/com/sun/nio/sctp/SctpMultiChannel.java	Wed May 18 18:18:04 2011 -0700
     8.3 @@ -69,55 +69,55 @@
     8.4   *     <th>Description</th>
     8.5   *   </tr>
     8.6   *   <tr>
     8.7 - *     <td> {@link SctpStandardSocketOption#SCTP_DISABLE_FRAGMENTS
     8.8 + *     <td> {@link SctpStandardSocketOptions#SCTP_DISABLE_FRAGMENTS
     8.9   *                                          SCTP_DISABLE_FRAGMENTS} </td>
    8.10   *     <td> Enables or disables message fragmentation </td>
    8.11   *   </tr>
    8.12   *   <tr>
    8.13 - *     <td> {@link SctpStandardSocketOption#SCTP_EXPLICIT_COMPLETE
    8.14 + *     <td> {@link SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE
    8.15   *                                          SCTP_EXPLICIT_COMPLETE} </td>
    8.16   *     <td> Enables or disables explicit message completion </td>
    8.17   *   </tr>
    8.18   *    <tr>
    8.19 - *     <td> {@link SctpStandardSocketOption#SCTP_FRAGMENT_INTERLEAVE
    8.20 + *     <td> {@link SctpStandardSocketOptions#SCTP_FRAGMENT_INTERLEAVE
    8.21   *                                          SCTP_FRAGMENT_INTERLEAVE} </td>
    8.22   *     <td> Controls how the presentation of messages occur for the message
    8.23   *          receiver </td>
    8.24   *   </tr>
    8.25   *   <tr>
    8.26 - *     <td> {@link SctpStandardSocketOption#SCTP_INIT_MAXSTREAMS
    8.27 + *     <td> {@link SctpStandardSocketOptions#SCTP_INIT_MAXSTREAMS
    8.28   *                                          SCTP_INIT_MAXSTREAMS} </td>
    8.29   *     <td> The maximum number of streams requested by the local endpoint during
    8.30   *          association initialization </td>
    8.31   *   </tr>
    8.32   *   <tr>
    8.33 - *     <td> {@link SctpStandardSocketOption#SCTP_NODELAY SCTP_NODELAY} </td>
    8.34 + *     <td> {@link SctpStandardSocketOptions#SCTP_NODELAY SCTP_NODELAY} </td>
    8.35   *     <td> Enables or disable a Nagle-like algorithm </td>
    8.36   *   </tr>
    8.37   *   <tr>
    8.38 - *     <td> {@link SctpStandardSocketOption#SCTP_PRIMARY_ADDR
    8.39 + *     <td> {@link SctpStandardSocketOptions#SCTP_PRIMARY_ADDR
    8.40   *                                          SCTP_PRIMARY_ADDR} </td>
    8.41   *     <td> Requests that the local SCTP stack use the given peer address as the
    8.42   *          association primary </td>
    8.43   *   </tr>
    8.44   *   <tr>
    8.45 - *     <td> {@link SctpStandardSocketOption#SCTP_SET_PEER_PRIMARY_ADDR
    8.46 + *     <td> {@link SctpStandardSocketOptions#SCTP_SET_PEER_PRIMARY_ADDR
    8.47   *                                          SCTP_SET_PEER_PRIMARY_ADDR} </td>
    8.48   *     <td> Requests that the peer mark the enclosed address as the association
    8.49   *          primary </td>
    8.50   *   </tr>
    8.51   *   <tr>
    8.52 - *     <td> {@link SctpStandardSocketOption#SO_SNDBUF
    8.53 + *     <td> {@link SctpStandardSocketOptions#SO_SNDBUF
    8.54   *                                          SO_SNDBUF} </td>
    8.55   *     <td> The size of the socket send buffer </td>
    8.56   *   </tr>
    8.57   *   <tr>
    8.58 - *     <td> {@link SctpStandardSocketOption#SO_RCVBUF
    8.59 + *     <td> {@link SctpStandardSocketOptions#SO_RCVBUF
    8.60   *                                          SO_RCVBUF} </td>
    8.61   *     <td> The size of the socket receive buffer </td>
    8.62   *   </tr>
    8.63   *   <tr>
    8.64 - *     <td> {@link SctpStandardSocketOption#SO_LINGER
    8.65 + *     <td> {@link SctpStandardSocketOptions#SO_LINGER
    8.66   *                                          SO_LINGER} </td>
    8.67   *     <td> Linger on close if data is present (when configured in blocking mode
    8.68   *          only) </td>
    8.69 @@ -450,7 +450,7 @@
    8.70       * @throws  IOException
    8.71       *          If an I/O error occurs
    8.72       *
    8.73 -     * @see SctpStandardSocketOption
    8.74 +     * @see SctpStandardSocketOptions
    8.75       */
    8.76      public abstract <T> T getOption(SctpSocketOption<T> name,
    8.77                                      Association association)
    8.78 @@ -489,7 +489,7 @@
    8.79       * @throws  IOException
    8.80       *          If an I/O error occurs
    8.81       *
    8.82 -     * @see SctpStandardSocketOption
    8.83 +     * @see SctpStandardSocketOptions
    8.84       */
    8.85      public abstract <T> SctpMultiChannel setOption(SctpSocketOption<T> name,
    8.86                                                     T value,
    8.87 @@ -542,7 +542,7 @@
    8.88       * MessageInfo} will return {@code false}, and more invocations of this
    8.89       * method will be necessary to completely consume the messgae. Only
    8.90       * one message at a time will be partially delivered in any stream. The
    8.91 -     * socket option {@link SctpStandardSocketOption#SCTP_FRAGMENT_INTERLEAVE
    8.92 +     * socket option {@link SctpStandardSocketOptions#SCTP_FRAGMENT_INTERLEAVE
    8.93       * SCTP_FRAGMENT_INTERLEAVE} controls various aspects of what interlacing of
    8.94       * messages occurs.
    8.95       *
    8.96 @@ -635,14 +635,14 @@
    8.97       * underlying output buffer, then the remaining bytes in the given byte
    8.98       * buffer are transmitted as a single message. Sending a message
    8.99       * is atomic unless explicit message completion {@link
   8.100 -     * SctpStandardSocketOption#SCTP_EXPLICIT_COMPLETE SCTP_EXPLICIT_COMPLETE}
   8.101 +     * SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE SCTP_EXPLICIT_COMPLETE}
   8.102       * socket option is enabled on this channel's socket.
   8.103       *
   8.104       * <P> If this channel is in non-blocking mode, there is sufficient room
   8.105       * in the underlying output buffer, and an implicit association setup is
   8.106       * required, then the remaining bytes in the given byte buffer are
   8.107       * transmitted as a single message, subject to {@link
   8.108 -     * SctpStandardSocketOption#SCTP_EXPLICIT_COMPLETE SCTP_EXPLICIT_COMPLETE}.
   8.109 +     * SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE SCTP_EXPLICIT_COMPLETE}.
   8.110       * If for any reason the message cannot
   8.111       * be delivered an {@link AssociationChangeNotification association
   8.112       * changed} notification is put on the SCTP stack with its {@code event} parameter set
     9.1 --- a/src/share/classes/com/sun/nio/sctp/SctpServerChannel.java	Wed May 18 16:32:05 2011 -0700
     9.2 +++ b/src/share/classes/com/sun/nio/sctp/SctpServerChannel.java	Wed May 18 18:18:04 2011 -0700
     9.3 @@ -53,7 +53,7 @@
     9.4   *     <th>Description</th>
     9.5   *   </tr>
     9.6   *   <tr>
     9.7 - *     <td> {@link SctpStandardSocketOption#SCTP_INIT_MAXSTREAMS
     9.8 + *     <td> {@link SctpStandardSocketOptions#SCTP_INIT_MAXSTREAMS
     9.9   *                                          SCTP_INIT_MAXSTREAMS} </td>
    9.10   *     <td> The maximum number of streams requested by the local endpoint during
    9.11   *          association initialization </td>
    9.12 @@ -360,7 +360,7 @@
    9.13       * @throws  IOException
    9.14       *          If an I/O error occurs
    9.15       *
    9.16 -     * @see SctpStandardSocketOption
    9.17 +     * @see SctpStandardSocketOptions
    9.18       */
    9.19      public abstract <T> T getOption(SctpSocketOption<T> name) throws IOException;
    9.20  
    9.21 @@ -388,7 +388,7 @@
    9.22       * @throws  IOException
    9.23       *          If an I/O error occurs
    9.24       *
    9.25 -     * @see SctpStandardSocketOption
    9.26 +     * @see SctpStandardSocketOptions
    9.27       */
    9.28      public abstract <T> SctpServerChannel setOption(SctpSocketOption<T> name,
    9.29                                                      T value)
    10.1 --- a/src/share/classes/com/sun/nio/sctp/SctpSocketOption.java	Wed May 18 16:32:05 2011 -0700
    10.2 +++ b/src/share/classes/com/sun/nio/sctp/SctpSocketOption.java	Wed May 18 18:18:04 2011 -0700
    10.3 @@ -33,6 +33,6 @@
    10.4   *
    10.5   * @since 1.7
    10.6   *
    10.7 - * @see SctpStandardSocketOption
    10.8 + * @see SctpStandardSocketOptions
    10.9   */
   10.10  public interface SctpSocketOption<T> extends SocketOption<T> { }
    11.1 --- a/src/share/classes/com/sun/nio/sctp/SctpStandardSocketOption.java	Wed May 18 16:32:05 2011 -0700
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,419 +0,0 @@
    11.4 -/*
    11.5 - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    11.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    11.7 - *
    11.8 - * This code is free software; you can redistribute it and/or modify it
    11.9 - * under the terms of the GNU General Public License version 2 only, as
   11.10 - * published by the Free Software Foundation.  Oracle designates this
   11.11 - * particular file as subject to the "Classpath" exception as provided
   11.12 - * by Oracle in the LICENSE file that accompanied this code.
   11.13 - *
   11.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   11.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   11.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   11.17 - * version 2 for more details (a copy is included in the LICENSE file that
   11.18 - * accompanied this code).
   11.19 - *
   11.20 - * You should have received a copy of the GNU General Public License version
   11.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   11.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   11.23 - *
   11.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   11.25 - * or visit www.oracle.com if you need additional information or have any
   11.26 - * questions.
   11.27 - */
   11.28 -package com.sun.nio.sctp;
   11.29 -
   11.30 -import java.net.SocketAddress;
   11.31 -import sun.nio.ch.SctpStdSocketOption;
   11.32 -
   11.33 -/**
   11.34 - * SCTP channels supports the socket options defined by this class
   11.35 - * (as well as those listed in the particular channel class) and may support
   11.36 - * additional Implementation specific socket options.
   11.37 - *
   11.38 - * @since 1.7
   11.39 - */
   11.40 -public class SctpStandardSocketOption {
   11.41 -    private SctpStandardSocketOption() {}
   11.42 -    /**
   11.43 -     * Enables or disables message fragmentation.
   11.44 -     *
   11.45 -     * <P> The value of this socket option is a {@code Boolean} that represents
   11.46 -     * whether the option is enabled or disabled. If enabled no SCTP message
   11.47 -     * fragmentation will be performed. Instead if a message being sent
   11.48 -     * exceeds the current PMTU size, the message will NOT be sent and
   11.49 -     * an error will be indicated to the user.
   11.50 -     *
   11.51 -     * <P> It is implementation specific whether or not this option is
   11.52 -     * supported.
   11.53 -     */
   11.54 -    public static final SctpSocketOption<Boolean> SCTP_DISABLE_FRAGMENTS = new
   11.55 -        SctpStdSocketOption<Boolean>("SCTP_DISABLE_FRAGMENTS", Boolean.class,
   11.56 -        sun.nio.ch.SctpStdSocketOption.SCTP_DISABLE_FRAGMENTS);
   11.57 -
   11.58 -    /**
   11.59 -     * Enables or disables explicit message completion.
   11.60 -     *
   11.61 -     * <p> The value of this socket option is a {@code Boolean} that represents
   11.62 -     * whether the option is enabled or disabled. When this option is enabled,
   11.63 -     * the {@code send} method may be invoked multiple times to a send message.
   11.64 -     * The {@code isComplete} parameter of the {@link MessageInfo} must only
   11.65 -     * be set to {@code true} for the final send to indicate that the message is
   11.66 -     * complete. If this option is disabled then each individual {@code send}
   11.67 -     * invocation is considered complete.
   11.68 -     *
   11.69 -     * <P> The default value of the option is {@code false} indicating that the
   11.70 -     * option is disabled. It is implementation specific whether or not this
   11.71 -     * option is supported.
   11.72 -     */
   11.73 -    public static final SctpSocketOption<Boolean> SCTP_EXPLICIT_COMPLETE = new
   11.74 -        SctpStdSocketOption<Boolean>("SCTP_EXPLICIT_COMPLETE", Boolean.class,
   11.75 -        sun.nio.ch.SctpStdSocketOption.SCTP_EXPLICIT_COMPLETE);
   11.76 -
   11.77 -    /**
   11.78 -     * Fragmented interleave controls how the presentation of messages occur
   11.79 -     * for the message receiver. There are three levels of fragment interleave
   11.80 -     * defined. Two of the levels effect {@link SctpChannel}, while
   11.81 -     * {@link SctpMultiChannel} is effected by all three levels.
   11.82 -     *
   11.83 -     * <P> This option takes an {@code Integer} value. It can be set to a value
   11.84 -     * of {@code 0}, {@code 1} or {@code 2}.
   11.85 -     *
   11.86 -     * <P> Setting the three levels provides the following receiver
   11.87 -     * interactions:
   11.88 -     *
   11.89 -     * <P> {@code level 0} - Prevents the interleaving of any messages. This
   11.90 -     * means that when a partial delivery begins, no other messages will be
   11.91 -     * received except the message being partially delivered. If another message
   11.92 -     * arrives on a different stream (or association) that could be delivered,
   11.93 -     * it will be blocked waiting for the user to read all of the partially
   11.94 -     * delivered message.
   11.95 -     *
   11.96 -     * <P> {@code level 1} - Allows interleaving of messages that are from
   11.97 -     * different associations. For {@code SctpChannel}, level 0 and
   11.98 -     * level 1 have the same meaning since an {@code SctpChannel} always
   11.99 -     * receives messages from the same association. Note that setting an {@code
  11.100 -     * SctpMultiChannel} to this level may cause multiple partial
  11.101 -     * delivers from different associations but for any given association, only
  11.102 -     * one message will be delivered until all parts of a message have been
  11.103 -     * delivered. This means that one large message, being read with an
  11.104 -     * association identification of "X", will block other messages from
  11.105 -     * association "X" from being delivered.
  11.106 -     *
  11.107 -     * <P> {@code level 2} - Allows complete interleaving of messages. This
  11.108 -     * level requires that the sender carefully observe not only the peer
  11.109 -     * {@code Association} but also must pay careful attention to the stream
  11.110 -     * number. With this option enabled a partially delivered message may begin
  11.111 -     * being delivered for association "X" stream "Y" and the next subsequent
  11.112 -     * receive may return a message from association "X" stream "Z". Note that
  11.113 -     * no other messages would be delivered for association "X" stream "Y"
  11.114 -     * until all of stream "Y"'s partially delivered message was read.
  11.115 -     * Note that this option effects both channel types.  Also note that
  11.116 -     * for an {@code SctpMultiChannel} not only may another streams
  11.117 -     * message from the same association be delivered from the next receive,
  11.118 -     * some other associations message may be delivered upon the next receive.
  11.119 -     *
  11.120 -     * <P> It is implementation specific whether or not this option is
  11.121 -     * supported.
  11.122 -     */
  11.123 -    public static final SctpSocketOption<Integer> SCTP_FRAGMENT_INTERLEAVE =
  11.124 -            new SctpStdSocketOption<Integer>("SCTP_FRAGMENT_INTERLEAVE",
  11.125 -                  Integer.class,
  11.126 -                  sun.nio.ch.SctpStdSocketOption.SCTP_FRAGMENT_INTERLEAVE);
  11.127 -
  11.128 -    /**
  11.129 -     * The maximum number of streams requested by the local endpoint during
  11.130 -     * association initialization.
  11.131 -     *
  11.132 -     * <P> The value of this socket option is an {@link
  11.133 -     * SctpStandardSocketOption.InitMaxStreams InitMaxStreams}, that represents
  11.134 -     * the maximum number of inbound and outbound streams that an association
  11.135 -     * on the channel is prepared to support.
  11.136 -     *
  11.137 -     * <P> For an {@link SctpChannel} this option may only be used to
  11.138 -     * change the number of inbound/outbound streams prior to connecting.
  11.139 -     *
  11.140 -     * <P> For an {@link SctpMultiChannel} this option determines
  11.141 -     * the maximum number of inbound/outbound streams new associations setup
  11.142 -     * on the channel will be prepared to support.
  11.143 -     *
  11.144 -     * <P> For an {@link SctpServerChannel} this option determines the
  11.145 -     * maximum number of inbound/outbound streams accepted sockets will
  11.146 -     * negotiate with their connecting peer.
  11.147 -     *
  11.148 -     * <P> In all cases the value set by this option is used in the negotiation
  11.149 -     * of new associations setup on the channel's socket and the actual
  11.150 -     * maximum number of inbound/outbound streams that have been negotiated
  11.151 -     * with the peer can be retrieved from the appropriate {@link
  11.152 -     * Association}. The {@code Association} can be retrieved from the
  11.153 -     * {@link AssociationChangeNotification.AssocChangeEvent#COMM_UP COMM_UP}
  11.154 -     * {@link AssociationChangeNotification} belonging to that association.
  11.155 -     *
  11.156 -     * <p> This value is bounded by the actual implementation. In other
  11.157 -     * words the user may be able to support more streams than the Operating
  11.158 -     * System. In such a case, the Operating System limit may override the
  11.159 -     * value requested by the user. The default value of 0 indicates to use
  11.160 -     * the endpoints default value.
  11.161 -     */
  11.162 -    public static final SctpSocketOption
  11.163 -        <SctpStandardSocketOption.InitMaxStreams> SCTP_INIT_MAXSTREAMS =
  11.164 -        new SctpStdSocketOption<SctpStandardSocketOption.InitMaxStreams>(
  11.165 -        "SCTP_INIT_MAXSTREAMS", SctpStandardSocketOption.InitMaxStreams.class);
  11.166 -
  11.167 -    /**
  11.168 -     * Enables or disables a Nagle-like algorithm.
  11.169 -     *
  11.170 -     * <P> The value of this socket option is a {@code Boolean} that represents
  11.171 -     * whether the option is enabled or disabled. SCTP uses an algorithm like
  11.172 -     * <em>The Nagle Algorithm</em> to coalesce short segments and
  11.173 -     * improve network efficiency.
  11.174 -     */
  11.175 -    public static final SctpSocketOption<Boolean> SCTP_NODELAY =
  11.176 -        new SctpStdSocketOption<Boolean>("SCTP_NODELAY", Boolean.class,
  11.177 -        sun.nio.ch.SctpStdSocketOption.SCTP_NODELAY);
  11.178 -
  11.179 -    /**
  11.180 -     * Requests that the local SCTP stack use the given peer address as
  11.181 -     * the association primary.
  11.182 -     *
  11.183 -     * <P> The value of this socket option is a {@code SocketAddress}
  11.184 -     * that represents the peer address that the local SCTP stack should use as
  11.185 -     * the association primary. The address must be one of the association
  11.186 -     * peer's addresses.
  11.187 -     *
  11.188 -     * <P> An {@code SctpMultiChannel} can control more than one
  11.189 -     * association, the association parameter must be given when setting or
  11.190 -     * retrieving this option.
  11.191 -     *
  11.192 -     * <P> Since {@code SctpChannel} only controls one association,
  11.193 -     * the association parameter is not required and this option can be
  11.194 -     * set or queried directly.
  11.195 -     */
  11.196 -     public static final SctpSocketOption<SocketAddress> SCTP_PRIMARY_ADDR =
  11.197 -             new SctpStdSocketOption<SocketAddress>
  11.198 -             ("SCTP_PRIMARY_ADDR", SocketAddress.class);
  11.199 -
  11.200 -     /**
  11.201 -     * Requests that the peer mark the enclosed address as the association
  11.202 -     * primary.
  11.203 -     *
  11.204 -     * <P> The value of this socket option is a {@code SocketAddress}
  11.205 -     * that represents the local address that the peer should use as its
  11.206 -     * primary address. The given address must be one of the association's
  11.207 -     * locally bound addresses.
  11.208 -     *
  11.209 -     * <P> An {@code SctpMultiChannel} can control more than one
  11.210 -     * association, the association parameter must be given when setting or
  11.211 -     * retrieving this option.
  11.212 -     *
  11.213 -     * <P> Since {@code SctpChannel} only controls one association,
  11.214 -     * the association parameter is not required and this option can be
  11.215 -     * queried directly.
  11.216 -     *
  11.217 -     * <P> Note, this is a set only option and cannot be retrieved by {@code
  11.218 -     * getOption}. It is implementation specific whether or not this
  11.219 -     * option is supported.
  11.220 -     */
  11.221 -    public static final SctpSocketOption<SocketAddress> SCTP_SET_PEER_PRIMARY_ADDR =
  11.222 -            new SctpStdSocketOption<SocketAddress>
  11.223 -            ("SCTP_SET_PEER_PRIMARY_ADDR", SocketAddress.class);
  11.224 -
  11.225 -    /**
  11.226 -     * The size of the socket send buffer.
  11.227 -     *
  11.228 -     * <p> The value of this socket option is an {@code Integer} that is the
  11.229 -     * size of the socket send buffer in bytes. The socket send buffer is an
  11.230 -     * output buffer used by the networking implementation. It may need to be
  11.231 -     * increased for high-volume connections. The value of the socket option is
  11.232 -     * a <em>hint</em> to the implementation to size the buffer and the actual
  11.233 -     * size may differ. The socket option can be queried to retrieve the actual
  11.234 -     * size.
  11.235 -     *
  11.236 -     * <p> For {@code SctpChannel}, this controls the amount of data
  11.237 -     * the SCTP stack may have waiting in internal buffers to be sent. This
  11.238 -     * option therefore bounds the maximum size of data that can be sent in a
  11.239 -     * single send call.
  11.240 -     *
  11.241 -     * <P> For {@code SctpMultiChannel}, the effect is the same as for {@code
  11.242 -     * SctpChannel}, except that it applies to all associations. The option
  11.243 -     * applies to each association's window size separately.
  11.244 -     *
  11.245 -     * <p> An implementation allows this socket option to be set before the
  11.246 -     * socket is bound or connected. Whether an implementation allows the
  11.247 -     * socket send buffer to be changed after the socket is bound is system
  11.248 -     * dependent.
  11.249 -     */
  11.250 -    public static final SctpSocketOption<Integer> SO_SNDBUF =
  11.251 -        new SctpStdSocketOption<Integer>("SO_SNDBUF", Integer.class,
  11.252 -        sun.nio.ch.SctpStdSocketOption.SO_SNDBUF);
  11.253 -
  11.254 -    /**
  11.255 -     * The size of the socket receive buffer.
  11.256 -     *
  11.257 -     * <P> The value of this socket option is an {@code Integer} that is the
  11.258 -     * size of the socket receive buffer in bytes. The socket receive buffer is
  11.259 -     * an input buffer used by the networking implementation. It may need to be
  11.260 -     * increased for high-volume connections or decreased to limit the possible
  11.261 -     * backlog of incoming data. The value of the socket option is a
  11.262 -     * <em>hint</em> to the implementation to size the buffer and the actual
  11.263 -     * size may differ.
  11.264 -     *
  11.265 -     * <P> For {@code SctpChannel}, this controls the receiver window size.
  11.266 -     *
  11.267 -     * <P> For {@code SctpMultiChannel}, the meaning is implementation
  11.268 -     * dependent. It might control the receive buffer for each association bound
  11.269 -     * to the socket descriptor or it might control the receive buffer for the
  11.270 -     * whole socket.
  11.271 -     *
  11.272 -     * <p> An implementation allows this socket option to be set before the
  11.273 -     * socket is bound or connected. Whether an implementation allows the
  11.274 -     * socket receive buffer to be changed after the socket is bound is system
  11.275 -     * dependent.
  11.276 -     */
  11.277 -    public static final SctpSocketOption<Integer> SO_RCVBUF =
  11.278 -        new SctpStdSocketOption<Integer>("SO_RCVBUF", Integer.class,
  11.279 -        sun.nio.ch.SctpStdSocketOption.SO_RCVBUF);
  11.280 -
  11.281 -    /**
  11.282 -     * Linger on close if data is present.
  11.283 -     *
  11.284 -     * <p> The value of this socket option is an {@code Integer} that controls
  11.285 -     * the action taken when unsent data is queued on the socket and a method
  11.286 -     * to close the socket is invoked. If the value of the socket option is zero
  11.287 -     * or greater, then it represents a timeout value, in seconds, known as the
  11.288 -     * <em>linger interval</em>. The linger interval is the timeout for the
  11.289 -     * {@code close} method to block while the operating system attempts to
  11.290 -     * transmit the unsent data or it decides that it is unable to transmit the
  11.291 -     * data. If the value of the socket option is less than zero then the option
  11.292 -     * is disabled. In that case the {@code close} method does not wait until
  11.293 -     * unsent data is transmitted; if possible the operating system will transmit
  11.294 -     * any unsent data before the connection is closed.
  11.295 -     *
  11.296 -     * <p> This socket option is intended for use with sockets that are configured
  11.297 -     * in {@link java.nio.channels.SelectableChannel#isBlocking() blocking} mode
  11.298 -     * only. The behavior of the {@code close} method when this option is
  11.299 -     * enabled on a non-blocking socket is not defined.
  11.300 -     *
  11.301 -     * <p> The initial value of this socket option is a negative value, meaning
  11.302 -     * that the option is disabled. The option may be enabled, or the linger
  11.303 -     * interval changed, at any time. The maximum value of the linger interval
  11.304 -     * is system dependent. Setting the linger interval to a value that is
  11.305 -     * greater than its maximum value causes the linger interval to be set to
  11.306 -     * its maximum value.
  11.307 -     */
  11.308 -    public static final SctpSocketOption<Integer> SO_LINGER =
  11.309 -        new SctpStdSocketOption<Integer>("SO_LINGER", Integer.class,
  11.310 -        sun.nio.ch.SctpStdSocketOption.SO_LINGER);
  11.311 -
  11.312 -    /**
  11.313 -     * This class is used to set the maximum number of inbound/outbound streams
  11.314 -     * used by the local endpoint during association initialization. An
  11.315 -     * instance of this class is used to set the {@link
  11.316 -     * SctpStandardSocketOption#SCTP_INIT_MAXSTREAMS SCTP_INIT_MAXSTREAMS}
  11.317 -     * socket option.
  11.318 -     *
  11.319 -     * @since 1.7
  11.320 -     */
  11.321 -    public static class InitMaxStreams {
  11.322 -        private int maxInStreams;
  11.323 -        private int maxOutStreams;
  11.324 -
  11.325 -        private InitMaxStreams(int maxInStreams, int maxOutStreams) {
  11.326 -           this.maxInStreams = maxInStreams;
  11.327 -           this.maxOutStreams = maxOutStreams;
  11.328 -        }
  11.329 -
  11.330 -        /**
  11.331 -         * Creates an InitMaxStreams instance.
  11.332 -         *
  11.333 -         * @param  maxInStreams
  11.334 -         *         The maximum number of inbound streams, where
  11.335 -         *         {@code 0 <= maxInStreams <= 65536}
  11.336 -         *
  11.337 -         * @param  maxOutStreams
  11.338 -         *         The maximum number of outbound streams, where
  11.339 -         *         {@code 0 <= maxOutStreams <= 65536}
  11.340 -         *
  11.341 -         * @return  An {@code InitMaxStreams} instance
  11.342 -         *
  11.343 -         * @throws  IllegalArgumentException
  11.344 -         *          If an argument is outside of specified bounds
  11.345 -         */
  11.346 -        public static InitMaxStreams create
  11.347 -              (int maxInStreams, int maxOutStreams) {
  11.348 -            if (maxOutStreams < 0 || maxOutStreams > 65535)
  11.349 -                throw new IllegalArgumentException(
  11.350 -                      "Invalid maxOutStreams value");
  11.351 -            if (maxInStreams < 0 || maxInStreams > 65535)
  11.352 -                throw new IllegalArgumentException(
  11.353 -                      "Invalid maxInStreams value");
  11.354 -
  11.355 -            return new InitMaxStreams(maxInStreams, maxOutStreams);
  11.356 -        }
  11.357 -
  11.358 -        /**
  11.359 -         * Returns the maximum number of inbound streams.
  11.360 -         *
  11.361 -         * @return  Maximum inbound streams
  11.362 -         */
  11.363 -        public int maxInStreams() {
  11.364 -            return maxInStreams;
  11.365 -        }
  11.366 -
  11.367 -        /**
  11.368 -         * Returns the maximum number of outbound streams.
  11.369 -         *
  11.370 -         * @return  Maximum outbound streams
  11.371 -         */
  11.372 -        public int maxOutStreams() {
  11.373 -            return maxOutStreams;
  11.374 -        }
  11.375 -
  11.376 -        /**
  11.377 -         * Returns a string representation of this init max streams, including
  11.378 -         * the maximum in and out bound streams.
  11.379 -         *
  11.380 -         * @return  A string representation of this init max streams
  11.381 -         */
  11.382 -        @Override
  11.383 -        public String toString() {
  11.384 -            StringBuilder sb = new StringBuilder();
  11.385 -            sb.append(super.toString()).append(" [");
  11.386 -            sb.append("maxInStreams:").append(maxInStreams);
  11.387 -            sb.append("maxOutStreams:").append(maxOutStreams).append("]");
  11.388 -            return sb.toString();
  11.389 -        }
  11.390 -
  11.391 -        /**
  11.392 -         * Returns true if the specified object is another {@code InitMaxStreams}
  11.393 -         * instance with the same number of in and out bound streams.
  11.394 -         *
  11.395 -         * @param  obj
  11.396 -         *         The object to be compared with this init max streams
  11.397 -         *
  11.398 -         * @return  true if the specified object is another
  11.399 -         *          {@code InitMaxStreams} instance with the same number of in
  11.400 -         *          and out bound streams
  11.401 -         */
  11.402 -        @Override
  11.403 -        public boolean equals(Object obj) {
  11.404 -            if (obj != null && obj instanceof InitMaxStreams) {
  11.405 -                InitMaxStreams that = (InitMaxStreams) obj;
  11.406 -                if (this.maxInStreams == that.maxInStreams &&
  11.407 -                    this.maxOutStreams == that.maxOutStreams)
  11.408 -                    return true;
  11.409 -            }
  11.410 -            return false;
  11.411 -        }
  11.412 -
  11.413 -        /**
  11.414 -         * Returns a hash code value for this init max streams.
  11.415 -         */
  11.416 -        @Override
  11.417 -        public int hashCode() {
  11.418 -            int hash = 7 ^ maxInStreams ^ maxOutStreams;
  11.419 -            return hash;
  11.420 -        }
  11.421 -    }
  11.422 -}
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/src/share/classes/com/sun/nio/sctp/SctpStandardSocketOptions.java	Wed May 18 18:18:04 2011 -0700
    12.3 @@ -0,0 +1,419 @@
    12.4 +/*
    12.5 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    12.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    12.7 + *
    12.8 + * This code is free software; you can redistribute it and/or modify it
    12.9 + * under the terms of the GNU General Public License version 2 only, as
   12.10 + * published by the Free Software Foundation.  Oracle designates this
   12.11 + * particular file as subject to the "Classpath" exception as provided
   12.12 + * by Oracle in the LICENSE file that accompanied this code.
   12.13 + *
   12.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   12.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   12.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   12.17 + * version 2 for more details (a copy is included in the LICENSE file that
   12.18 + * accompanied this code).
   12.19 + *
   12.20 + * You should have received a copy of the GNU General Public License version
   12.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   12.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   12.23 + *
   12.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   12.25 + * or visit www.oracle.com if you need additional information or have any
   12.26 + * questions.
   12.27 + */
   12.28 +package com.sun.nio.sctp;
   12.29 +
   12.30 +import java.net.SocketAddress;
   12.31 +import sun.nio.ch.SctpStdSocketOption;
   12.32 +
   12.33 +/**
   12.34 + * SCTP channels supports the socket options defined by this class
   12.35 + * (as well as those listed in the particular channel class) and may support
   12.36 + * additional Implementation specific socket options.
   12.37 + *
   12.38 + * @since 1.7
   12.39 + */
   12.40 +public class SctpStandardSocketOptions {
   12.41 +    private SctpStandardSocketOptions() {}
   12.42 +    /**
   12.43 +     * Enables or disables message fragmentation.
   12.44 +     *
   12.45 +     * <P> The value of this socket option is a {@code Boolean} that represents
   12.46 +     * whether the option is enabled or disabled. If enabled no SCTP message
   12.47 +     * fragmentation will be performed. Instead if a message being sent
   12.48 +     * exceeds the current PMTU size, the message will NOT be sent and
   12.49 +     * an error will be indicated to the user.
   12.50 +     *
   12.51 +     * <P> It is implementation specific whether or not this option is
   12.52 +     * supported.
   12.53 +     */
   12.54 +    public static final SctpSocketOption<Boolean> SCTP_DISABLE_FRAGMENTS = new
   12.55 +        SctpStdSocketOption<Boolean>("SCTP_DISABLE_FRAGMENTS", Boolean.class,
   12.56 +        sun.nio.ch.SctpStdSocketOption.SCTP_DISABLE_FRAGMENTS);
   12.57 +
   12.58 +    /**
   12.59 +     * Enables or disables explicit message completion.
   12.60 +     *
   12.61 +     * <p> The value of this socket option is a {@code Boolean} that represents
   12.62 +     * whether the option is enabled or disabled. When this option is enabled,
   12.63 +     * the {@code send} method may be invoked multiple times to a send message.
   12.64 +     * The {@code isComplete} parameter of the {@link MessageInfo} must only
   12.65 +     * be set to {@code true} for the final send to indicate that the message is
   12.66 +     * complete. If this option is disabled then each individual {@code send}
   12.67 +     * invocation is considered complete.
   12.68 +     *
   12.69 +     * <P> The default value of the option is {@code false} indicating that the
   12.70 +     * option is disabled. It is implementation specific whether or not this
   12.71 +     * option is supported.
   12.72 +     */
   12.73 +    public static final SctpSocketOption<Boolean> SCTP_EXPLICIT_COMPLETE = new
   12.74 +        SctpStdSocketOption<Boolean>("SCTP_EXPLICIT_COMPLETE", Boolean.class,
   12.75 +        sun.nio.ch.SctpStdSocketOption.SCTP_EXPLICIT_COMPLETE);
   12.76 +
   12.77 +    /**
   12.78 +     * Fragmented interleave controls how the presentation of messages occur
   12.79 +     * for the message receiver. There are three levels of fragment interleave
   12.80 +     * defined. Two of the levels effect {@link SctpChannel}, while
   12.81 +     * {@link SctpMultiChannel} is effected by all three levels.
   12.82 +     *
   12.83 +     * <P> This option takes an {@code Integer} value. It can be set to a value
   12.84 +     * of {@code 0}, {@code 1} or {@code 2}.
   12.85 +     *
   12.86 +     * <P> Setting the three levels provides the following receiver
   12.87 +     * interactions:
   12.88 +     *
   12.89 +     * <P> {@code level 0} - Prevents the interleaving of any messages. This
   12.90 +     * means that when a partial delivery begins, no other messages will be
   12.91 +     * received except the message being partially delivered. If another message
   12.92 +     * arrives on a different stream (or association) that could be delivered,
   12.93 +     * it will be blocked waiting for the user to read all of the partially
   12.94 +     * delivered message.
   12.95 +     *
   12.96 +     * <P> {@code level 1} - Allows interleaving of messages that are from
   12.97 +     * different associations. For {@code SctpChannel}, level 0 and
   12.98 +     * level 1 have the same meaning since an {@code SctpChannel} always
   12.99 +     * receives messages from the same association. Note that setting an {@code
  12.100 +     * SctpMultiChannel} to this level may cause multiple partial
  12.101 +     * delivers from different associations but for any given association, only
  12.102 +     * one message will be delivered until all parts of a message have been
  12.103 +     * delivered. This means that one large message, being read with an
  12.104 +     * association identification of "X", will block other messages from
  12.105 +     * association "X" from being delivered.
  12.106 +     *
  12.107 +     * <P> {@code level 2} - Allows complete interleaving of messages. This
  12.108 +     * level requires that the sender carefully observe not only the peer
  12.109 +     * {@code Association} but also must pay careful attention to the stream
  12.110 +     * number. With this option enabled a partially delivered message may begin
  12.111 +     * being delivered for association "X" stream "Y" and the next subsequent
  12.112 +     * receive may return a message from association "X" stream "Z". Note that
  12.113 +     * no other messages would be delivered for association "X" stream "Y"
  12.114 +     * until all of stream "Y"'s partially delivered message was read.
  12.115 +     * Note that this option effects both channel types.  Also note that
  12.116 +     * for an {@code SctpMultiChannel} not only may another streams
  12.117 +     * message from the same association be delivered from the next receive,
  12.118 +     * some other associations message may be delivered upon the next receive.
  12.119 +     *
  12.120 +     * <P> It is implementation specific whether or not this option is
  12.121 +     * supported.
  12.122 +     */
  12.123 +    public static final SctpSocketOption<Integer> SCTP_FRAGMENT_INTERLEAVE =
  12.124 +            new SctpStdSocketOption<Integer>("SCTP_FRAGMENT_INTERLEAVE",
  12.125 +                  Integer.class,
  12.126 +                  sun.nio.ch.SctpStdSocketOption.SCTP_FRAGMENT_INTERLEAVE);
  12.127 +
  12.128 +    /**
  12.129 +     * The maximum number of streams requested by the local endpoint during
  12.130 +     * association initialization.
  12.131 +     *
  12.132 +     * <P> The value of this socket option is an {@link
  12.133 +     * SctpStandardSocketOptions.InitMaxStreams InitMaxStreams}, that represents
  12.134 +     * the maximum number of inbound and outbound streams that an association
  12.135 +     * on the channel is prepared to support.
  12.136 +     *
  12.137 +     * <P> For an {@link SctpChannel} this option may only be used to
  12.138 +     * change the number of inbound/outbound streams prior to connecting.
  12.139 +     *
  12.140 +     * <P> For an {@link SctpMultiChannel} this option determines
  12.141 +     * the maximum number of inbound/outbound streams new associations setup
  12.142 +     * on the channel will be prepared to support.
  12.143 +     *
  12.144 +     * <P> For an {@link SctpServerChannel} this option determines the
  12.145 +     * maximum number of inbound/outbound streams accepted sockets will
  12.146 +     * negotiate with their connecting peer.
  12.147 +     *
  12.148 +     * <P> In all cases the value set by this option is used in the negotiation
  12.149 +     * of new associations setup on the channel's socket and the actual
  12.150 +     * maximum number of inbound/outbound streams that have been negotiated
  12.151 +     * with the peer can be retrieved from the appropriate {@link
  12.152 +     * Association}. The {@code Association} can be retrieved from the
  12.153 +     * {@link AssociationChangeNotification.AssocChangeEvent#COMM_UP COMM_UP}
  12.154 +     * {@link AssociationChangeNotification} belonging to that association.
  12.155 +     *
  12.156 +     * <p> This value is bounded by the actual implementation. In other
  12.157 +     * words the user may be able to support more streams than the Operating
  12.158 +     * System. In such a case, the Operating System limit may override the
  12.159 +     * value requested by the user. The default value of 0 indicates to use
  12.160 +     * the endpoints default value.
  12.161 +     */
  12.162 +    public static final SctpSocketOption
  12.163 +        <SctpStandardSocketOptions.InitMaxStreams> SCTP_INIT_MAXSTREAMS =
  12.164 +        new SctpStdSocketOption<SctpStandardSocketOptions.InitMaxStreams>(
  12.165 +        "SCTP_INIT_MAXSTREAMS", SctpStandardSocketOptions.InitMaxStreams.class);
  12.166 +
  12.167 +    /**
  12.168 +     * Enables or disables a Nagle-like algorithm.
  12.169 +     *
  12.170 +     * <P> The value of this socket option is a {@code Boolean} that represents
  12.171 +     * whether the option is enabled or disabled. SCTP uses an algorithm like
  12.172 +     * <em>The Nagle Algorithm</em> to coalesce short segments and
  12.173 +     * improve network efficiency.
  12.174 +     */
  12.175 +    public static final SctpSocketOption<Boolean> SCTP_NODELAY =
  12.176 +        new SctpStdSocketOption<Boolean>("SCTP_NODELAY", Boolean.class,
  12.177 +        sun.nio.ch.SctpStdSocketOption.SCTP_NODELAY);
  12.178 +
  12.179 +    /**
  12.180 +     * Requests that the local SCTP stack use the given peer address as
  12.181 +     * the association primary.
  12.182 +     *
  12.183 +     * <P> The value of this socket option is a {@code SocketAddress}
  12.184 +     * that represents the peer address that the local SCTP stack should use as
  12.185 +     * the association primary. The address must be one of the association
  12.186 +     * peer's addresses.
  12.187 +     *
  12.188 +     * <P> An {@code SctpMultiChannel} can control more than one
  12.189 +     * association, the association parameter must be given when setting or
  12.190 +     * retrieving this option.
  12.191 +     *
  12.192 +     * <P> Since {@code SctpChannel} only controls one association,
  12.193 +     * the association parameter is not required and this option can be
  12.194 +     * set or queried directly.
  12.195 +     */
  12.196 +     public static final SctpSocketOption<SocketAddress> SCTP_PRIMARY_ADDR =
  12.197 +             new SctpStdSocketOption<SocketAddress>
  12.198 +             ("SCTP_PRIMARY_ADDR", SocketAddress.class);
  12.199 +
  12.200 +     /**
  12.201 +     * Requests that the peer mark the enclosed address as the association
  12.202 +     * primary.
  12.203 +     *
  12.204 +     * <P> The value of this socket option is a {@code SocketAddress}
  12.205 +     * that represents the local address that the peer should use as its
  12.206 +     * primary address. The given address must be one of the association's
  12.207 +     * locally bound addresses.
  12.208 +     *
  12.209 +     * <P> An {@code SctpMultiChannel} can control more than one
  12.210 +     * association, the association parameter must be given when setting or
  12.211 +     * retrieving this option.
  12.212 +     *
  12.213 +     * <P> Since {@code SctpChannel} only controls one association,
  12.214 +     * the association parameter is not required and this option can be
  12.215 +     * queried directly.
  12.216 +     *
  12.217 +     * <P> Note, this is a set only option and cannot be retrieved by {@code
  12.218 +     * getOption}. It is implementation specific whether or not this
  12.219 +     * option is supported.
  12.220 +     */
  12.221 +    public static final SctpSocketOption<SocketAddress> SCTP_SET_PEER_PRIMARY_ADDR =
  12.222 +            new SctpStdSocketOption<SocketAddress>
  12.223 +            ("SCTP_SET_PEER_PRIMARY_ADDR", SocketAddress.class);
  12.224 +
  12.225 +    /**
  12.226 +     * The size of the socket send buffer.
  12.227 +     *
  12.228 +     * <p> The value of this socket option is an {@code Integer} that is the
  12.229 +     * size of the socket send buffer in bytes. The socket send buffer is an
  12.230 +     * output buffer used by the networking implementation. It may need to be
  12.231 +     * increased for high-volume connections. The value of the socket option is
  12.232 +     * a <em>hint</em> to the implementation to size the buffer and the actual
  12.233 +     * size may differ. The socket option can be queried to retrieve the actual
  12.234 +     * size.
  12.235 +     *
  12.236 +     * <p> For {@code SctpChannel}, this controls the amount of data
  12.237 +     * the SCTP stack may have waiting in internal buffers to be sent. This
  12.238 +     * option therefore bounds the maximum size of data that can be sent in a
  12.239 +     * single send call.
  12.240 +     *
  12.241 +     * <P> For {@code SctpMultiChannel}, the effect is the same as for {@code
  12.242 +     * SctpChannel}, except that it applies to all associations. The option
  12.243 +     * applies to each association's window size separately.
  12.244 +     *
  12.245 +     * <p> An implementation allows this socket option to be set before the
  12.246 +     * socket is bound or connected. Whether an implementation allows the
  12.247 +     * socket send buffer to be changed after the socket is bound is system
  12.248 +     * dependent.
  12.249 +     */
  12.250 +    public static final SctpSocketOption<Integer> SO_SNDBUF =
  12.251 +        new SctpStdSocketOption<Integer>("SO_SNDBUF", Integer.class,
  12.252 +        sun.nio.ch.SctpStdSocketOption.SO_SNDBUF);
  12.253 +
  12.254 +    /**
  12.255 +     * The size of the socket receive buffer.
  12.256 +     *
  12.257 +     * <P> The value of this socket option is an {@code Integer} that is the
  12.258 +     * size of the socket receive buffer in bytes. The socket receive buffer is
  12.259 +     * an input buffer used by the networking implementation. It may need to be
  12.260 +     * increased for high-volume connections or decreased to limit the possible
  12.261 +     * backlog of incoming data. The value of the socket option is a
  12.262 +     * <em>hint</em> to the implementation to size the buffer and the actual
  12.263 +     * size may differ.
  12.264 +     *
  12.265 +     * <P> For {@code SctpChannel}, this controls the receiver window size.
  12.266 +     *
  12.267 +     * <P> For {@code SctpMultiChannel}, the meaning is implementation
  12.268 +     * dependent. It might control the receive buffer for each association bound
  12.269 +     * to the socket descriptor or it might control the receive buffer for the
  12.270 +     * whole socket.
  12.271 +     *
  12.272 +     * <p> An implementation allows this socket option to be set before the
  12.273 +     * socket is bound or connected. Whether an implementation allows the
  12.274 +     * socket receive buffer to be changed after the socket is bound is system
  12.275 +     * dependent.
  12.276 +     */
  12.277 +    public static final SctpSocketOption<Integer> SO_RCVBUF =
  12.278 +        new SctpStdSocketOption<Integer>("SO_RCVBUF", Integer.class,
  12.279 +        sun.nio.ch.SctpStdSocketOption.SO_RCVBUF);
  12.280 +
  12.281 +    /**
  12.282 +     * Linger on close if data is present.
  12.283 +     *
  12.284 +     * <p> The value of this socket option is an {@code Integer} that controls
  12.285 +     * the action taken when unsent data is queued on the socket and a method
  12.286 +     * to close the socket is invoked. If the value of the socket option is zero
  12.287 +     * or greater, then it represents a timeout value, in seconds, known as the
  12.288 +     * <em>linger interval</em>. The linger interval is the timeout for the
  12.289 +     * {@code close} method to block while the operating system attempts to
  12.290 +     * transmit the unsent data or it decides that it is unable to transmit the
  12.291 +     * data. If the value of the socket option is less than zero then the option
  12.292 +     * is disabled. In that case the {@code close} method does not wait until
  12.293 +     * unsent data is transmitted; if possible the operating system will transmit
  12.294 +     * any unsent data before the connection is closed.
  12.295 +     *
  12.296 +     * <p> This socket option is intended for use with sockets that are configured
  12.297 +     * in {@link java.nio.channels.SelectableChannel#isBlocking() blocking} mode
  12.298 +     * only. The behavior of the {@code close} method when this option is
  12.299 +     * enabled on a non-blocking socket is not defined.
  12.300 +     *
  12.301 +     * <p> The initial value of this socket option is a negative value, meaning
  12.302 +     * that the option is disabled. The option may be enabled, or the linger
  12.303 +     * interval changed, at any time. The maximum value of the linger interval
  12.304 +     * is system dependent. Setting the linger interval to a value that is
  12.305 +     * greater than its maximum value causes the linger interval to be set to
  12.306 +     * its maximum value.
  12.307 +     */
  12.308 +    public static final SctpSocketOption<Integer> SO_LINGER =
  12.309 +        new SctpStdSocketOption<Integer>("SO_LINGER", Integer.class,
  12.310 +        sun.nio.ch.SctpStdSocketOption.SO_LINGER);
  12.311 +
  12.312 +    /**
  12.313 +     * This class is used to set the maximum number of inbound/outbound streams
  12.314 +     * used by the local endpoint during association initialization. An
  12.315 +     * instance of this class is used to set the {@link
  12.316 +     * SctpStandardSocketOptions#SCTP_INIT_MAXSTREAMS SCTP_INIT_MAXSTREAMS}
  12.317 +     * socket option.
  12.318 +     *
  12.319 +     * @since 1.7
  12.320 +     */
  12.321 +    public static class InitMaxStreams {
  12.322 +        private int maxInStreams;
  12.323 +        private int maxOutStreams;
  12.324 +
  12.325 +        private InitMaxStreams(int maxInStreams, int maxOutStreams) {
  12.326 +           this.maxInStreams = maxInStreams;
  12.327 +           this.maxOutStreams = maxOutStreams;
  12.328 +        }
  12.329 +
  12.330 +        /**
  12.331 +         * Creates an InitMaxStreams instance.
  12.332 +         *
  12.333 +         * @param  maxInStreams
  12.334 +         *         The maximum number of inbound streams, where
  12.335 +         *         {@code 0 <= maxInStreams <= 65536}
  12.336 +         *
  12.337 +         * @param  maxOutStreams
  12.338 +         *         The maximum number of outbound streams, where
  12.339 +         *         {@code 0 <= maxOutStreams <= 65536}
  12.340 +         *
  12.341 +         * @return  An {@code InitMaxStreams} instance
  12.342 +         *
  12.343 +         * @throws  IllegalArgumentException
  12.344 +         *          If an argument is outside of specified bounds
  12.345 +         */
  12.346 +        public static InitMaxStreams create
  12.347 +              (int maxInStreams, int maxOutStreams) {
  12.348 +            if (maxOutStreams < 0 || maxOutStreams > 65535)
  12.349 +                throw new IllegalArgumentException(
  12.350 +                      "Invalid maxOutStreams value");
  12.351 +            if (maxInStreams < 0 || maxInStreams > 65535)
  12.352 +                throw new IllegalArgumentException(
  12.353 +                      "Invalid maxInStreams value");
  12.354 +
  12.355 +            return new InitMaxStreams(maxInStreams, maxOutStreams);
  12.356 +        }
  12.357 +
  12.358 +        /**
  12.359 +         * Returns the maximum number of inbound streams.
  12.360 +         *
  12.361 +         * @return  Maximum inbound streams
  12.362 +         */
  12.363 +        public int maxInStreams() {
  12.364 +            return maxInStreams;
  12.365 +        }
  12.366 +
  12.367 +        /**
  12.368 +         * Returns the maximum number of outbound streams.
  12.369 +         *
  12.370 +         * @return  Maximum outbound streams
  12.371 +         */
  12.372 +        public int maxOutStreams() {
  12.373 +            return maxOutStreams;
  12.374 +        }
  12.375 +
  12.376 +        /**
  12.377 +         * Returns a string representation of this init max streams, including
  12.378 +         * the maximum in and out bound streams.
  12.379 +         *
  12.380 +         * @return  A string representation of this init max streams
  12.381 +         */
  12.382 +        @Override
  12.383 +        public String toString() {
  12.384 +            StringBuilder sb = new StringBuilder();
  12.385 +            sb.append(super.toString()).append(" [");
  12.386 +            sb.append("maxInStreams:").append(maxInStreams);
  12.387 +            sb.append("maxOutStreams:").append(maxOutStreams).append("]");
  12.388 +            return sb.toString();
  12.389 +        }
  12.390 +
  12.391 +        /**
  12.392 +         * Returns true if the specified object is another {@code InitMaxStreams}
  12.393 +         * instance with the same number of in and out bound streams.
  12.394 +         *
  12.395 +         * @param  obj
  12.396 +         *         The object to be compared with this init max streams
  12.397 +         *
  12.398 +         * @return  true if the specified object is another
  12.399 +         *          {@code InitMaxStreams} instance with the same number of in
  12.400 +         *          and out bound streams
  12.401 +         */
  12.402 +        @Override
  12.403 +        public boolean equals(Object obj) {
  12.404 +            if (obj != null && obj instanceof InitMaxStreams) {
  12.405 +                InitMaxStreams that = (InitMaxStreams) obj;
  12.406 +                if (this.maxInStreams == that.maxInStreams &&
  12.407 +                    this.maxOutStreams == that.maxOutStreams)
  12.408 +                    return true;
  12.409 +            }
  12.410 +            return false;
  12.411 +        }
  12.412 +
  12.413 +        /**
  12.414 +         * Returns a hash code value for this init max streams.
  12.415 +         */
  12.416 +        @Override
  12.417 +        public int hashCode() {
  12.418 +            int hash = 7 ^ maxInStreams ^ maxOutStreams;
  12.419 +            return hash;
  12.420 +        }
  12.421 +    }
  12.422 +}
    13.1 --- a/src/share/classes/java/awt/Component.java	Wed May 18 16:32:05 2011 -0700
    13.2 +++ b/src/share/classes/java/awt/Component.java	Wed May 18 18:18:04 2011 -0700
    13.3 @@ -2887,11 +2887,12 @@
    13.4      /**
    13.5       * Invalidates this component and its ancestors.
    13.6       * <p>
    13.7 -     * All the ancestors of this component up to the nearest validate root are
    13.8 -     * marked invalid also. If there is no a validate root container for this
    13.9 -     * component, all of its ancestors up to the root of the hierarchy are
   13.10 -     * marked invalid as well. Marking a container <i>invalid</i> indicates
   13.11 -     * that the container needs to be laid out.
   13.12 +     * By default, all the ancestors of the component up to the top-most
   13.13 +     * container of the hierarchy are marked invalid. If the {@code
   13.14 +     * java.awt.smartInvalidate} system property is set to {@code true},
   13.15 +     * invalidation stops on the nearest validate root of this component.
   13.16 +     * Marking a container <i>invalid</i> indicates that the container needs to
   13.17 +     * be laid out.
   13.18       * <p>
   13.19       * This method is called automatically when any layout-related information
   13.20       * changes (e.g. setting the bounds of the component, or adding the
    14.1 --- a/src/share/classes/java/awt/Container.java	Wed May 18 16:32:05 2011 -0700
    14.2 +++ b/src/share/classes/java/awt/Container.java	Wed May 18 18:18:04 2011 -0700
    14.3 @@ -41,6 +41,8 @@
    14.4  import java.io.PrintStream;
    14.5  import java.io.PrintWriter;
    14.6  
    14.7 +import java.security.AccessController;
    14.8 +
    14.9  import java.util.Arrays;
   14.10  import java.util.EventListener;
   14.11  import java.util.HashSet;
   14.12 @@ -60,6 +62,8 @@
   14.13  
   14.14  import sun.java2d.pipe.Region;
   14.15  
   14.16 +import sun.security.action.GetBooleanAction;
   14.17 +
   14.18  /**
   14.19   * A generic Abstract Window Toolkit(AWT) container object is a component
   14.20   * that can contain other AWT components.
   14.21 @@ -1506,12 +1510,18 @@
   14.22       * Layout-related changes, such as bounds of the validate root descendants,
   14.23       * do not affect the layout of the validate root parent. This peculiarity
   14.24       * enables the {@code invalidate()} method to stop invalidating the
   14.25 -     * component hierarchy when the method encounters a validate root.
   14.26 +     * component hierarchy when the method encounters a validate root. However,
   14.27 +     * to preserve backward compatibility this new optimized behavior is
   14.28 +     * enabled only when the {@code java.awt.smartInvalidate} system property
   14.29 +     * value is set to {@code true}.
   14.30       * <p>
   14.31 -     * If a component hierarchy contains validate roots, the {@code validate()}
   14.32 -     * method must be invoked on the validate root of a previously invalidated
   14.33 -     * component, rather than on the top-level container (such as a {@code
   14.34 -     * Frame} object) to restore the validity of the hierarchy later.
   14.35 +     * If a component hierarchy contains validate roots and the new optimized
   14.36 +     * {@code invalidate()} behavior is enabled, the {@code validate()} method
   14.37 +     * must be invoked on the validate root of a previously invalidated
   14.38 +     * component to restore the validity of the hierarchy later. Otherwise,
   14.39 +     * calling the {@code validate()} method on the top-level container (such
   14.40 +     * as a {@code Frame} object) should be used to restore the validity of the
   14.41 +     * component hierarchy.
   14.42       * <p>
   14.43       * The {@code Window} class and the {@code Applet} class are the validate
   14.44       * roots in AWT.  Swing introduces more validate roots.
   14.45 @@ -1527,13 +1537,20 @@
   14.46          return false;
   14.47      }
   14.48  
   14.49 +    private static final boolean isJavaAwtSmartInvalidate;
   14.50 +    static {
   14.51 +        // Don't lazy-read because every app uses invalidate()
   14.52 +        isJavaAwtSmartInvalidate = AccessController.doPrivileged(
   14.53 +                new GetBooleanAction("java.awt.smartInvalidate"));
   14.54 +    }
   14.55 +
   14.56      /**
   14.57       * Invalidates the parent of the container unless the container
   14.58       * is a validate root.
   14.59       */
   14.60      @Override
   14.61      void invalidateParent() {
   14.62 -        if (!isValidateRoot()) {
   14.63 +        if (!isJavaAwtSmartInvalidate || !isValidateRoot()) {
   14.64              super.invalidateParent();
   14.65          }
   14.66      }
   14.67 @@ -1572,9 +1589,8 @@
   14.68       * automatically.  Note that the ancestors of the container may be
   14.69       * invalidated also (see {@link Component#invalidate} for details.)
   14.70       * Therefore, to restore the validity of the hierarchy, the {@code
   14.71 -     * validate()} method should be invoked on a validate root of an
   14.72 -     * invalidated component, or on the top-most container if the hierarchy
   14.73 -     * does not contain validate roots.
   14.74 +     * validate()} method should be invoked on the top-most invalid
   14.75 +     * container of the hierarchy.
   14.76       * <p>
   14.77       * Validating the container may be a quite time-consuming operation. For
   14.78       * performance reasons a developer may postpone the validation of the
    15.1 --- a/src/share/classes/java/awt/Toolkit.java	Wed May 18 16:32:05 2011 -0700
    15.2 +++ b/src/share/classes/java/awt/Toolkit.java	Wed May 18 18:18:04 2011 -0700
    15.3 @@ -466,10 +466,7 @@
    15.4       */
    15.5      protected void loadSystemColors(int[] systemColors)
    15.6          throws HeadlessException {
    15.7 -        if (GraphicsEnvironment.isHeadless()){
    15.8 -            throw new HeadlessException();
    15.9 -        }
   15.10 -
   15.11 +        GraphicsEnvironment.checkHeadless();
   15.12      }
   15.13  
   15.14  /**
   15.15 @@ -504,10 +501,7 @@
   15.16       */
   15.17      public void setDynamicLayout(boolean dynamic)
   15.18          throws HeadlessException {
   15.19 -        if (GraphicsEnvironment.isHeadless()){
   15.20 -            throw new HeadlessException();
   15.21 -        }
   15.22 -
   15.23 +        GraphicsEnvironment.checkHeadless();
   15.24      }
   15.25  
   15.26      /**
   15.27 @@ -531,9 +525,8 @@
   15.28       */
   15.29      protected boolean isDynamicLayoutSet()
   15.30          throws HeadlessException {
   15.31 -        if (GraphicsEnvironment.isHeadless()){
   15.32 -            throw new HeadlessException();
   15.33 -        }
   15.34 +        GraphicsEnvironment.checkHeadless();
   15.35 +
   15.36          if (this != Toolkit.getDefaultToolkit()) {
   15.37              return Toolkit.getDefaultToolkit().isDynamicLayoutSet();
   15.38          } else {
   15.39 @@ -569,9 +562,8 @@
   15.40       */
   15.41      public boolean isDynamicLayoutActive()
   15.42          throws HeadlessException {
   15.43 -        if (GraphicsEnvironment.isHeadless()){
   15.44 -            throw new HeadlessException();
   15.45 -        }
   15.46 +        GraphicsEnvironment.checkHeadless();
   15.47 +
   15.48          if (this != Toolkit.getDefaultToolkit()) {
   15.49              return Toolkit.getDefaultToolkit().isDynamicLayoutActive();
   15.50          } else {
   15.51 @@ -615,9 +607,7 @@
   15.52       */
   15.53      public Insets getScreenInsets(GraphicsConfiguration gc)
   15.54          throws HeadlessException {
   15.55 -        if (GraphicsEnvironment.isHeadless()){
   15.56 -            throw new HeadlessException();
   15.57 -        }
   15.58 +        GraphicsEnvironment.checkHeadless();
   15.59          if (this != Toolkit.getDefaultToolkit()) {
   15.60              return Toolkit.getDefaultToolkit().getScreenInsets(gc);
   15.61          } else {
   15.62 @@ -1200,10 +1190,7 @@
   15.63       * security manager's <code>checkPermission</code> method with a <code>
   15.64       * RuntimePermission("queuePrintJob")</code> permission.
   15.65       *
   15.66 -     * @param   frame the parent of the print dialog. May be null if and only
   15.67 -     *          if jobAttributes is not null and jobAttributes.getDialog()
   15.68 -     *          returns JobAttributes.DialogType.NONE or
   15.69 -     *          JobAttributes.DialogType.COMMON.
   15.70 +     * @param   frame the parent of the print dialog. May not be null.
   15.71       * @param   jobtitle the title of the PrintJob. A null title is equivalent
   15.72       *          to "".
   15.73       * @param   jobAttributes a set of job attributes which will control the
   15.74 @@ -1359,9 +1346,8 @@
   15.75       * @since 1.4
   15.76       */
   15.77      public Clipboard getSystemSelection() throws HeadlessException {
   15.78 -        if (GraphicsEnvironment.isHeadless()){
   15.79 -            throw new HeadlessException();
   15.80 -        }
   15.81 +        GraphicsEnvironment.checkHeadless();
   15.82 +
   15.83          if (this != Toolkit.getDefaultToolkit()) {
   15.84              return Toolkit.getDefaultToolkit().getSystemSelection();
   15.85          } else {
   15.86 @@ -1391,9 +1377,7 @@
   15.87       * @since     JDK1.1
   15.88       */
   15.89      public int getMenuShortcutKeyMask() throws HeadlessException {
   15.90 -        if (GraphicsEnvironment.isHeadless()){
   15.91 -            throw new HeadlessException();
   15.92 -        }
   15.93 +        GraphicsEnvironment.checkHeadless();
   15.94  
   15.95          return Event.CTRL_MASK;
   15.96      }
   15.97 @@ -1418,7 +1402,10 @@
   15.98       * @since 1.3
   15.99       */
  15.100      public boolean getLockingKeyState(int keyCode)
  15.101 -        throws UnsupportedOperationException {
  15.102 +        throws UnsupportedOperationException
  15.103 +    {
  15.104 +        GraphicsEnvironment.checkHeadless();
  15.105 +
  15.106          if (! (keyCode == KeyEvent.VK_CAPS_LOCK || keyCode == KeyEvent.VK_NUM_LOCK ||
  15.107                 keyCode == KeyEvent.VK_SCROLL_LOCK || keyCode == KeyEvent.VK_KANA_LOCK)) {
  15.108              throw new IllegalArgumentException("invalid key for Toolkit.getLockingKeyState");
  15.109 @@ -1449,7 +1436,10 @@
  15.110       * @since 1.3
  15.111       */
  15.112      public void setLockingKeyState(int keyCode, boolean on)
  15.113 -        throws UnsupportedOperationException {
  15.114 +        throws UnsupportedOperationException
  15.115 +    {
  15.116 +        GraphicsEnvironment.checkHeadless();
  15.117 +
  15.118          if (! (keyCode == KeyEvent.VK_CAPS_LOCK || keyCode == KeyEvent.VK_NUM_LOCK ||
  15.119                 keyCode == KeyEvent.VK_SCROLL_LOCK || keyCode == KeyEvent.VK_KANA_LOCK)) {
  15.120              throw new IllegalArgumentException("invalid key for Toolkit.setLockingKeyState");
  15.121 @@ -1523,9 +1513,8 @@
  15.122       */
  15.123      public Dimension getBestCursorSize(int preferredWidth,
  15.124          int preferredHeight) throws HeadlessException {
  15.125 -        if (GraphicsEnvironment.isHeadless()){
  15.126 -            throw new HeadlessException();
  15.127 -        }
  15.128 +        GraphicsEnvironment.checkHeadless();
  15.129 +
  15.130          // Override to implement custom cursor support.
  15.131          if (this != Toolkit.getDefaultToolkit()) {
  15.132              return Toolkit.getDefaultToolkit().
  15.133 @@ -1553,9 +1542,8 @@
  15.134       * @since     1.2
  15.135       */
  15.136      public int getMaximumCursorColors() throws HeadlessException {
  15.137 -        if (GraphicsEnvironment.isHeadless()){
  15.138 -            throw new HeadlessException();
  15.139 -        }
  15.140 +        GraphicsEnvironment.checkHeadless();
  15.141 +
  15.142          // Override to implement custom cursor support.
  15.143          if (this != Toolkit.getDefaultToolkit()) {
  15.144              return Toolkit.getDefaultToolkit().getMaximumCursorColors();
  15.145 @@ -1605,9 +1593,8 @@
  15.146      public boolean isFrameStateSupported(int state)
  15.147          throws HeadlessException
  15.148      {
  15.149 -        if (GraphicsEnvironment.isHeadless()){
  15.150 -            throw new HeadlessException();
  15.151 -        }
  15.152 +        GraphicsEnvironment.checkHeadless();
  15.153 +
  15.154          if (this != Toolkit.getDefaultToolkit()) {
  15.155              return Toolkit.getDefaultToolkit().
  15.156                  isFrameStateSupported(state);
  15.157 @@ -2614,9 +2601,8 @@
  15.158      * @since 1.7
  15.159       */
  15.160      public boolean areExtraMouseButtonsEnabled() throws HeadlessException {
  15.161 -        if (GraphicsEnvironment.isHeadless()){
  15.162 -            throw new HeadlessException();
  15.163 -        }
  15.164 +        GraphicsEnvironment.checkHeadless();
  15.165 +
  15.166          return Toolkit.getDefaultToolkit().areExtraMouseButtonsEnabled();
  15.167      }
  15.168  }
    16.1 --- a/src/share/classes/java/lang/SafeVarargs.java	Wed May 18 16:32:05 2011 -0700
    16.2 +++ b/src/share/classes/java/lang/SafeVarargs.java	Wed May 18 18:18:04 2011 -0700
    16.3 @@ -1,5 +1,5 @@
    16.4  /*
    16.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    16.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
    16.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    16.8   *
    16.9   * This code is free software; you can redistribute it and/or modify it
   16.10 @@ -32,7 +32,7 @@
   16.11   * constructor does not perform potentially unsafe operations on its
   16.12   * varargs parameter.  Applying this annotation to a method or
   16.13   * constructor suppresses unchecked warnings about a
   16.14 - * <i>non-reifiable</i> variable-arity (vararg) type and suppresses
   16.15 + * <i>non-reifiable</i> variable arity (vararg) type and suppresses
   16.16   * unchecked warnings about parameterized array creation at call
   16.17   * sites.
   16.18   *
   16.19 @@ -41,11 +41,10 @@
   16.20   * additional usage restrictions on this annotation type; it is a
   16.21   * compile-time error if a method or constructor declaration is
   16.22   * annotated with a {@code @SafeVarargs} annotation, and either:
   16.23 -
   16.24   * <ul>
   16.25 - * <li>  the declaration is a fixed-arity method or constructor
   16.26 + * <li>  the declaration is a fixed arity method or constructor
   16.27   *
   16.28 - * <li> the declaration is a variable-arity method that is neither
   16.29 + * <li> the declaration is a variable arity method that is neither
   16.30   * {@code static} nor {@code final}.
   16.31   *
   16.32   * </ul>
   16.33 @@ -55,15 +54,28 @@
   16.34   *
   16.35   * <ul>
   16.36   *
   16.37 - * <li> The variable-arity parameter has a reifiable element type,
   16.38 + * <li> The variable arity parameter has a reifiable element type,
   16.39   * which includes primitive types, {@code Object}, and {@code String}.
   16.40   * (The unchecked warnings this annotation type suppresses already do
   16.41   * not occur for a reifiable element type.)
   16.42   *
   16.43   * <li> The body of the method or constructor declaration performs
   16.44   * potentially unsafe operations, such as an assignment to an element
   16.45 - * of the variable-arity parameter's array that generates an unchecked
   16.46 - * warning.
   16.47 + * of the variable arity parameter's array that generates an unchecked
   16.48 + * warning.  Some unsafe operations do not trigger an unchecked
   16.49 + * warning.  For example, the aliasing in
   16.50 + *
   16.51 + * <blockquote><pre>
   16.52 + * &#64;SafeVarargs // Not actually safe!
   16.53 + * static void m(List&lt;String&gt;... stringLists) {
   16.54 + *   Object[] array = stringLists;
   16.55 + *   List&lt;Integer&gt; tmpList = Arrays.asList(42);
   16.56 + *   array[0] = tmpList; // Semantically invalid, but compiles without warnings
   16.57 + *   String s = stringLists[0].get(0); // Oh no, ClassCastException at runtime!
   16.58 + * }
   16.59 + * </pre></blockquote>
   16.60 + *
   16.61 + * leads to a {@code ClassCastException} at runtime.
   16.62   *
   16.63   * <p>Future versions of the platform may mandate compiler errors for
   16.64   * such unsafe operations.
    17.1 --- a/src/share/classes/java/lang/Throwable.java	Wed May 18 16:32:05 2011 -0700
    17.2 +++ b/src/share/classes/java/lang/Throwable.java	Wed May 18 18:18:04 2011 -0700
    17.3 @@ -336,7 +336,10 @@
    17.4       * Disabling of suppression should only occur in exceptional
    17.5       * circumstances where special requirements exist, such as a
    17.6       * virtual machine reusing exception objects under low-memory
    17.7 -     * situations.
    17.8 +     * situations.  Circumstances where a given exception object is
    17.9 +     * repeatedly caught and rethrown, such as to implement control
   17.10 +     * flow between two sub-systems, is another situation where
   17.11 +     * immutable throwable objects would be appropriate.
   17.12       *
   17.13       * @param  message the detail message.
   17.14       * @param cause the cause.  (A {@code null} value is permitted,
   17.15 @@ -423,6 +426,18 @@
   17.16       * {@link #Throwable(String,Throwable)}, this method cannot be called
   17.17       * even once.
   17.18       *
   17.19 +     * <p>An example of using this method on a legacy throwable type
   17.20 +     * without other support for setting the cause is:
   17.21 +     *
   17.22 +     * <pre>
   17.23 +     * try {
   17.24 +     *     lowLevelOp();
   17.25 +     * } catch (LowLevelException le) {
   17.26 +     *     throw (HighLevelException)
   17.27 +     *           new HighLevelException().initCause(le); // Legacy constructor
   17.28 +     * }
   17.29 +     * </pre>
   17.30 +     *
   17.31       * @param  cause the cause (which is saved for later retrieval by the
   17.32       *         {@link #getCause()} method).  (A {@code null} value is
   17.33       *         permitted, and indicates that the cause is nonexistent or
   17.34 @@ -762,7 +777,8 @@
   17.35       * @see     java.lang.Throwable#printStackTrace()
   17.36       */
   17.37      public synchronized Throwable fillInStackTrace() {
   17.38 -        if (stackTrace != null) {
   17.39 +        if (stackTrace != null ||
   17.40 +            backtrace != null /* Out of protocol state */ ) {
   17.41              fillInStackTrace(0);
   17.42              stackTrace = UNASSIGNED_STACK;
   17.43          }
   17.44 @@ -788,7 +804,8 @@
   17.45       * this throwable is permitted to return a zero-length array from this
   17.46       * method.  Generally speaking, the array returned by this method will
   17.47       * contain one element for every frame that would be printed by
   17.48 -     * {@code printStackTrace}.
   17.49 +     * {@code printStackTrace}.  Writes to the returned array do not
   17.50 +     * affect future calls to this method.
   17.51       *
   17.52       * @return an array of stack trace elements representing the stack trace
   17.53       *         pertaining to this throwable.
   17.54 @@ -801,7 +818,8 @@
   17.55      private synchronized StackTraceElement[] getOurStackTrace() {
   17.56          // Initialize stack trace field with information from
   17.57          // backtrace if this is the first call to this method
   17.58 -        if (stackTrace == UNASSIGNED_STACK) {
   17.59 +        if (stackTrace == UNASSIGNED_STACK ||
   17.60 +            (stackTrace == null && backtrace != null) /* Out of protocol state */) {
   17.61              int depth = getStackTraceDepth();
   17.62              stackTrace = new StackTraceElement[depth];
   17.63              for (int i=0; i < depth; i++)
   17.64 @@ -849,7 +867,8 @@
   17.65          }
   17.66  
   17.67          synchronized (this) {
   17.68 -            if (this.stackTrace == null) // Immutable stack
   17.69 +            if (this.stackTrace == null && // Immutable stack
   17.70 +                backtrace == null) // Test for out of protocol state
   17.71                  return;
   17.72              this.stackTrace = defensiveCopy;
   17.73          }
   17.74 @@ -971,8 +990,8 @@
   17.75      /**
   17.76       * Appends the specified exception to the exceptions that were
   17.77       * suppressed in order to deliver this exception. This method is
   17.78 -     * typically called (automatically and implicitly) by the {@code
   17.79 -     * try}-with-resources statement.
   17.80 +     * thread-safe and typically called (automatically and implicitly)
   17.81 +     * by the {@code try}-with-resources statement.
   17.82       *
   17.83       * <p>The suppression behavior is enabled <em>unless</em> disabled
   17.84       * {@linkplain #Throwable(String, Throwable, boolean, boolean) via
   17.85 @@ -1043,7 +1062,9 @@
   17.86       *
   17.87       * If no exceptions were suppressed or {@linkplain
   17.88       * #Throwable(String, Throwable, boolean, boolean) suppression is
   17.89 -     * disabled}, an empty array is returned.
   17.90 +     * disabled}, an empty array is returned.  This method is
   17.91 +     * thread-safe.  Writes to the returned array do not affect future
   17.92 +     * calls to this method.
   17.93       *
   17.94       * @return an array containing all of the exceptions that were
   17.95       *         suppressed to deliver this exception.
    18.1 --- a/src/share/classes/java/net/SocketOption.java	Wed May 18 16:32:05 2011 -0700
    18.2 +++ b/src/share/classes/java/net/SocketOption.java	Wed May 18 18:18:04 2011 -0700
    18.3 @@ -38,7 +38,7 @@
    18.4   *
    18.5   * @since 1.7
    18.6   *
    18.7 - * @see StandardSocketOption
    18.8 + * @see StandardSocketOptions
    18.9   */
   18.10  
   18.11  public interface SocketOption<T> {
    19.1 --- a/src/share/classes/java/net/StandardSocketOption.java	Wed May 18 16:32:05 2011 -0700
    19.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.3 @@ -1,367 +0,0 @@
    19.4 -/*
    19.5 - * Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved.
    19.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    19.7 - *
    19.8 - * This code is free software; you can redistribute it and/or modify it
    19.9 - * under the terms of the GNU General Public License version 2 only, as
   19.10 - * published by the Free Software Foundation.  Oracle designates this
   19.11 - * particular file as subject to the "Classpath" exception as provided
   19.12 - * by Oracle in the LICENSE file that accompanied this code.
   19.13 - *
   19.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   19.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   19.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   19.17 - * version 2 for more details (a copy is included in the LICENSE file that
   19.18 - * accompanied this code).
   19.19 - *
   19.20 - * You should have received a copy of the GNU General Public License version
   19.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   19.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   19.23 - *
   19.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   19.25 - * or visit www.oracle.com if you need additional information or have any
   19.26 - * questions.
   19.27 - */
   19.28 -
   19.29 -package java.net;
   19.30 -
   19.31 -/**
   19.32 - * Defines the <em>standard</em> socket options.
   19.33 - *
   19.34 - * <p> The {@link SocketOption#name name} of each socket option defined by this
   19.35 - * class is its field name.
   19.36 - *
   19.37 - * <p> In this release, the socket options defined here are used by {@link
   19.38 - * java.nio.channels.NetworkChannel network} channels in the {@link
   19.39 - * java.nio.channels channels} package.
   19.40 - *
   19.41 - * @since 1.7
   19.42 - */
   19.43 -
   19.44 -public final class StandardSocketOption {
   19.45 -    private StandardSocketOption() { }
   19.46 -
   19.47 -    // -- SOL_SOCKET --
   19.48 -
   19.49 -    /**
   19.50 -     * Allow transmission of broadcast datagrams.
   19.51 -     *
   19.52 -     * <p> The value of this socket option is a {@code Boolean} that represents
   19.53 -     * whether the option is enabled or disabled. The option is specific to
   19.54 -     * datagram-oriented sockets sending to {@link java.net.Inet4Address IPv4}
   19.55 -     * broadcast addresses. When the socket option is enabled then the socket
   19.56 -     * can be used to send <em>broadcast datagrams</em>.
   19.57 -     *
   19.58 -     * <p> The initial value of this socket option is {@code FALSE}. The socket
   19.59 -     * option may be enabled or disabled at any time. Some operating systems may
   19.60 -     * require that the Java virtual machine be started with implementation
   19.61 -     * specific privileges to enable this option or send broadcast datagrams.
   19.62 -     *
   19.63 -     * @see <a href="http://www.ietf.org/rfc/rfc919.txt">RFC&nbsp;929:
   19.64 -     * Broadcasting Internet Datagrams</a>
   19.65 -     * @see DatagramSocket#setBroadcast
   19.66 -     */
   19.67 -    public static final SocketOption<Boolean> SO_BROADCAST =
   19.68 -        new StdSocketOption<Boolean>("SO_BROADCAST", Boolean.class);
   19.69 -
   19.70 -    /**
   19.71 -     * Keep connection alive.
   19.72 -     *
   19.73 -     * <p> The value of this socket option is a {@code Boolean} that represents
   19.74 -     * whether the option is enabled or disabled. When the {@code SO_KEEPALIVE}
   19.75 -     * option is enabled the operating system may use a <em>keep-alive</em>
   19.76 -     * mechanism to periodically probe the other end of a connection when the
   19.77 -     * connection is otherwise idle. The exact semantics of the keep alive
   19.78 -     * mechanism is system dependent and therefore unspecified.
   19.79 -     *
   19.80 -     * <p> The initial value of this socket option is {@code FALSE}. The socket
   19.81 -     * option may be enabled or disabled at any time.
   19.82 -     *
   19.83 -     * @see <a href="http://www.ietf.org/rfc/rfc1122.txt">RFC&nbsp;1122
   19.84 -     * Requirements for Internet Hosts -- Communication Layers</a>
   19.85 -     * @see Socket#setKeepAlive
   19.86 -     */
   19.87 -    public static final SocketOption<Boolean> SO_KEEPALIVE =
   19.88 -        new StdSocketOption<Boolean>("SO_KEEPALIVE", Boolean.class);
   19.89 -
   19.90 -    /**
   19.91 -     * The size of the socket send buffer.
   19.92 -     *
   19.93 -     * <p> The value of this socket option is an {@code Integer} that is the
   19.94 -     * size of the socket send buffer in bytes. The socket send buffer is an
   19.95 -     * output buffer used by the networking implementation. It may need to be
   19.96 -     * increased for high-volume connections. The value of the socket option is
   19.97 -     * a <em>hint</em> to the implementation to size the buffer and the actual
   19.98 -     * size may differ. The socket option can be queried to retrieve the actual
   19.99 -     * size.
  19.100 -     *
  19.101 -     * <p> For datagram-oriented sockets, the size of the send buffer may limit
  19.102 -     * the size of the datagrams that may be sent by the socket. Whether
  19.103 -     * datagrams larger than the buffer size are sent or discarded is system
  19.104 -     * dependent.
  19.105 -     *
  19.106 -     * <p> The initial/default size of the socket send buffer and the range of
  19.107 -     * allowable values is system dependent although a negative size is not
  19.108 -     * allowed. An attempt to set the socket send buffer to larger than its
  19.109 -     * maximum size causes it to be set to its maximum size.
  19.110 -     *
  19.111 -     * <p> An implementation allows this socket option to be set before the
  19.112 -     * socket is bound or connected. Whether an implementation allows the
  19.113 -     * socket send buffer to be changed after the socket is bound is system
  19.114 -     * dependent.
  19.115 -     *
  19.116 -     * @see Socket#setSendBufferSize
  19.117 -     */
  19.118 -    public static final SocketOption<Integer> SO_SNDBUF =
  19.119 -        new StdSocketOption<Integer>("SO_SNDBUF", Integer.class);
  19.120 -
  19.121 -
  19.122 -    /**
  19.123 -     * The size of the socket receive buffer.
  19.124 -     *
  19.125 -     * <p> The value of this socket option is an {@code Integer} that is the
  19.126 -     * size of the socket receive buffer in bytes. The socket receive buffer is
  19.127 -     * an input buffer used by the networking implementation. It may need to be
  19.128 -     * increased for high-volume connections or decreased to limit the possible
  19.129 -     * backlog of incoming data. The value of the socket option is a
  19.130 -     * <em>hint</em> to the implementation to size the buffer and the actual
  19.131 -     * size may differ.
  19.132 -     *
  19.133 -     * <p> For datagram-oriented sockets, the size of the receive buffer may
  19.134 -     * limit the size of the datagrams that can be received. Whether datagrams
  19.135 -     * larger than the buffer size can be received is system dependent.
  19.136 -     * Increasing the socket receive buffer may be important for cases where
  19.137 -     * datagrams arrive in bursts faster than they can be processed.
  19.138 -     *
  19.139 -     * <p> In the case of stream-oriented sockets and the TCP/IP protocol, the
  19.140 -     * size of the socket receive buffer may be used when advertising the size
  19.141 -     * of the TCP receive window to the remote peer.
  19.142 -     *
  19.143 -     * <p> The initial/default size of the socket receive buffer and the range
  19.144 -     * of allowable values is system dependent although a negative size is not
  19.145 -     * allowed. An attempt to set the socket receive buffer to larger than its
  19.146 -     * maximum size causes it to be set to its maximum size.
  19.147 -     *
  19.148 -     * <p> An implementation allows this socket option to be set before the
  19.149 -     * socket is bound or connected. Whether an implementation allows the
  19.150 -     * socket receive buffer to be changed after the socket is bound is system
  19.151 -     * dependent.
  19.152 -     *
  19.153 -     * @see <a href="http://www.ietf.org/rfc/rfc1323.txt">RFC&nbsp;1323: TCP
  19.154 -     * Extensions for High Performance</a>
  19.155 -     * @see Socket#setReceiveBufferSize
  19.156 -     * @see ServerSocket#setReceiveBufferSize
  19.157 -     */
  19.158 -    public static final SocketOption<Integer> SO_RCVBUF =
  19.159 -        new StdSocketOption<Integer>("SO_RCVBUF", Integer.class);
  19.160 -
  19.161 -    /**
  19.162 -     * Re-use address.
  19.163 -     *
  19.164 -     * <p> The value of this socket option is a {@code Boolean} that represents
  19.165 -     * whether the option is enabled or disabled. The exact semantics of this
  19.166 -     * socket option are socket type and system dependent.
  19.167 -     *
  19.168 -     * <p> In the case of stream-oriented sockets, this socket option will
  19.169 -     * usually determine whether the socket can be bound to a socket address
  19.170 -     * when a previous connection involving that socket address is in the
  19.171 -     * <em>TIME_WAIT</em> state. On implementations where the semantics differ,
  19.172 -     * and the socket option is not required to be enabled in order to bind the
  19.173 -     * socket when a previous connection is in this state, then the
  19.174 -     * implementation may choose to ignore this option.
  19.175 -     *
  19.176 -     * <p> For datagram-oriented sockets the socket option is used to allow
  19.177 -     * multiple programs bind to the same address. This option should be enabled
  19.178 -     * when the socket is to be used for Internet Protocol (IP) multicasting.
  19.179 -     *
  19.180 -     * <p> An implementation allows this socket option to be set before the
  19.181 -     * socket is bound or connected. Changing the value of this socket option
  19.182 -     * after the socket is bound has no effect. The default value of this
  19.183 -     * socket option is system dependent.
  19.184 -     *
  19.185 -     * @see <a href="http://www.ietf.org/rfc/rfc793.txt">RFC&nbsp;793: Transmission
  19.186 -     * Control Protocol</a>
  19.187 -     * @see ServerSocket#setReuseAddress
  19.188 -     */
  19.189 -    public static final SocketOption<Boolean> SO_REUSEADDR =
  19.190 -        new StdSocketOption<Boolean>("SO_REUSEADDR", Boolean.class);
  19.191 -
  19.192 -    /**
  19.193 -     * Linger on close if data is present.
  19.194 -     *
  19.195 -     * <p> The value of this socket option is an {@code Integer} that controls
  19.196 -     * the action taken when unsent data is queued on the socket and a method
  19.197 -     * to close the socket is invoked. If the value of the socket option is zero
  19.198 -     * or greater, then it represents a timeout value, in seconds, known as the
  19.199 -     * <em>linger interval</em>. The linger interval is the timeout for the
  19.200 -     * {@code close} method to block while the operating system attempts to
  19.201 -     * transmit the unsent data or it decides that it is unable to transmit the
  19.202 -     * data. If the value of the socket option is less than zero then the option
  19.203 -     * is disabled. In that case the {@code close} method does not wait until
  19.204 -     * unsent data is transmitted; if possible the operating system will transmit
  19.205 -     * any unsent data before the connection is closed.
  19.206 -     *
  19.207 -     * <p> This socket option is intended for use with sockets that are configured
  19.208 -     * in {@link java.nio.channels.SelectableChannel#isBlocking() blocking} mode
  19.209 -     * only. The behavior of the {@code close} method when this option is
  19.210 -     * enabled on a non-blocking socket is not defined.
  19.211 -     *
  19.212 -     * <p> The initial value of this socket option is a negative value, meaning
  19.213 -     * that the option is disabled. The option may be enabled, or the linger
  19.214 -     * interval changed, at any time. The maximum value of the linger interval
  19.215 -     * is system dependent. Setting the linger interval to a value that is
  19.216 -     * greater than its maximum value causes the linger interval to be set to
  19.217 -     * its maximum value.
  19.218 -     *
  19.219 -     * @see Socket#setSoLinger
  19.220 -     */
  19.221 -    public static final SocketOption<Integer> SO_LINGER =
  19.222 -        new StdSocketOption<Integer>("SO_LINGER", Integer.class);
  19.223 -
  19.224 -
  19.225 -    // -- IPPROTO_IP --
  19.226 -
  19.227 -    /**
  19.228 -     * The Type of Service (ToS) octet in the Internet Protocol (IP) header.
  19.229 -     *
  19.230 -     * <p> The value of this socket option is an {@code Integer} representing
  19.231 -     * the value of the ToS octet in IP packets sent by sockets to an {@link
  19.232 -     * StandardProtocolFamily#INET IPv4} socket. The interpretation of the ToS
  19.233 -     * octet is network specific and is not defined by this class. Further
  19.234 -     * information on the ToS octet can be found in <a
  19.235 -     * href="http://www.ietf.org/rfc/rfc1349.txt">RFC&nbsp;1349</a> and <a
  19.236 -     * href="http://www.ietf.org/rfc/rfc2474.txt">RFC&nbsp;2474</a>. The value
  19.237 -     * of the socket option is a <em>hint</em>. An implementation may ignore the
  19.238 -     * value, or ignore specific values.
  19.239 -     *
  19.240 -     * <p> The initial/default value of the TOS field in the ToS octet is
  19.241 -     * implementation specific but will typically be {@code 0}. For
  19.242 -     * datagram-oriented sockets the option may be configured at any time after
  19.243 -     * the socket has been bound. The new value of the octet is used when sending
  19.244 -     * subsequent datagrams. It is system dependent whether this option can be
  19.245 -     * queried or changed prior to binding the socket.
  19.246 -     *
  19.247 -     * <p> The behavior of this socket option on a stream-oriented socket, or an
  19.248 -     * {@link StandardProtocolFamily#INET6 IPv6} socket, is not defined in this
  19.249 -     * release.
  19.250 -     *
  19.251 -     * @see DatagramSocket#setTrafficClass
  19.252 -     */
  19.253 -    public static final SocketOption<Integer> IP_TOS =
  19.254 -        new StdSocketOption<Integer>("IP_TOS", Integer.class);
  19.255 -
  19.256 -    /**
  19.257 -     * The network interface for Internet Protocol (IP) multicast datagrams.
  19.258 -     *
  19.259 -     * <p> The value of this socket option is a {@link NetworkInterface} that
  19.260 -     * represents the outgoing interface for multicast datagrams sent by the
  19.261 -     * datagram-oriented socket. For {@link StandardProtocolFamily#INET6 IPv6}
  19.262 -     * sockets then it is system dependent whether setting this option also
  19.263 -     * sets the outgoing interface for multlicast datagrams sent to IPv4
  19.264 -     * addresses.
  19.265 -     *
  19.266 -     * <p> The initial/default value of this socket option may be {@code null}
  19.267 -     * to indicate that outgoing interface will be selected by the operating
  19.268 -     * system, typically based on the network routing tables. An implementation
  19.269 -     * allows this socket option to be set after the socket is bound. Whether
  19.270 -     * the socket option can be queried or changed prior to binding the socket
  19.271 -     * is system dependent.
  19.272 -     *
  19.273 -     * @see java.nio.channels.MulticastChannel
  19.274 -     * @see MulticastSocket#setInterface
  19.275 -     */
  19.276 -    public static final SocketOption<NetworkInterface> IP_MULTICAST_IF =
  19.277 -        new StdSocketOption<NetworkInterface>("IP_MULTICAST_IF", NetworkInterface.class);
  19.278 -
  19.279 -    /**
  19.280 -     * The <em>time-to-live</em> for Internet Protocol (IP) multicast datagrams.
  19.281 -     *
  19.282 -     * <p> The value of this socket option is an {@code Integer} in the range
  19.283 -     * <tt>0&nbsp;<=&nbsp;value&nbsp;<=&nbsp;255</tt>. It is used to control
  19.284 -     * the scope of multicast datagrams sent by the datagram-oriented socket.
  19.285 -     * In the case of an {@link StandardProtocolFamily#INET IPv4} socket
  19.286 -     * the option is the time-to-live (TTL) on multicast datagrams sent by the
  19.287 -     * socket. Datagrams with a TTL of zero are not transmitted on the network
  19.288 -     * but may be delivered locally. In the case of an {@link
  19.289 -     * StandardProtocolFamily#INET6 IPv6} socket the option is the
  19.290 -     * <em>hop limit</em> which is number of <em>hops</em> that the datagram can
  19.291 -     * pass through before expiring on the network. For IPv6 sockets it is
  19.292 -     * system dependent whether the option also sets the <em>time-to-live</em>
  19.293 -     * on multicast datagrams sent to IPv4 addresses.
  19.294 -     *
  19.295 -     * <p> The initial/default value of the time-to-live setting is typically
  19.296 -     * {@code 1}. An implementation allows this socket option to be set after
  19.297 -     * the socket is bound. Whether the socket option can be queried or changed
  19.298 -     * prior to binding the socket is system dependent.
  19.299 -     *
  19.300 -     * @see java.nio.channels.MulticastChannel
  19.301 -     * @see MulticastSocket#setTimeToLive
  19.302 -     */
  19.303 -    public static final SocketOption<Integer> IP_MULTICAST_TTL =
  19.304 -        new StdSocketOption<Integer>("IP_MULTICAST_TTL", Integer.class);
  19.305 -
  19.306 -    /**
  19.307 -     * Loopback for Internet Protocol (IP) multicast datagrams.
  19.308 -     *
  19.309 -     * <p> The value of this socket option is a {@code Boolean} that controls
  19.310 -     * the <em>loopback</em> of multicast datagrams. The value of the socket
  19.311 -     * option represents if the option is enabled or disabled.
  19.312 -     *
  19.313 -     * <p> The exact semantics of this socket options are system dependent.
  19.314 -     * In particular, it is system dependent whether the loopback applies to
  19.315 -     * multicast datagrams sent from the socket or received by the socket.
  19.316 -     * For {@link StandardProtocolFamily#INET6 IPv6} sockets then it is
  19.317 -     * system dependent whether the option also applies to multicast datagrams
  19.318 -     * sent to IPv4 addresses.
  19.319 -     *
  19.320 -     * <p> The initial/default value of this socket option is {@code TRUE}. An
  19.321 -     * implementation allows this socket option to be set after the socket is
  19.322 -     * bound. Whether the socket option can be queried or changed prior to
  19.323 -     * binding the socket is system dependent.
  19.324 -     *
  19.325 -     * @see java.nio.channels.MulticastChannel
  19.326 -     *  @see MulticastSocket#setLoopbackMode
  19.327 -     */
  19.328 -    public static final SocketOption<Boolean> IP_MULTICAST_LOOP =
  19.329 -        new StdSocketOption<Boolean>("IP_MULTICAST_LOOP", Boolean.class);
  19.330 -
  19.331 -
  19.332 -    // -- IPPROTO_TCP --
  19.333 -
  19.334 -    /**
  19.335 -     * Disable the Nagle algorithm.
  19.336 -     *
  19.337 -     * <p> The value of this socket option is a {@code Boolean} that represents
  19.338 -     * whether the option is enabled or disabled. The socket option is specific to
  19.339 -     * stream-oriented sockets using the TCP/IP protocol. TCP/IP uses an algorithm
  19.340 -     * known as <em>The Nagle Algorithm</em> to coalesce short segments and
  19.341 -     * improve network efficiency.
  19.342 -     *
  19.343 -     * <p> The default value of this socket option is {@code FALSE}. The
  19.344 -     * socket option should only be enabled in cases where it is known that the
  19.345 -     * coalescing impacts performance. The socket option may be enabled at any
  19.346 -     * time. In other words, the Nagle Algorithm can be disabled. Once the option
  19.347 -     * is enabled, it is system dependent whether it can be subsequently
  19.348 -     * disabled. If it cannot, then invoking the {@code setOption} method to
  19.349 -     * disable the option has no effect.
  19.350 -     *
  19.351 -     * @see <a href="http://www.ietf.org/rfc/rfc1122.txt">RFC&nbsp;1122:
  19.352 -     * Requirements for Internet Hosts -- Communication Layers</a>
  19.353 -     * @see Socket#setTcpNoDelay
  19.354 -     */
  19.355 -    public static final SocketOption<Boolean> TCP_NODELAY =
  19.356 -        new StdSocketOption<Boolean>("TCP_NODELAY", Boolean.class);
  19.357 -
  19.358 -
  19.359 -    private static class StdSocketOption<T> implements SocketOption<T> {
  19.360 -        private final String name;
  19.361 -        private final Class<T> type;
  19.362 -        StdSocketOption(String name, Class<T> type) {
  19.363 -            this.name = name;
  19.364 -            this.type = type;
  19.365 -        }
  19.366 -        @Override public String name() { return name; }
  19.367 -        @Override public Class<T> type() { return type; }
  19.368 -        @Override public String toString() { return name; }
  19.369 -    }
  19.370 -}
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/src/share/classes/java/net/StandardSocketOptions.java	Wed May 18 18:18:04 2011 -0700
    20.3 @@ -0,0 +1,367 @@
    20.4 +/*
    20.5 + * Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved.
    20.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    20.7 + *
    20.8 + * This code is free software; you can redistribute it and/or modify it
    20.9 + * under the terms of the GNU General Public License version 2 only, as
   20.10 + * published by the Free Software Foundation.  Oracle designates this
   20.11 + * particular file as subject to the "Classpath" exception as provided
   20.12 + * by Oracle in the LICENSE file that accompanied this code.
   20.13 + *
   20.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   20.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   20.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   20.17 + * version 2 for more details (a copy is included in the LICENSE file that
   20.18 + * accompanied this code).
   20.19 + *
   20.20 + * You should have received a copy of the GNU General Public License version
   20.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   20.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   20.23 + *
   20.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   20.25 + * or visit www.oracle.com if you need additional information or have any
   20.26 + * questions.
   20.27 + */
   20.28 +
   20.29 +package java.net;
   20.30 +
   20.31 +/**
   20.32 + * Defines the <em>standard</em> socket options.
   20.33 + *
   20.34 + * <p> The {@link SocketOption#name name} of each socket option defined by this
   20.35 + * class is its field name.
   20.36 + *
   20.37 + * <p> In this release, the socket options defined here are used by {@link
   20.38 + * java.nio.channels.NetworkChannel network} channels in the {@link
   20.39 + * java.nio.channels channels} package.
   20.40 + *
   20.41 + * @since 1.7
   20.42 + */
   20.43 +
   20.44 +public final class StandardSocketOptions {
   20.45 +    private StandardSocketOptions() { }
   20.46 +
   20.47 +    // -- SOL_SOCKET --
   20.48 +
   20.49 +    /**
   20.50 +     * Allow transmission of broadcast datagrams.
   20.51 +     *
   20.52 +     * <p> The value of this socket option is a {@code Boolean} that represents
   20.53 +     * whether the option is enabled or disabled. The option is specific to
   20.54 +     * datagram-oriented sockets sending to {@link java.net.Inet4Address IPv4}
   20.55 +     * broadcast addresses. When the socket option is enabled then the socket
   20.56 +     * can be used to send <em>broadcast datagrams</em>.
   20.57 +     *
   20.58 +     * <p> The initial value of this socket option is {@code FALSE}. The socket
   20.59 +     * option may be enabled or disabled at any time. Some operating systems may
   20.60 +     * require that the Java virtual machine be started with implementation
   20.61 +     * specific privileges to enable this option or send broadcast datagrams.
   20.62 +     *
   20.63 +     * @see <a href="http://www.ietf.org/rfc/rfc919.txt">RFC&nbsp;929:
   20.64 +     * Broadcasting Internet Datagrams</a>
   20.65 +     * @see DatagramSocket#setBroadcast
   20.66 +     */
   20.67 +    public static final SocketOption<Boolean> SO_BROADCAST =
   20.68 +        new StdSocketOption<Boolean>("SO_BROADCAST", Boolean.class);
   20.69 +
   20.70 +    /**
   20.71 +     * Keep connection alive.
   20.72 +     *
   20.73 +     * <p> The value of this socket option is a {@code Boolean} that represents
   20.74 +     * whether the option is enabled or disabled. When the {@code SO_KEEPALIVE}
   20.75 +     * option is enabled the operating system may use a <em>keep-alive</em>
   20.76 +     * mechanism to periodically probe the other end of a connection when the
   20.77 +     * connection is otherwise idle. The exact semantics of the keep alive
   20.78 +     * mechanism is system dependent and therefore unspecified.
   20.79 +     *
   20.80 +     * <p> The initial value of this socket option is {@code FALSE}. The socket
   20.81 +     * option may be enabled or disabled at any time.
   20.82 +     *
   20.83 +     * @see <a href="http://www.ietf.org/rfc/rfc1122.txt">RFC&nbsp;1122
   20.84 +     * Requirements for Internet Hosts -- Communication Layers</a>
   20.85 +     * @see Socket#setKeepAlive
   20.86 +     */
   20.87 +    public static final SocketOption<Boolean> SO_KEEPALIVE =
   20.88 +        new StdSocketOption<Boolean>("SO_KEEPALIVE", Boolean.class);
   20.89 +
   20.90 +    /**
   20.91 +     * The size of the socket send buffer.
   20.92 +     *
   20.93 +     * <p> The value of this socket option is an {@code Integer} that is the
   20.94 +     * size of the socket send buffer in bytes. The socket send buffer is an
   20.95 +     * output buffer used by the networking implementation. It may need to be
   20.96 +     * increased for high-volume connections. The value of the socket option is
   20.97 +     * a <em>hint</em> to the implementation to size the buffer and the actual
   20.98 +     * size may differ. The socket option can be queried to retrieve the actual
   20.99 +     * size.
  20.100 +     *
  20.101 +     * <p> For datagram-oriented sockets, the size of the send buffer may limit
  20.102 +     * the size of the datagrams that may be sent by the socket. Whether
  20.103 +     * datagrams larger than the buffer size are sent or discarded is system
  20.104 +     * dependent.
  20.105 +     *
  20.106 +     * <p> The initial/default size of the socket send buffer and the range of
  20.107 +     * allowable values is system dependent although a negative size is not
  20.108 +     * allowed. An attempt to set the socket send buffer to larger than its
  20.109 +     * maximum size causes it to be set to its maximum size.
  20.110 +     *
  20.111 +     * <p> An implementation allows this socket option to be set before the
  20.112 +     * socket is bound or connected. Whether an implementation allows the
  20.113 +     * socket send buffer to be changed after the socket is bound is system
  20.114 +     * dependent.
  20.115 +     *
  20.116 +     * @see Socket#setSendBufferSize
  20.117 +     */
  20.118 +    public static final SocketOption<Integer> SO_SNDBUF =
  20.119 +        new StdSocketOption<Integer>("SO_SNDBUF", Integer.class);
  20.120 +
  20.121 +
  20.122 +    /**
  20.123 +     * The size of the socket receive buffer.
  20.124 +     *
  20.125 +     * <p> The value of this socket option is an {@code Integer} that is the
  20.126 +     * size of the socket receive buffer in bytes. The socket receive buffer is
  20.127 +     * an input buffer used by the networking implementation. It may need to be
  20.128 +     * increased for high-volume connections or decreased to limit the possible
  20.129 +     * backlog of incoming data. The value of the socket option is a
  20.130 +     * <em>hint</em> to the implementation to size the buffer and the actual
  20.131 +     * size may differ.
  20.132 +     *
  20.133 +     * <p> For datagram-oriented sockets, the size of the receive buffer may
  20.134 +     * limit the size of the datagrams that can be received. Whether datagrams
  20.135 +     * larger than the buffer size can be received is system dependent.
  20.136 +     * Increasing the socket receive buffer may be important for cases where
  20.137 +     * datagrams arrive in bursts faster than they can be processed.
  20.138 +     *
  20.139 +     * <p> In the case of stream-oriented sockets and the TCP/IP protocol, the
  20.140 +     * size of the socket receive buffer may be used when advertising the size
  20.141 +     * of the TCP receive window to the remote peer.
  20.142 +     *
  20.143 +     * <p> The initial/default size of the socket receive buffer and the range
  20.144 +     * of allowable values is system dependent although a negative size is not
  20.145 +     * allowed. An attempt to set the socket receive buffer to larger than its
  20.146 +     * maximum size causes it to be set to its maximum size.
  20.147 +     *
  20.148 +     * <p> An implementation allows this socket option to be set before the
  20.149 +     * socket is bound or connected. Whether an implementation allows the
  20.150 +     * socket receive buffer to be changed after the socket is bound is system
  20.151 +     * dependent.
  20.152 +     *
  20.153 +     * @see <a href="http://www.ietf.org/rfc/rfc1323.txt">RFC&nbsp;1323: TCP
  20.154 +     * Extensions for High Performance</a>
  20.155 +     * @see Socket#setReceiveBufferSize
  20.156 +     * @see ServerSocket#setReceiveBufferSize
  20.157 +     */
  20.158 +    public static final SocketOption<Integer> SO_RCVBUF =
  20.159 +        new StdSocketOption<Integer>("SO_RCVBUF", Integer.class);
  20.160 +
  20.161 +    /**
  20.162 +     * Re-use address.
  20.163 +     *
  20.164 +     * <p> The value of this socket option is a {@code Boolean} that represents
  20.165 +     * whether the option is enabled or disabled. The exact semantics of this
  20.166 +     * socket option are socket type and system dependent.
  20.167 +     *
  20.168 +     * <p> In the case of stream-oriented sockets, this socket option will
  20.169 +     * usually determine whether the socket can be bound to a socket address
  20.170 +     * when a previous connection involving that socket address is in the
  20.171 +     * <em>TIME_WAIT</em> state. On implementations where the semantics differ,
  20.172 +     * and the socket option is not required to be enabled in order to bind the
  20.173 +     * socket when a previous connection is in this state, then the
  20.174 +     * implementation may choose to ignore this option.
  20.175 +     *
  20.176 +     * <p> For datagram-oriented sockets the socket option is used to allow
  20.177 +     * multiple programs bind to the same address. This option should be enabled
  20.178 +     * when the socket is to be used for Internet Protocol (IP) multicasting.
  20.179 +     *
  20.180 +     * <p> An implementation allows this socket option to be set before the
  20.181 +     * socket is bound or connected. Changing the value of this socket option
  20.182 +     * after the socket is bound has no effect. The default value of this
  20.183 +     * socket option is system dependent.
  20.184 +     *
  20.185 +     * @see <a href="http://www.ietf.org/rfc/rfc793.txt">RFC&nbsp;793: Transmission
  20.186 +     * Control Protocol</a>
  20.187 +     * @see ServerSocket#setReuseAddress
  20.188 +     */
  20.189 +    public static final SocketOption<Boolean> SO_REUSEADDR =
  20.190 +        new StdSocketOption<Boolean>("SO_REUSEADDR", Boolean.class);
  20.191 +
  20.192 +    /**
  20.193 +     * Linger on close if data is present.
  20.194 +     *
  20.195 +     * <p> The value of this socket option is an {@code Integer} that controls
  20.196 +     * the action taken when unsent data is queued on the socket and a method
  20.197 +     * to close the socket is invoked. If the value of the socket option is zero
  20.198 +     * or greater, then it represents a timeout value, in seconds, known as the
  20.199 +     * <em>linger interval</em>. The linger interval is the timeout for the
  20.200 +     * {@code close} method to block while the operating system attempts to
  20.201 +     * transmit the unsent data or it decides that it is unable to transmit the
  20.202 +     * data. If the value of the socket option is less than zero then the option
  20.203 +     * is disabled. In that case the {@code close} method does not wait until
  20.204 +     * unsent data is transmitted; if possible the operating system will transmit
  20.205 +     * any unsent data before the connection is closed.
  20.206 +     *
  20.207 +     * <p> This socket option is intended for use with sockets that are configured
  20.208 +     * in {@link java.nio.channels.SelectableChannel#isBlocking() blocking} mode
  20.209 +     * only. The behavior of the {@code close} method when this option is
  20.210 +     * enabled on a non-blocking socket is not defined.
  20.211 +     *
  20.212 +     * <p> The initial value of this socket option is a negative value, meaning
  20.213 +     * that the option is disabled. The option may be enabled, or the linger
  20.214 +     * interval changed, at any time. The maximum value of the linger interval
  20.215 +     * is system dependent. Setting the linger interval to a value that is
  20.216 +     * greater than its maximum value causes the linger interval to be set to
  20.217 +     * its maximum value.
  20.218 +     *
  20.219 +     * @see Socket#setSoLinger
  20.220 +     */
  20.221 +    public static final SocketOption<Integer> SO_LINGER =
  20.222 +        new StdSocketOption<Integer>("SO_LINGER", Integer.class);
  20.223 +
  20.224 +
  20.225 +    // -- IPPROTO_IP --
  20.226 +
  20.227 +    /**
  20.228 +     * The Type of Service (ToS) octet in the Internet Protocol (IP) header.
  20.229 +     *
  20.230 +     * <p> The value of this socket option is an {@code Integer} representing
  20.231 +     * the value of the ToS octet in IP packets sent by sockets to an {@link
  20.232 +     * StandardProtocolFamily#INET IPv4} socket. The interpretation of the ToS
  20.233 +     * octet is network specific and is not defined by this class. Further
  20.234 +     * information on the ToS octet can be found in <a
  20.235 +     * href="http://www.ietf.org/rfc/rfc1349.txt">RFC&nbsp;1349</a> and <a
  20.236 +     * href="http://www.ietf.org/rfc/rfc2474.txt">RFC&nbsp;2474</a>. The value
  20.237 +     * of the socket option is a <em>hint</em>. An implementation may ignore the
  20.238 +     * value, or ignore specific values.
  20.239 +     *
  20.240 +     * <p> The initial/default value of the TOS field in the ToS octet is
  20.241 +     * implementation specific but will typically be {@code 0}. For
  20.242 +     * datagram-oriented sockets the option may be configured at any time after
  20.243 +     * the socket has been bound. The new value of the octet is used when sending
  20.244 +     * subsequent datagrams. It is system dependent whether this option can be
  20.245 +     * queried or changed prior to binding the socket.
  20.246 +     *
  20.247 +     * <p> The behavior of this socket option on a stream-oriented socket, or an
  20.248 +     * {@link StandardProtocolFamily#INET6 IPv6} socket, is not defined in this
  20.249 +     * release.
  20.250 +     *
  20.251 +     * @see DatagramSocket#setTrafficClass
  20.252 +     */
  20.253 +    public static final SocketOption<Integer> IP_TOS =
  20.254 +        new StdSocketOption<Integer>("IP_TOS", Integer.class);
  20.255 +
  20.256 +    /**
  20.257 +     * The network interface for Internet Protocol (IP) multicast datagrams.
  20.258 +     *
  20.259 +     * <p> The value of this socket option is a {@link NetworkInterface} that
  20.260 +     * represents the outgoing interface for multicast datagrams sent by the
  20.261 +     * datagram-oriented socket. For {@link StandardProtocolFamily#INET6 IPv6}
  20.262 +     * sockets then it is system dependent whether setting this option also
  20.263 +     * sets the outgoing interface for multlicast datagrams sent to IPv4
  20.264 +     * addresses.
  20.265 +     *
  20.266 +     * <p> The initial/default value of this socket option may be {@code null}
  20.267 +     * to indicate that outgoing interface will be selected by the operating
  20.268 +     * system, typically based on the network routing tables. An implementation
  20.269 +     * allows this socket option to be set after the socket is bound. Whether
  20.270 +     * the socket option can be queried or changed prior to binding the socket
  20.271 +     * is system dependent.
  20.272 +     *
  20.273 +     * @see java.nio.channels.MulticastChannel
  20.274 +     * @see MulticastSocket#setInterface
  20.275 +     */
  20.276 +    public static final SocketOption<NetworkInterface> IP_MULTICAST_IF =
  20.277 +        new StdSocketOption<NetworkInterface>("IP_MULTICAST_IF", NetworkInterface.class);
  20.278 +
  20.279 +    /**
  20.280 +     * The <em>time-to-live</em> for Internet Protocol (IP) multicast datagrams.
  20.281 +     *
  20.282 +     * <p> The value of this socket option is an {@code Integer} in the range
  20.283 +     * <tt>0&nbsp;<=&nbsp;value&nbsp;<=&nbsp;255</tt>. It is used to control
  20.284 +     * the scope of multicast datagrams sent by the datagram-oriented socket.
  20.285 +     * In the case of an {@link StandardProtocolFamily#INET IPv4} socket
  20.286 +     * the option is the time-to-live (TTL) on multicast datagrams sent by the
  20.287 +     * socket. Datagrams with a TTL of zero are not transmitted on the network
  20.288 +     * but may be delivered locally. In the case of an {@link
  20.289 +     * StandardProtocolFamily#INET6 IPv6} socket the option is the
  20.290 +     * <em>hop limit</em> which is number of <em>hops</em> that the datagram can
  20.291 +     * pass through before expiring on the network. For IPv6 sockets it is
  20.292 +     * system dependent whether the option also sets the <em>time-to-live</em>
  20.293 +     * on multicast datagrams sent to IPv4 addresses.
  20.294 +     *
  20.295 +     * <p> The initial/default value of the time-to-live setting is typically
  20.296 +     * {@code 1}. An implementation allows this socket option to be set after
  20.297 +     * the socket is bound. Whether the socket option can be queried or changed
  20.298 +     * prior to binding the socket is system dependent.
  20.299 +     *
  20.300 +     * @see java.nio.channels.MulticastChannel
  20.301 +     * @see MulticastSocket#setTimeToLive
  20.302 +     */
  20.303 +    public static final SocketOption<Integer> IP_MULTICAST_TTL =
  20.304 +        new StdSocketOption<Integer>("IP_MULTICAST_TTL", Integer.class);
  20.305 +
  20.306 +    /**
  20.307 +     * Loopback for Internet Protocol (IP) multicast datagrams.
  20.308 +     *
  20.309 +     * <p> The value of this socket option is a {@code Boolean} that controls
  20.310 +     * the <em>loopback</em> of multicast datagrams. The value of the socket
  20.311 +     * option represents if the option is enabled or disabled.
  20.312 +     *
  20.313 +     * <p> The exact semantics of this socket options are system dependent.
  20.314 +     * In particular, it is system dependent whether the loopback applies to
  20.315 +     * multicast datagrams sent from the socket or received by the socket.
  20.316 +     * For {@link StandardProtocolFamily#INET6 IPv6} sockets then it is
  20.317 +     * system dependent whether the option also applies to multicast datagrams
  20.318 +     * sent to IPv4 addresses.
  20.319 +     *
  20.320 +     * <p> The initial/default value of this socket option is {@code TRUE}. An
  20.321 +     * implementation allows this socket option to be set after the socket is
  20.322 +     * bound. Whether the socket option can be queried or changed prior to
  20.323 +     * binding the socket is system dependent.
  20.324 +     *
  20.325 +     * @see java.nio.channels.MulticastChannel
  20.326 +     *  @see MulticastSocket#setLoopbackMode
  20.327 +     */
  20.328 +    public static final SocketOption<Boolean> IP_MULTICAST_LOOP =
  20.329 +        new StdSocketOption<Boolean>("IP_MULTICAST_LOOP", Boolean.class);
  20.330 +
  20.331 +
  20.332 +    // -- IPPROTO_TCP --
  20.333 +
  20.334 +    /**
  20.335 +     * Disable the Nagle algorithm.
  20.336 +     *
  20.337 +     * <p> The value of this socket option is a {@code Boolean} that represents
  20.338 +     * whether the option is enabled or disabled. The socket option is specific to
  20.339 +     * stream-oriented sockets using the TCP/IP protocol. TCP/IP uses an algorithm
  20.340 +     * known as <em>The Nagle Algorithm</em> to coalesce short segments and
  20.341 +     * improve network efficiency.
  20.342 +     *
  20.343 +     * <p> The default value of this socket option is {@code FALSE}. The
  20.344 +     * socket option should only be enabled in cases where it is known that the
  20.345 +     * coalescing impacts performance. The socket option may be enabled at any
  20.346 +     * time. In other words, the Nagle Algorithm can be disabled. Once the option
  20.347 +     * is enabled, it is system dependent whether it can be subsequently
  20.348 +     * disabled. If it cannot, then invoking the {@code setOption} method to
  20.349 +     * disable the option has no effect.
  20.350 +     *
  20.351 +     * @see <a href="http://www.ietf.org/rfc/rfc1122.txt">RFC&nbsp;1122:
  20.352 +     * Requirements for Internet Hosts -- Communication Layers</a>
  20.353 +     * @see Socket#setTcpNoDelay
  20.354 +     */
  20.355 +    public static final SocketOption<Boolean> TCP_NODELAY =
  20.356 +        new StdSocketOption<Boolean>("TCP_NODELAY", Boolean.class);
  20.357 +
  20.358 +
  20.359 +    private static class StdSocketOption<T> implements SocketOption<T> {
  20.360 +        private final String name;
  20.361 +        private final Class<T> type;
  20.362 +        StdSocketOption(String name, Class<T> type) {
  20.363 +            this.name = name;
  20.364 +            this.type = type;
  20.365 +        }
  20.366 +        @Override public String name() { return name; }
  20.367 +        @Override public Class<T> type() { return type; }
  20.368 +        @Override public String toString() { return name; }
  20.369 +    }
  20.370 +}
    21.1 --- a/src/share/classes/java/nio/channels/AsynchronousServerSocketChannel.java	Wed May 18 16:32:05 2011 -0700
    21.2 +++ b/src/share/classes/java/nio/channels/AsynchronousServerSocketChannel.java	Wed May 18 18:18:04 2011 -0700
    21.3 @@ -58,11 +58,11 @@
    21.4   *     <th>Description</th>
    21.5   *   </tr>
    21.6   *   <tr>
    21.7 - *     <td> {@link java.net.StandardSocketOption#SO_RCVBUF SO_RCVBUF} </td>
    21.8 + *     <td> {@link java.net.StandardSocketOptions#SO_RCVBUF SO_RCVBUF} </td>
    21.9   *     <td> The size of the socket receive buffer </td>
   21.10   *   </tr>
   21.11   *   <tr>
   21.12 - *     <td> {@link java.net.StandardSocketOption#SO_REUSEADDR SO_REUSEADDR} </td>
   21.13 + *     <td> {@link java.net.StandardSocketOptions#SO_REUSEADDR SO_REUSEADDR} </td>
   21.14   *     <td> Re-use address </td>
   21.15   *   </tr>
   21.16   * </table>
    22.1 --- a/src/share/classes/java/nio/channels/AsynchronousSocketChannel.java	Wed May 18 16:32:05 2011 -0700
    22.2 +++ b/src/share/classes/java/nio/channels/AsynchronousSocketChannel.java	Wed May 18 18:18:04 2011 -0700
    22.3 @@ -68,23 +68,23 @@
    22.4   *     <th>Description</th>
    22.5   *   </tr>
    22.6   *   <tr>
    22.7 - *     <td> {@link java.net.StandardSocketOption#SO_SNDBUF SO_SNDBUF} </td>
    22.8 + *     <td> {@link java.net.StandardSocketOptions#SO_SNDBUF SO_SNDBUF} </td>
    22.9   *     <td> The size of the socket send buffer </td>
   22.10   *   </tr>
   22.11   *   <tr>
   22.12 - *     <td> {@link java.net.StandardSocketOption#SO_RCVBUF SO_RCVBUF} </td>
   22.13 + *     <td> {@link java.net.StandardSocketOptions#SO_RCVBUF SO_RCVBUF} </td>
   22.14   *     <td> The size of the socket receive buffer </td>
   22.15   *   </tr>
   22.16   *   <tr>
   22.17 - *     <td> {@link java.net.StandardSocketOption#SO_KEEPALIVE SO_KEEPALIVE} </td>
   22.18 + *     <td> {@link java.net.StandardSocketOptions#SO_KEEPALIVE SO_KEEPALIVE} </td>
   22.19   *     <td> Keep connection alive </td>
   22.20   *   </tr>
   22.21   *   <tr>
   22.22 - *     <td> {@link java.net.StandardSocketOption#SO_REUSEADDR SO_REUSEADDR} </td>
   22.23 + *     <td> {@link java.net.StandardSocketOptions#SO_REUSEADDR SO_REUSEADDR} </td>
   22.24   *     <td> Re-use address </td>
   22.25   *   </tr>
   22.26   *   <tr>
   22.27 - *     <td> {@link java.net.StandardSocketOption#TCP_NODELAY TCP_NODELAY} </td>
   22.28 + *     <td> {@link java.net.StandardSocketOptions#TCP_NODELAY TCP_NODELAY} </td>
   22.29   *     <td> Disable the Nagle algorithm </td>
   22.30   *   </tr>
   22.31   * </table>
    23.1 --- a/src/share/classes/java/nio/channels/DatagramChannel.java	Wed May 18 16:32:05 2011 -0700
    23.2 +++ b/src/share/classes/java/nio/channels/DatagramChannel.java	Wed May 18 18:18:04 2011 -0700
    23.3 @@ -63,37 +63,37 @@
    23.4   *     <th>Description</th>
    23.5   *   </tr>
    23.6   *   <tr>
    23.7 - *     <td> {@link java.net.StandardSocketOption#SO_SNDBUF SO_SNDBUF} </td>
    23.8 + *     <td> {@link java.net.StandardSocketOptions#SO_SNDBUF SO_SNDBUF} </td>
    23.9   *     <td> The size of the socket send buffer </td>
   23.10   *   </tr>
   23.11   *   <tr>
   23.12 - *     <td> {@link java.net.StandardSocketOption#SO_RCVBUF SO_RCVBUF} </td>
   23.13 + *     <td> {@link java.net.StandardSocketOptions#SO_RCVBUF SO_RCVBUF} </td>
   23.14   *     <td> The size of the socket receive buffer </td>
   23.15   *   </tr>
   23.16   *   <tr>
   23.17 - *     <td> {@link java.net.StandardSocketOption#SO_REUSEADDR SO_REUSEADDR} </td>
   23.18 + *     <td> {@link java.net.StandardSocketOptions#SO_REUSEADDR SO_REUSEADDR} </td>
   23.19   *     <td> Re-use address </td>
   23.20   *   </tr>
   23.21   *   <tr>
   23.22 - *     <td> {@link java.net.StandardSocketOption#SO_BROADCAST SO_BROADCAST} </td>
   23.23 + *     <td> {@link java.net.StandardSocketOptions#SO_BROADCAST SO_BROADCAST} </td>
   23.24   *     <td> Allow transmission of broadcast datagrams </td>
   23.25   *   </tr>
   23.26   *   <tr>
   23.27 - *     <td> {@link java.net.StandardSocketOption#IP_TOS IP_TOS} </td>
   23.28 + *     <td> {@link java.net.StandardSocketOptions#IP_TOS IP_TOS} </td>
   23.29   *     <td> The Type of Service (ToS) octet in the Internet Protocol (IP) header </td>
   23.30   *   </tr>
   23.31   *   <tr>
   23.32 - *     <td> {@link java.net.StandardSocketOption#IP_MULTICAST_IF IP_MULTICAST_IF} </td>
   23.33 + *     <td> {@link java.net.StandardSocketOptions#IP_MULTICAST_IF IP_MULTICAST_IF} </td>
   23.34   *     <td> The network interface for Internet Protocol (IP) multicast datagrams </td>
   23.35   *   </tr>
   23.36   *   <tr>
   23.37 - *     <td> {@link java.net.StandardSocketOption#IP_MULTICAST_TTL
   23.38 + *     <td> {@link java.net.StandardSocketOptions#IP_MULTICAST_TTL
   23.39   *       IP_MULTICAST_TTL} </td>
   23.40   *     <td> The <em>time-to-live</em> for Internet Protocol (IP) multicast
   23.41   *       datagrams </td>
   23.42   *   </tr>
   23.43   *   <tr>
   23.44 - *     <td> {@link java.net.StandardSocketOption#IP_MULTICAST_LOOP
   23.45 + *     <td> {@link java.net.StandardSocketOptions#IP_MULTICAST_LOOP
   23.46   *       IP_MULTICAST_LOOP} </td>
   23.47   *     <td> Loopback for Internet Protocol (IP) multicast datagrams </td>
   23.48   *   </tr>
    24.1 --- a/src/share/classes/java/nio/channels/MulticastChannel.java	Wed May 18 16:32:05 2011 -0700
    24.2 +++ b/src/share/classes/java/nio/channels/MulticastChannel.java	Wed May 18 18:18:04 2011 -0700
    24.3 @@ -30,7 +30,7 @@
    24.4  import java.io.IOException;
    24.5  import java.net.ProtocolFamily;             // javadoc
    24.6  import java.net.StandardProtocolFamily;     // javadoc
    24.7 -import java.net.StandardSocketOption;       // javadoc
    24.8 +import java.net.StandardSocketOptions;      // javadoc
    24.9  
   24.10  /**
   24.11   * A network channel that supports Internet Protocol (IP) multicasting.
   24.12 @@ -93,7 +93,7 @@
   24.13   * a specific address, rather than the wildcard address then it is implementation
   24.14   * specific if multicast datagrams are received by the socket. </p></li>
   24.15   *
   24.16 - * <li><p> The {@link StandardSocketOption#SO_REUSEADDR SO_REUSEADDR} option should be
   24.17 + * <li><p> The {@link StandardSocketOptions#SO_REUSEADDR SO_REUSEADDR} option should be
   24.18   * enabled prior to {@link NetworkChannel#bind binding} the socket. This is
   24.19   * required to allow multiple members of the group to bind to the same
   24.20   * address. </p></li>
   24.21 @@ -107,9 +107,9 @@
   24.22   *     NetworkInterface ni = NetworkInterface.getByName("hme0");
   24.23   *
   24.24   *     DatagramChannel dc = DatagramChannel.open(StandardProtocolFamily.INET)
   24.25 - *         .setOption(StandardSocketOption.SO_REUSEADDR, true)
   24.26 + *         .setOption(StandardSocketOptions.SO_REUSEADDR, true)
   24.27   *         .bind(new InetSocketAddress(5000))
   24.28 - *         .setOption(StandardSocketOption.IP_MULTICAST_IF, ni);
   24.29 + *         .setOption(StandardSocketOptions.IP_MULTICAST_IF, ni);
   24.30   *
   24.31   *     InetAddress group = InetAddress.getByName("225.4.5.6");
   24.32   *
    25.1 --- a/src/share/classes/java/nio/channels/NetworkChannel.java	Wed May 18 16:32:05 2011 -0700
    25.2 +++ b/src/share/classes/java/nio/channels/NetworkChannel.java	Wed May 18 18:18:04 2011 -0700
    25.3 @@ -124,7 +124,7 @@
    25.4       * @throws  IOException
    25.5       *          If an I/O error occurs
    25.6       *
    25.7 -     * @see java.net.StandardSocketOption
    25.8 +     * @see java.net.StandardSocketOptions
    25.9       */
   25.10      <T> NetworkChannel setOption(SocketOption<T> name, T value) throws IOException;
   25.11  
   25.12 @@ -144,7 +144,7 @@
   25.13       * @throws  IOException
   25.14       *          If an I/O error occurs
   25.15       *
   25.16 -     * @see java.net.StandardSocketOption
   25.17 +     * @see java.net.StandardSocketOptions
   25.18       */
   25.19      <T> T getOption(SocketOption<T> name) throws IOException;
   25.20  
    26.1 --- a/src/share/classes/java/nio/channels/ServerSocketChannel.java	Wed May 18 16:32:05 2011 -0700
    26.2 +++ b/src/share/classes/java/nio/channels/ServerSocketChannel.java	Wed May 18 18:18:04 2011 -0700
    26.3 @@ -52,11 +52,11 @@
    26.4   *     <th>Description</th>
    26.5   *   </tr>
    26.6   *   <tr>
    26.7 - *     <td> {@link java.net.StandardSocketOption#SO_RCVBUF SO_RCVBUF} </td>
    26.8 + *     <td> {@link java.net.StandardSocketOptions#SO_RCVBUF SO_RCVBUF} </td>
    26.9   *     <td> The size of the socket receive buffer </td>
   26.10   *   </tr>
   26.11   *   <tr>
   26.12 - *     <td> {@link java.net.StandardSocketOption#SO_REUSEADDR SO_REUSEADDR} </td>
   26.13 + *     <td> {@link java.net.StandardSocketOptions#SO_REUSEADDR SO_REUSEADDR} </td>
   26.14   *     <td> Re-use address </td>
   26.15   *   </tr>
   26.16   * </table>
    27.1 --- a/src/share/classes/java/nio/channels/SocketChannel.java	Wed May 18 16:32:05 2011 -0700
    27.2 +++ b/src/share/classes/java/nio/channels/SocketChannel.java	Wed May 18 18:18:04 2011 -0700
    27.3 @@ -72,28 +72,28 @@
    27.4   *     <th>Description</th>
    27.5   *   </tr>
    27.6   *   <tr>
    27.7 - *     <td> {@link java.net.StandardSocketOption#SO_SNDBUF SO_SNDBUF} </td>
    27.8 + *     <td> {@link java.net.StandardSocketOptions#SO_SNDBUF SO_SNDBUF} </td>
    27.9   *     <td> The size of the socket send buffer </td>
   27.10   *   </tr>
   27.11   *   <tr>
   27.12 - *     <td> {@link java.net.StandardSocketOption#SO_RCVBUF SO_RCVBUF} </td>
   27.13 + *     <td> {@link java.net.StandardSocketOptions#SO_RCVBUF SO_RCVBUF} </td>
   27.14   *     <td> The size of the socket receive buffer </td>
   27.15   *   </tr>
   27.16   *   <tr>
   27.17 - *     <td> {@link java.net.StandardSocketOption#SO_KEEPALIVE SO_KEEPALIVE} </td>
   27.18 + *     <td> {@link java.net.StandardSocketOptions#SO_KEEPALIVE SO_KEEPALIVE} </td>
   27.19   *     <td> Keep connection alive </td>
   27.20   *   </tr>
   27.21   *   <tr>
   27.22 - *     <td> {@link java.net.StandardSocketOption#SO_REUSEADDR SO_REUSEADDR} </td>
   27.23 + *     <td> {@link java.net.StandardSocketOptions#SO_REUSEADDR SO_REUSEADDR} </td>
   27.24   *     <td> Re-use address </td>
   27.25   *   </tr>
   27.26   *   <tr>
   27.27 - *     <td> {@link java.net.StandardSocketOption#SO_LINGER SO_LINGER} </td>
   27.28 + *     <td> {@link java.net.StandardSocketOptions#SO_LINGER SO_LINGER} </td>
   27.29   *     <td> Linger on close if data is present (when configured in blocking mode
   27.30   *          only) </td>
   27.31   *   </tr>
   27.32   *   <tr>
   27.33 - *     <td> {@link java.net.StandardSocketOption#TCP_NODELAY TCP_NODELAY} </td>
   27.34 + *     <td> {@link java.net.StandardSocketOptions#TCP_NODELAY TCP_NODELAY} </td>
   27.35   *     <td> Disable the Nagle algorithm </td>
   27.36   *   </tr>
   27.37   * </table>
    28.1 --- a/src/share/classes/java/nio/charset/Charset.java	Wed May 18 16:32:05 2011 -0700
    28.2 +++ b/src/share/classes/java/nio/charset/Charset.java	Wed May 18 18:18:04 2011 -0700
    28.3 @@ -215,7 +215,7 @@
    28.4   * determined during virtual-machine startup and typically depends upon the
    28.5   * locale and charset being used by the underlying operating system. </p>
    28.6   *
    28.7 - * <p>The {@link StandardCharset} class defines constants for each of the
    28.8 + * <p>The {@link StandardCharsets} class defines constants for each of the
    28.9   * standard charsets.
   28.10   *
   28.11   * <h4>Terminology</h4>
    29.1 --- a/src/share/classes/java/nio/charset/StandardCharset.java	Wed May 18 16:32:05 2011 -0700
    29.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.3 @@ -1,66 +0,0 @@
    29.4 -/*
    29.5 - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    29.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    29.7 - *
    29.8 - * This code is free software; you can redistribute it and/or modify it
    29.9 - * under the terms of the GNU General Public License version 2 only, as
   29.10 - * published by the Free Software Foundation.  Oracle designates this
   29.11 - * particular file as subject to the "Classpath" exception as provided
   29.12 - * by Oracle in the LICENSE file that accompanied this code.
   29.13 - *
   29.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   29.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   29.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   29.17 - * version 2 for more details (a copy is included in the LICENSE file that
   29.18 - * accompanied this code).
   29.19 - *
   29.20 - * You should have received a copy of the GNU General Public License version
   29.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   29.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   29.23 - *
   29.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   29.25 - * or visit www.oracle.com if you need additional information or have any
   29.26 - * questions.
   29.27 - */
   29.28 -package java.nio.charset;
   29.29 -
   29.30 -/**
   29.31 - * Constant definitions for the standard {@link Charset Charsets}. These
   29.32 - * charsets are guaranteed to be available on every implementation of the Java
   29.33 - * platform.
   29.34 - *
   29.35 - * @see <a href="Charset#standard">Standard Charsets</a>
   29.36 - * @since 1.7
   29.37 - */
   29.38 -public final class StandardCharset {
   29.39 -
   29.40 -    private StandardCharset() {
   29.41 -        throw new AssertionError("No java.nio.charset.StandardCharset instances for you!");
   29.42 -    }
   29.43 -    /**
   29.44 -     * Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the
   29.45 -     * Unicode character set
   29.46 -     */
   29.47 -    public static final Charset US_ASCII = Charset.forName("US-ASCII");
   29.48 -    /**
   29.49 -     * ISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1
   29.50 -     */
   29.51 -    public static final Charset ISO_8859_1 = Charset.forName("ISO-8859-1");
   29.52 -    /**
   29.53 -     * Eight-bit UCS Transformation Format
   29.54 -     */
   29.55 -    public static final Charset UTF_8 = Charset.forName("UTF-8");
   29.56 -    /**
   29.57 -     * Sixteen-bit UCS Transformation Format, big-endian byte order
   29.58 -     */
   29.59 -    public static final Charset UTF_16BE = Charset.forName("UTF-16BE");
   29.60 -    /**
   29.61 -     * Sixteen-bit UCS Transformation Format, little-endian byte order
   29.62 -     */
   29.63 -    public static final Charset UTF_16LE = Charset.forName("UTF-16LE");
   29.64 -    /**
   29.65 -     * Sixteen-bit UCS Transformation Format, byte order identified by an
   29.66 -     * optional byte-order mark
   29.67 -     */
   29.68 -    public static final Charset UTF_16 = Charset.forName("UTF-16");
   29.69 -}
    30.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2 +++ b/src/share/classes/java/nio/charset/StandardCharsets.java	Wed May 18 18:18:04 2011 -0700
    30.3 @@ -0,0 +1,66 @@
    30.4 +/*
    30.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    30.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    30.7 + *
    30.8 + * This code is free software; you can redistribute it and/or modify it
    30.9 + * under the terms of the GNU General Public License version 2 only, as
   30.10 + * published by the Free Software Foundation.  Oracle designates this
   30.11 + * particular file as subject to the "Classpath" exception as provided
   30.12 + * by Oracle in the LICENSE file that accompanied this code.
   30.13 + *
   30.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   30.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   30.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   30.17 + * version 2 for more details (a copy is included in the LICENSE file that
   30.18 + * accompanied this code).
   30.19 + *
   30.20 + * You should have received a copy of the GNU General Public License version
   30.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   30.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   30.23 + *
   30.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   30.25 + * or visit www.oracle.com if you need additional information or have any
   30.26 + * questions.
   30.27 + */
   30.28 +package java.nio.charset;
   30.29 +
   30.30 +/**
   30.31 + * Constant definitions for the standard {@link Charset Charsets}. These
   30.32 + * charsets are guaranteed to be available on every implementation of the Java
   30.33 + * platform.
   30.34 + *
   30.35 + * @see <a href="Charset#standard">Standard Charsets</a>
   30.36 + * @since 1.7
   30.37 + */
   30.38 +public final class StandardCharsets {
   30.39 +
   30.40 +    private StandardCharsets() {
   30.41 +        throw new AssertionError("No java.nio.charset.StandardCharsets instances for you!");
   30.42 +    }
   30.43 +    /**
   30.44 +     * Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the
   30.45 +     * Unicode character set
   30.46 +     */
   30.47 +    public static final Charset US_ASCII = Charset.forName("US-ASCII");
   30.48 +    /**
   30.49 +     * ISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1
   30.50 +     */
   30.51 +    public static final Charset ISO_8859_1 = Charset.forName("ISO-8859-1");
   30.52 +    /**
   30.53 +     * Eight-bit UCS Transformation Format
   30.54 +     */
   30.55 +    public static final Charset UTF_8 = Charset.forName("UTF-8");
   30.56 +    /**
   30.57 +     * Sixteen-bit UCS Transformation Format, big-endian byte order
   30.58 +     */
   30.59 +    public static final Charset UTF_16BE = Charset.forName("UTF-16BE");
   30.60 +    /**
   30.61 +     * Sixteen-bit UCS Transformation Format, little-endian byte order
   30.62 +     */
   30.63 +    public static final Charset UTF_16LE = Charset.forName("UTF-16LE");
   30.64 +    /**
   30.65 +     * Sixteen-bit UCS Transformation Format, byte order identified by an
   30.66 +     * optional byte-order mark
   30.67 +     */
   30.68 +    public static final Charset UTF_16 = Charset.forName("UTF-16");
   30.69 +}
    31.1 --- a/src/share/classes/java/nio/file/Path.java	Wed May 18 16:32:05 2011 -0700
    31.2 +++ b/src/share/classes/java/nio/file/Path.java	Wed May 18 18:18:04 2011 -0700
    31.3 @@ -72,7 +72,7 @@
    31.4   * directory and is UTF-8 encoded.
    31.5   * <pre>
    31.6   *     Path path = FileSystems.getDefault().getPath("logs", "access.log");
    31.7 - *     BufferReader reader = Files.newBufferedReader(path, StandardCharset.UTF_8);
    31.8 + *     BufferReader reader = Files.newBufferedReader(path, StandardCharsets.UTF_8);
    31.9   * </pre>
   31.10   *
   31.11   * <a name="interop"><h4>Interoperability</h4></a>
   31.12 @@ -609,11 +609,11 @@
   31.13       * directory can be watched. The {@code events} parameter is the events to
   31.14       * register and may contain the following events:
   31.15       * <ul>
   31.16 -     *   <li>{@link StandardWatchEventKind#ENTRY_CREATE ENTRY_CREATE} -
   31.17 +     *   <li>{@link StandardWatchEventKinds#ENTRY_CREATE ENTRY_CREATE} -
   31.18       *       entry created or moved into the directory</li>
   31.19 -     *   <li>{@link StandardWatchEventKind#ENTRY_DELETE ENTRY_DELETE} -
   31.20 +     *   <li>{@link StandardWatchEventKinds#ENTRY_DELETE ENTRY_DELETE} -
   31.21       *        entry deleted or moved out of the directory</li>
   31.22 -     *   <li>{@link StandardWatchEventKind#ENTRY_MODIFY ENTRY_MODIFY} -
   31.23 +     *   <li>{@link StandardWatchEventKinds#ENTRY_MODIFY ENTRY_MODIFY} -
   31.24       *        entry in directory was modified</li>
   31.25       * </ul>
   31.26       *
   31.27 @@ -622,7 +622,7 @@
   31.28       * that locates the directory entry that is created, deleted, or modified.
   31.29       *
   31.30       * <p> The set of events may include additional implementation specific
   31.31 -     * event that are not defined by the enum {@link StandardWatchEventKind}
   31.32 +     * event that are not defined by the enum {@link StandardWatchEventKinds}
   31.33       *
   31.34       * <p> The {@code modifiers} parameter specifies <em>modifiers</em> that
   31.35       * qualify how the directory is registered. This release does not define any
    32.1 --- a/src/share/classes/java/nio/file/StandardWatchEventKind.java	Wed May 18 16:32:05 2011 -0700
    32.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.3 @@ -1,94 +0,0 @@
    32.4 -/*
    32.5 - * Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved.
    32.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    32.7 - *
    32.8 - * This code is free software; you can redistribute it and/or modify it
    32.9 - * under the terms of the GNU General Public License version 2 only, as
   32.10 - * published by the Free Software Foundation.  Oracle designates this
   32.11 - * particular file as subject to the "Classpath" exception as provided
   32.12 - * by Oracle in the LICENSE file that accompanied this code.
   32.13 - *
   32.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   32.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   32.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   32.17 - * version 2 for more details (a copy is included in the LICENSE file that
   32.18 - * accompanied this code).
   32.19 - *
   32.20 - * You should have received a copy of the GNU General Public License version
   32.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   32.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   32.23 - *
   32.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   32.25 - * or visit www.oracle.com if you need additional information or have any
   32.26 - * questions.
   32.27 - */
   32.28 -
   32.29 -package java.nio.file;
   32.30 -
   32.31 -/**
   32.32 - * Defines the <em>standard</em> event kinds.
   32.33 - *
   32.34 - * @since 1.7
   32.35 - */
   32.36 -
   32.37 -public final class StandardWatchEventKind {
   32.38 -    private StandardWatchEventKind() { }
   32.39 -
   32.40 -    /**
   32.41 -     * A special event to indicate that events may have been lost or
   32.42 -     * discarded.
   32.43 -     *
   32.44 -     * <p> The {@link WatchEvent#context context} for this event is
   32.45 -     * implementation specific and may be {@code null}. The event {@link
   32.46 -     * WatchEvent#count count} may be greater than {@code 1}.
   32.47 -     *
   32.48 -     * @see WatchService
   32.49 -     */
   32.50 -    public static final WatchEvent.Kind<Void> OVERFLOW =
   32.51 -        new StdWatchEventKind<Void>("OVERFLOW", Void.class);
   32.52 -
   32.53 -    /**
   32.54 -     * Directory entry created.
   32.55 -     *
   32.56 -     * <p> When a directory is registered for this event then the {@link WatchKey}
   32.57 -     * is queued when it is observed that an entry is created in the directory
   32.58 -     * or renamed into the directory. The event {@link WatchEvent#count count}
   32.59 -     * for this event is always {@code 1}.
   32.60 -     */
   32.61 -    public static final WatchEvent.Kind<Path> ENTRY_CREATE =
   32.62 -        new StdWatchEventKind<Path>("ENTRY_CREATE", Path.class);
   32.63 -
   32.64 -    /**
   32.65 -     * Directory entry deleted.
   32.66 -     *
   32.67 -     * <p> When a directory is registered for this event then the {@link WatchKey}
   32.68 -     * is queued when it is observed that an entry is deleted or renamed out of
   32.69 -     * the directory. The event {@link WatchEvent#count count} for this event
   32.70 -     * is always {@code 1}.
   32.71 -     */
   32.72 -    public static final WatchEvent.Kind<Path> ENTRY_DELETE =
   32.73 -        new StdWatchEventKind<Path>("ENTRY_DELETE", Path.class);
   32.74 -
   32.75 -    /**
   32.76 -     * Directory entry modified.
   32.77 -     *
   32.78 -     * <p> When a directory is registered for this event then the {@link WatchKey}
   32.79 -     * is queued when it is observed that an entry in the directory has been
   32.80 -     * modified. The event {@link WatchEvent#count count} for this event is
   32.81 -     * {@code 1} or greater.
   32.82 -     */
   32.83 -    public static final WatchEvent.Kind<Path> ENTRY_MODIFY =
   32.84 -        new StdWatchEventKind<Path>("ENTRY_MODIFY", Path.class);
   32.85 -
   32.86 -    private static class StdWatchEventKind<T> implements WatchEvent.Kind<T> {
   32.87 -        private final String name;
   32.88 -        private final Class<T> type;
   32.89 -        StdWatchEventKind(String name, Class<T> type) {
   32.90 -            this.name = name;
   32.91 -            this.type = type;
   32.92 -        }
   32.93 -        @Override public String name() { return name; }
   32.94 -        @Override public Class<T> type() { return type; }
   32.95 -        @Override public String toString() { return name; }
   32.96 -    }
   32.97 -}
    33.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.2 +++ b/src/share/classes/java/nio/file/StandardWatchEventKinds.java	Wed May 18 18:18:04 2011 -0700
    33.3 @@ -0,0 +1,94 @@
    33.4 +/*
    33.5 + * Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved.
    33.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    33.7 + *
    33.8 + * This code is free software; you can redistribute it and/or modify it
    33.9 + * under the terms of the GNU General Public License version 2 only, as
   33.10 + * published by the Free Software Foundation.  Oracle designates this
   33.11 + * particular file as subject to the "Classpath" exception as provided
   33.12 + * by Oracle in the LICENSE file that accompanied this code.
   33.13 + *
   33.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   33.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   33.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   33.17 + * version 2 for more details (a copy is included in the LICENSE file that
   33.18 + * accompanied this code).
   33.19 + *
   33.20 + * You should have received a copy of the GNU General Public License version
   33.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   33.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   33.23 + *
   33.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   33.25 + * or visit www.oracle.com if you need additional information or have any
   33.26 + * questions.
   33.27 + */
   33.28 +
   33.29 +package java.nio.file;
   33.30 +
   33.31 +/**
   33.32 + * Defines the <em>standard</em> event kinds.
   33.33 + *
   33.34 + * @since 1.7
   33.35 + */
   33.36 +
   33.37 +public final class StandardWatchEventKinds {
   33.38 +    private StandardWatchEventKinds() { }
   33.39 +
   33.40 +    /**
   33.41 +     * A special event to indicate that events may have been lost or
   33.42 +     * discarded.
   33.43 +     *
   33.44 +     * <p> The {@link WatchEvent#context context} for this event is
   33.45 +     * implementation specific and may be {@code null}. The event {@link
   33.46 +     * WatchEvent#count count} may be greater than {@code 1}.
   33.47 +     *
   33.48 +     * @see WatchService
   33.49 +     */
   33.50 +    public static final WatchEvent.Kind<Object> OVERFLOW =
   33.51 +        new StdWatchEventKind<Object>("OVERFLOW", Object.class);
   33.52 +
   33.53 +    /**
   33.54 +     * Directory entry created.
   33.55 +     *
   33.56 +     * <p> When a directory is registered for this event then the {@link WatchKey}
   33.57 +     * is queued when it is observed that an entry is created in the directory
   33.58 +     * or renamed into the directory. The event {@link WatchEvent#count count}
   33.59 +     * for this event is always {@code 1}.
   33.60 +     */
   33.61 +    public static final WatchEvent.Kind<Path> ENTRY_CREATE =
   33.62 +        new StdWatchEventKind<Path>("ENTRY_CREATE", Path.class);
   33.63 +
   33.64 +    /**
   33.65 +     * Directory entry deleted.
   33.66 +     *
   33.67 +     * <p> When a directory is registered for this event then the {@link WatchKey}
   33.68 +     * is queued when it is observed that an entry is deleted or renamed out of
   33.69 +     * the directory. The event {@link WatchEvent#count count} for this event
   33.70 +     * is always {@code 1}.
   33.71 +     */
   33.72 +    public static final WatchEvent.Kind<Path> ENTRY_DELETE =
   33.73 +        new StdWatchEventKind<Path>("ENTRY_DELETE", Path.class);
   33.74 +
   33.75 +    /**
   33.76 +     * Directory entry modified.
   33.77 +     *
   33.78 +     * <p> When a directory is registered for this event then the {@link WatchKey}
   33.79 +     * is queued when it is observed that an entry in the directory has been
   33.80 +     * modified. The event {@link WatchEvent#count count} for this event is
   33.81 +     * {@code 1} or greater.
   33.82 +     */
   33.83 +    public static final WatchEvent.Kind<Path> ENTRY_MODIFY =
   33.84 +        new StdWatchEventKind<Path>("ENTRY_MODIFY", Path.class);
   33.85 +
   33.86 +    private static class StdWatchEventKind<T> implements WatchEvent.Kind<T> {
   33.87 +        private final String name;
   33.88 +        private final Class<T> type;
   33.89 +        StdWatchEventKind(String name, Class<T> type) {
   33.90 +            this.name = name;
   33.91 +            this.type = type;
   33.92 +        }
   33.93 +        @Override public String name() { return name; }
   33.94 +        @Override public Class<T> type() { return type; }
   33.95 +        @Override public String toString() { return name; }
   33.96 +    }
   33.97 +}
    34.1 --- a/src/share/classes/java/nio/file/WatchEvent.java	Wed May 18 16:32:05 2011 -0700
    34.2 +++ b/src/share/classes/java/nio/file/WatchEvent.java	Wed May 18 18:18:04 2011 -0700
    34.3 @@ -50,7 +50,7 @@
    34.4       * An event kind, for the purposes of identification.
    34.5       *
    34.6       * @since 1.7
    34.7 -     * @see StandardWatchEventKind
    34.8 +     * @see StandardWatchEventKinds
    34.9       */
   34.10      public static interface Kind<T> {
   34.11          /**
   34.12 @@ -98,9 +98,9 @@
   34.13      /**
   34.14       * Returns the context for the event.
   34.15       *
   34.16 -     * <p> In the case of {@link StandardWatchEventKind#ENTRY_CREATE ENTRY_CREATE},
   34.17 -     * {@link StandardWatchEventKind#ENTRY_DELETE ENTRY_DELETE}, and {@link
   34.18 -     * StandardWatchEventKind#ENTRY_MODIFY ENTRY_MODIFY} events the context is
   34.19 +     * <p> In the case of {@link StandardWatchEventKinds#ENTRY_CREATE ENTRY_CREATE},
   34.20 +     * {@link StandardWatchEventKinds#ENTRY_DELETE ENTRY_DELETE}, and {@link
   34.21 +     * StandardWatchEventKinds#ENTRY_MODIFY ENTRY_MODIFY} events the context is
   34.22       * a {@code Path} that is the {@link Path#relativize relative} path between
   34.23       * the directory registered with the watch service, and the entry that is
   34.24       * created, deleted, or modified.
    35.1 --- a/src/share/classes/java/nio/file/WatchService.java	Wed May 18 16:32:05 2011 -0700
    35.2 +++ b/src/share/classes/java/nio/file/WatchService.java	Wed May 18 18:18:04 2011 -0700
    35.3 @@ -68,7 +68,7 @@
    35.4   * of events that it may accumulate. Where an implementation <em>knowingly</em>
    35.5   * discards events then it arranges for the key's {@link WatchKey#pollEvents
    35.6   * pollEvents} method to return an element with an event type of {@link
    35.7 - * StandardWatchEventKind#OVERFLOW OVERFLOW}. This event can be used by the
    35.8 + * StandardWatchEventKinds#OVERFLOW OVERFLOW}. This event can be used by the
    35.9   * consumer as a trigger to re-examine the state of the object.
   35.10   *
   35.11   * <p> When an event is reported to indicate that a file in a watched directory
   35.12 @@ -87,7 +87,7 @@
   35.13   * are detected, their timeliness, and whether their ordering is preserved are
   35.14   * highly implementation specific. For example, when a file in a watched
   35.15   * directory is modified then it may result in a single {@link
   35.16 - * StandardWatchEventKind#ENTRY_MODIFY ENTRY_MODIFY} event in some
   35.17 + * StandardWatchEventKinds#ENTRY_MODIFY ENTRY_MODIFY} event in some
   35.18   * implementations but several events in other implementations. Short-lived
   35.19   * files (meaning files that are deleted very quickly after they are created)
   35.20   * may not be detected by primitive implementations that periodically poll the
    36.1 --- a/src/share/classes/java/nio/file/Watchable.java	Wed May 18 16:32:05 2011 -0700
    36.2 +++ b/src/share/classes/java/nio/file/Watchable.java	Wed May 18 18:18:04 2011 -0700
    36.3 @@ -53,7 +53,7 @@
    36.4       * those specified by the {@code events} and {@code modifiers} parameters.
    36.5       * Changing the event set does not cause pending events for the object to be
    36.6       * discarded. Objects are automatically registered for the {@link
    36.7 -     * StandardWatchEventKind#OVERFLOW OVERFLOW} event. This event is not
    36.8 +     * StandardWatchEventKinds#OVERFLOW OVERFLOW} event. This event is not
    36.9       * required to be present in the array of events.
   36.10       *
   36.11       * <p> Otherwise the file system object has not yet been registered with the
    37.1 --- a/src/share/classes/java/sql/BatchUpdateException.java	Wed May 18 16:32:05 2011 -0700
    37.2 +++ b/src/share/classes/java/sql/BatchUpdateException.java	Wed May 18 18:18:04 2011 -0700
    37.3 @@ -89,7 +89,7 @@
    37.4     * The <code>cause</code> is not initialized, and may subsequently be
    37.5     * initialized by a call to the
    37.6     * {@link Throwable#initCause(java.lang.Throwable)} method. The vendor code
    37.7 -   * is intialized to 0.
    37.8 +   * is initialized to 0.
    37.9     * <p>
   37.10     *
   37.11     * @param reason a description of the exception
   37.12 @@ -188,7 +188,7 @@
   37.13       * @since 1.6
   37.14       */
   37.15      public BatchUpdateException(Throwable cause) {
   37.16 -        this(null, null, 0, null, cause);
   37.17 +        this((cause == null ? null : cause.toString()), null, 0, null, cause);
   37.18      }
   37.19  
   37.20      /**
   37.21 @@ -214,7 +214,7 @@
   37.22       * @since 1.6
   37.23       */
   37.24      public BatchUpdateException(int []updateCounts , Throwable cause) {
   37.25 -        this(null, null, 0, updateCounts, cause);
   37.26 +        this((cause == null ? null : cause.toString()), null, 0, updateCounts, cause);
   37.27      }
   37.28  
   37.29      /**
    38.1 --- a/src/share/classes/java/util/Formatter.java	Wed May 18 16:32:05 2011 -0700
    38.2 +++ b/src/share/classes/java/util/Formatter.java	Wed May 18 18:18:04 2011 -0700
    38.3 @@ -826,7 +826,7 @@
    38.4   *
    38.5   * <li> <a href="#dndec"><b>Float and Double</b></a>
    38.6   *
    38.7 - * <li> <a href="#dndec"><b>BigDecimal</b></a>
    38.8 + * <li> <a href="#dnbdec"><b>BigDecimal</b></a>
    38.9   *
   38.10   * </ol>
   38.11   *
   38.12 @@ -1362,7 +1362,7 @@
   38.13   * precision is not provided, then all of the digits as returned by {@link
   38.14   * Double#toHexString(double)} will be output.
   38.15   *
   38.16 - * <p><a name="dndec"><b> BigDecimal </b></a>
   38.17 + * <p><a name="dnbdec"><b> BigDecimal </b></a>
   38.18   *
   38.19   * <p> The following conversions may be applied {@link java.math.BigDecimal
   38.20   * BigDecimal}.
   38.21 @@ -1372,7 +1372,7 @@
   38.22   * <tr><td valign="top"> {@code 'e'}
   38.23   *     <td valign="top"> <tt>'&#92;u0065'</tt>
   38.24   *     <td> Requires the output to be formatted using <a
   38.25 - *     name="scientific">computerized scientific notation</a>.  The <a
   38.26 + *     name="bscientific">computerized scientific notation</a>.  The <a
   38.27   *     href="#l10n algorithm">localization algorithm</a> is applied.
   38.28   *
   38.29   *     <p> The formatting of the magnitude <i>m</i> depends upon its value.
   38.30 @@ -1427,11 +1427,11 @@
   38.31   *
   38.32   *     <p> If <i>m</i> is greater than or equal to 10<sup>-4</sup> but less
   38.33   *     than 10<sup>precision</sup> then it is represented in <i><a
   38.34 - *     href="#decimal">decimal format</a></i>.
   38.35 + *     href="#bdecimal">decimal format</a></i>.
   38.36   *
   38.37   *     <p> If <i>m</i> is less than 10<sup>-4</sup> or greater than or equal to
   38.38   *     10<sup>precision</sup>, then it is represented in <i><a
   38.39 - *     href="#scientific">computerized scientific notation</a></i>.
   38.40 + *     href="#bscientific">computerized scientific notation</a></i>.
   38.41   *
   38.42   *     <p> The total number of significant digits in <i>m</i> is equal to the
   38.43   *     precision.  If the precision is not specified, then the default value is
   38.44 @@ -1447,7 +1447,7 @@
   38.45   *
   38.46   * <tr><td valign="top"> {@code 'f'}
   38.47   *     <td valign="top"> <tt>'&#92;u0066'</tt>
   38.48 - *     <td> Requires the output to be formatted using <a name="decimal">decimal
   38.49 + *     <td> Requires the output to be formatted using <a name="bdecimal">decimal
   38.50   *     format</a>.  The <a href="#l10n algorithm">localization algorithm</a> is
   38.51   *     applied.
   38.52   *
    39.1 --- a/src/share/classes/java/util/concurrent/Phaser.java	Wed May 18 16:32:05 2011 -0700
    39.2 +++ b/src/share/classes/java/util/concurrent/Phaser.java	Wed May 18 18:18:04 2011 -0700
    39.3 @@ -159,7 +159,7 @@
    39.4   * void runTasks(List<Runnable> tasks) {
    39.5   *   final Phaser phaser = new Phaser(1); // "1" to register self
    39.6   *   // create and start threads
    39.7 - *   for (Runnable task : tasks) {
    39.8 + *   for (final Runnable task : tasks) {
    39.9   *     phaser.register();
   39.10   *     new Thread() {
   39.11   *       public void run() {
    40.1 --- a/src/share/classes/java/util/concurrent/locks/LockSupport.java	Wed May 18 16:32:05 2011 -0700
    40.2 +++ b/src/share/classes/java/util/concurrent/locks/LockSupport.java	Wed May 18 18:18:04 2011 -0700
    40.3 @@ -275,10 +275,14 @@
    40.4       * snapshot -- the thread may have since unblocked or blocked on a
    40.5       * different blocker object.
    40.6       *
    40.7 +     * @param t the thread
    40.8       * @return the blocker
    40.9 +     * @throws NullPointerException if argument is null
   40.10       * @since 1.6
   40.11       */
   40.12      public static Object getBlocker(Thread t) {
   40.13 +        if (t == null)
   40.14 +            throw new NullPointerException();
   40.15          return unsafe.getObjectVolatile(t, parkBlockerOffset);
   40.16      }
   40.17  
    41.1 --- a/src/share/classes/java/util/logging/LogManager.java	Wed May 18 16:32:05 2011 -0700
    41.2 +++ b/src/share/classes/java/util/logging/LogManager.java	Wed May 18 18:18:04 2011 -0700
    41.3 @@ -1,5 +1,5 @@
    41.4  /*
    41.5 - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    41.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
    41.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    41.8   *
    41.9   * This code is free software; you can redistribute it and/or modify it
   41.10 @@ -342,12 +342,35 @@
   41.11      // already been created with the given name it is returned.
   41.12      // Otherwise a new logger instance is created and registered
   41.13      // in the LogManager global namespace.
   41.14 +
   41.15 +    // This method will always return a non-null Logger object.
   41.16 +    // Synchronization is not required here. All synchronization for
   41.17 +    // adding a new Logger object is handled by addLogger().
   41.18      Logger demandLogger(String name) {
   41.19          Logger result = getLogger(name);
   41.20          if (result == null) {
   41.21 -            result = new Logger(name, null);
   41.22 -            addLogger(result);
   41.23 -            result = getLogger(name);
   41.24 +            // only allocate the new logger once
   41.25 +            Logger newLogger = new Logger(name, null);
   41.26 +            do {
   41.27 +                if (addLogger(newLogger)) {
   41.28 +                    // We successfully added the new Logger that we
   41.29 +                    // created above so return it without refetching.
   41.30 +                    return newLogger;
   41.31 +                }
   41.32 +
   41.33 +                // We didn't add the new Logger that we created above
   41.34 +                // because another thread added a Logger with the same
   41.35 +                // name after our null check above and before our call
   41.36 +                // to addLogger(). We have to refetch the Logger because
   41.37 +                // addLogger() returns a boolean instead of the Logger
   41.38 +                // reference itself. However, if the thread that created
   41.39 +                // the other Logger is not holding a strong reference to
   41.40 +                // the other Logger, then it is possible for the other
   41.41 +                // Logger to be GC'ed after we saw it in addLogger() and
   41.42 +                // before we can refetch it. If it has been GC'ed then
   41.43 +                // we'll just loop around and try again.
   41.44 +                result = getLogger(name);
   41.45 +            } while (result == null);
   41.46          }
   41.47          return result;
   41.48      }
    42.1 --- a/src/share/classes/java/util/logging/Logger.java	Wed May 18 16:32:05 2011 -0700
    42.2 +++ b/src/share/classes/java/util/logging/Logger.java	Wed May 18 18:18:04 2011 -0700
    42.3 @@ -310,7 +310,20 @@
    42.4       * @return a suitable Logger
    42.5       * @throws NullPointerException if the name is null.
    42.6       */
    42.7 -    public static synchronized Logger getLogger(String name) {
    42.8 +
    42.9 +    // Synchronization is not required here. All synchronization for
   42.10 +    // adding a new Logger object is handled by LogManager.addLogger().
   42.11 +    public static Logger getLogger(String name) {
   42.12 +        // This method is intentionally not a wrapper around a call
   42.13 +        // to getLogger(name, resourceBundleName). If it were then
   42.14 +        // this sequence:
   42.15 +        //
   42.16 +        //     getLogger("Foo", "resourceBundleForFoo");
   42.17 +        //     getLogger("Foo");
   42.18 +        //
   42.19 +        // would throw an IllegalArgumentException in the second call
   42.20 +        // because the wrapper would result in an attempt to replace
   42.21 +        // the existing "resourceBundleForFoo" with null.
   42.22          LogManager manager = LogManager.getLogManager();
   42.23          return manager.demandLogger(name);
   42.24      }
   42.25 @@ -355,7 +368,10 @@
   42.26       *             a different resource bundle name.
   42.27       * @throws NullPointerException if the name is null.
   42.28       */
   42.29 -    public static synchronized Logger getLogger(String name, String resourceBundleName) {
   42.30 +
   42.31 +    // Synchronization is not required here. All synchronization for
   42.32 +    // adding a new Logger object is handled by LogManager.addLogger().
   42.33 +    public static Logger getLogger(String name, String resourceBundleName) {
   42.34          LogManager manager = LogManager.getLogManager();
   42.35          Logger result = manager.demandLogger(name);
   42.36          if (result.resourceBundleName == null) {
   42.37 @@ -417,7 +433,10 @@
   42.38       * @throws MissingResourceException if the resourceBundleName is non-null and
   42.39       *             no corresponding resource can be found.
   42.40       */
   42.41 -    public static synchronized Logger getAnonymousLogger(String resourceBundleName) {
   42.42 +
   42.43 +    // Synchronization is not required here. All synchronization for
   42.44 +    // adding a new anonymous Logger object is handled by doSetParent().
   42.45 +    public static Logger getAnonymousLogger(String resourceBundleName) {
   42.46          LogManager manager = LogManager.getLogManager();
   42.47          // cleanup some Loggers that have been GC'ed
   42.48          manager.drainLoggerRefQueueBounded();
    43.1 --- a/src/share/classes/java/util/regex/Pattern.java	Wed May 18 16:32:05 2011 -0700
    43.2 +++ b/src/share/classes/java/util/regex/Pattern.java	Wed May 18 18:18:04 2011 -0700
    43.3 @@ -213,7 +213,7 @@
    43.4   *     <td headers="matches">A character in the Greek&nbsp;block (<a href="#ubc">block</a>)</td></tr>
    43.5   * <tr><td valign="top" headers="construct unicode"><tt>\p{Lu}</tt></td>
    43.6   *     <td headers="matches">An uppercase letter (<a href="#ucc">category</a>)</td></tr>
    43.7 - * <tr><td valign="top" headers="construct unicode"><tt>\p{isAlphabetic}</tt></td>
    43.8 + * <tr><td valign="top" headers="construct unicode"><tt>\p{IsAlphabetic}</tt></td>
    43.9   *     <td headers="matches">An alphabetic character (<a href="#ubpc">binary property</a>)</td></tr>
   43.10   * <tr><td valign="top" headers="construct unicode"><tt>\p{Sc}</tt></td>
   43.11   *     <td headers="matches">A currency symbol</td></tr>
    44.1 --- a/src/share/classes/java/util/zip/ZipCoder.java	Wed May 18 16:32:05 2011 -0700
    44.2 +++ b/src/share/classes/java/util/zip/ZipCoder.java	Wed May 18 18:18:04 2011 -0700
    44.3 @@ -28,7 +28,7 @@
    44.4  import java.nio.ByteBuffer;
    44.5  import java.nio.CharBuffer;
    44.6  import java.nio.charset.Charset;
    44.7 -import java.nio.charset.StandardCharset;
    44.8 +import java.nio.charset.StandardCharsets;
    44.9  import java.nio.charset.CharsetDecoder;
   44.10  import java.nio.charset.CharsetEncoder;
   44.11  import java.nio.charset.CoderResult;
   44.12 @@ -107,7 +107,7 @@
   44.13          if (isUTF8)
   44.14              return getBytes(s);
   44.15          if (utf8 == null)
   44.16 -            utf8 = new ZipCoder(StandardCharset.UTF_8);
   44.17 +            utf8 = new ZipCoder(StandardCharsets.UTF_8);
   44.18          return utf8.getBytes(s);
   44.19      }
   44.20  
   44.21 @@ -116,7 +116,7 @@
   44.22          if (isUTF8)
   44.23              return toString(ba, len);
   44.24          if (utf8 == null)
   44.25 -            utf8 = new ZipCoder(StandardCharset.UTF_8);
   44.26 +            utf8 = new ZipCoder(StandardCharsets.UTF_8);
   44.27          return utf8.toString(ba, len);
   44.28      }
   44.29  
   44.30 @@ -132,7 +132,7 @@
   44.31  
   44.32      private ZipCoder(Charset cs) {
   44.33          this.cs = cs;
   44.34 -        this.isUTF8 = cs.name().equals(StandardCharset.UTF_8.name());
   44.35 +        this.isUTF8 = cs.name().equals(StandardCharsets.UTF_8.name());
   44.36      }
   44.37  
   44.38      static ZipCoder get(Charset charset) {
    45.1 --- a/src/share/classes/java/util/zip/ZipFile.java	Wed May 18 16:32:05 2011 -0700
    45.2 +++ b/src/share/classes/java/util/zip/ZipFile.java	Wed May 18 18:18:04 2011 -0700
    45.3 @@ -31,7 +31,7 @@
    45.4  import java.io.EOFException;
    45.5  import java.io.File;
    45.6  import java.nio.charset.Charset;
    45.7 -import java.nio.charset.StandardCharset;
    45.8 +import java.nio.charset.StandardCharsets;
    45.9  import java.util.ArrayDeque;
   45.10  import java.util.Deque;
   45.11  import java.util.Enumeration;
   45.12 @@ -141,7 +141,7 @@
   45.13       * @since 1.3
   45.14       */
   45.15      public ZipFile(File file, int mode) throws IOException {
   45.16 -        this(file, mode, StandardCharset.UTF_8);
   45.17 +        this(file, mode, StandardCharsets.UTF_8);
   45.18      }
   45.19  
   45.20      /**
    46.1 --- a/src/share/classes/java/util/zip/ZipInputStream.java	Wed May 18 16:32:05 2011 -0700
    46.2 +++ b/src/share/classes/java/util/zip/ZipInputStream.java	Wed May 18 18:18:04 2011 -0700
    46.3 @@ -30,7 +30,7 @@
    46.4  import java.io.EOFException;
    46.5  import java.io.PushbackInputStream;
    46.6  import java.nio.charset.Charset;
    46.7 -import java.nio.charset.StandardCharset;
    46.8 +import java.nio.charset.StandardCharsets;
    46.9  import static java.util.zip.ZipConstants64.*;
   46.10  
   46.11  /**
   46.12 @@ -76,7 +76,7 @@
   46.13       * @param in the actual input stream
   46.14       */
   46.15      public ZipInputStream(InputStream in) {
   46.16 -        this(in, StandardCharset.UTF_8);
   46.17 +        this(in, StandardCharsets.UTF_8);
   46.18      }
   46.19  
   46.20      /**
    47.1 --- a/src/share/classes/java/util/zip/ZipOutputStream.java	Wed May 18 16:32:05 2011 -0700
    47.2 +++ b/src/share/classes/java/util/zip/ZipOutputStream.java	Wed May 18 18:18:04 2011 -0700
    47.3 @@ -28,7 +28,7 @@
    47.4  import java.io.OutputStream;
    47.5  import java.io.IOException;
    47.6  import java.nio.charset.Charset;
    47.7 -import java.nio.charset.StandardCharset;
    47.8 +import java.nio.charset.StandardCharsets;
    47.9  import java.util.Vector;
   47.10  import java.util.HashSet;
   47.11  import static java.util.zip.ZipConstants64.*;
   47.12 @@ -101,7 +101,7 @@
   47.13       * @param out the actual output stream
   47.14       */
   47.15      public ZipOutputStream(OutputStream out) {
   47.16 -        this(out, StandardCharset.UTF_8);
   47.17 +        this(out, StandardCharsets.UTF_8);
   47.18      }
   47.19  
   47.20      /**
    48.1 --- a/src/share/classes/javax/imageio/metadata/doc-files/jpeg_metadata.html	Wed May 18 16:32:05 2011 -0700
    48.2 +++ b/src/share/classes/javax/imageio/metadata/doc-files/jpeg_metadata.html	Wed May 18 18:18:04 2011 -0700
    48.3 @@ -211,6 +211,20 @@
    48.4  
    48.5  <p>
    48.6  
    48.7 +<a name=optcolor><b>Optional ColorSpace support:</b></a>
    48.8 +Handling of PhotoYCC (YCC), PhotoYCCA (YCCA), RGBA and YCbCrA color spaces
    48.9 +by the standard plugin, as described below, is dependent on capabilities
   48.10 +of the libraries used to interpret the JPEG data. Thus all consequential
   48.11 +behaviors are optional. If the support is not available when decoding,
   48.12 +the color space will be treated as unrecognized and the appropriate
   48.13 +default color space for the specified number of component channels
   48.14 +may be used.
   48.15 +When writing, an Exception may be thrown if no suitable conversion
   48.16 +can be applied before encoding.
   48.17 +But where the support for these color spaces is available, the behavior
   48.18 +must be as documented. 
   48.19 +<p>
   48.20 +
   48.21  When reading, the contents of the stream are interpreted by the usual
   48.22  JPEG conventions, as follows:
   48.23  
   48.24 @@ -241,8 +255,11 @@
   48.25         2-channel images are assumed to be grayscale with an alpha channel.
   48.26         For 3- and 4-channel images, the component ids are consulted.  If these
   48.27         values are 1-3 for a 3-channel image, then the image is assumed to be
   48.28 -       YCbCr. If these values are 1-4 for a 4-channel image, then the image 
   48.29 -       is assumed to be YCbCrA.  If these values are > 4, they are checked 
   48.30 +       YCbCr. Subject to the availability of the
   48.31 +       <a href=#optcolor>optional color space support</a>
   48.32 +       described above, if these values are 1-4 for a 4-channel image,
   48.33 +       then the image is assumed to be YCbCrA. 
   48.34 +       If these values are > 4, they are checked 
   48.35         against the ASCII codes for 'R', 'G', 'B', 'A', 'C', 'c'.  These can 
   48.36         encode the following colorspaces:
   48.37         <p>
   48.38 @@ -346,12 +363,16 @@
   48.39         component ids in the frame and scan headers are set to 1, 2, and 3.
   48.40  
   48.41  
   48.42 -  <li> RGBA images are converted to YCbCrA, subsampled in the
   48.43 +  <li> Subject to the <a href=#optcolor>optional library support</a>
   48.44 +        described above,
   48.45 +       RGBA images are converted to YCbCrA, subsampled in the
   48.46         chrominance channels by half both vertically and horizontally, and
   48.47         written without any special marker segments.  The component ids 
   48.48         in the frame and scan headers are set to 1, 2, 3, and 4.
   48.49  
   48.50 -  <li> PhotoYCC and YCCAimages are subsampled by half in the chrominance
   48.51 +  <li> Subject to the <a href=#optcolor>optional library support</a>
   48.52 +       described above,
   48.53 +       PhotoYCC and YCCAimages are subsampled by half in the chrominance
   48.54         channels both vertically and horizontally and written with an
   48.55         Adobe <code>APP14</code> marker segment and 'Y','C', and 'c' (and
   48.56         'A' if an alpha channel is present) as component ids in the frame
   48.57 @@ -433,6 +454,8 @@
   48.58      </ul>
   48.59  
   48.60    <li> RGBA images:
   48.61 +       Subject to the <a href=#optcolor>optional library support</a>
   48.62 +       described above,
   48.63      <ul>
   48.64        <li> If an <code>app0JFIF</code> node is present in the metadata object,
   48.65             it is ignored and a warning is sent to listeners, as JFIF does not
   48.66 @@ -456,6 +479,8 @@
   48.67      </ul>
   48.68  
   48.69    <li> PhotoYCC Images:
   48.70 +       Subject to the <a href=#optcolor>optional library support</a>
   48.71 +       described above,
   48.72      <ul>
   48.73        <li> If an <code>app0JFIF</code> node is present in the metadata object,
   48.74             the image is converted to sRGB, and then to YCbCr during encoding,
   48.75 @@ -471,6 +496,8 @@
   48.76      </ul>
   48.77  
   48.78    <li> PhotoYCCA Images:
   48.79 +       Subject to the <a href=#optcolor>optional library support</a>
   48.80 +       described above,
   48.81      <ul>
   48.82        <li> If an <code>app0JFIF</code> node is present in the metadata object,
   48.83             it is ignored and a warning is sent to listeners, as JFIF does not
    49.1 --- a/src/share/classes/javax/management/loading/package.html	Wed May 18 16:32:05 2011 -0700
    49.2 +++ b/src/share/classes/javax/management/loading/package.html	Wed May 18 18:18:04 2011 -0700
    49.3 @@ -2,7 +2,7 @@
    49.4  <head>
    49.5  <title>javax.management.loading package</title>
    49.6  <!--
    49.7 -Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
    49.8 +Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    49.9  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   49.10  
   49.11  This code is free software; you can redistribute it and/or modify it
   49.12 @@ -68,7 +68,7 @@
   49.13  
   49.14      <p id="spec">
   49.15      @see <a href="{@docRoot}/../technotes/guides/jmx/">
   49.16 -      Java SE 6 Platform documentation on JMX technology</a>,
   49.17 +      Java Platform documentation on JMX technology</a>,
   49.18      in particular the 
   49.19      <a href="{@docRoot}/../technotes/guides/jmx/JMX_1_4_specification.pdf">
   49.20        JMX Specification, version 1.4(pdf).</a>
    50.1 --- a/src/share/classes/javax/management/modelmbean/package.html	Wed May 18 16:32:05 2011 -0700
    50.2 +++ b/src/share/classes/javax/management/modelmbean/package.html	Wed May 18 18:18:04 2011 -0700
    50.3 @@ -2,7 +2,7 @@
    50.4  <head>
    50.5  <title>javax.management.modelmbean package</title>
    50.6  <!--
    50.7 -Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
    50.8 +Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
    50.9  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   50.10  
   50.11  This code is free software; you can redistribute it and/or modify it
   50.12 @@ -116,7 +116,7 @@
   50.13  	  <li>See the <i>JMX 1.4 Specification</i>
   50.14  	     PDF document available from the 
   50.15  	     <a href="{@docRoot}/../technotes/guides/jmx/">
   50.16 -	     Java SE 6 Platform documentation on JMX</a>
   50.17 +	     Java Platform documentation on JMX technology</a>
   50.18      </ul>
   50.19  
   50.20      @since 1.5
    51.1 --- a/src/share/classes/javax/management/monitor/package.html	Wed May 18 16:32:05 2011 -0700
    51.2 +++ b/src/share/classes/javax/management/monitor/package.html	Wed May 18 18:18:04 2011 -0700
    51.3 @@ -2,7 +2,7 @@
    51.4  <head>
    51.5  <title>javax.management.monitor package</title>
    51.6  <!--
    51.7 -Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
    51.8 +Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    51.9  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   51.10  
   51.11  This code is free software; you can redistribute it and/or modify it
   51.12 @@ -184,7 +184,7 @@
   51.13        </ul>
   51.14      <p id="spec">
   51.15      @see <a href="{@docRoot}/../technotes/guides/jmx/">
   51.16 -      Java SE 6 Platform documentation on JMX technology</a>,
   51.17 +      Java Platform documentation on JMX technology</a>,
   51.18      in particular the 
   51.19      <a href="{@docRoot}/../technotes/guides/jmx/JMX_1_4_specification.pdf">
   51.20        JMX Specification, version 1.4(pdf).</a>
    52.1 --- a/src/share/classes/javax/management/openmbean/package.html	Wed May 18 16:32:05 2011 -0700
    52.2 +++ b/src/share/classes/javax/management/openmbean/package.html	Wed May 18 18:18:04 2011 -0700
    52.3 @@ -2,7 +2,7 @@
    52.4  <head>
    52.5  <title>javax.management.openmbean package</title>
    52.6  <!--
    52.7 -Copyright (c) 2001, 2007, Oracle and/or its affiliates. All rights reserved.
    52.8 +Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
    52.9  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   52.10  
   52.11  This code is free software; you can redistribute it and/or modify it
   52.12 @@ -143,7 +143,7 @@
   52.13      </ul>
   52.14  
   52.15      @see <a href="{@docRoot}/../technotes/guides/jmx/">
   52.16 -      Java SE 6 Platform documentation on JMX technology</a>,
   52.17 +      Java Platform documentation on JMX technology</a>,
   52.18      in particular the 
   52.19      <a href="{@docRoot}/../technotes/guides/jmx/JMX_1_4_specification.pdf">
   52.20        JMX Specification, version 1.4</a>
    53.1 --- a/src/share/classes/javax/management/package.html	Wed May 18 16:32:05 2011 -0700
    53.2 +++ b/src/share/classes/javax/management/package.html	Wed May 18 18:18:04 2011 -0700
    53.3 @@ -2,7 +2,7 @@
    53.4      <head>
    53.5          <title>javax.management package</title>
    53.6          <!--
    53.7 -Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
    53.8 +Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    53.9  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   53.10  
   53.11  This code is free software; you can redistribute it and/or modify it
   53.12 @@ -391,7 +391,7 @@
   53.13  
   53.14          <p id="spec">
   53.15          @see <a href="{@docRoot}/../technotes/guides/jmx/index.html">
   53.16 -        Java SE 6 Platform documentation on JMX technology</a>
   53.17 +        Java Platform documentation on JMX technology</a>
   53.18          in particular the
   53.19          <a href="{@docRoot}/../technotes/guides/jmx/JMX_1_4_specification.pdf">
   53.20          JMX Specification, version 1.4(pdf).</a>
    54.1 --- a/src/share/classes/javax/management/relation/package.html	Wed May 18 16:32:05 2011 -0700
    54.2 +++ b/src/share/classes/javax/management/relation/package.html	Wed May 18 18:18:04 2011 -0700
    54.3 @@ -2,7 +2,7 @@
    54.4  <head>
    54.5  <title>javax.management.relation package</title>
    54.6  <!--
    54.7 -Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
    54.8 +Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
    54.9  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   54.10  
   54.11  This code is free software; you can redistribute it and/or modify it
   54.12 @@ -137,7 +137,7 @@
   54.13  </pre>
   54.14  
   54.15      @see <a href="{@docRoot}/../technotes/guides/jmx/">
   54.16 -      Java SE 6 Platform documentation on JMX technology</a>,
   54.17 +      Java Platform documentation on JMX technology</a>,
   54.18      in particular the 
   54.19      <a href="{@docRoot}/../technotes/guides/jmx/JMX_1_4_specification.pdf">
   54.20        JMX Specification, version 1.4</a>
    55.1 --- a/src/share/classes/javax/management/remote/package.html	Wed May 18 16:32:05 2011 -0700
    55.2 +++ b/src/share/classes/javax/management/remote/package.html	Wed May 18 18:18:04 2011 -0700
    55.3 @@ -2,7 +2,7 @@
    55.4  <head>
    55.5      <title>JMX<sup><font size="-2">TM</font></sup> Remote API.</title>
    55.6  <!--
    55.7 -Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
    55.8 +Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
    55.9  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   55.10  
   55.11  This code is free software; you can redistribute it and/or modify it
   55.12 @@ -195,7 +195,7 @@
   55.13  
   55.14  
   55.15      @see <a href="{@docRoot}/../technotes/guides/jmx/">
   55.16 -      Java SE 6 Platform documentation on JMX technology</a>,
   55.17 +      Java Platform documentation on JMX technology</a>,
   55.18      in particular the 
   55.19      <a href="{@docRoot}/../technotes/guides/jmx/JMX_1_4_specification.pdf">
   55.20        JMX Specification, version 1.4</a>
    56.1 --- a/src/share/classes/javax/management/timer/Timer.java	Wed May 18 16:32:05 2011 -0700
    56.2 +++ b/src/share/classes/javax/management/timer/Timer.java	Wed May 18 18:18:04 2011 -0700
    56.3 @@ -26,6 +26,7 @@
    56.4  package javax.management.timer;
    56.5  
    56.6  import static com.sun.jmx.defaults.JmxProperties.TIMER_LOGGER;
    56.7 +import java.util.ArrayList;
    56.8  import java.util.Date;
    56.9  import java.util.Hashtable;
   56.10  import java.util.Iterator;
   56.11 @@ -1003,7 +1004,10 @@
   56.12          Integer notifID;
   56.13          Date date;
   56.14  
   56.15 -        for (Object[] obj : timerTable.values()) {
   56.16 +        ArrayList<Object[]> values =
   56.17 +            new ArrayList<Object[]>(timerTable.values());
   56.18 +
   56.19 +        for (Object[] obj : values) {
   56.20  
   56.21              // Retrieve the timer notification and the date notification.
   56.22              //
    57.1 --- a/src/share/classes/javax/swing/ComboBoxModel.java	Wed May 18 16:32:05 2011 -0700
    57.2 +++ b/src/share/classes/javax/swing/ComboBoxModel.java	Wed May 18 18:18:04 2011 -0700
    57.3 @@ -33,9 +33,11 @@
    57.4   * <code>ListModel</code>. This disjoint behavior allows for the temporary
    57.5   * storage and retrieval of a selected item in the model.
    57.6   *
    57.7 + * @param <E> the type of the elements of this model
    57.8 + *
    57.9   * @author Arnaud Weber
   57.10   */
   57.11 -public interface ComboBoxModel extends ListModel {
   57.12 +public interface ComboBoxModel<E> extends ListModel<E> {
   57.13  
   57.14    /**
   57.15     * Set the selected item. The implementation of this  method should notify
    58.1 --- a/src/share/classes/javax/swing/DefaultComboBoxModel.java	Wed May 18 16:32:05 2011 -0700
    58.2 +++ b/src/share/classes/javax/swing/DefaultComboBoxModel.java	Wed May 18 18:18:04 2011 -0700
    58.3 @@ -24,39 +24,28 @@
    58.4   */
    58.5  package javax.swing;
    58.6  
    58.7 -import java.beans.*;
    58.8  import java.util.*;
    58.9  
   58.10 -import java.awt.*;
   58.11 -import java.awt.event.*;
   58.12 -
   58.13  import java.io.Serializable;
   58.14 -import java.io.ObjectOutputStream;
   58.15 -import java.io.ObjectInputStream;
   58.16 -import java.io.IOException;
   58.17 -
   58.18 -import javax.swing.event.*;
   58.19 -import javax.swing.plaf.*;
   58.20 -import javax.swing.border.*;
   58.21 -
   58.22 -import javax.accessibility.*;
   58.23  
   58.24  /**
   58.25   * The default model for combo boxes.
   58.26   *
   58.27 + * @param <E> the type of the elements of this model
   58.28 + *
   58.29   * @author Arnaud Weber
   58.30   * @author Tom Santos
   58.31   */
   58.32  
   58.33 -public class DefaultComboBoxModel extends AbstractListModel implements MutableComboBoxModel, Serializable {
   58.34 -    Vector objects;
   58.35 +public class DefaultComboBoxModel<E> extends AbstractListModel<E> implements MutableComboBoxModel<E>, Serializable {
   58.36 +    Vector<E> objects;
   58.37      Object selectedObject;
   58.38  
   58.39      /**
   58.40       * Constructs an empty DefaultComboBoxModel object.
   58.41       */
   58.42      public DefaultComboBoxModel() {
   58.43 -        objects = new Vector();
   58.44 +        objects = new Vector<E>();
   58.45      }
   58.46  
   58.47      /**
   58.48 @@ -65,8 +54,8 @@
   58.49       *
   58.50       * @param items  an array of Object objects
   58.51       */
   58.52 -    public DefaultComboBoxModel(final Object items[]) {
   58.53 -        objects = new Vector();
   58.54 +    public DefaultComboBoxModel(final E items[]) {
   58.55 +        objects = new Vector<E>();
   58.56          objects.ensureCapacity( items.length );
   58.57  
   58.58          int i,c;
   58.59 @@ -84,7 +73,7 @@
   58.60       *
   58.61       * @param v  a Vector object ...
   58.62       */
   58.63 -    public DefaultComboBoxModel(Vector<?> v) {
   58.64 +    public DefaultComboBoxModel(Vector<E> v) {
   58.65          objects = v;
   58.66  
   58.67          if ( getSize() > 0 ) {
   58.68 @@ -117,7 +106,7 @@
   58.69      }
   58.70  
   58.71      // implements javax.swing.ListModel
   58.72 -    public Object getElementAt(int index) {
   58.73 +    public E getElementAt(int index) {
   58.74          if ( index >= 0 && index < objects.size() )
   58.75              return objects.elementAt(index);
   58.76          else
   58.77 @@ -136,7 +125,7 @@
   58.78      }
   58.79  
   58.80      // implements javax.swing.MutableComboBoxModel
   58.81 -    public void addElement(Object anObject) {
   58.82 +    public void addElement(E anObject) {
   58.83          objects.addElement(anObject);
   58.84          fireIntervalAdded(this,objects.size()-1, objects.size()-1);
   58.85          if ( objects.size() == 1 && selectedObject == null && anObject != null ) {
   58.86 @@ -145,7 +134,7 @@
   58.87      }
   58.88  
   58.89      // implements javax.swing.MutableComboBoxModel
   58.90 -    public void insertElementAt(Object anObject,int index) {
   58.91 +    public void insertElementAt(E anObject,int index) {
   58.92          objects.insertElementAt(anObject,index);
   58.93          fireIntervalAdded(this, index, index);
   58.94      }
    59.1 --- a/src/share/classes/javax/swing/JComboBox.java	Wed May 18 16:32:05 2011 -0700
    59.2 +++ b/src/share/classes/javax/swing/JComboBox.java	Wed May 18 18:18:04 2011 -0700
    59.3 @@ -69,6 +69,8 @@
    59.4   * @see ComboBoxModel
    59.5   * @see DefaultComboBoxModel
    59.6   *
    59.7 + * @param <E> the type of the elements of this combo box
    59.8 + *
    59.9   * @beaninfo
   59.10   *   attribute: isContainer false
   59.11   * description: A combination of a text field and a drop-down list.
   59.12 @@ -76,7 +78,7 @@
   59.13   * @author Arnaud Weber
   59.14   * @author Mark Davidson
   59.15   */
   59.16 -public class JComboBox extends JComponent
   59.17 +public class JComboBox<E> extends JComponent
   59.18  implements ItemSelectable,ListDataListener,ActionListener, Accessible {
   59.19      /**
   59.20       * @see #getUIClassID
   59.21 @@ -91,7 +93,7 @@
   59.22       * @see #getModel
   59.23       * @see #setModel
   59.24       */
   59.25 -    protected ComboBoxModel    dataModel;
   59.26 +    protected ComboBoxModel<E>    dataModel;
   59.27      /**
   59.28       * This protected field is implementation specific. Do not access directly
   59.29       * or override. Use the accessor methods instead.
   59.30 @@ -99,7 +101,7 @@
   59.31       * @see #getRenderer
   59.32       * @see #setRenderer
   59.33       */
   59.34 -    protected ListCellRenderer renderer;
   59.35 +    protected ListCellRenderer<? super E> renderer;
   59.36      /**
   59.37       * This protected field is implementation specific. Do not access directly
   59.38       * or override. Use the accessor methods instead.
   59.39 @@ -156,7 +158,7 @@
   59.40       */
   59.41      protected Object selectedItemReminder = null;
   59.42  
   59.43 -    private Object prototypeDisplayValue;
   59.44 +    private E prototypeDisplayValue;
   59.45  
   59.46      // Flag to ensure that infinite loops do not occur with ActionEvents.
   59.47      private boolean firingActionEvent = false;
   59.48 @@ -175,7 +177,7 @@
   59.49       *          displayed list of items
   59.50       * @see DefaultComboBoxModel
   59.51       */
   59.52 -    public JComboBox(ComboBoxModel aModel) {
   59.53 +    public JComboBox(ComboBoxModel<E> aModel) {
   59.54          super();
   59.55          setModel(aModel);
   59.56          init();
   59.57 @@ -189,9 +191,9 @@
   59.58       * @param items  an array of objects to insert into the combo box
   59.59       * @see DefaultComboBoxModel
   59.60       */
   59.61 -    public JComboBox(final Object items[]) {
   59.62 +    public JComboBox(E[] items) {
   59.63          super();
   59.64 -        setModel(new DefaultComboBoxModel(items));
   59.65 +        setModel(new DefaultComboBoxModel<E>(items));
   59.66          init();
   59.67      }
   59.68  
   59.69 @@ -203,9 +205,9 @@
   59.70       * @param items  an array of vectors to insert into the combo box
   59.71       * @see DefaultComboBoxModel
   59.72       */
   59.73 -    public JComboBox(Vector<?> items) {
   59.74 +    public JComboBox(Vector<E> items) {
   59.75          super();
   59.76 -        setModel(new DefaultComboBoxModel(items));
   59.77 +        setModel(new DefaultComboBoxModel<E>(items));
   59.78          init();
   59.79      }
   59.80  
   59.81 @@ -219,7 +221,7 @@
   59.82       */
   59.83      public JComboBox() {
   59.84          super();
   59.85 -        setModel(new DefaultComboBoxModel());
   59.86 +        setModel(new DefaultComboBoxModel<E>());
   59.87          init();
   59.88      }
   59.89  
   59.90 @@ -263,7 +265,7 @@
   59.91      public void updateUI() {
   59.92          setUI((ComboBoxUI)UIManager.getUI(this));
   59.93  
   59.94 -        ListCellRenderer renderer = getRenderer();
   59.95 +        ListCellRenderer<? super E> renderer = getRenderer();
   59.96          if (renderer instanceof Component) {
   59.97              SwingUtilities.updateComponentTreeUI((Component)renderer);
   59.98          }
   59.99 @@ -302,8 +304,8 @@
  59.100       *        bound: true
  59.101       *  description: Model that the combo box uses to get data to display.
  59.102       */
  59.103 -    public void setModel(ComboBoxModel aModel) {
  59.104 -        ComboBoxModel oldModel = dataModel;
  59.105 +    public void setModel(ComboBoxModel<E> aModel) {
  59.106 +        ComboBoxModel<E> oldModel = dataModel;
  59.107          if (oldModel != null) {
  59.108              oldModel.removeListDataListener(this);
  59.109          }
  59.110 @@ -322,7 +324,7 @@
  59.111       * @return the <code>ComboBoxModel</code> that provides the displayed
  59.112       *                  list of items
  59.113       */
  59.114 -    public ComboBoxModel getModel() {
  59.115 +    public ComboBoxModel<E> getModel() {
  59.116          return dataModel;
  59.117      }
  59.118  
  59.119 @@ -461,8 +463,8 @@
  59.120       *     expert: true
  59.121       *  description: The renderer that paints the item selected in the list.
  59.122       */
  59.123 -    public void setRenderer(ListCellRenderer aRenderer) {
  59.124 -        ListCellRenderer oldRenderer = renderer;
  59.125 +    public void setRenderer(ListCellRenderer<? super E> aRenderer) {
  59.126 +        ListCellRenderer<? super E> oldRenderer = renderer;
  59.127          renderer = aRenderer;
  59.128          firePropertyChange( "renderer", oldRenderer, renderer );
  59.129          invalidate();
  59.130 @@ -475,7 +477,7 @@
  59.131       * @return  the <code>ListCellRenderer</code> that displays
  59.132       *                  the selected item.
  59.133       */
  59.134 -    public ListCellRenderer getRenderer() {
  59.135 +    public ListCellRenderer<? super E> getRenderer() {
  59.136          return renderer;
  59.137      }
  59.138  
  59.139 @@ -558,7 +560,7 @@
  59.140                  // will be rejected.
  59.141                  boolean found = false;
  59.142                  for (int i = 0; i < dataModel.getSize(); i++) {
  59.143 -                    Object element = dataModel.getElementAt(i);
  59.144 +                    E element = dataModel.getElementAt(i);
  59.145                      if (anObject.equals(element)) {
  59.146                          found = true;
  59.147                          objectToSelect = element;
  59.148 @@ -640,7 +642,7 @@
  59.149      public int getSelectedIndex() {
  59.150          Object sObject = dataModel.getSelectedItem();
  59.151          int i,c;
  59.152 -        Object obj;
  59.153 +        E obj;
  59.154  
  59.155          for ( i=0,c=dataModel.getSize();i<c;i++ ) {
  59.156              obj = dataModel.getElementAt(i);
  59.157 @@ -658,7 +660,7 @@
  59.158       * @see #setPrototypeDisplayValue
  59.159       * @since 1.4
  59.160       */
  59.161 -    public Object getPrototypeDisplayValue() {
  59.162 +    public E getPrototypeDisplayValue() {
  59.163          return prototypeDisplayValue;
  59.164      }
  59.165  
  59.166 @@ -683,7 +685,7 @@
  59.167       *   attribute: visualUpdate true
  59.168       * description: The display prototype value, used to compute display width and height.
  59.169       */
  59.170 -    public void setPrototypeDisplayValue(Object prototypeDisplayValue) {
  59.171 +    public void setPrototypeDisplayValue(E prototypeDisplayValue) {
  59.172          Object oldValue = this.prototypeDisplayValue;
  59.173          this.prototypeDisplayValue = prototypeDisplayValue;
  59.174          firePropertyChange("prototypeDisplayValue", oldValue, prototypeDisplayValue);
  59.175 @@ -708,12 +710,12 @@
  59.176       *   }
  59.177       * </pre>
  59.178       *
  59.179 -     * @param anObject the Object to add to the list
  59.180 +     * @param item the item to add to the list
  59.181       * @see MutableComboBoxModel
  59.182       */
  59.183 -    public void addItem(Object anObject) {
  59.184 +    public void addItem(E item) {
  59.185          checkMutableComboBoxModel();
  59.186 -        ((MutableComboBoxModel)dataModel).addElement(anObject);
  59.187 +        ((MutableComboBoxModel<E>)dataModel).addElement(item);
  59.188      }
  59.189  
  59.190      /**
  59.191 @@ -721,14 +723,14 @@
  59.192       * This method works only if the <code>JComboBox</code> uses a
  59.193       * mutable data model.
  59.194       *
  59.195 -     * @param anObject the <code>Object</code> to add to the list
  59.196 +     * @param item the item to add to the list
  59.197       * @param index    an integer specifying the position at which
  59.198       *                  to add the item
  59.199       * @see MutableComboBoxModel
  59.200       */
  59.201 -    public void insertItemAt(Object anObject, int index) {
  59.202 +    public void insertItemAt(E item, int index) {
  59.203          checkMutableComboBoxModel();
  59.204 -        ((MutableComboBoxModel)dataModel).insertElementAt(anObject,index);
  59.205 +        ((MutableComboBoxModel<E>)dataModel).insertElementAt(item,index);
  59.206      }
  59.207  
  59.208      /**
  59.209 @@ -756,7 +758,7 @@
  59.210       */
  59.211      public void removeItemAt(int anIndex) {
  59.212          checkMutableComboBoxModel();
  59.213 -        ((MutableComboBoxModel)dataModel).removeElementAt( anIndex );
  59.214 +        ((MutableComboBoxModel<E>)dataModel).removeElementAt( anIndex );
  59.215      }
  59.216  
  59.217      /**
  59.218 @@ -764,7 +766,7 @@
  59.219       */
  59.220      public void removeAllItems() {
  59.221          checkMutableComboBoxModel();
  59.222 -        MutableComboBoxModel model = (MutableComboBoxModel)dataModel;
  59.223 +        MutableComboBoxModel<E> model = (MutableComboBoxModel<E>)dataModel;
  59.224          int size = model.getSize();
  59.225  
  59.226          if ( model instanceof DefaultComboBoxModel ) {
  59.227 @@ -772,7 +774,7 @@
  59.228          }
  59.229          else {
  59.230              for ( int i = 0; i < size; ++i ) {
  59.231 -                Object element = model.getElementAt( 0 );
  59.232 +                E element = model.getElementAt( 0 );
  59.233                  model.removeElement( element );
  59.234              }
  59.235          }
  59.236 @@ -1188,11 +1190,11 @@
  59.237  
  59.238  
  59.239      private static class ComboBoxActionPropertyChangeListener
  59.240 -                 extends ActionPropertyChangeListener<JComboBox> {
  59.241 -        ComboBoxActionPropertyChangeListener(JComboBox b, Action a) {
  59.242 +                 extends ActionPropertyChangeListener<JComboBox<?>> {
  59.243 +        ComboBoxActionPropertyChangeListener(JComboBox<?> b, Action a) {
  59.244              super(b, a);
  59.245          }
  59.246 -        protected void actionPropertyChanged(JComboBox cb,
  59.247 +        protected void actionPropertyChanged(JComboBox<?> cb,
  59.248                                               Action action,
  59.249                                               PropertyChangeEvent e) {
  59.250              if (AbstractAction.shouldReconfigure(e)) {
  59.251 @@ -1454,10 +1456,10 @@
  59.252       *
  59.253       * @param index  an integer indicating the list position, where the first
  59.254       *               item starts at zero
  59.255 -     * @return the <code>Object</code> at that list position; or
  59.256 +     * @return the item at that list position; or
  59.257       *                  <code>null</code> if out of range
  59.258       */
  59.259 -    public Object getItemAt(int index) {
  59.260 +    public E getItemAt(int index) {
  59.261          return dataModel.getElementAt(index);
  59.262      }
  59.263  
    60.1 --- a/src/share/classes/javax/swing/MutableComboBoxModel.java	Wed May 18 16:32:05 2011 -0700
    60.2 +++ b/src/share/classes/javax/swing/MutableComboBoxModel.java	Wed May 18 18:18:04 2011 -0700
    60.3 @@ -27,19 +27,21 @@
    60.4  /**
    60.5   * A mutable version of <code>ComboBoxModel</code>.
    60.6   *
    60.7 + * @param <E> the type of the elements of this model
    60.8 + *
    60.9   * @author Tom Santos
   60.10   */
   60.11  
   60.12 -public interface MutableComboBoxModel extends ComboBoxModel {
   60.13 +public interface MutableComboBoxModel<E> extends ComboBoxModel<E> {
   60.14  
   60.15      /**
   60.16       * Adds an item at the end of the model. The implementation of this method
   60.17       * should notify all registered <code>ListDataListener</code>s that the
   60.18       * item has been added.
   60.19       *
   60.20 -     * @param obj the <code>Object</code> to be added
   60.21 +     * @param item the item to be added
   60.22       */
   60.23 -    public void addElement( Object obj );
   60.24 +    public void addElement( E item );
   60.25  
   60.26      /**
   60.27       * Removes an item from the model. The implementation of this method should
   60.28 @@ -55,17 +57,17 @@
   60.29       * should notify all registered <code>ListDataListener</code>s that the
   60.30       * item has been added.
   60.31       *
   60.32 -     * @param obj  the <code>Object</code> to be added
   60.33 +     * @param item  the item to be added
   60.34       * @param index  location to add the object
   60.35       */
   60.36 -    public void insertElementAt( Object obj, int index );
   60.37 +    public void insertElementAt( E item, int index );
   60.38  
   60.39      /**
   60.40       * Removes an item at a specific index. The implementation of this method
   60.41       * should notify all registered <code>ListDataListener</code>s that the
   60.42       * item has been removed.
   60.43       *
   60.44 -     * @param index  location of object to be removed
   60.45 +     * @param index  location of the item to be removed
   60.46       */
   60.47      public void removeElementAt( int index );
   60.48  }
    61.1 --- a/src/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java	Wed May 18 16:32:05 2011 -0700
    61.2 +++ b/src/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java	Wed May 18 18:18:04 2011 -0700
    61.3 @@ -40,7 +40,7 @@
    61.4   *
    61.5   * @author Jeff Dinkins
    61.6   */
    61.7 -public class BasicDirectoryModel extends AbstractListModel implements PropertyChangeListener {
    61.8 +public class BasicDirectoryModel extends AbstractListModel<Object> implements PropertyChangeListener {
    61.9  
   61.10      private JFileChooser filechooser = null;
   61.11      // PENDING(jeff) pick the size more sensibly
    62.1 --- a/src/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java	Wed May 18 16:32:05 2011 -0700
    62.2 +++ b/src/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java	Wed May 18 18:18:04 2011 -0700
    62.3 @@ -906,7 +906,7 @@
    62.4      /**
    62.5       * Data model for a type-face selection combo-box.
    62.6       */
    62.7 -    protected class DirectoryComboBoxModel extends AbstractListModel implements ComboBoxModel {
    62.8 +    protected class DirectoryComboBoxModel extends AbstractListModel<Object> implements ComboBoxModel<Object> {
    62.9          Vector<File> directories = new Vector<File>();
   62.10          int[] depths = null;
   62.11          File selectedDirectory = null;
   62.12 @@ -1063,7 +1063,7 @@
   62.13      /**
   62.14       * Data model for a type-face selection combo-box.
   62.15       */
   62.16 -    protected class FilterComboBoxModel extends AbstractListModel implements ComboBoxModel, PropertyChangeListener {
   62.17 +    protected class FilterComboBoxModel extends AbstractListModel<Object> implements ComboBoxModel<Object>, PropertyChangeListener {
   62.18          protected FileFilter[] filters;
   62.19          protected FilterComboBoxModel() {
   62.20              super();
    63.1 --- a/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java	Wed May 18 16:32:05 2011 -0700
    63.2 +++ b/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java	Wed May 18 18:18:04 2011 -0700
    63.3 @@ -488,6 +488,18 @@
    63.4          paintContentBorder(tabContentContext, g, tabPlacement, selectedIndex);
    63.5      }
    63.6  
    63.7 +    protected void paintTabArea(Graphics g, int tabPlacement,
    63.8 +                                int selectedIndex) {
    63.9 +        // This can be invoked from ScrollabeTabPanel
   63.10 +        Insets insets = tabPane.getInsets();
   63.11 +        int x = insets.left;
   63.12 +        int y = insets.top;
   63.13 +        int width = tabPane.getWidth() - insets.left - insets.right;
   63.14 +        int height = tabPane.getHeight() - insets.top - insets.bottom;
   63.15 +
   63.16 +        paintTabArea(tabAreaContext, g, tabPlacement, selectedIndex,
   63.17 +                     new Rectangle(x, y, width, height));
   63.18 +    }
   63.19  
   63.20      private void paintTabArea(SynthContext ss, Graphics g,
   63.21                                  int tabPlacement, int selectedIndex,
    64.1 --- a/src/share/classes/sun/awt/FontDescriptor.java	Wed May 18 16:32:05 2011 -0700
    64.2 +++ b/src/share/classes/sun/awt/FontDescriptor.java	Wed May 18 18:18:04 2011 -0700
    64.3 @@ -26,7 +26,7 @@
    64.4  
    64.5  import java.nio.charset.Charset;
    64.6  import java.nio.charset.CharsetEncoder;
    64.7 -import java.nio.charset.StandardCharset;
    64.8 +import java.nio.charset.StandardCharsets;
    64.9  import sun.nio.cs.HistoricallyNamedCharset;
   64.10  
   64.11  public class FontDescriptor implements Cloneable {
   64.12 @@ -105,8 +105,8 @@
   64.13          if (useUnicode && unicodeEncoder == null) {
   64.14              try {
   64.15                  this.unicodeEncoder = isLE?
   64.16 -                    StandardCharset.UTF_16LE.newEncoder():
   64.17 -                    StandardCharset.UTF_16BE.newEncoder();
   64.18 +                    StandardCharsets.UTF_16LE.newEncoder():
   64.19 +                    StandardCharsets.UTF_16BE.newEncoder();
   64.20              } catch (IllegalArgumentException x) {}
   64.21          }
   64.22          return useUnicode;
    65.1 --- a/src/share/classes/sun/java2d/opengl/OGLRenderer.java	Wed May 18 16:32:05 2011 -0700
    65.2 +++ b/src/share/classes/sun/java2d/opengl/OGLRenderer.java	Wed May 18 18:18:04 2011 -0700
    65.3 @@ -102,15 +102,20 @@
    65.4              final ParallelogramPipe realpipe = oglr.getAAParallelogramPipe();
    65.5              return new ParallelogramPipe() {
    65.6                  public void fillParallelogram(SunGraphics2D sg2d,
    65.7 +                                              double ux1, double uy1,
    65.8 +                                              double ux2, double uy2,
    65.9                                                double x, double y,
   65.10                                                double dx1, double dy1,
   65.11                                                double dx2, double dy2)
   65.12                  {
   65.13                      GraphicsPrimitive.tracePrimitive("OGLFillAAParallelogram");
   65.14                      realpipe.fillParallelogram(sg2d,
   65.15 +                                               ux1, uy1, ux2, uy2,
   65.16                                                 x, y, dx1, dy1, dx2, dy2);
   65.17                  }
   65.18                  public void drawParallelogram(SunGraphics2D sg2d,
   65.19 +                                              double ux1, double uy1,
   65.20 +                                              double ux2, double uy2,
   65.21                                                double x, double y,
   65.22                                                double dx1, double dy1,
   65.23                                                double dx2, double dy2,
   65.24 @@ -118,6 +123,7 @@
   65.25                  {
   65.26                      GraphicsPrimitive.tracePrimitive("OGLDrawAAParallelogram");
   65.27                      realpipe.drawParallelogram(sg2d,
   65.28 +                                               ux1, uy1, ux2, uy2,
   65.29                                                 x, y, dx1, dy1, dx2, dy2,
   65.30                                                 lw1, lw2);
   65.31                  }
   65.32 @@ -166,21 +172,29 @@
   65.33              oglr.fillSpans(sg2d, si, transx, transy);
   65.34          }
   65.35          public void fillParallelogram(SunGraphics2D sg2d,
   65.36 +                                      double ux1, double uy1,
   65.37 +                                      double ux2, double uy2,
   65.38                                        double x, double y,
   65.39                                        double dx1, double dy1,
   65.40                                        double dx2, double dy2)
   65.41          {
   65.42              GraphicsPrimitive.tracePrimitive("OGLFillParallelogram");
   65.43 -            oglr.fillParallelogram(sg2d, x, y, dx1, dy1, dx2, dy2);
   65.44 +            oglr.fillParallelogram(sg2d,
   65.45 +                                   ux1, uy1, ux2, uy2,
   65.46 +                                   x, y, dx1, dy1, dx2, dy2);
   65.47          }
   65.48          public void drawParallelogram(SunGraphics2D sg2d,
   65.49 +                                      double ux1, double uy1,
   65.50 +                                      double ux2, double uy2,
   65.51                                        double x, double y,
   65.52                                        double dx1, double dy1,
   65.53                                        double dx2, double dy2,
   65.54                                        double lw1, double lw2)
   65.55          {
   65.56              GraphicsPrimitive.tracePrimitive("OGLDrawParallelogram");
   65.57 -            oglr.drawParallelogram(sg2d, x, y, dx1, dy1, dx2, dy2, lw1, lw2);
   65.58 +            oglr.drawParallelogram(sg2d,
   65.59 +                                   ux1, uy1, ux2, uy2,
   65.60 +                                   x, y, dx1, dy1, dx2, dy2, lw1, lw2);
   65.61          }
   65.62          public void copyArea(SunGraphics2D sg2d,
   65.63                               int x, int y, int w, int h, int dx, int dy)
    66.1 --- a/src/share/classes/sun/java2d/pipe/AAShapePipe.java	Wed May 18 16:32:05 2011 -0700
    66.2 +++ b/src/share/classes/sun/java2d/pipe/AAShapePipe.java	Wed May 18 18:18:04 2011 -0700
    66.3 @@ -68,21 +68,23 @@
    66.4          renderPath(sg, s, null);
    66.5      }
    66.6  
    66.7 -    private static Rectangle2D computeBBox(double x, double y,
    66.8 -                                           double dx1, double dy1,
    66.9 -                                           double dx2, double dy2)
   66.10 +    private static Rectangle2D computeBBox(double ux1, double uy1,
   66.11 +                                           double ux2, double uy2)
   66.12      {
   66.13 -        double lox, loy, hix, hiy;
   66.14 -        lox = hix = x;
   66.15 -        loy = hiy = y;
   66.16 -        if (dx1 < 0) { lox += dx1; } else { hix += dx1; }
   66.17 -        if (dy1 < 0) { loy += dy1; } else { hiy += dy1; }
   66.18 -        if (dx2 < 0) { lox += dx2; } else { hix += dx2; }
   66.19 -        if (dy2 < 0) { loy += dy2; } else { hiy += dy2; }
   66.20 -        return new Rectangle2D.Double(lox, loy, hix-lox, hiy-loy);
   66.21 +        if ((ux2 -= ux1) < 0) {
   66.22 +            ux1 += ux2;
   66.23 +            ux2 = -ux2;
   66.24 +        }
   66.25 +        if ((uy2 -= uy1) < 0) {
   66.26 +            uy1 += uy2;
   66.27 +            uy2 = -uy2;
   66.28 +        }
   66.29 +        return new Rectangle2D.Double(ux1, uy1, ux2, uy2);
   66.30      }
   66.31  
   66.32      public void fillParallelogram(SunGraphics2D sg,
   66.33 +                                  double ux1, double uy1,
   66.34 +                                  double ux2, double uy2,
   66.35                                    double x, double y,
   66.36                                    double dx1, double dy1,
   66.37                                    double dx2, double dy2)
   66.38 @@ -97,10 +99,12 @@
   66.39              return;
   66.40          }
   66.41  
   66.42 -        renderTiles(sg, computeBBox(x, y, dx1, dy1, dx2, dy2), aatg, abox);
   66.43 +        renderTiles(sg, computeBBox(ux1, uy1, ux2, uy2), aatg, abox);
   66.44      }
   66.45  
   66.46      public void drawParallelogram(SunGraphics2D sg,
   66.47 +                                  double ux1, double uy1,
   66.48 +                                  double ux2, double uy2,
   66.49                                    double x, double y,
   66.50                                    double dx1, double dy1,
   66.51                                    double dx2, double dy2,
   66.52 @@ -118,7 +122,7 @@
   66.53  
   66.54          // Note that bbox is of the original shape, not the wide path.
   66.55          // This is appropriate for handing to Paint methods...
   66.56 -        renderTiles(sg, computeBBox(x, y, dx1, dy1, dx2, dy2), aatg, abox);
   66.57 +        renderTiles(sg, computeBBox(ux1, uy1, ux2, uy2), aatg, abox);
   66.58      }
   66.59  
   66.60      private static byte[] theTile;
    67.1 --- a/src/share/classes/sun/java2d/pipe/AlphaColorPipe.java	Wed May 18 16:32:05 2011 -0700
    67.2 +++ b/src/share/classes/sun/java2d/pipe/AlphaColorPipe.java	Wed May 18 18:18:04 2011 -0700
    67.3 @@ -66,6 +66,8 @@
    67.4      }
    67.5  
    67.6      public void fillParallelogram(SunGraphics2D sg,
    67.7 +                                  double ux1, double uy1,
    67.8 +                                  double ux2, double uy2,
    67.9                                    double x, double y,
   67.10                                    double dx1, double dy1,
   67.11                                    double dx2, double dy2)
   67.12 @@ -75,6 +77,8 @@
   67.13      }
   67.14  
   67.15      public void drawParallelogram(SunGraphics2D sg,
   67.16 +                                  double ux1, double uy1,
   67.17 +                                  double ux2, double uy2,
   67.18                                    double x, double y,
   67.19                                    double dx1, double dy1,
   67.20                                    double dx2, double dy2,
    68.1 --- a/src/share/classes/sun/java2d/pipe/BufferedRenderPipe.java	Wed May 18 16:32:05 2011 -0700
    68.2 +++ b/src/share/classes/sun/java2d/pipe/BufferedRenderPipe.java	Wed May 18 18:18:04 2011 -0700
    68.3 @@ -408,6 +408,8 @@
    68.4      }
    68.5  
    68.6      public void fillParallelogram(SunGraphics2D sg2d,
    68.7 +                                  double ux1, double uy1,
    68.8 +                                  double ux2, double uy2,
    68.9                                    double x, double y,
   68.10                                    double dx1, double dy1,
   68.11                                    double dx2, double dy2)
   68.12 @@ -429,6 +431,8 @@
   68.13      }
   68.14  
   68.15      public void drawParallelogram(SunGraphics2D sg2d,
   68.16 +                                  double ux1, double uy1,
   68.17 +                                  double ux2, double uy2,
   68.18                                    double x, double y,
   68.19                                    double dx1, double dy1,
   68.20                                    double dx2, double dy2,
   68.21 @@ -454,6 +458,8 @@
   68.22  
   68.23      private class AAParallelogramPipe implements ParallelogramPipe {
   68.24          public void fillParallelogram(SunGraphics2D sg2d,
   68.25 +                                      double ux1, double uy1,
   68.26 +                                      double ux2, double uy2,
   68.27                                        double x, double y,
   68.28                                        double dx1, double dy1,
   68.29                                        double dx2, double dy2)
   68.30 @@ -475,6 +481,8 @@
   68.31          }
   68.32  
   68.33          public void drawParallelogram(SunGraphics2D sg2d,
   68.34 +                                      double ux1, double uy1,
   68.35 +                                      double ux2, double uy2,
   68.36                                        double x, double y,
   68.37                                        double dx1, double dy1,
   68.38                                        double dx2, double dy2,
    69.1 --- a/src/share/classes/sun/java2d/pipe/LoopPipe.java	Wed May 18 16:32:05 2011 -0700
    69.2 +++ b/src/share/classes/sun/java2d/pipe/LoopPipe.java	Wed May 18 18:18:04 2011 -0700
    69.3 @@ -352,6 +352,8 @@
    69.4      }
    69.5  
    69.6      public void fillParallelogram(SunGraphics2D sg2d,
    69.7 +                                  double ux1, double uy1,
    69.8 +                                  double ux2, double uy2,
    69.9                                    double x, double y,
   69.10                                    double dx1, double dy1,
   69.11                                    double dx2, double dy2)
   69.12 @@ -362,6 +364,8 @@
   69.13      }
   69.14  
   69.15      public void drawParallelogram(SunGraphics2D sg2d,
   69.16 +                                  double ux1, double uy1,
   69.17 +                                  double ux2, double uy2,
   69.18                                    double x, double y,
   69.19                                    double dx1, double dy1,
   69.20                                    double dx2, double dy2,
    70.1 --- a/src/share/classes/sun/java2d/pipe/ParallelogramPipe.java	Wed May 18 16:32:05 2011 -0700
    70.2 +++ b/src/share/classes/sun/java2d/pipe/ParallelogramPipe.java	Wed May 18 18:18:04 2011 -0700
    70.3 @@ -1,5 +1,5 @@
    70.4  /*
    70.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
    70.6 + * Copyright (c) 2008, 2011 Oracle and/or its affiliates. All rights reserved.
    70.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    70.8   *
    70.9   * This code is free software; you can redistribute it and/or modify it
   70.10 @@ -40,9 +40,17 @@
   70.11   *          => (x+dx2, y+dy2)
   70.12   *          => origin
   70.13   * </pre>
   70.14 + * The four u[xy][12] parameters are the unsorted extreme coordinates
   70.15 + * of the primitive in user space.  They may have been generated by a
   70.16 + * line or a rectangle so they could have u[xy]2 < u[xy]1 in some cases.
   70.17 + * They should be sorted before calculating the bounds of the original
   70.18 + * primitive (such as for calculating the user space bounds for the
   70.19 + * Paint.createContext() method).
   70.20   */
   70.21  public interface ParallelogramPipe {
   70.22      public void fillParallelogram(SunGraphics2D sg,
   70.23 +                                  double ux1, double uy1,
   70.24 +                                  double ux2, double uy2,
   70.25                                    double x, double y,
   70.26                                    double dx1, double dy1,
   70.27                                    double dx2, double dy2);
   70.28 @@ -59,6 +67,8 @@
   70.29       * difference between the outer and inner parallelograms.
   70.30       */
   70.31      public void drawParallelogram(SunGraphics2D sg,
   70.32 +                                  double ux1, double uy1,
   70.33 +                                  double ux2, double uy2,
   70.34                                    double x, double y,
   70.35                                    double dx1, double dy1,
   70.36                                    double dx2, double dy2,
    71.1 --- a/src/share/classes/sun/java2d/pipe/PixelToParallelogramConverter.java	Wed May 18 16:32:05 2011 -0700
    71.2 +++ b/src/share/classes/sun/java2d/pipe/PixelToParallelogramConverter.java	Wed May 18 18:18:04 2011 -0700
    71.3 @@ -175,8 +175,8 @@
    71.4      }
    71.5  
    71.6      public boolean drawGeneralLine(SunGraphics2D sg2d,
    71.7 -                                   double x1, double y1,
    71.8 -                                   double x2, double y2)
    71.9 +                                   double ux1, double uy1,
   71.10 +                                   double ux2, double uy2)
   71.11      {
   71.12          if (sg2d.strokeState == SunGraphics2D.STROKE_CUSTOM ||
   71.13              sg2d.strokeState == SunGraphics2D.STROKE_THINDASHED)
   71.14 @@ -194,13 +194,14 @@
   71.15          double lw = bs.getLineWidth();
   71.16          // Save the original dx, dy in case we need it to transform
   71.17          // the linewidth as a perpendicular vector below
   71.18 -        double dx = x2 - x1;
   71.19 -        double dy = y2 - y1;
   71.20 +        double dx = ux2 - ux1;
   71.21 +        double dy = uy2 - uy1;
   71.22 +        double x1, y1, x2, y2;
   71.23          switch (sg2d.transformState) {
   71.24          case SunGraphics2D.TRANSFORM_GENERIC:
   71.25          case SunGraphics2D.TRANSFORM_TRANSLATESCALE:
   71.26              {
   71.27 -                double coords[] = {x1, y1, x2, y2};
   71.28 +                double coords[] = {ux1, uy1, ux2, uy2};
   71.29                  sg2d.transform.transform(coords, 0, coords, 0, 2);
   71.30                  x1 = coords[0];
   71.31                  y1 = coords[1];
   71.32 @@ -213,13 +214,17 @@
   71.33              {
   71.34                  double tx = sg2d.transform.getTranslateX();
   71.35                  double ty = sg2d.transform.getTranslateY();
   71.36 -                x1 += tx;
   71.37 -                y1 += ty;
   71.38 -                x2 += tx;
   71.39 -                y2 += ty;
   71.40 +                x1 = ux1 + tx;
   71.41 +                y1 = uy1 + ty;
   71.42 +                x2 = ux2 + tx;
   71.43 +                y2 = uy2 + ty;
   71.44              }
   71.45              break;
   71.46          case SunGraphics2D.TRANSFORM_ISIDENT:
   71.47 +            x1 = ux1;
   71.48 +            y1 = uy1;
   71.49 +            x2 = ux2;
   71.50 +            y2 = uy2;
   71.51              break;
   71.52          default:
   71.53              throw new InternalError("unknown TRANSFORM state...");
   71.54 @@ -279,7 +284,8 @@
   71.55              dx += udx;
   71.56              dy += udy;
   71.57          }
   71.58 -        outrenderer.fillParallelogram(sg2d, px, py, -udy, udx, dx, dy);
   71.59 +        outrenderer.fillParallelogram(sg2d, ux1, uy1, ux2, uy2,
   71.60 +                                      px, py, -udy, udx, dx, dy);
   71.61          return true;
   71.62      }
   71.63  
   71.64 @@ -313,7 +319,8 @@
   71.65              px = newx;
   71.66              py = newy;
   71.67          }
   71.68 -        outrenderer.fillParallelogram(sg2d, px, py, dx1, dy1, dx2, dy2);
   71.69 +        outrenderer.fillParallelogram(sg2d, rx, ry, rx+rw, ry+rh,
   71.70 +                                      px, py, dx1, dy1, dx2, dy2);
   71.71      }
   71.72  
   71.73      public void drawRectangle(SunGraphics2D sg2d,
   71.74 @@ -360,10 +367,12 @@
   71.75              // entire hole in the middle of the parallelogram
   71.76              // so we can just fill the outer parallelogram.
   71.77              fillOuterParallelogram(sg2d,
   71.78 +                                   rx, ry, rx+rw, ry+rh,
   71.79                                     px, py, dx1, dy1, dx2, dy2,
   71.80                                     len1, len2, lw1, lw2);
   71.81          } else {
   71.82              outrenderer.drawParallelogram(sg2d,
   71.83 +                                          rx, ry, rx+rw, ry+rh,
   71.84                                            px, py, dx1, dy1, dx2, dy2,
   71.85                                            lw1 / len1, lw2 / len2);
   71.86          }
   71.87 @@ -377,6 +386,8 @@
   71.88       * and issues a single fillParallelogram request to fill it.
   71.89       */
   71.90      public void fillOuterParallelogram(SunGraphics2D sg2d,
   71.91 +                                       double ux1, double uy1,
   71.92 +                                       double ux2, double uy2,
   71.93                                         double px, double py,
   71.94                                         double dx1, double dy1,
   71.95                                         double dx2, double dy2,
   71.96 @@ -412,6 +423,7 @@
   71.97          dx2 += udx2;
   71.98          dy2 += udy2;
   71.99  
  71.100 -        outrenderer.fillParallelogram(sg2d, px, py, dx1, dy1, dx2, dy2);
  71.101 +        outrenderer.fillParallelogram(sg2d, ux1, uy1, ux2, uy2,
  71.102 +                                      px, py, dx1, dy1, dx2, dy2);
  71.103      }
  71.104  }
    72.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    72.2 +++ b/src/share/classes/sun/management/GarbageCollectionNotifInfoCompositeData.java	Wed May 18 18:18:04 2011 -0700
    72.3 @@ -0,0 +1,219 @@
    72.4 +/*
    72.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    72.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    72.7 + *
    72.8 + * This code is free software; you can redistribute it and/or modify it
    72.9 + * under the terms of the GNU General Public License version 2 only, as
   72.10 + * published by the Free Software Foundation.  Oracle designates this
   72.11 + * particular file as subject to the "Classpath" exception as provided
   72.12 + * by Oracle in the LICENSE file that accompanied this code.
   72.13 + *
   72.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   72.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   72.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   72.17 + * version 2 for more details (a copy is included in the LICENSE file that
   72.18 + * accompanied this code).
   72.19 + *
   72.20 + * You should have received a copy of the GNU General Public License version
   72.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   72.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   72.23 + *
   72.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   72.25 + * or visit www.oracle.com if you need additional information or have any
   72.26 + * questions.
   72.27 + */
   72.28 +
   72.29 +package sun.management;
   72.30 +
   72.31 +import com.sun.management.GarbageCollectionNotificationInfo;
   72.32 +import com.sun.management.GcInfo;
   72.33 +import java.lang.reflect.Method;
   72.34 +import javax.management.openmbean.CompositeData;
   72.35 +import javax.management.openmbean.CompositeType;
   72.36 +import javax.management.openmbean.CompositeDataSupport;
   72.37 +import javax.management.openmbean.OpenDataException;
   72.38 +import javax.management.openmbean.OpenType;
   72.39 +import javax.management.openmbean.SimpleType;
   72.40 +import java.security.AccessController;
   72.41 +import java.security.PrivilegedAction;
   72.42 +import java.lang.reflect.Field;
   72.43 +import java.util.HashMap;
   72.44 +
   72.45 +/**
   72.46 + * A CompositeData for GarbageCollectionNotificationInfo for the local management support.
   72.47 + * This class avoids the performance penalty paid to the
   72.48 + * construction of a CompositeData use in the local case.
   72.49 + */
   72.50 +public class GarbageCollectionNotifInfoCompositeData extends LazyCompositeData {
   72.51 +    private final GarbageCollectionNotificationInfo gcNotifInfo;
   72.52 +
   72.53 +    public GarbageCollectionNotifInfoCompositeData(GarbageCollectionNotificationInfo info) {
   72.54 +        this.gcNotifInfo = info;
   72.55 +    }
   72.56 +
   72.57 +    public GarbageCollectionNotificationInfo getGarbageCollectionNotifInfo() {
   72.58 +        return gcNotifInfo;
   72.59 +    }
   72.60 +
   72.61 +    public static CompositeData toCompositeData(GarbageCollectionNotificationInfo info) {
   72.62 +        GarbageCollectionNotifInfoCompositeData gcnicd =
   72.63 +            new GarbageCollectionNotifInfoCompositeData(info);
   72.64 +        return gcnicd.getCompositeData();
   72.65 +    }
   72.66 +
   72.67 +    private CompositeType getCompositeTypeByBuilder() {
   72.68 +        final GcInfoBuilder builder = AccessController.doPrivileged (new PrivilegedAction<GcInfoBuilder>() {
   72.69 +                public GcInfoBuilder run() {
   72.70 +                    try {
   72.71 +                        Class cl = Class.forName("com.sun.management.GcInfo");
   72.72 +                        Field f = cl.getDeclaredField("builder");
   72.73 +                        f.setAccessible(true);
   72.74 +                        return (GcInfoBuilder)f.get(gcNotifInfo.getGcInfo());
   72.75 +                    } catch(ClassNotFoundException e) {
   72.76 +                        return null;
   72.77 +                    } catch(NoSuchFieldException e) {
   72.78 +                        return null;
   72.79 +                    } catch(IllegalAccessException e) {
   72.80 +                        return null;
   72.81 +                    }
   72.82 +                }
   72.83 +            });
   72.84 +        CompositeType gict = null;
   72.85 +        synchronized(compositeTypeByBuilder) {
   72.86 +            gict = compositeTypeByBuilder.get(builder);
   72.87 +            if(gict == null) {
   72.88 +                OpenType[] gcNotifInfoItemTypes = new OpenType[] {
   72.89 +                    SimpleType.STRING,
   72.90 +                    SimpleType.STRING,
   72.91 +                    SimpleType.STRING,
   72.92 +                    builder.getGcInfoCompositeType(),
   72.93 +                };
   72.94 +                try {
   72.95 +                    final String typeName =
   72.96 +                        "sun.management.GarbageCollectionNotifInfoCompositeType";
   72.97 +                    gict = new CompositeType(typeName,
   72.98 +                                             "CompositeType for GC notification info",
   72.99 +                                             gcNotifInfoItemNames,
  72.100 +                                             gcNotifInfoItemNames,
  72.101 +                                             gcNotifInfoItemTypes);
  72.102 +                    compositeTypeByBuilder.put(builder,gict);
  72.103 +                } catch (OpenDataException e) {
  72.104 +                    // shouldn't reach here
  72.105 +                    throw Util.newException(e);
  72.106 +                }
  72.107 +            }
  72.108 +        }
  72.109 +        return gict;
  72.110 +    }
  72.111 +
  72.112 +    protected CompositeData getCompositeData() {
  72.113 +        // CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH
  72.114 +        // gcNotifInfoItemNames!
  72.115 +        final Object[] gcNotifInfoItemValues;
  72.116 +        gcNotifInfoItemValues = new Object[] {
  72.117 +            gcNotifInfo.getGcName(),
  72.118 +            gcNotifInfo.getGcAction(),
  72.119 +            gcNotifInfo.getGcCause(),
  72.120 +            GcInfoCompositeData.toCompositeData(gcNotifInfo.getGcInfo())
  72.121 +        };
  72.122 +
  72.123 +        CompositeType gict = getCompositeTypeByBuilder();
  72.124 +
  72.125 +        try {
  72.126 +            return new CompositeDataSupport(gict,
  72.127 +                                            gcNotifInfoItemNames,
  72.128 +                                            gcNotifInfoItemValues);
  72.129 +        } catch (OpenDataException e) {
  72.130 +            // Should never reach here
  72.131 +            throw new AssertionError(e);
  72.132 +        }
  72.133 +    }
  72.134 +
  72.135 +    //    private static MappedMXBeanType gcInfoMapType;
  72.136 +    private static final String GC_NAME = "gcName";
  72.137 +    private static final String GC_ACTION = "gcAction";
  72.138 +    private static final String GC_CAUSE = "gcCause";
  72.139 +    private static final String GC_INFO     = "gcInfo";
  72.140 +    private static final String[] gcNotifInfoItemNames = {
  72.141 +        GC_NAME,
  72.142 +        GC_ACTION,
  72.143 +        GC_CAUSE,
  72.144 +        GC_INFO
  72.145 +    };
  72.146 +    private static HashMap<GcInfoBuilder,CompositeType> compositeTypeByBuilder =
  72.147 +        new HashMap<GcInfoBuilder,CompositeType>();
  72.148 +
  72.149 +    public static String getGcName(CompositeData cd) {
  72.150 +        String gcname = getString(cd, GC_NAME);
  72.151 +        if (gcname == null) {
  72.152 +            throw new IllegalArgumentException("Invalid composite data: " +
  72.153 +                "Attribute " + GC_NAME + " has null value");
  72.154 +        }
  72.155 +        return gcname;
  72.156 +    }
  72.157 +
  72.158 +    public static String getGcAction(CompositeData cd) {
  72.159 +        String gcaction = getString(cd, GC_ACTION);
  72.160 +        if (gcaction == null) {
  72.161 +            throw new IllegalArgumentException("Invalid composite data: " +
  72.162 +                "Attribute " + GC_ACTION + " has null value");
  72.163 +        }
  72.164 +        return gcaction;
  72.165 +    }
  72.166 +
  72.167 +    public static String getGcCause(CompositeData cd) {
  72.168 +        String gccause = getString(cd, GC_CAUSE);
  72.169 +        if (gccause == null) {
  72.170 +            throw new IllegalArgumentException("Invalid composite data: " +
  72.171 +                "Attribute " + GC_CAUSE + " has null value");
  72.172 +        }
  72.173 +        return gccause;
  72.174 +    }
  72.175 +
  72.176 +    public static GcInfo getGcInfo(CompositeData cd) {
  72.177 +        CompositeData gcInfoData = (CompositeData) cd.get(GC_INFO);
  72.178 +        return GcInfo.from(gcInfoData);
  72.179 +    }
  72.180 +
  72.181 +    /** Validate if the input CompositeData has the expected
  72.182 +     * CompositeType (i.e. contain all attributes with expected
  72.183 +     * names and types).
  72.184 +     */
  72.185 +    public static void validateCompositeData(CompositeData cd) {
  72.186 +        if (cd == null) {
  72.187 +            throw new NullPointerException("Null CompositeData");
  72.188 +        }
  72.189 +
  72.190 +        if (!isTypeMatched( getBaseGcNotifInfoCompositeType(), cd.getCompositeType())) {
  72.191 +            throw new IllegalArgumentException(
  72.192 +                "Unexpected composite type for GarbageCollectionNotificationInfo");
  72.193 +        }
  72.194 +    }
  72.195 +
  72.196 +    // This is only used for validation.
  72.197 +    private static CompositeType baseGcNotifInfoCompositeType = null;
  72.198 +    private static synchronized CompositeType getBaseGcNotifInfoCompositeType() {
  72.199 +        if (baseGcNotifInfoCompositeType == null) {
  72.200 +            try {
  72.201 +                OpenType[] baseGcNotifInfoItemTypes = new OpenType[] {
  72.202 +                    SimpleType.STRING,
  72.203 +                    SimpleType.STRING,
  72.204 +                    SimpleType.STRING,
  72.205 +                    GcInfoCompositeData.getBaseGcInfoCompositeType()
  72.206 +                };
  72.207 +                baseGcNotifInfoCompositeType =
  72.208 +                    new CompositeType("sun.management.BaseGarbageCollectionNotifInfoCompositeType",
  72.209 +                                      "CompositeType for Base GarbageCollectionNotificationInfo",
  72.210 +                                      gcNotifInfoItemNames,
  72.211 +                                      gcNotifInfoItemNames,
  72.212 +                                      baseGcNotifInfoItemTypes);
  72.213 +            } catch (OpenDataException e) {
  72.214 +                // shouldn't reach here
  72.215 +                throw Util.newException(e);
  72.216 +            }
  72.217 +        }
  72.218 +        return baseGcNotifInfoCompositeType;
  72.219 +    }
  72.220 +
  72.221 +    private static final long serialVersionUID = -1805123446483771292L;
  72.222 +}
    73.1 --- a/src/share/classes/sun/management/GarbageCollectorImpl.java	Wed May 18 16:32:05 2011 -0700
    73.2 +++ b/src/share/classes/sun/management/GarbageCollectorImpl.java	Wed May 18 18:18:04 2011 -0700
    73.3 @@ -1,5 +1,5 @@
    73.4  /*
    73.5 - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
    73.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
    73.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    73.8   *
    73.9   * This code is free software; you can redistribute it and/or modify it
   73.10 @@ -26,6 +26,7 @@
   73.11  package sun.management;
   73.12  
   73.13  import com.sun.management.GarbageCollectorMXBean;
   73.14 +import com.sun.management.GarbageCollectionNotificationInfo;
   73.15  import java.lang.management.ManagementFactory;
   73.16  import java.lang.management.MemoryPoolMXBean;
   73.17  import java.lang.management.MemoryUsage;
   73.18 @@ -35,9 +36,15 @@
   73.19  import javax.management.MBeanInfo;
   73.20  import javax.management.MBeanAttributeInfo;
   73.21  import javax.management.ObjectName;
   73.22 +import javax.management.MBeanNotificationInfo;
   73.23 +import javax.management.Notification;
   73.24 +import javax.management.NotificationFilter;
   73.25 +import javax.management.NotificationListener;
   73.26 +import javax.management.ListenerNotFoundException;
   73.27  
   73.28  import java.util.List;
   73.29  import java.util.ListIterator;
   73.30 +import java.util.Map;
   73.31  
   73.32  /**
   73.33   * Implementation class for the garbage collector.
   73.34 @@ -78,19 +85,111 @@
   73.35  
   73.36      // Sun JDK extension
   73.37      private GcInfoBuilder gcInfoBuilder;
   73.38 +
   73.39 +    private synchronized GcInfoBuilder getGcInfoBuilder() {
   73.40 +        if(gcInfoBuilder == null) {
   73.41 +            gcInfoBuilder = new GcInfoBuilder(this, getAllPoolNames());
   73.42 +        }
   73.43 +        return gcInfoBuilder;
   73.44 +    }
   73.45 +
   73.46      public GcInfo getLastGcInfo() {
   73.47 +        GcInfo info = getGcInfoBuilder().getLastGcInfo();
   73.48 +        return info;
   73.49 +    }
   73.50 +
   73.51 +    private final static String notifName =
   73.52 +        "javax.management.Notification";
   73.53 +
   73.54 +    private final static String[] gcNotifTypes = {
   73.55 +        GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION
   73.56 +    };
   73.57 +
   73.58 +    private MBeanNotificationInfo[] notifInfo = null;
   73.59 +    public MBeanNotificationInfo[] getNotificationInfo() {
   73.60          synchronized (this) {
   73.61 -            if (gcInfoBuilder == null) {
   73.62 -                 gcInfoBuilder = new GcInfoBuilder(this, getAllPoolNames());
   73.63 +            if (notifInfo == null) {
   73.64 +                 notifInfo = new MBeanNotificationInfo[1];
   73.65 +                 notifInfo[0] = new MBeanNotificationInfo(gcNotifTypes,
   73.66 +                                                          notifName,
   73.67 +                                                          "GC Notification");
   73.68              }
   73.69          }
   73.70 +        return notifInfo;
   73.71 +    }
   73.72  
   73.73 -        GcInfo info = gcInfoBuilder.getLastGcInfo();
   73.74 -        return info;
   73.75 +    private static long seqNumber = 0;
   73.76 +    private static long getNextSeqNumber() {
   73.77 +        return ++seqNumber;
   73.78 +    }
   73.79 +
   73.80 +    void createGCNotification(long timestamp,
   73.81 +                              String gcName,
   73.82 +                              String gcAction,
   73.83 +                              String gcCause,
   73.84 +                              GcInfo gcInfo)  {
   73.85 +
   73.86 +        if (!hasListeners()) {
   73.87 +            return;
   73.88 +        }
   73.89 +
   73.90 +        Notification notif = new Notification(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION,
   73.91 +                                              getObjectName(),
   73.92 +                                              getNextSeqNumber(),
   73.93 +                                              timestamp,
   73.94 +                                              gcName);
   73.95 +        GarbageCollectionNotificationInfo info =
   73.96 +            new GarbageCollectionNotificationInfo(gcName,
   73.97 +                                                  gcAction,
   73.98 +                                                  gcCause,
   73.99 +                                                  gcInfo);
  73.100 +
  73.101 +        CompositeData cd =
  73.102 +            GarbageCollectionNotifInfoCompositeData.toCompositeData(info);
  73.103 +        notif.setUserData(cd);
  73.104 +        sendNotification(notif);
  73.105 +    }
  73.106 +
  73.107 +    public synchronized void addNotificationListener(NotificationListener listener,
  73.108 +                                                     NotificationFilter filter,
  73.109 +                                                     Object handback)
  73.110 +    {
  73.111 +        boolean before = hasListeners();
  73.112 +        super.addNotificationListener(listener, filter, handback);
  73.113 +        boolean after = hasListeners();
  73.114 +        if (!before && after) {
  73.115 +            setNotificationEnabled(this, true);
  73.116 +        }
  73.117 +    }
  73.118 +
  73.119 +    public synchronized void removeNotificationListener(NotificationListener listener)
  73.120 +        throws ListenerNotFoundException {
  73.121 +        boolean before = hasListeners();
  73.122 +        super.removeNotificationListener(listener);
  73.123 +        boolean after = hasListeners();
  73.124 +        if (before && !after) {
  73.125 +            setNotificationEnabled(this,false);
  73.126 +        }
  73.127 +    }
  73.128 +
  73.129 +    public synchronized void removeNotificationListener(NotificationListener listener,
  73.130 +                                                        NotificationFilter filter,
  73.131 +                                                        Object handback)
  73.132 +            throws ListenerNotFoundException
  73.133 +    {
  73.134 +        boolean before = hasListeners();
  73.135 +        super.removeNotificationListener(listener,filter,handback);
  73.136 +        boolean after = hasListeners();
  73.137 +        if (before && !after) {
  73.138 +            setNotificationEnabled(this,false);
  73.139 +        }
  73.140      }
  73.141  
  73.142      public ObjectName getObjectName() {
  73.143          return Util.newObjectName(ManagementFactory.GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE, getName());
  73.144      }
  73.145  
  73.146 +    native void setNotificationEnabled(GarbageCollectorMXBean gc,
  73.147 +                                       boolean enabled);
  73.148 +
  73.149  }
    74.1 --- a/src/share/classes/sun/management/GcInfoCompositeData.java	Wed May 18 16:32:05 2011 -0700
    74.2 +++ b/src/share/classes/sun/management/GcInfoCompositeData.java	Wed May 18 18:18:04 2011 -0700
    74.3 @@ -1,5 +1,5 @@
    74.4  /*
    74.5 - * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
    74.6 + * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
    74.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    74.8   *
    74.9   * This code is free software; you can redistribute it and/or modify it
   74.10 @@ -27,6 +27,7 @@
   74.11  
   74.12  import java.lang.management.MemoryUsage;
   74.13  import java.lang.reflect.Method;
   74.14 +import java.lang.reflect.Field;
   74.15  import java.util.Iterator;
   74.16  import java.util.Map;
   74.17  import java.util.HashMap;
   74.18 @@ -41,6 +42,9 @@
   74.19  import javax.management.openmbean.OpenType;
   74.20  import javax.management.openmbean.OpenDataException;
   74.21  import com.sun.management.GcInfo;
   74.22 +import com.sun.management.GarbageCollectionNotificationInfo;
   74.23 +import java.security.AccessController;
   74.24 +import java.security.PrivilegedAction;
   74.25  
   74.26  /**
   74.27   * A CompositeData for GcInfo for the local management support.
   74.28 @@ -64,6 +68,44 @@
   74.29          return info;
   74.30      }
   74.31  
   74.32 +    public static CompositeData toCompositeData(final GcInfo info) {
   74.33 +        final GcInfoBuilder builder = AccessController.doPrivileged (new PrivilegedAction<GcInfoBuilder>() {
   74.34 +                        public GcInfoBuilder run() {
   74.35 +                            try {
   74.36 +                                Class cl = Class.forName("com.sun.management.GcInfo");
   74.37 +                                Field f = cl.getDeclaredField("builder");
   74.38 +                                f.setAccessible(true);
   74.39 +                                return (GcInfoBuilder)f.get(info);
   74.40 +                            } catch(ClassNotFoundException e) {
   74.41 +                                return null;
   74.42 +                            } catch(NoSuchFieldException e) {
   74.43 +                                return null;
   74.44 +                            } catch(IllegalAccessException e) {
   74.45 +                                return null;
   74.46 +                            }
   74.47 +                        }
   74.48 +                    });
   74.49 +        final Object[] extAttr = AccessController.doPrivileged (new PrivilegedAction<Object[]>() {
   74.50 +                        public Object[] run() {
   74.51 +                            try {
   74.52 +                                Class cl = Class.forName("com.sun.management.GcInfo");
   74.53 +                                Field f = cl.getDeclaredField("extAttributes");
   74.54 +                                f.setAccessible(true);
   74.55 +                                return (Object[])f.get(info);
   74.56 +                            } catch(ClassNotFoundException e) {
   74.57 +                                return null;
   74.58 +                            } catch(NoSuchFieldException e) {
   74.59 +                                return null;
   74.60 +                            } catch(IllegalAccessException e) {
   74.61 +                                return null;
   74.62 +                            }
   74.63 +                        }
   74.64 +                    });
   74.65 +        GcInfoCompositeData gcicd =
   74.66 +            new GcInfoCompositeData(info,builder,extAttr);
   74.67 +        return gcicd.getCompositeData();
   74.68 +    }
   74.69 +
   74.70      protected CompositeData getCompositeData() {
   74.71          // CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH
   74.72          // baseGcInfoItemNames!
   74.73 @@ -115,7 +157,6 @@
   74.74          }
   74.75      }
   74.76  
   74.77 -
   74.78      private static final String ID                     = "id";
   74.79      private static final String START_TIME             = "startTime";
   74.80      private static final String END_TIME               = "endTime";
   74.81 @@ -231,7 +272,7 @@
   74.82  
   74.83      // This is only used for validation.
   74.84      private static CompositeType baseGcInfoCompositeType = null;
   74.85 -    private static synchronized CompositeType getBaseGcInfoCompositeType() {
   74.86 +    static synchronized CompositeType getBaseGcInfoCompositeType() {
   74.87          if (baseGcInfoCompositeType == null) {
   74.88              try {
   74.89                  baseGcInfoCompositeType =
    75.1 --- a/src/share/classes/sun/management/MemoryManagerImpl.java	Wed May 18 16:32:05 2011 -0700
    75.2 +++ b/src/share/classes/sun/management/MemoryManagerImpl.java	Wed May 18 18:18:04 2011 -0700
    75.3 @@ -1,5 +1,5 @@
    75.4  /*
    75.5 - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
    75.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
    75.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    75.8   *
    75.9   * This code is free software; you can redistribute it and/or modify it
   75.10 @@ -29,6 +29,7 @@
   75.11  import java.lang.management.MemoryManagerMXBean;
   75.12  import java.lang.management.MemoryPoolMXBean;
   75.13  
   75.14 +import javax.management.MBeanNotificationInfo;
   75.15  import javax.management.ObjectName;
   75.16  
   75.17  /**
   75.18 @@ -38,7 +39,8 @@
   75.19   * ManagementFactory.getMemoryManagerMXBeans() returns a list
   75.20   * of instances of this class.
   75.21   */
   75.22 -class MemoryManagerImpl implements MemoryManagerMXBean {
   75.23 +class MemoryManagerImpl extends NotificationEmitterSupport
   75.24 +    implements MemoryManagerMXBean {
   75.25  
   75.26      private final String  name;
   75.27      private final boolean isValid;
   75.28 @@ -76,6 +78,16 @@
   75.29      }
   75.30      private native MemoryPoolMXBean[] getMemoryPools0();
   75.31  
   75.32 +    private MBeanNotificationInfo[] notifInfo = null;
   75.33 +    public MBeanNotificationInfo[] getNotificationInfo() {
   75.34 +        synchronized (this) {
   75.35 +            if(notifInfo == null) {
   75.36 +                notifInfo = new MBeanNotificationInfo[0];
   75.37 +            }
   75.38 +        }
   75.39 +        return notifInfo;
   75.40 +    }
   75.41 +
   75.42      public ObjectName getObjectName() {
   75.43          return Util.newObjectName(ManagementFactory.MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE, getName());
   75.44      }
    76.1 --- a/src/share/classes/sun/management/VMManagement.java	Wed May 18 16:32:05 2011 -0700
    76.2 +++ b/src/share/classes/sun/management/VMManagement.java	Wed May 18 18:18:04 2011 -0700
    76.3 @@ -45,6 +45,7 @@
    76.4      public boolean isSynchronizerUsageSupported();
    76.5      public boolean isThreadAllocatedMemorySupported();
    76.6      public boolean isThreadAllocatedMemoryEnabled();
    76.7 +    public boolean isGcNotificationSupported();
    76.8  
    76.9      // Class Loading Subsystem
   76.10      public long    getTotalClassCount();
    77.1 --- a/src/share/classes/sun/management/VMManagementImpl.java	Wed May 18 16:32:05 2011 -0700
    77.2 +++ b/src/share/classes/sun/management/VMManagementImpl.java	Wed May 18 18:18:04 2011 -0700
    77.3 @@ -56,6 +56,8 @@
    77.4      private static boolean objectMonitorUsageSupport;
    77.5      private static boolean synchronizerUsageSupport;
    77.6      private static boolean threadAllocatedMemorySupport;
    77.7 +    private static boolean gcNotificationSupport;
    77.8 +
    77.9  
   77.10      static {
   77.11          version = getVersion0();
   77.12 @@ -100,6 +102,10 @@
   77.13          return threadAllocatedMemorySupport;
   77.14      }
   77.15  
   77.16 +    public boolean isGcNotificationSupported() {
   77.17 +        return gcNotificationSupport;
   77.18 +    }
   77.19 +
   77.20      public native boolean isThreadContentionMonitoringEnabled();
   77.21      public native boolean isThreadCpuTimeEnabled();
   77.22      public native boolean isThreadAllocatedMemoryEnabled();
    78.1 --- a/src/share/classes/sun/nio/ch/AsynchronousServerSocketChannelImpl.java	Wed May 18 16:32:05 2011 -0700
    78.2 +++ b/src/share/classes/sun/nio/ch/AsynchronousServerSocketChannelImpl.java	Wed May 18 18:18:04 2011 -0700
    78.3 @@ -28,7 +28,7 @@
    78.4  import java.nio.channels.*;
    78.5  import java.net.SocketAddress;
    78.6  import java.net.SocketOption;
    78.7 -import java.net.StandardSocketOption;
    78.8 +import java.net.StandardSocketOptions;
    78.9  import java.net.InetSocketAddress;
   78.10  import java.io.FileDescriptor;
   78.11  import java.io.IOException;
   78.12 @@ -214,8 +214,8 @@
   78.13  
   78.14          private static Set<SocketOption<?>> defaultOptions() {
   78.15              HashSet<SocketOption<?>> set = new HashSet<SocketOption<?>>(2);
   78.16 -            set.add(StandardSocketOption.SO_RCVBUF);
   78.17 -            set.add(StandardSocketOption.SO_REUSEADDR);
   78.18 +            set.add(StandardSocketOptions.SO_RCVBUF);
   78.19 +            set.add(StandardSocketOptions.SO_REUSEADDR);
   78.20              return Collections.unmodifiableSet(set);
   78.21          }
   78.22      }
    79.1 --- a/src/share/classes/sun/nio/ch/AsynchronousSocketChannelImpl.java	Wed May 18 16:32:05 2011 -0700
    79.2 +++ b/src/share/classes/sun/nio/ch/AsynchronousSocketChannelImpl.java	Wed May 18 18:18:04 2011 -0700
    79.3 @@ -28,7 +28,7 @@
    79.4  import java.nio.ByteBuffer;
    79.5  import java.nio.channels.*;
    79.6  import java.net.SocketOption;
    79.7 -import java.net.StandardSocketOption;
    79.8 +import java.net.StandardSocketOptions;
    79.9  import java.net.SocketAddress;
   79.10  import java.net.InetSocketAddress;
   79.11  import java.io.IOException;
   79.12 @@ -483,11 +483,11 @@
   79.13  
   79.14          private static Set<SocketOption<?>> defaultOptions() {
   79.15              HashSet<SocketOption<?>> set = new HashSet<SocketOption<?>>(5);
   79.16 -            set.add(StandardSocketOption.SO_SNDBUF);
   79.17 -            set.add(StandardSocketOption.SO_RCVBUF);
   79.18 -            set.add(StandardSocketOption.SO_KEEPALIVE);
   79.19 -            set.add(StandardSocketOption.SO_REUSEADDR);
   79.20 -            set.add(StandardSocketOption.TCP_NODELAY);
   79.21 +            set.add(StandardSocketOptions.SO_SNDBUF);
   79.22 +            set.add(StandardSocketOptions.SO_RCVBUF);
   79.23 +            set.add(StandardSocketOptions.SO_KEEPALIVE);
   79.24 +            set.add(StandardSocketOptions.SO_REUSEADDR);
   79.25 +            set.add(StandardSocketOptions.TCP_NODELAY);
   79.26              return Collections.unmodifiableSet(set);
   79.27          }
   79.28      }
    80.1 --- a/src/share/classes/sun/nio/ch/DatagramChannelImpl.java	Wed May 18 16:32:05 2011 -0700
    80.2 +++ b/src/share/classes/sun/nio/ch/DatagramChannelImpl.java	Wed May 18 18:18:04 2011 -0700
    80.3 @@ -188,7 +188,7 @@
    80.4          synchronized (stateLock) {
    80.5              ensureOpen();
    80.6  
    80.7 -            if (name == StandardSocketOption.IP_TOS) {
    80.8 +            if (name == StandardSocketOptions.IP_TOS) {
    80.9                  // IPv4 only; no-op for IPv6
   80.10                  if (family == StandardProtocolFamily.INET) {
   80.11                      Net.setSocketOption(fd, family, name, value);
   80.12 @@ -196,15 +196,15 @@
   80.13                  return this;
   80.14              }
   80.15  
   80.16 -            if (name == StandardSocketOption.IP_MULTICAST_TTL ||
   80.17 -                name == StandardSocketOption.IP_MULTICAST_LOOP)
   80.18 +            if (name == StandardSocketOptions.IP_MULTICAST_TTL ||
   80.19 +                name == StandardSocketOptions.IP_MULTICAST_LOOP)
   80.20              {
   80.21                  // options are protocol dependent
   80.22                  Net.setSocketOption(fd, family, name, value);
   80.23                  return this;
   80.24              }
   80.25  
   80.26 -            if (name == StandardSocketOption.IP_MULTICAST_IF) {
   80.27 +            if (name == StandardSocketOptions.IP_MULTICAST_IF) {
   80.28                  if (value == null)
   80.29                      throw new IllegalArgumentException("Cannot set IP_MULTICAST_IF to 'null'");
   80.30                  NetworkInterface interf = (NetworkInterface)value;
   80.31 @@ -243,7 +243,7 @@
   80.32          synchronized (stateLock) {
   80.33              ensureOpen();
   80.34  
   80.35 -            if (name == StandardSocketOption.IP_TOS) {
   80.36 +            if (name == StandardSocketOptions.IP_TOS) {
   80.37                  // IPv4 only; always return 0 on IPv6
   80.38                  if (family == StandardProtocolFamily.INET) {
   80.39                      return (T) Net.getSocketOption(fd, family, name);
   80.40 @@ -252,13 +252,13 @@
   80.41                  }
   80.42              }
   80.43  
   80.44 -            if (name == StandardSocketOption.IP_MULTICAST_TTL ||
   80.45 -                name == StandardSocketOption.IP_MULTICAST_LOOP)
   80.46 +            if (name == StandardSocketOptions.IP_MULTICAST_TTL ||
   80.47 +                name == StandardSocketOptions.IP_MULTICAST_LOOP)
   80.48              {
   80.49                  return (T) Net.getSocketOption(fd, family, name);
   80.50              }
   80.51  
   80.52 -            if (name == StandardSocketOption.IP_MULTICAST_IF) {
   80.53 +            if (name == StandardSocketOptions.IP_MULTICAST_IF) {
   80.54                  if (family == StandardProtocolFamily.INET) {
   80.55                      int address = Net.getInterface4(fd);
   80.56                      if (address == 0)
   80.57 @@ -291,14 +291,14 @@
   80.58  
   80.59          private static Set<SocketOption<?>> defaultOptions() {
   80.60              HashSet<SocketOption<?>> set = new HashSet<SocketOption<?>>(8);
   80.61 -            set.add(StandardSocketOption.SO_SNDBUF);
   80.62 -            set.add(StandardSocketOption.SO_RCVBUF);
   80.63 -            set.add(StandardSocketOption.SO_REUSEADDR);
   80.64 -            set.add(StandardSocketOption.SO_BROADCAST);
   80.65 -            set.add(StandardSocketOption.IP_TOS);
   80.66 -            set.add(StandardSocketOption.IP_MULTICAST_IF);
   80.67 -            set.add(StandardSocketOption.IP_MULTICAST_TTL);
   80.68 -            set.add(StandardSocketOption.IP_MULTICAST_LOOP);
   80.69 +            set.add(StandardSocketOptions.SO_SNDBUF);
   80.70 +            set.add(StandardSocketOptions.SO_RCVBUF);
   80.71 +            set.add(StandardSocketOptions.SO_REUSEADDR);
   80.72 +            set.add(StandardSocketOptions.SO_BROADCAST);
   80.73 +            set.add(StandardSocketOptions.IP_TOS);
   80.74 +            set.add(StandardSocketOptions.IP_MULTICAST_IF);
   80.75 +            set.add(StandardSocketOptions.IP_MULTICAST_TTL);
   80.76 +            set.add(StandardSocketOptions.IP_MULTICAST_LOOP);
   80.77              return Collections.unmodifiableSet(set);
   80.78          }
   80.79      }
    81.1 --- a/src/share/classes/sun/nio/ch/DatagramSocketAdaptor.java	Wed May 18 16:32:05 2011 -0700
    81.2 +++ b/src/share/classes/sun/nio/ch/DatagramSocketAdaptor.java	Wed May 18 18:18:04 2011 -0700
    81.3 @@ -312,46 +312,46 @@
    81.4      public void setSendBufferSize(int size) throws SocketException {
    81.5          if (size <= 0)
    81.6              throw new IllegalArgumentException("Invalid send size");
    81.7 -        setIntOption(StandardSocketOption.SO_SNDBUF, size);
    81.8 +        setIntOption(StandardSocketOptions.SO_SNDBUF, size);
    81.9      }
   81.10  
   81.11      public int getSendBufferSize() throws SocketException {
   81.12 -        return getIntOption(StandardSocketOption.SO_SNDBUF);
   81.13 +        return getIntOption(StandardSocketOptions.SO_SNDBUF);
   81.14      }
   81.15  
   81.16      public void setReceiveBufferSize(int size) throws SocketException {
   81.17          if (size <= 0)
   81.18              throw new IllegalArgumentException("Invalid receive size");
   81.19 -        setIntOption(StandardSocketOption.SO_RCVBUF, size);
   81.20 +        setIntOption(StandardSocketOptions.SO_RCVBUF, size);
   81.21      }
   81.22  
   81.23      public int getReceiveBufferSize() throws SocketException {
   81.24 -        return getIntOption(StandardSocketOption.SO_RCVBUF);
   81.25 +        return getIntOption(StandardSocketOptions.SO_RCVBUF);
   81.26      }
   81.27  
   81.28      public void setReuseAddress(boolean on) throws SocketException {
   81.29 -        setBooleanOption(StandardSocketOption.SO_REUSEADDR, on);
   81.30 +        setBooleanOption(StandardSocketOptions.SO_REUSEADDR, on);
   81.31      }
   81.32  
   81.33      public boolean getReuseAddress() throws SocketException {
   81.34 -        return getBooleanOption(StandardSocketOption.SO_REUSEADDR);
   81.35 +        return getBooleanOption(StandardSocketOptions.SO_REUSEADDR);
   81.36  
   81.37      }
   81.38  
   81.39      public void setBroadcast(boolean on) throws SocketException {
   81.40 -        setBooleanOption(StandardSocketOption.SO_BROADCAST, on);
   81.41 +        setBooleanOption(StandardSocketOptions.SO_BROADCAST, on);
   81.42      }
   81.43  
   81.44      public boolean getBroadcast() throws SocketException {
   81.45 -        return getBooleanOption(StandardSocketOption.SO_BROADCAST);
   81.46 +        return getBooleanOption(StandardSocketOptions.SO_BROADCAST);
   81.47      }
   81.48  
   81.49      public void setTrafficClass(int tc) throws SocketException {
   81.50 -        setIntOption(StandardSocketOption.IP_TOS, tc);
   81.51 +        setIntOption(StandardSocketOptions.IP_TOS, tc);
   81.52      }
   81.53  
   81.54      public int getTrafficClass() throws SocketException {
   81.55 -        return getIntOption(StandardSocketOption.IP_TOS);
   81.56 +        return getIntOption(StandardSocketOptions.IP_TOS);
   81.57      }
   81.58  
   81.59      public void close() {
    82.1 --- a/src/share/classes/sun/nio/ch/ExtendedSocketOption.java	Wed May 18 16:32:05 2011 -0700
    82.2 +++ b/src/share/classes/sun/nio/ch/ExtendedSocketOption.java	Wed May 18 18:18:04 2011 -0700
    82.3 @@ -29,7 +29,7 @@
    82.4  
    82.5  /**
    82.6   * Defines socket options that are supported by the implementation
    82.7 - * but not defined in StandardSocketOption.
    82.8 + * but not defined in StandardSocketOptions.
    82.9   */
   82.10  
   82.11  class ExtendedSocketOption {
    83.1 --- a/src/share/classes/sun/nio/ch/NativeThreadSet.java	Wed May 18 16:32:05 2011 -0700
    83.2 +++ b/src/share/classes/sun/nio/ch/NativeThreadSet.java	Wed May 18 18:18:04 2011 -0700
    83.3 @@ -96,11 +96,16 @@
    83.4                      break;
    83.5              }
    83.6              waitingToEmpty = true;
    83.7 +            boolean interrupted = false;
    83.8              while (used > 0) {
    83.9                  try {
   83.10                      wait();
   83.11 -                } catch (InterruptedException ignore) { }
   83.12 +                } catch (InterruptedException e) {
   83.13 +                    interrupted = true;
   83.14 +                }
   83.15              }
   83.16 +            if (interrupted)
   83.17 +                Thread.currentThread().interrupt();
   83.18          }
   83.19      }
   83.20  }
    84.1 --- a/src/share/classes/sun/nio/ch/Net.java	Wed May 18 16:32:05 2011 -0700
    84.2 +++ b/src/share/classes/sun/nio/ch/Net.java	Wed May 18 18:18:04 2011 -0700
    84.3 @@ -237,26 +237,26 @@
    84.4              throw new AssertionError("Should not reach here");
    84.5  
    84.6          // special handling
    84.7 -        if (name == StandardSocketOption.SO_RCVBUF ||
    84.8 -            name == StandardSocketOption.SO_SNDBUF)
    84.9 +        if (name == StandardSocketOptions.SO_RCVBUF ||
   84.10 +            name == StandardSocketOptions.SO_SNDBUF)
   84.11          {
   84.12              int i = ((Integer)value).intValue();
   84.13              if (i < 0)
   84.14                  throw new IllegalArgumentException("Invalid send/receive buffer size");
   84.15          }
   84.16 -        if (name == StandardSocketOption.SO_LINGER) {
   84.17 +        if (name == StandardSocketOptions.SO_LINGER) {
   84.18              int i = ((Integer)value).intValue();
   84.19              if (i < 0)
   84.20                  value = Integer.valueOf(-1);
   84.21              if (i > 65535)
   84.22                  value = Integer.valueOf(65535);
   84.23          }
   84.24 -        if (name == StandardSocketOption.IP_TOS) {
   84.25 +        if (name == StandardSocketOptions.IP_TOS) {
   84.26              int i = ((Integer)value).intValue();
   84.27              if (i < 0 || i > 255)
   84.28                  throw new IllegalArgumentException("Invalid IP_TOS value");
   84.29          }
   84.30 -        if (name == StandardSocketOption.IP_MULTICAST_TTL) {
   84.31 +        if (name == StandardSocketOptions.IP_MULTICAST_TTL) {
   84.32              int i = ((Integer)value).intValue();
   84.33              if (i < 0 || i > 255)
   84.34                  throw new IllegalArgumentException("Invalid TTL/hop value");
    85.1 --- a/src/share/classes/sun/nio/ch/ServerSocketAdaptor.java	Wed May 18 16:32:05 2011 -0700
    85.2 +++ b/src/share/classes/sun/nio/ch/ServerSocketAdaptor.java	Wed May 18 18:18:04 2011 -0700
    85.3 @@ -169,7 +169,7 @@
    85.4  
    85.5      public void setReuseAddress(boolean on) throws SocketException {
    85.6          try {
    85.7 -            ssc.setOption(StandardSocketOption.SO_REUSEADDR, on);
    85.8 +            ssc.setOption(StandardSocketOptions.SO_REUSEADDR, on);
    85.9          } catch (IOException x) {
   85.10              Net.translateToSocketException(x);
   85.11          }
   85.12 @@ -177,7 +177,7 @@
   85.13  
   85.14      public boolean getReuseAddress() throws SocketException {
   85.15          try {
   85.16 -            return ssc.getOption(StandardSocketOption.SO_REUSEADDR).booleanValue();
   85.17 +            return ssc.getOption(StandardSocketOptions.SO_REUSEADDR).booleanValue();
   85.18          } catch (IOException x) {
   85.19              Net.translateToSocketException(x);
   85.20              return false;       // Never happens
   85.21 @@ -197,7 +197,7 @@
   85.22          if (size <= 0)
   85.23              throw new IllegalArgumentException("size cannot be 0 or negative");
   85.24          try {
   85.25 -            ssc.setOption(StandardSocketOption.SO_RCVBUF, size);
   85.26 +            ssc.setOption(StandardSocketOptions.SO_RCVBUF, size);
   85.27          } catch (IOException x) {
   85.28              Net.translateToSocketException(x);
   85.29          }
   85.30 @@ -205,7 +205,7 @@
   85.31  
   85.32      public int getReceiveBufferSize() throws SocketException {
   85.33          try {
   85.34 -            return ssc.getOption(StandardSocketOption.SO_RCVBUF).intValue();
   85.35 +            return ssc.getOption(StandardSocketOptions.SO_RCVBUF).intValue();
   85.36          } catch (IOException x) {
   85.37              Net.translateToSocketException(x);
   85.38              return -1;          // Never happens
    86.1 --- a/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java	Wed May 18 16:32:05 2011 -0700
    86.2 +++ b/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java	Wed May 18 18:18:04 2011 -0700
    86.3 @@ -160,8 +160,8 @@
    86.4  
    86.5          private static Set<SocketOption<?>> defaultOptions() {
    86.6              HashSet<SocketOption<?>> set = new HashSet<SocketOption<?>>(2);
    86.7 -            set.add(StandardSocketOption.SO_RCVBUF);
    86.8 -            set.add(StandardSocketOption.SO_REUSEADDR);
    86.9 +            set.add(StandardSocketOptions.SO_RCVBUF);
   86.10 +            set.add(StandardSocketOptions.SO_REUSEADDR);
   86.11              return Collections.unmodifiableSet(set);
   86.12          }
   86.13      }
    87.1 --- a/src/share/classes/sun/nio/ch/SocketAdaptor.java	Wed May 18 16:32:05 2011 -0700
    87.2 +++ b/src/share/classes/sun/nio/ch/SocketAdaptor.java	Wed May 18 18:18:04 2011 -0700
    87.3 @@ -318,21 +318,21 @@
    87.4      }
    87.5  
    87.6      public void setTcpNoDelay(boolean on) throws SocketException {
    87.7 -        setBooleanOption(StandardSocketOption.TCP_NODELAY, on);
    87.8 +        setBooleanOption(StandardSocketOptions.TCP_NODELAY, on);
    87.9      }
   87.10  
   87.11      public boolean getTcpNoDelay() throws SocketException {
   87.12 -        return getBooleanOption(StandardSocketOption.TCP_NODELAY);
   87.13 +        return getBooleanOption(StandardSocketOptions.TCP_NODELAY);
   87.14      }
   87.15  
   87.16      public void setSoLinger(boolean on, int linger) throws SocketException {
   87.17          if (!on)
   87.18              linger = -1;
   87.19 -        setIntOption(StandardSocketOption.SO_LINGER, linger);
   87.20 +        setIntOption(StandardSocketOptions.SO_LINGER, linger);
   87.21      }
   87.22  
   87.23      public int getSoLinger() throws SocketException {
   87.24 -        return getIntOption(StandardSocketOption.SO_LINGER);
   87.25 +        return getIntOption(StandardSocketOptions.SO_LINGER);
   87.26      }
   87.27  
   87.28      public void sendUrgentData(int data) throws IOException {
   87.29 @@ -366,46 +366,46 @@
   87.30          // size 0 valid for SocketChannel, invalid for Socket
   87.31          if (size <= 0)
   87.32              throw new IllegalArgumentException("Invalid send size");
   87.33 -        setIntOption(StandardSocketOption.SO_SNDBUF, size);
   87.34 +        setIntOption(StandardSocketOptions.SO_SNDBUF, size);
   87.35      }
   87.36  
   87.37      public int getSendBufferSize() throws SocketException {
   87.38 -        return getIntOption(StandardSocketOption.SO_SNDBUF);
   87.39 +        return getIntOption(StandardSocketOptions.SO_SNDBUF);
   87.40      }
   87.41  
   87.42      public void setReceiveBufferSize(int size) throws SocketException {
   87.43          // size 0 valid for SocketChannel, invalid for Socket
   87.44          if (size <= 0)
   87.45              throw new IllegalArgumentException("Invalid receive size");
   87.46 -        setIntOption(StandardSocketOption.SO_RCVBUF, size);
   87.47 +        setIntOption(StandardSocketOptions.SO_RCVBUF, size);
   87.48      }
   87.49  
   87.50      public int getReceiveBufferSize() throws SocketException {
   87.51 -        return getIntOption(StandardSocketOption.SO_RCVBUF);
   87.52 +        return getIntOption(StandardSocketOptions.SO_RCVBUF);
   87.53      }
   87.54  
   87.55      public void setKeepAlive(boolean on) throws SocketException {
   87.56 -        setBooleanOption(StandardSocketOption.SO_KEEPALIVE, on);
   87.57 +        setBooleanOption(StandardSocketOptions.SO_KEEPALIVE, on);
   87.58      }
   87.59  
   87.60      public boolean getKeepAlive() throws SocketException {
   87.61 -        return getBooleanOption(StandardSocketOption.SO_KEEPALIVE);
   87.62 +        return getBooleanOption(StandardSocketOptions.SO_KEEPALIVE);
   87.63      }
   87.64  
   87.65      public void setTrafficClass(int tc) throws SocketException {
   87.66 -        setIntOption(StandardSocketOption.IP_TOS, tc);
   87.67 +        setIntOption(StandardSocketOptions.IP_TOS, tc);
   87.68      }
   87.69  
   87.70      public int getTrafficClass() throws SocketException {
   87.71 -        return getIntOption(StandardSocketOption.IP_TOS);
   87.72 +        return getIntOption(StandardSocketOptions.IP_TOS);
   87.73      }
   87.74  
   87.75      public void setReuseAddress(boolean on) throws SocketException {
   87.76 -        setBooleanOption(StandardSocketOption.SO_REUSEADDR, on);
   87.77 +        setBooleanOption(StandardSocketOptions.SO_REUSEADDR, on);
   87.78      }
   87.79  
   87.80      public boolean getReuseAddress() throws SocketException {
   87.81 -        return getBooleanOption(StandardSocketOption.SO_REUSEADDR);
   87.82 +        return getBooleanOption(StandardSocketOptions.SO_REUSEADDR);
   87.83      }
   87.84  
   87.85      public void close() throws IOException {
    88.1 --- a/src/share/classes/sun/nio/ch/SocketChannelImpl.java	Wed May 18 16:32:05 2011 -0700
    88.2 +++ b/src/share/classes/sun/nio/ch/SocketChannelImpl.java	Wed May 18 18:18:04 2011 -0700
    88.3 @@ -170,7 +170,7 @@
    88.4                  throw new ClosedChannelException();
    88.5  
    88.6              // special handling for IP_TOS: no-op when IPv6
    88.7 -            if (name == StandardSocketOption.IP_TOS) {
    88.8 +            if (name == StandardSocketOptions.IP_TOS) {
    88.9                  if (!Net.isIPv6Available())
   88.10                      Net.setSocketOption(fd, StandardProtocolFamily.INET, name, value);
   88.11                  return this;
   88.12 @@ -197,7 +197,7 @@
   88.13                  throw new ClosedChannelException();
   88.14  
   88.15              // special handling for IP_TOS: always return 0 when IPv6
   88.16 -            if (name == StandardSocketOption.IP_TOS) {
   88.17 +            if (name == StandardSocketOptions.IP_TOS) {
   88.18                  return (Net.isIPv6Available()) ? (T) Integer.valueOf(0) :
   88.19                      (T) Net.getSocketOption(fd, StandardProtocolFamily.INET, name);
   88.20              }
   88.21 @@ -212,14 +212,14 @@
   88.22  
   88.23          private static Set<SocketOption<?>> defaultOptions() {
   88.24              HashSet<SocketOption<?>> set = new HashSet<SocketOption<?>>(8);
   88.25 -            set.add(StandardSocketOption.SO_SNDBUF);
   88.26 -            set.add(StandardSocketOption.SO_RCVBUF);
   88.27 -            set.add(StandardSocketOption.SO_KEEPALIVE);
   88.28 -            set.add(StandardSocketOption.SO_REUSEADDR);
   88.29 -            set.add(StandardSocketOption.SO_LINGER);
   88.30 -            set.add(StandardSocketOption.TCP_NODELAY);
   88.31 +            set.add(StandardSocketOptions.SO_SNDBUF);
   88.32 +            set.add(StandardSocketOptions.SO_RCVBUF);
   88.33 +            set.add(StandardSocketOptions.SO_KEEPALIVE);
   88.34 +            set.add(StandardSocketOptions.SO_REUSEADDR);
   88.35 +            set.add(StandardSocketOptions.SO_LINGER);
   88.36 +            set.add(StandardSocketOptions.TCP_NODELAY);
   88.37              // additional options required by socket adaptor
   88.38 -            set.add(StandardSocketOption.IP_TOS);
   88.39 +            set.add(StandardSocketOptions.IP_TOS);
   88.40              set.add(ExtendedSocketOption.SO_OOBINLINE);
   88.41              return Collections.unmodifiableSet(set);
   88.42          }
    89.1 --- a/src/share/classes/sun/nio/fs/AbstractPoller.java	Wed May 18 16:32:05 2011 -0700
    89.2 +++ b/src/share/classes/sun/nio/fs/AbstractPoller.java	Wed May 18 18:18:04 2011 -0700
    89.3 @@ -105,16 +105,16 @@
    89.4          Set<WatchEvent.Kind<?>> eventSet = new HashSet<>(events.length);
    89.5          for (WatchEvent.Kind<?> event: events) {
    89.6              // standard events
    89.7 -            if (event == StandardWatchEventKind.ENTRY_CREATE ||
    89.8 -                event == StandardWatchEventKind.ENTRY_MODIFY ||
    89.9 -                event == StandardWatchEventKind.ENTRY_DELETE)
   89.10 +            if (event == StandardWatchEventKinds.ENTRY_CREATE ||
   89.11 +                event == StandardWatchEventKinds.ENTRY_MODIFY ||
   89.12 +                event == StandardWatchEventKinds.ENTRY_DELETE)
   89.13              {
   89.14                  eventSet.add(event);
   89.15                  continue;
   89.16              }
   89.17  
   89.18              // OVERFLOW is ignored
   89.19 -            if (event == StandardWatchEventKind.OVERFLOW) {
   89.20 +            if (event == StandardWatchEventKinds.OVERFLOW) {
   89.21                  if (events.length == 1)
   89.22                      throw new IllegalArgumentException("No events to register");
   89.23                  continue;
    90.1 --- a/src/share/classes/sun/nio/fs/AbstractWatchKey.java	Wed May 18 16:32:05 2011 -0700
    90.2 +++ b/src/share/classes/sun/nio/fs/AbstractWatchKey.java	Wed May 18 18:18:04 2011 -0700
    90.3 @@ -42,8 +42,8 @@
    90.4      /**
    90.5       * Special event to signal overflow
    90.6       */
    90.7 -    static final Event<Void> OVERFLOW_EVENT =
    90.8 -        new Event<Void>(StandardWatchEventKind.OVERFLOW, null);
    90.9 +    static final Event<Object> OVERFLOW_EVENT =
   90.10 +        new Event<Object>(StandardWatchEventKinds.OVERFLOW, null);
   90.11  
   90.12      /**
   90.13       * Possible key states
   90.14 @@ -103,14 +103,14 @@
   90.15       */
   90.16      @SuppressWarnings("unchecked")
   90.17      final void signalEvent(WatchEvent.Kind<?> kind, Object context) {
   90.18 -        boolean isModify = (kind == StandardWatchEventKind.ENTRY_MODIFY);
   90.19 +        boolean isModify = (kind == StandardWatchEventKinds.ENTRY_MODIFY);
   90.20          synchronized (this) {
   90.21              int size = events.size();
   90.22              if (size > 0) {
   90.23                  // if the previous event is an OVERFLOW event or this is a
   90.24                  // repeated event then we simply increment the counter
   90.25                  WatchEvent<?> prev = events.get(size-1);
   90.26 -                if ((prev.kind() == StandardWatchEventKind.OVERFLOW) ||
   90.27 +                if ((prev.kind() == StandardWatchEventKinds.OVERFLOW) ||
   90.28                      ((kind == prev.kind() &&
   90.29                       Objects.equals(context, prev.context()))))
   90.30                  {
   90.31 @@ -124,7 +124,7 @@
   90.32                      if (isModify) {
   90.33                          WatchEvent<?> ev = lastModifyEvents.get(context);
   90.34                          if (ev != null) {
   90.35 -                            assert ev.kind() == StandardWatchEventKind.ENTRY_MODIFY;
   90.36 +                            assert ev.kind() == StandardWatchEventKinds.ENTRY_MODIFY;
   90.37                              ((Event<?>)ev).increment();
   90.38                              return;
   90.39                          }
   90.40 @@ -138,7 +138,7 @@
   90.41                  // if the list has reached the limit then drop pending events
   90.42                  // and queue an OVERFLOW event
   90.43                  if (size >= MAX_EVENT_LIST_SIZE) {
   90.44 -                    kind = StandardWatchEventKind.OVERFLOW;
   90.45 +                    kind = StandardWatchEventKinds.OVERFLOW;
   90.46                      isModify = false;
   90.47                      context = null;
   90.48                  }
   90.49 @@ -149,7 +149,7 @@
   90.50                  new Event<Object>((WatchEvent.Kind<Object>)kind, context);
   90.51              if (isModify) {
   90.52                  lastModifyEvents.put(context, ev);
   90.53 -            } else if (kind == StandardWatchEventKind.OVERFLOW) {
   90.54 +            } else if (kind == StandardWatchEventKinds.OVERFLOW) {
   90.55                  // drop all pending events
   90.56                  events.clear();
   90.57                  lastModifyEvents.clear();
    91.1 --- a/src/share/classes/sun/nio/fs/PollingWatchService.java	Wed May 18 16:32:05 2011 -0700
    91.2 +++ b/src/share/classes/sun/nio/fs/PollingWatchService.java	Wed May 18 18:18:04 2011 -0700
    91.3 @@ -80,16 +80,16 @@
    91.4              new HashSet<WatchEvent.Kind<?>>(events.length);
    91.5          for (WatchEvent.Kind<?> event: events) {
    91.6              // standard events
    91.7 -            if (event == StandardWatchEventKind.ENTRY_CREATE ||
    91.8 -                event == StandardWatchEventKind.ENTRY_MODIFY ||
    91.9 -                event == StandardWatchEventKind.ENTRY_DELETE)
   91.10 +            if (event == StandardWatchEventKinds.ENTRY_CREATE ||
   91.11 +                event == StandardWatchEventKinds.ENTRY_MODIFY ||
   91.12 +                event == StandardWatchEventKinds.ENTRY_DELETE)
   91.13              {
   91.14                  eventSet.add(event);
   91.15                  continue;
   91.16              }
   91.17  
   91.18              // OVERFLOW is ignored
   91.19 -            if (event == StandardWatchEventKind.OVERFLOW) {
   91.20 +            if (event == StandardWatchEventKinds.OVERFLOW) {
   91.21                  if (events.length == 1)
   91.22                      throw new IllegalArgumentException("No events to register");
   91.23                  continue;
   91.24 @@ -355,16 +355,16 @@
   91.25                                       new CacheEntry(lastModified, tickCount));
   91.26  
   91.27                          // queue ENTRY_CREATE if event enabled
   91.28 -                        if (events.contains(StandardWatchEventKind.ENTRY_CREATE)) {
   91.29 -                            signalEvent(StandardWatchEventKind.ENTRY_CREATE, entry.getFileName());
   91.30 +                        if (events.contains(StandardWatchEventKinds.ENTRY_CREATE)) {
   91.31 +                            signalEvent(StandardWatchEventKinds.ENTRY_CREATE, entry.getFileName());
   91.32                              continue;
   91.33                          } else {
   91.34                              // if ENTRY_CREATE is not enabled and ENTRY_MODIFY is
   91.35                              // enabled then queue event to avoid missing out on
   91.36                              // modifications to the file immediately after it is
   91.37                              // created.
   91.38 -                            if (events.contains(StandardWatchEventKind.ENTRY_MODIFY)) {
   91.39 -                                signalEvent(StandardWatchEventKind.ENTRY_MODIFY, entry.getFileName());
   91.40 +                            if (events.contains(StandardWatchEventKinds.ENTRY_MODIFY)) {
   91.41 +                                signalEvent(StandardWatchEventKinds.ENTRY_MODIFY, entry.getFileName());
   91.42                              }
   91.43                          }
   91.44                          continue;
   91.45 @@ -372,8 +372,8 @@
   91.46  
   91.47                      // check if file has changed
   91.48                      if (e.lastModified != lastModified) {
   91.49 -                        if (events.contains(StandardWatchEventKind.ENTRY_MODIFY)) {
   91.50 -                            signalEvent(StandardWatchEventKind.ENTRY_MODIFY,
   91.51 +                        if (events.contains(StandardWatchEventKinds.ENTRY_MODIFY)) {
   91.52 +                            signalEvent(StandardWatchEventKinds.ENTRY_MODIFY,
   91.53                                          entry.getFileName());
   91.54                          }
   91.55                      }
   91.56 @@ -403,8 +403,8 @@
   91.57                      Path name = mapEntry.getKey();
   91.58                      // remove from map and queue delete event (if enabled)
   91.59                      i.remove();
   91.60 -                    if (events.contains(StandardWatchEventKind.ENTRY_DELETE)) {
   91.61 -                        signalEvent(StandardWatchEventKind.ENTRY_DELETE, name);
   91.62 +                    if (events.contains(StandardWatchEventKinds.ENTRY_DELETE)) {
   91.63 +                        signalEvent(StandardWatchEventKinds.ENTRY_DELETE, name);
   91.64                      }
   91.65                  }
   91.66              }
    92.1 --- a/src/share/classes/sun/security/jgss/spi/GSSContextSpi.java	Wed May 18 16:32:05 2011 -0700
    92.2 +++ b/src/share/classes/sun/security/jgss/spi/GSSContextSpi.java	Wed May 18 18:18:04 2011 -0700
    92.3 @@ -24,22 +24,10 @@
    92.4   */
    92.5  
    92.6  /*
    92.7 - * ===========================================================================
    92.8 - *  IBM Confidential
    92.9 - *  OCO Source Materials
   92.10 - *  Licensed Materials - Property of IBM
   92.11   *
   92.12   *  (C) Copyright IBM Corp. 1999 All Rights Reserved.
   92.13 - *
   92.14 - *  The source code for this program is not published or otherwise divested of
   92.15 - *  its trade secrets, irrespective of what has been deposited with the U.S.
   92.16 - *  Copyright Office.
   92.17 - *
   92.18   *  Copyright 1997 The Open Group Research Institute.  All rights reserved.
   92.19 - * ===========================================================================
   92.20 - *
   92.21   */
   92.22 -
   92.23  package sun.security.jgss.spi;
   92.24  
   92.25  import org.ietf.jgss.*;
    93.1 --- a/src/share/classes/sun/security/ssl/JsseJce.java	Wed May 18 16:32:05 2011 -0700
    93.2 +++ b/src/share/classes/sun/security/ssl/JsseJce.java	Wed May 18 18:18:04 2011 -0700
    93.3 @@ -62,7 +62,7 @@
    93.4      // Flag indicating whether EC crypto is available.
    93.5      // If null, then we have not checked yet.
    93.6      // If yes, then all the EC based crypto we need is available.
    93.7 -    private static volatile Boolean ecAvailable;
    93.8 +    private static Boolean ecAvailable;
    93.9  
   93.10      // Flag indicating whether Kerberos crypto is available.
   93.11      // If true, then all the Kerberos-based crypto we need is available.
   93.12 @@ -190,7 +190,7 @@
   93.13          // no instantiation of this class
   93.14      }
   93.15  
   93.16 -    static boolean isEcAvailable() {
   93.17 +    synchronized static boolean isEcAvailable() {
   93.18          if (ecAvailable == null) {
   93.19              try {
   93.20                  JsseJce.getSignature(SIGNATURE_ECDSA);
   93.21 @@ -206,7 +206,7 @@
   93.22          return ecAvailable;
   93.23      }
   93.24  
   93.25 -    static void clearEcAvailable() {
   93.26 +    synchronized static void clearEcAvailable() {
   93.27          ecAvailable = null;
   93.28      }
   93.29  
    94.1 --- a/src/share/classes/sun/text/bidi/BidiBase.java	Wed May 18 16:32:05 2011 -0700
    94.2 +++ b/src/share/classes/sun/text/bidi/BidiBase.java	Wed May 18 18:18:04 2011 -0700
    94.3 @@ -2889,10 +2889,6 @@
    94.4          verifyValidPara();
    94.5          verifyRange(start, 0, limit);
    94.6          verifyRange(limit, 0, length+1);
    94.7 -        if (getParagraphIndex(start) != getParagraphIndex(limit - 1)) {
    94.8 -            /* the line crosses a paragraph boundary */
    94.9 -            throw new IllegalArgumentException();
   94.10 -        }
   94.11  
   94.12          return BidiLine.setLine(bidi, this, newBidi, newBidiBase, start, limit);
   94.13      }
    95.1 --- a/src/share/classes/sun/text/resources/BreakIteratorRules_th.java	Wed May 18 16:32:05 2011 -0700
    95.2 +++ b/src/share/classes/sun/text/resources/BreakIteratorRules_th.java	Wed May 18 18:18:04 2011 -0700
    95.3 @@ -27,17 +27,7 @@
    95.4   */
    95.5  
    95.6  /*
    95.7 - * IBM Confidential
    95.8 - * OCO Source Materials
    95.9 - *
   95.10 - * IBM Java(tm)2 SDK, Standard Edition, v 1.2
   95.11 - *
   95.12 - * (C) Copyright IBM Corp. 1999
   95.13 - *
   95.14 - * The source code for this program is not published or otherwise divested of
   95.15 - * its trade secrets, irrespective of what has been deposited with the U.S.
   95.16 - * Copyright office.
   95.17 - *
   95.18 + *  (C) Copyright IBM Corp. 1999 All Rights Reserved.
   95.19   */
   95.20  
   95.21  /*
    96.1 --- a/src/share/javavm/export/jmm.h	Wed May 18 16:32:05 2011 -0700
    96.2 +++ b/src/share/javavm/export/jmm.h	Wed May 18 18:18:04 2011 -0700
    96.3 @@ -48,7 +48,7 @@
    96.4    JMM_VERSION_1_0 = 0x20010000,
    96.5    JMM_VERSION_1_1 = 0x20010100, // JDK 6
    96.6    JMM_VERSION_1_2 = 0x20010200, // JDK 7
    96.7 -  JMM_VERSION     = 0x20010200
    96.8 +  JMM_VERSION     = 0x20010201
    96.9  };
   96.10  
   96.11  typedef struct {
   96.12 @@ -293,6 +293,9 @@
   96.13                                                    jlongArray ids,
   96.14                                                    jboolean lockedMonitors,
   96.15                                                    jboolean lockedSynchronizers);
   96.16 +   void         (JNICALL *SetGCNotificationEnabled) (JNIEnv *env,
   96.17 +                                                  jobject mgr,
   96.18 +                                                  jboolean enabled);
   96.19  } JmmInterface;
   96.20  
   96.21  #ifdef __cplusplus
    97.1 --- a/src/share/native/sun/management/GarbageCollectorImpl.c	Wed May 18 16:32:05 2011 -0700
    97.2 +++ b/src/share/native/sun/management/GarbageCollectorImpl.c	Wed May 18 18:18:04 2011 -0700
    97.3 @@ -1,5 +1,5 @@
    97.4  /*
    97.5 - * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
    97.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
    97.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    97.8   *
    97.9   * This code is free software; you can redistribute it and/or modify it
   97.10 @@ -36,3 +36,17 @@
   97.11    (JNIEnv *env, jobject mgr) {
   97.12      return jmm_interface->GetLongAttribute(env, mgr, JMM_GC_TIME_MS);
   97.13  }
   97.14 +
   97.15 +
   97.16 +JNIEXPORT void JNICALL Java_sun_management_GarbageCollectorImpl_setNotificationEnabled
   97.17 +(JNIEnv *env, jobject dummy, jobject gc,jboolean enabled) {
   97.18 +
   97.19 +    if (gc == NULL) {
   97.20 +        JNU_ThrowNullPointerException(env, "Invalid GarbageCollectorMBean");
   97.21 +        return;
   97.22 +    }
   97.23 +    if((jmm_version > JMM_VERSION_1_2)
   97.24 +       || (jmm_version == JMM_VERSION_1_2 && ((jmm_version&0xFF)>=1))) {
   97.25 +      jmm_interface->SetGCNotificationEnabled(env, gc, enabled);
   97.26 +    }
   97.27 +}
    98.1 --- a/src/share/native/sun/management/VMManagementImpl.c	Wed May 18 16:32:05 2011 -0700
    98.2 +++ b/src/share/native/sun/management/VMManagementImpl.c	Wed May 18 18:18:04 2011 -0700
    98.3 @@ -95,6 +95,13 @@
    98.4  
    98.5      value = mos.isThreadAllocatedMemorySupported;
    98.6      setStaticBooleanField(env, cls, "threadAllocatedMemorySupport", value);
    98.7 +
    98.8 +    if ((jmm_version > JMM_VERSION_1_2) ||
    98.9 +        (jmm_version == JMM_VERSION_1_2 && ((jmm_version&0xFF) >= 1))) {
   98.10 +        setStaticBooleanField(env, cls, "gcNotificationSupport", JNI_TRUE);
   98.11 +    } else {
   98.12 +        setStaticBooleanField(env, cls, "gcNotificationSupport", JNI_FALSE);
   98.13 +    }
   98.14  }
   98.15  
   98.16  JNIEXPORT jobjectArray JNICALL
    99.1 --- a/src/share/native/sun/nio/ch/genSocketOptionRegistry.c	Wed May 18 16:32:05 2011 -0700
    99.2 +++ b/src/share/native/sun/nio/ch/genSocketOptionRegistry.c	Wed May 18 18:18:04 2011 -0700
    99.3 @@ -63,7 +63,7 @@
    99.4      out("// AUTOMATICALLY GENERATED FILE - DO NOT EDIT                                  ");
    99.5      out("package sun.nio.ch;                                                            ");
    99.6      out("import java.net.SocketOption;                                                  ");
    99.7 -    out("import java.net.StandardSocketOption;                                          ");
    99.8 +    out("import java.net.StandardSocketOptions;                                         ");
    99.9      out("import java.net.ProtocolFamily;                                                ");
   99.10      out("import java.net.StandardProtocolFamily;                                        ");
   99.11      out("import java.util.Map;                                                          ");
   99.12 @@ -73,7 +73,7 @@
   99.13      out("    private static class RegistryKey {                                         ");
   99.14      out("        private final SocketOption<?> name;                                    ");
   99.15      out("        private final ProtocolFamily family;                                   ");
   99.16 -    out("        RegistryKey(SocketOption<?> name, ProtocolFamily family) {                ");
   99.17 +    out("        RegistryKey(SocketOption<?> name, ProtocolFamily family) {             ");
   99.18      out("            this.name = name;                                                  ");
   99.19      out("            this.family = family;                                              ");
   99.20      out("        }                                                                      ");
   99.21 @@ -95,23 +95,23 @@
   99.22      out("            Map<RegistryKey,OptionKey> map =                                   ");
   99.23      out("                new HashMap<RegistryKey,OptionKey>();                          ");
   99.24  
   99.25 -    emit_unspec("StandardSocketOption.SO_BROADCAST", SOL_SOCKET, SO_BROADCAST);
   99.26 -    emit_unspec("StandardSocketOption.SO_KEEPALIVE", SOL_SOCKET, SO_KEEPALIVE);
   99.27 -    emit_unspec("StandardSocketOption.SO_LINGER",    SOL_SOCKET, SO_LINGER);
   99.28 -    emit_unspec("StandardSocketOption.SO_SNDBUF",    SOL_SOCKET, SO_SNDBUF);
   99.29 -    emit_unspec("StandardSocketOption.SO_RCVBUF",    SOL_SOCKET, SO_RCVBUF);
   99.30 -    emit_unspec("StandardSocketOption.SO_REUSEADDR", SOL_SOCKET, SO_REUSEADDR);
   99.31 -    emit_unspec("StandardSocketOption.TCP_NODELAY",  IPPROTO_TCP, TCP_NODELAY);
   99.32 +    emit_unspec("StandardSocketOptions.SO_BROADCAST", SOL_SOCKET, SO_BROADCAST);
   99.33 +    emit_unspec("StandardSocketOptions.SO_KEEPALIVE", SOL_SOCKET, SO_KEEPALIVE);
   99.34 +    emit_unspec("StandardSocketOptions.SO_LINGER",    SOL_SOCKET, SO_LINGER);
   99.35 +    emit_unspec("StandardSocketOptions.SO_SNDBUF",    SOL_SOCKET, SO_SNDBUF);
   99.36 +    emit_unspec("StandardSocketOptions.SO_RCVBUF",    SOL_SOCKET, SO_RCVBUF);
   99.37 +    emit_unspec("StandardSocketOptions.SO_REUSEADDR", SOL_SOCKET, SO_REUSEADDR);
   99.38 +    emit_unspec("StandardSocketOptions.TCP_NODELAY",  IPPROTO_TCP, TCP_NODELAY);
   99.39  
   99.40 -    emit_inet("StandardSocketOption.IP_TOS",            IPPROTO_IP,     IP_TOS);
   99.41 -    emit_inet("StandardSocketOption.IP_MULTICAST_IF",   IPPROTO_IP,     IP_MULTICAST_IF);
   99.42 -    emit_inet("StandardSocketOption.IP_MULTICAST_TTL",  IPPROTO_IP,     IP_MULTICAST_TTL);
   99.43 -    emit_inet("StandardSocketOption.IP_MULTICAST_LOOP", IPPROTO_IP,     IP_MULTICAST_LOOP);
   99.44 +    emit_inet("StandardSocketOptions.IP_TOS",            IPPROTO_IP,     IP_TOS);
   99.45 +    emit_inet("StandardSocketOptions.IP_MULTICAST_IF",   IPPROTO_IP,     IP_MULTICAST_IF);
   99.46 +    emit_inet("StandardSocketOptions.IP_MULTICAST_TTL",  IPPROTO_IP,     IP_MULTICAST_TTL);
   99.47 +    emit_inet("StandardSocketOptions.IP_MULTICAST_LOOP", IPPROTO_IP,     IP_MULTICAST_LOOP);
   99.48  
   99.49  #ifdef AF_INET6
   99.50 -    emit_inet6("StandardSocketOption.IP_MULTICAST_IF",   IPPROTO_IPV6,  IPV6_MULTICAST_IF);
   99.51 -    emit_inet6("StandardSocketOption.IP_MULTICAST_TTL",  IPPROTO_IPV6,  IPV6_MULTICAST_HOPS);
   99.52 -    emit_inet6("StandardSocketOption.IP_MULTICAST_LOOP", IPPROTO_IPV6,  IPV6_MULTICAST_LOOP);
   99.53 +    emit_inet6("StandardSocketOptions.IP_MULTICAST_IF",   IPPROTO_IPV6,  IPV6_MULTICAST_IF);
   99.54 +    emit_inet6("StandardSocketOptions.IP_MULTICAST_TTL",  IPPROTO_IPV6,  IPV6_MULTICAST_HOPS);
   99.55 +    emit_inet6("StandardSocketOptions.IP_MULTICAST_LOOP", IPPROTO_IPV6,  IPV6_MULTICAST_LOOP);
   99.56  #endif
   99.57  
   99.58      emit_unspec("ExtendedSocketOption.SO_OOBINLINE", SOL_SOCKET, SO_OOBINLINE);
   100.1 --- a/src/share/sample/nio/chatserver/ChatServer.java	Wed May 18 16:32:05 2011 -0700
   100.2 +++ b/src/share/sample/nio/chatserver/ChatServer.java	Wed May 18 18:18:04 2011 -0700
   100.3 @@ -32,7 +32,7 @@
   100.4  import java.io.IOException;
   100.5  import java.net.InetSocketAddress;
   100.6  import java.net.SocketAddress;
   100.7 -import java.net.StandardSocketOption;
   100.8 +import java.net.StandardSocketOptions;
   100.9  import java.nio.channels.*;
  100.10  import java.util.*;
  100.11  import java.util.concurrent.Executors;
  100.12 @@ -105,7 +105,7 @@
  100.13      */
  100.14      private AsynchronousServerSocketChannel createListener(AsynchronousChannelGroup channelGroup) throws IOException {
  100.15          final AsynchronousServerSocketChannel listener = openChannel(channelGroup);
  100.16 -        listener.setOption(StandardSocketOption.SO_REUSEADDR, true);
  100.17 +        listener.setOption(StandardSocketOptions.SO_REUSEADDR, true);
  100.18          listener.bind(new InetSocketAddress(port));
  100.19          return listener;
  100.20      }
  100.21 @@ -123,7 +123,7 @@
  100.22      private void handleNewConnection(AsynchronousSocketChannel channel) {
  100.23          Client client = new Client(channel, new ClientReader(this, new NameReader(this)));
  100.24          try {
  100.25 -            channel.setOption(StandardSocketOption.TCP_NODELAY, true);
  100.26 +            channel.setOption(StandardSocketOptions.TCP_NODELAY, true);
  100.27          } catch (IOException e) {
  100.28              // ignore
  100.29          }
   101.1 --- a/src/share/sample/nio/file/WatchDir.java	Wed May 18 16:32:05 2011 -0700
   101.2 +++ b/src/share/sample/nio/file/WatchDir.java	Wed May 18 18:18:04 2011 -0700
   101.3 @@ -30,7 +30,7 @@
   101.4   */
   101.5  
   101.6  import java.nio.file.*;
   101.7 -import static java.nio.file.StandardWatchEventKind.*;
   101.8 +import static java.nio.file.StandardWatchEventKinds.*;
   101.9  import static java.nio.file.LinkOption.*;
  101.10  import java.nio.file.attribute.*;
  101.11  import java.io.IOException;
   102.1 --- a/src/share/sample/nio/multicast/Reader.java	Wed May 18 16:32:05 2011 -0700
   102.2 +++ b/src/share/sample/nio/multicast/Reader.java	Wed May 18 18:18:04 2011 -0700
   102.3 @@ -96,7 +96,7 @@
   102.4              family = StandardProtocolFamily.INET6;
   102.5          }
   102.6          DatagramChannel dc = DatagramChannel.open(family)
   102.7 -            .setOption(StandardSocketOption.SO_REUSEADDR, true)
   102.8 +            .setOption(StandardSocketOptions.SO_REUSEADDR, true)
   102.9              .bind(new InetSocketAddress(target.port()));
  102.10  
  102.11          if (includeList.isEmpty()) {
   103.1 --- a/src/share/sample/nio/multicast/Sender.java	Wed May 18 16:32:05 2011 -0700
   103.2 +++ b/src/share/sample/nio/multicast/Sender.java	Wed May 18 18:18:04 2011 -0700
   103.3 @@ -59,7 +59,7 @@
   103.4              family = StandardProtocolFamily.INET6;
   103.5          DatagramChannel dc = DatagramChannel.open(family).bind(new InetSocketAddress(0));
   103.6          if (target.interf() != null) {
   103.7 -            dc.setOption(StandardSocketOption.IP_MULTICAST_IF, target.interf());
   103.8 +            dc.setOption(StandardSocketOptions.IP_MULTICAST_IF, target.interf());
   103.9          }
  103.10  
  103.11          // send multicast packet
   104.1 --- a/src/solaris/classes/sun/awt/X11/XRobotPeer.java	Wed May 18 16:32:05 2011 -0700
   104.2 +++ b/src/solaris/classes/sun/awt/X11/XRobotPeer.java	Wed May 18 18:18:04 2011 -0700
   104.3 @@ -48,7 +48,7 @@
   104.4      }
   104.5  
   104.6      public void dispose() {
   104.7 -        _dispose();
   104.8 +        // does nothing
   104.9      }
  104.10  
  104.11      public void mouseMove(int x, int y) {
  104.12 @@ -88,7 +88,6 @@
  104.13      }
  104.14  
  104.15      private static native synchronized void setup(int numberOfButtons, int[] buttonDownMasks);
  104.16 -    private static native synchronized void _dispose();
  104.17  
  104.18      private static native synchronized void mouseMoveImpl(X11GraphicsConfig xgc, int x, int y);
  104.19      private static native synchronized void mousePressImpl(int buttons);
   105.1 --- a/src/solaris/classes/sun/nio/ch/SctpChannelImpl.java	Wed May 18 16:32:05 2011 -0700
   105.2 +++ b/src/solaris/classes/sun/nio/ch/SctpChannelImpl.java	Wed May 18 18:18:04 2011 -0700
   105.3 @@ -55,7 +55,7 @@
   105.4  import com.sun.nio.sctp.SctpSocketOption;
   105.5  import sun.nio.ch.PollArrayWrapper;
   105.6  import sun.nio.ch.SelChImpl;
   105.7 -import static com.sun.nio.sctp.SctpStandardSocketOption.*;
   105.8 +import static com.sun.nio.sctp.SctpStandardSocketOptions.*;
   105.9  import static sun.nio.ch.SctpResultContainer.SEND_FAILED;
  105.10  import static sun.nio.ch.SctpResultContainer.ASSOCIATION_CHANGED;
  105.11  import static sun.nio.ch.SctpResultContainer.PEER_ADDRESS_CHANGED;
   106.1 --- a/src/solaris/classes/sun/nio/ch/SctpMultiChannelImpl.java	Wed May 18 16:32:05 2011 -0700
   106.2 +++ b/src/solaris/classes/sun/nio/ch/SctpMultiChannelImpl.java	Wed May 18 18:18:04 2011 -0700
   106.3 @@ -53,7 +53,7 @@
   106.4  import com.sun.nio.sctp.SctpChannel;
   106.5  import com.sun.nio.sctp.SctpMultiChannel;
   106.6  import com.sun.nio.sctp.SctpSocketOption;
   106.7 -import static com.sun.nio.sctp.SctpStandardSocketOption.*;
   106.8 +import static com.sun.nio.sctp.SctpStandardSocketOptions.*;
   106.9  import static sun.nio.ch.SctpResultContainer.*;
  106.10  
  106.11  /**
   107.1 --- a/src/solaris/classes/sun/nio/ch/SctpNet.java	Wed May 18 16:32:05 2011 -0700
   107.2 +++ b/src/solaris/classes/sun/nio/ch/SctpNet.java	Wed May 18 18:18:04 2011 -0700
   107.3 @@ -35,7 +35,7 @@
   107.4  import java.security.AccessController;
   107.5  import sun.security.action.GetPropertyAction;
   107.6  import com.sun.nio.sctp.SctpSocketOption;
   107.7 -import static com.sun.nio.sctp.SctpStandardSocketOption.*;
   107.8 +import static com.sun.nio.sctp.SctpStandardSocketOptions.*;
   107.9  
  107.10  public class SctpNet {
  107.11      static final String osName = AccessController.doPrivileged(
   108.1 --- a/src/solaris/classes/sun/nio/ch/SctpServerChannelImpl.java	Wed May 18 16:32:05 2011 -0700
   108.2 +++ b/src/solaris/classes/sun/nio/ch/SctpServerChannelImpl.java	Wed May 18 18:18:04 2011 -0700
   108.3 @@ -40,7 +40,7 @@
   108.4  import com.sun.nio.sctp.SctpChannel;
   108.5  import com.sun.nio.sctp.SctpServerChannel;
   108.6  import com.sun.nio.sctp.SctpSocketOption;
   108.7 -import com.sun.nio.sctp.SctpStandardSocketOption;
   108.8 +import com.sun.nio.sctp.SctpStandardSocketOptions;
   108.9  
  108.10  /**
  108.11   * An implementation of SctpServerChannel
  108.12 @@ -386,7 +386,7 @@
  108.13  
  108.14          private static Set<SctpSocketOption<?>> defaultOptions() {
  108.15              HashSet<SctpSocketOption<?>> set = new HashSet<SctpSocketOption<?>>(1);
  108.16 -            set.add(SctpStandardSocketOption.SCTP_INIT_MAXSTREAMS);
  108.17 +            set.add(SctpStandardSocketOptions.SCTP_INIT_MAXSTREAMS);
  108.18              return Collections.unmodifiableSet(set);
  108.19          }
  108.20      }
   109.1 --- a/src/solaris/classes/sun/nio/fs/LinuxWatchService.java	Wed May 18 16:32:05 2011 -0700
   109.2 +++ b/src/solaris/classes/sun/nio/fs/LinuxWatchService.java	Wed May 18 18:18:04 2011 -0700
   109.3 @@ -210,15 +210,15 @@
   109.4  
   109.5              int mask = 0;
   109.6              for (WatchEvent.Kind<?> event: events) {
   109.7 -                if (event == StandardWatchEventKind.ENTRY_CREATE) {
   109.8 +                if (event == StandardWatchEventKinds.ENTRY_CREATE) {
   109.9                      mask |= IN_CREATE | IN_MOVED_TO;
  109.10                      continue;
  109.11                  }
  109.12 -                if (event == StandardWatchEventKind.ENTRY_DELETE) {
  109.13 +                if (event == StandardWatchEventKinds.ENTRY_DELETE) {
  109.14                      mask |= IN_DELETE | IN_MOVED_FROM;
  109.15                      continue;
  109.16                  }
  109.17 -                if (event == StandardWatchEventKind.ENTRY_MODIFY) {
  109.18 +                if (event == StandardWatchEventKinds.ENTRY_MODIFY) {
  109.19                      mask |= IN_MODIFY | IN_ATTRIB;
  109.20                      continue;
  109.21                  }
  109.22 @@ -378,17 +378,17 @@
  109.23           */
  109.24          private WatchEvent.Kind<?> maskToEventKind(int mask) {
  109.25              if ((mask & IN_MODIFY) > 0)
  109.26 -                return StandardWatchEventKind.ENTRY_MODIFY;
  109.27 +                return StandardWatchEventKinds.ENTRY_MODIFY;
  109.28              if ((mask & IN_ATTRIB) > 0)
  109.29 -                return StandardWatchEventKind.ENTRY_MODIFY;
  109.30 +                return StandardWatchEventKinds.ENTRY_MODIFY;
  109.31              if ((mask & IN_CREATE) > 0)
  109.32 -                return StandardWatchEventKind.ENTRY_CREATE;
  109.33 +                return StandardWatchEventKinds.ENTRY_CREATE;
  109.34              if ((mask & IN_MOVED_TO) > 0)
  109.35 -                return StandardWatchEventKind.ENTRY_CREATE;
  109.36 +                return StandardWatchEventKinds.ENTRY_CREATE;
  109.37              if ((mask & IN_DELETE) > 0)
  109.38 -                return StandardWatchEventKind.ENTRY_DELETE;
  109.39 +                return StandardWatchEventKinds.ENTRY_DELETE;
  109.40              if ((mask & IN_MOVED_FROM) > 0)
  109.41 -                return StandardWatchEventKind.ENTRY_DELETE;
  109.42 +                return StandardWatchEventKinds.ENTRY_DELETE;
  109.43              return null;
  109.44          }
  109.45  
  109.46 @@ -400,7 +400,7 @@
  109.47              if ((mask & IN_Q_OVERFLOW) > 0) {
  109.48                  for (Map.Entry<Integer,LinuxWatchKey> entry: wdToKey.entrySet()) {
  109.49                      entry.getValue()
  109.50 -                        .signalEvent(StandardWatchEventKind.OVERFLOW, null);
  109.51 +                        .signalEvent(StandardWatchEventKinds.OVERFLOW, null);
  109.52                  }
  109.53                  return;
  109.54              }
   110.1 --- a/src/solaris/classes/sun/nio/fs/SolarisWatchService.java	Wed May 18 16:32:05 2011 -0700
   110.2 +++ b/src/solaris/classes/sun/nio/fs/SolarisWatchService.java	Wed May 18 18:18:04 2011 -0700
   110.3 @@ -486,7 +486,7 @@
   110.4          void processDirectoryEvents(SolarisWatchKey key, int mask) {
   110.5              if ((mask & (FILE_MODIFIED | FILE_ATTRIB)) != 0) {
   110.6                  registerChildren(key.getDirectory(), key,
   110.7 -                    key.events().contains(StandardWatchEventKind.ENTRY_CREATE));
   110.8 +                    key.events().contains(StandardWatchEventKinds.ENTRY_CREATE));
   110.9              }
  110.10          }
  110.11  
  110.12 @@ -504,14 +504,14 @@
  110.13  
  110.14              // entry modified
  110.15              if (((mask & (FILE_MODIFIED | FILE_ATTRIB)) != 0) &&
  110.16 -                events.contains(StandardWatchEventKind.ENTRY_MODIFY))
  110.17 +                events.contains(StandardWatchEventKinds.ENTRY_MODIFY))
  110.18              {
  110.19 -                key.signalEvent(StandardWatchEventKind.ENTRY_MODIFY, node.name());
  110.20 +                key.signalEvent(StandardWatchEventKinds.ENTRY_MODIFY, node.name());
  110.21              }
  110.22  
  110.23              // entry removed
  110.24              if (((mask & (FILE_REMOVED)) != 0) &&
  110.25 -                events.contains(StandardWatchEventKind.ENTRY_DELETE))
  110.26 +                events.contains(StandardWatchEventKinds.ENTRY_DELETE))
  110.27              {
  110.28                  // Due to 6636438/6636412 we may get a remove event for cases
  110.29                  // where a rmdir/unlink/rename is attempted but fails. Until
  110.30 @@ -527,7 +527,7 @@
  110.31                  } catch (UnixException x) { }
  110.32  
  110.33                  if (removed)
  110.34 -                    key.signalEvent(StandardWatchEventKind.ENTRY_DELETE, node.name());
  110.35 +                    key.signalEvent(StandardWatchEventKinds.ENTRY_DELETE, node.name());
  110.36              }
  110.37              return false;
  110.38          }
  110.39 @@ -547,7 +547,7 @@
  110.40              // if the ENTRY_MODIFY event is not enabled then we don't need
  110.41              // modification events for entries in the directory
  110.42              int events = FILE_NOFOLLOW;
  110.43 -            if (parent.events().contains(StandardWatchEventKind.ENTRY_MODIFY))
  110.44 +            if (parent.events().contains(StandardWatchEventKinds.ENTRY_MODIFY))
  110.45                  events |= (FILE_MODIFIED | FILE_ATTRIB);
  110.46  
  110.47              DirectoryStream<Path> stream = null;
  110.48 @@ -567,7 +567,7 @@
  110.49  
  110.50                      // send ENTRY_CREATE if enabled
  110.51                      if (sendEvents) {
  110.52 -                        parent.signalEvent(StandardWatchEventKind.ENTRY_CREATE, name);
  110.53 +                        parent.signalEvent(StandardWatchEventKinds.ENTRY_CREATE, name);
  110.54                      }
  110.55  
  110.56                      // register it
  110.57 @@ -602,12 +602,12 @@
  110.58              // update events, rembering if ENTRY_MODIFY was previously
  110.59              // enabled or disabled.
  110.60              boolean wasModifyEnabled = key.events()
  110.61 -                .contains(StandardWatchEventKind.ENTRY_MODIFY);
  110.62 +                .contains(StandardWatchEventKinds.ENTRY_MODIFY);
  110.63              key.setEvents(events);
  110.64  
  110.65              // check if ENTRY_MODIFY has changed
  110.66              boolean isModifyEnabled = events
  110.67 -                .contains(StandardWatchEventKind.ENTRY_MODIFY);
  110.68 +                .contains(StandardWatchEventKinds.ENTRY_MODIFY);
  110.69              if (wasModifyEnabled == isModifyEnabled) {
  110.70                  return;
  110.71              }
   111.1 --- a/src/solaris/native/sun/awt/awt_Robot.c	Wed May 18 16:32:05 2011 -0700
   111.2 +++ b/src/solaris/native/sun/awt/awt_Robot.c	Wed May 18 18:18:04 2011 -0700
   111.3 @@ -48,28 +48,12 @@
   111.4  #ifdef __linux__
   111.5  #include <sys/socket.h>
   111.6  #endif
   111.7 -#include <dlfcn.h>
   111.8  
   111.9  extern struct X11GraphicsConfigIDs x11GraphicsConfigIDs;
  111.10  
  111.11  static jint * masks;
  111.12  static jint num_buttons;
  111.13  
  111.14 -static unsigned int s_robotInstanceCounter = 0;
  111.15 -
  111.16 -static void* xcompositeLibHandle = NULL;
  111.17 -static Bool xcompositeExtAvailable = False;
  111.18 -static Bool xcompositeExtTested = False;
  111.19 -
  111.20 -typedef Status (*T_XCompositeQueryVersion)(Display *dpy, int *major_versionp, int *minor_versionp);
  111.21 -typedef Window (*T_XCompositeGetOverlayWindow)(Display *dpy, Window window);
  111.22 -typedef void (*T_XCompositeReleaseOverlayWindow)(Display *dpy, Window window);
  111.23 -
  111.24 -static T_XCompositeQueryVersion XCompositeQueryVersion = NULL;
  111.25 -static T_XCompositeGetOverlayWindow XCompositeGetOverlayWindow = NULL;
  111.26 -static T_XCompositeReleaseOverlayWindow XCompositeReleaseOverlayWindow = NULL;
  111.27 -
  111.28 -
  111.29  static int32_t isXTestAvailable() {
  111.30      int32_t major_opcode, first_event, first_error;
  111.31      int32_t  event_basep, error_basep, majorp, minorp;
  111.32 @@ -210,80 +194,8 @@
  111.33      }
  111.34  
  111.35      AWT_UNLOCK();
  111.36 -
  111.37 -    s_robotInstanceCounter++;
  111.38  }
  111.39  
  111.40 -JNIEXPORT void JNICALL
  111.41 -Java_sun_awt_X11_XRobotPeer__1dispose (JNIEnv * env, jclass cls)
  111.42 -{
  111.43 -    if (--s_robotInstanceCounter) {
  111.44 -        return;
  111.45 -    }
  111.46 -
  111.47 -    // This is the last instance of the XRobotPeer being released
  111.48 -
  111.49 -    if (xcompositeExtTested && xcompositeExtAvailable && xcompositeLibHandle) {
  111.50 -        // The lib is loaded in IsXCompositeAvailable(). Unload under AWT_LOCK
  111.51 -        // so that the shutdown function of the lib behaves correctly.
  111.52 -        AWT_LOCK();
  111.53 -        dlclose(xcompositeLibHandle);
  111.54 -        AWT_UNLOCK();
  111.55 -    }
  111.56 -
  111.57 -    xcompositeExtTested = False;
  111.58 -    xcompositeExtAvailable = False;
  111.59 -    xcompositeLibHandle = NULL;
  111.60 -}
  111.61 -
  111.62 -/*
  111.63 - * Returns True only if XCOMPOSITE is of version 0.3 or higher.
  111.64 - * The functions that we need are available since that version.
  111.65 - *
  111.66 - * Must be invoked under AWT_LOCK.
  111.67 - *
  111.68 - * Leaves the library loaded if the version is correct.
  111.69 - */
  111.70 -static Bool IsXCompositeAvailable()
  111.71 -{
  111.72 -    if (!xcompositeExtTested) {
  111.73 -        int opcode, eventb, errorb;
  111.74 -
  111.75 -        if (XQueryExtension(awt_display, "Composite", &opcode, &eventb, &errorb)) {
  111.76 -            xcompositeLibHandle = dlopen("libXcomposite.so.1", RTLD_LAZY | RTLD_GLOBAL);
  111.77 -#ifndef __linux__ /* SOLARIS */
  111.78 -            if (xcompositeLibHandle == NULL) {
  111.79 -                xcompositeLibHandle = dlopen("/usr/sfw/lib/libXcomposite.so.1",
  111.80 -                        RTLD_LAZY | RTLD_GLOBAL);
  111.81 -            }
  111.82 -#endif
  111.83 -
  111.84 -            if (xcompositeLibHandle) {
  111.85 -                int major, minor;
  111.86 -                XCompositeQueryVersion = (T_XCompositeQueryVersion)dlsym(xcompositeLibHandle, "XCompositeQueryVersion");
  111.87 -
  111.88 -                if (XCompositeQueryVersion && XCompositeQueryVersion(awt_display, &major, &minor)) {
  111.89 -                    if (major >= 0 && minor >= 3) {
  111.90 -                        XCompositeGetOverlayWindow = (T_XCompositeGetOverlayWindow)dlsym(xcompositeLibHandle, "XCompositeGetOverlayWindow");
  111.91 -                        XCompositeReleaseOverlayWindow = (T_XCompositeReleaseOverlayWindow)dlsym(xcompositeLibHandle, "XCompositeReleaseOverlayWindow");
  111.92 -
  111.93 -                        if (XCompositeGetOverlayWindow && XCompositeReleaseOverlayWindow) {
  111.94 -                            xcompositeExtAvailable = True;
  111.95 -                        }
  111.96 -                    }
  111.97 -                }
  111.98 -
  111.99 -                if (!xcompositeExtAvailable) {
 111.100 -                    dlclose(xcompositeLibHandle);
 111.101 -                } /* else the lib is unloaded in _dispose() */
 111.102 -            }
 111.103 -        }
 111.104 -
 111.105 -        xcompositeExtTested = True;
 111.106 -    }
 111.107 -
 111.108 -    return xcompositeExtAvailable;
 111.109 -}
 111.110  
 111.111  JNIEXPORT void JNICALL
 111.112  Java_sun_awt_X11_XRobotPeer_getRGBPixelsImpl( JNIEnv *env,
 111.113 @@ -299,7 +211,7 @@
 111.114      jint *ary;               /* Array of jints for sending pixel values back
 111.115                                * to parent process.
 111.116                                */
 111.117 -    Window window;
 111.118 +    Window rootWindow;
 111.119      AwtGraphicsConfigDataPtr adata;
 111.120  
 111.121      DTRACE_PRINTLN6("RobotPeer: getRGBPixelsImpl(%lx, %d, %d, %d, %d, %x)", xgc, x, y, width, height, pixelArray);
 111.122 @@ -316,24 +228,14 @@
 111.123      adata = (AwtGraphicsConfigDataPtr) JNU_GetLongFieldAsPtr(env, xgc, x11GraphicsConfigIDs.aData);
 111.124      DASSERT(adata != NULL);
 111.125  
 111.126 -    window = XRootWindow(awt_display, adata->awt_visInfo.screen);
 111.127 -
 111.128 -    if (IsXCompositeAvailable()) {
 111.129 -        // Use 'composite overlay window' instead of the root window.
 111.130 -        // See 6903034 for details.
 111.131 -        window = XCompositeGetOverlayWindow(awt_display, window);
 111.132 -    }
 111.133 -
 111.134 -    image = getWindowImage(awt_display, window, x, y, width, height);
 111.135 +    rootWindow = XRootWindow(awt_display, adata->awt_visInfo.screen);
 111.136 +    image = getWindowImage(awt_display, rootWindow, x, y, width, height);
 111.137  
 111.138      /* Array to use to crunch around the pixel values */
 111.139      ary = (jint *) malloc(width * height * sizeof (jint));
 111.140      if (ary == NULL) {
 111.141          JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError");
 111.142          XDestroyImage(image);
 111.143 -        if (IsXCompositeAvailable()) {
 111.144 -            XCompositeReleaseOverlayWindow(awt_display, window);
 111.145 -        }
 111.146          AWT_UNLOCK();
 111.147          return;
 111.148      }
 111.149 @@ -354,9 +256,6 @@
 111.150      free(ary);
 111.151  
 111.152      XDestroyImage(image);
 111.153 -    if (IsXCompositeAvailable()) {
 111.154 -        XCompositeReleaseOverlayWindow(awt_display, window);
 111.155 -    }
 111.156  
 111.157      AWT_UNLOCK();
 111.158  }
   112.1 --- a/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c	Wed May 18 16:32:05 2011 -0700
   112.2 +++ b/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c	Wed May 18 18:18:04 2011 -0700
   112.3 @@ -892,8 +892,9 @@
   112.4  
   112.5          if (res != 0 || p == NULL || p->pw_name == NULL || *(p->pw_name) == '\0') {
   112.6              /* not found or error */
   112.7 -            if (errno != 0 && errno != ENOENT)
   112.8 -                throwUnixException(env, errno);
   112.9 +            if (errno == 0)
  112.10 +                errno = ENOENT;
  112.11 +            throwUnixException(env, errno);
  112.12          } else {
  112.13              jsize len = strlen(p->pw_name);
  112.14              result = (*env)->NewByteArray(env, len);
  112.15 @@ -941,14 +942,14 @@
  112.16          retry = 0;
  112.17          if (res != 0 || g == NULL || g->gr_name == NULL || *(g->gr_name) == '\0') {
  112.18              /* not found or error */
  112.19 -            if (errno != 0 && errno != ENOENT) {
  112.20 -                if (errno == ERANGE) {
  112.21 -                    /* insufficient buffer size so need larger buffer */
  112.22 -                    buflen += ENT_BUF_SIZE;
  112.23 -                    retry = 1;
  112.24 -                } else {
  112.25 -                    throwUnixException(env, errno);
  112.26 -                }
  112.27 +            if (errno == ERANGE) {
  112.28 +                /* insufficient buffer size so need larger buffer */
  112.29 +                buflen += ENT_BUF_SIZE;
  112.30 +                retry = 1;
  112.31 +            } else {
  112.32 +                if (errno == 0)
  112.33 +                    errno = ENOENT;
  112.34 +                throwUnixException(env, errno);
  112.35              }
  112.36          } else {
  112.37              jsize len = strlen(g->gr_name);
   113.1 --- a/src/windows/classes/sun/awt/windows/WFramePeer.java	Wed May 18 16:32:05 2011 -0700
   113.2 +++ b/src/windows/classes/sun/awt/windows/WFramePeer.java	Wed May 18 18:18:04 2011 -0700
   113.3 @@ -107,8 +107,16 @@
   113.4              Rectangle currentDevBounds = currentDevGC.getBounds();
   113.5              Rectangle primaryDevBounds = primaryDevGC.getBounds();
   113.6  
   113.7 -            b.width -= (currentDevBounds.width - primaryDevBounds.width);
   113.8 -            b.height -= (currentDevBounds.height - primaryDevBounds.height);
   113.9 +            boolean isCurrentDevLarger =
  113.10 +                ((currentDevBounds.width - primaryDevBounds.width > 0) ||
  113.11 +                 (currentDevBounds.height - primaryDevBounds.height > 0));
  113.12 +
  113.13 +            // the window manager doesn't seem to compensate for differences when
  113.14 +            // the primary monitor is larger than the monitor that display the window
  113.15 +            if (isCurrentDevLarger) {
  113.16 +                b.width -= (currentDevBounds.width - primaryDevBounds.width);
  113.17 +                b.height -= (currentDevBounds.height - primaryDevBounds.height);
  113.18 +            }
  113.19          }
  113.20      }
  113.21  
   114.1 --- a/src/windows/classes/sun/java2d/d3d/D3DRenderer.java	Wed May 18 16:32:05 2011 -0700
   114.2 +++ b/src/windows/classes/sun/java2d/d3d/D3DRenderer.java	Wed May 18 18:18:04 2011 -0700
   114.3 @@ -102,15 +102,20 @@
   114.4              final ParallelogramPipe realpipe = d3dr.getAAParallelogramPipe();
   114.5              return new ParallelogramPipe() {
   114.6                  public void fillParallelogram(SunGraphics2D sg2d,
   114.7 +                                              double ux1, double uy1,
   114.8 +                                              double ux2, double uy2,
   114.9                                                double x, double y,
  114.10                                                double dx1, double dy1,
  114.11                                                double dx2, double dy2)
  114.12                  {
  114.13                      GraphicsPrimitive.tracePrimitive("D3DFillAAParallelogram");
  114.14                      realpipe.fillParallelogram(sg2d,
  114.15 +                                               ux1, uy1, ux2, uy2,
  114.16                                                 x, y, dx1, dy1, dx2, dy2);
  114.17                  }
  114.18                  public void drawParallelogram(SunGraphics2D sg2d,
  114.19 +                                              double ux1, double uy1,
  114.20 +                                              double ux2, double uy2,
  114.21                                                double x, double y,
  114.22                                                double dx1, double dy1,
  114.23                                                double dx2, double dy2,
  114.24 @@ -118,6 +123,7 @@
  114.25                  {
  114.26                      GraphicsPrimitive.tracePrimitive("D3DDrawAAParallelogram");
  114.27                      realpipe.drawParallelogram(sg2d,
  114.28 +                                               ux1, uy1, ux2, uy2,
  114.29                                                 x, y, dx1, dy1, dx2, dy2,
  114.30                                                 lw1, lw2);
  114.31                  }
  114.32 @@ -167,21 +173,29 @@
  114.33              d3dr.fillSpans(sg2d, si, transx, transy);
  114.34          }
  114.35          public void fillParallelogram(SunGraphics2D sg2d,
  114.36 +                                      double ux1, double uy1,
  114.37 +                                      double ux2, double uy2,
  114.38                                        double x, double y,
  114.39                                        double dx1, double dy1,
  114.40                                        double dx2, double dy2)
  114.41          {
  114.42              GraphicsPrimitive.tracePrimitive("D3DFillParallelogram");
  114.43 -            d3dr.fillParallelogram(sg2d, x, y, dx1, dy1, dx2, dy2);
  114.44 +            d3dr.fillParallelogram(sg2d,
  114.45 +                                   ux1, uy1, ux2, uy2,
  114.46 +                                   x, y, dx1, dy1, dx2, dy2);
  114.47          }
  114.48          public void drawParallelogram(SunGraphics2D sg2d,
  114.49 +                                      double ux1, double uy1,
  114.50 +                                      double ux2, double uy2,
  114.51                                        double x, double y,
  114.52                                        double dx1, double dy1,
  114.53                                        double dx2, double dy2,
  114.54                                        double lw1, double lw2)
  114.55          {
  114.56              GraphicsPrimitive.tracePrimitive("D3DDrawParallelogram");
  114.57 -            d3dr.drawParallelogram(sg2d, x, y, dx1, dy1, dx2, dy2, lw1, lw2);
  114.58 +            d3dr.drawParallelogram(sg2d,
  114.59 +                                   ux1, uy1, ux2, uy2,
  114.60 +                                   x, y, dx1, dy1, dx2, dy2, lw1, lw2);
  114.61          }
  114.62          public void copyArea(SunGraphics2D sg2d,
  114.63                               int x, int y, int w, int h, int dx, int dy)
   115.1 --- a/src/windows/classes/sun/nio/fs/WindowsWatchService.java	Wed May 18 16:32:05 2011 -0700
   115.2 +++ b/src/windows/classes/sun/nio/fs/WindowsWatchService.java	Wed May 18 18:18:04 2011 -0700
   115.3 @@ -464,15 +464,15 @@
   115.4          {
   115.5              switch (action) {
   115.6                  case FILE_ACTION_MODIFIED :
   115.7 -                    return StandardWatchEventKind.ENTRY_MODIFY;
   115.8 +                    return StandardWatchEventKinds.ENTRY_MODIFY;
   115.9  
  115.10                  case FILE_ACTION_ADDED :
  115.11                  case FILE_ACTION_RENAMED_NEW_NAME :
  115.12 -                    return StandardWatchEventKind.ENTRY_CREATE;
  115.13 +                    return StandardWatchEventKinds.ENTRY_CREATE;
  115.14  
  115.15                  case FILE_ACTION_REMOVED :
  115.16                  case FILE_ACTION_RENAMED_OLD_NAME :
  115.17 -                    return StandardWatchEventKind.ENTRY_DELETE;
  115.18 +                    return StandardWatchEventKinds.ENTRY_DELETE;
  115.19  
  115.20                  default :
  115.21                      return null;  // action not recognized
  115.22 @@ -548,7 +548,7 @@
  115.23                  if (info.error() != 0) {
  115.24                      // buffer overflow
  115.25                      if (info.error() == ERROR_NOTIFY_ENUM_DIR) {
  115.26 -                        key.signalEvent(StandardWatchEventKind.OVERFLOW, null);
  115.27 +                        key.signalEvent(StandardWatchEventKinds.OVERFLOW, null);
  115.28                      } else {
  115.29                          // other error so cancel key
  115.30                          implCancelKey(key);
  115.31 @@ -562,7 +562,7 @@
  115.32                      processEvents(key, info.bytesTransferred());
  115.33                  } else {
  115.34                      // insufficient buffer size
  115.35 -                    key.signalEvent(StandardWatchEventKind.OVERFLOW, null);
  115.36 +                    key.signalEvent(StandardWatchEventKinds.OVERFLOW, null);
  115.37                  }
  115.38  
  115.39                  // start read for next batch of changes
   116.1 --- a/src/windows/native/sun/java2d/d3d/D3DPipelineManager.cpp	Wed May 18 16:32:05 2011 -0700
   116.2 +++ b/src/windows/native/sun/java2d/d3d/D3DPipelineManager.cpp	Wed May 18 18:18:04 2011 -0700
   116.3 @@ -192,6 +192,14 @@
   116.4      pMgr = D3DPipelineManager::GetInstance();
   116.5      RETURN_IF_NULL(pMgr);
   116.6      hMon = pMgr->pd3d9->GetAdapterMonitor(adapter);
   116.7 +
   116.8 +    /*
   116.9 +     * If we don't have devices initialized yet, no sense to clear them.
  116.10 +     */
  116.11 +    if (!Devices::GetInstance()){
  116.12 +         return;
  116.13 +    }
  116.14 +
  116.15      gdiScreen = AwtWin32GraphicsDevice::GetScreenFromHMONITOR(hMon);
  116.16  
  116.17      JNU_CallStaticMethodByName(env, NULL,
   117.1 --- a/src/windows/native/sun/security/mscapi/security.cpp	Wed May 18 16:32:05 2011 -0700
   117.2 +++ b/src/windows/native/sun/security/mscapi/security.cpp	Wed May 18 18:18:04 2011 -0700
   117.3 @@ -705,7 +705,7 @@
   117.4      HCRYPTPROV hCryptProv = NULL;
   117.5      HCRYPTKEY hKeyPair;
   117.6      DWORD dwFlags = (keySize << 16) | CRYPT_EXPORTABLE;
   117.7 -    jobject keypair;
   117.8 +    jobject keypair = NULL;
   117.9      const char* pszKeyContainerName = NULL; // UUID
  117.10  
  117.11      __try
   118.1 --- a/src/windows/native/sun/windows/Devices.h	Wed May 18 16:32:05 2011 -0700
   118.2 +++ b/src/windows/native/sun/windows/Devices.h	Wed May 18 18:18:04 2011 -0700
   118.3 @@ -36,6 +36,7 @@
   118.4  class Devices {
   118.5  
   118.6  public:
   118.7 +static Devices*                 GetInstance();
   118.8  static BOOL                     UpdateInstance(JNIEnv *env);
   118.9         int                      GetNumDevices() { return numDevices; }
  118.10         AwtWin32GraphicsDevice*  GetDeviceReference(int index, BOOL adjust = TRUE);
  118.11 @@ -59,7 +60,6 @@
  118.12  private:
  118.13                                  Devices(int numElements);
  118.14         void                     AddReference();
  118.15 -static Devices*                 GetInstance();
  118.16  
  118.17         AwtWin32GraphicsDevice** devices;
  118.18         int                      refCount;
   119.1 --- a/src/windows/native/sun/windows/awt_Choice.cpp	Wed May 18 16:32:05 2011 -0700
   119.2 +++ b/src/windows/native/sun/windows/awt_Choice.cpp	Wed May 18 18:18:04 2011 -0700
   119.3 @@ -396,6 +396,12 @@
   119.4  
   119.5      DASSERT(::IsWindow(hwnd));
   119.6  
   119.7 +    // This branch is required for the proper work of AwtComponent::GetComponent() method
   119.8 +    // while hovering drop-down list
   119.9 +    if (message == WmAwtIsComponent) {
  119.10 +        return (LRESULT)TRUE;
  119.11 +    }
  119.12 +
  119.13      switch (message) {
  119.14          case WM_LBUTTONDOWN: {
  119.15              DWORD curPos = ::GetMessagePos();
   120.1 --- a/src/windows/native/sun/windows/awt_Component.cpp	Wed May 18 16:32:05 2011 -0700
   120.2 +++ b/src/windows/native/sun/windows/awt_Component.cpp	Wed May 18 18:18:04 2011 -0700
   120.3 @@ -364,7 +364,6 @@
   120.4      AwtComponent *component =
   120.5          (AwtComponent *)::GetWindowLongPtr(hWnd, GWLP_USERDATA);
   120.6      DASSERT(!component || !IsBadReadPtr(component, sizeof(AwtComponent)) );
   120.7 -    DASSERT(!component || component->GetHWnd() == hWnd );
   120.8      return component;
   120.9  }
  120.10  
   121.1 --- a/src/windows/native/sun/windows/awt_Frame.cpp	Wed May 18 16:32:05 2011 -0700
   121.2 +++ b/src/windows/native/sun/windows/awt_Frame.cpp	Wed May 18 18:18:04 2011 -0700
   121.3 @@ -344,17 +344,6 @@
   121.4                  SetImeTargetComponent(NULL);
   121.5              }
   121.6              break;
   121.7 -        // TODO: when a Choice's list is dropped down and we're scrolling in
   121.8 -        // the list WM_MOUSEWHEEL messages come to the poxy, not to the list. Why?
   121.9 -        case WM_MOUSEWHEEL:
  121.10 -            focusOwner = AwtComponent::GetComponent(sm_focusOwner);
  121.11 -            if  (focusOwner != NULL &&
  121.12 -                 focusOwner != this) // avoid recursive calls
  121.13 -            {
  121.14 -                 retValue = focusOwner->WindowProc(message, wParam, lParam);
  121.15 -                 mr = mrConsume;
  121.16 -            }
  121.17 -            break;
  121.18          case WM_SETFOCUS:
  121.19              if (sm_inSynthesizeFocus) break; // pass it up the WindowProc chain
  121.20  
   122.1 --- a/test/ProblemList.txt	Wed May 18 16:32:05 2011 -0700
   122.2 +++ b/test/ProblemList.txt	Wed May 18 18:18:04 2011 -0700
   122.3 @@ -195,6 +195,9 @@
   122.4  
   122.5  # jdk_lang
   122.6  
   122.7 +# requires junit
   122.8 +java/lang/invoke/InvokeDynamicPrintArgs.java                    generic-all
   122.9 +
  122.10  # Times out on solaris 10 sparc
  122.11  java/lang/ClassLoader/Assert.java				generic-all
  122.12  
   123.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   123.2 +++ b/test/com/sun/management/GarbageCollectorMXBean/GarbageCollectionNotificationContentTest.java	Wed May 18 18:18:04 2011 -0700
   123.3 @@ -0,0 +1,163 @@
   123.4 +/*
   123.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   123.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   123.7 + *
   123.8 + * This code is free software; you can redistribute it and/or modify it
   123.9 + * under the terms of the GNU General Public License version 2 only, as
  123.10 + * published by the Free Software Foundation.
  123.11 + *
  123.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  123.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  123.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  123.15 + * version 2 for more details (a copy is included in the LICENSE file that
  123.16 + * accompanied this code).
  123.17 + *
  123.18 + * You should have received a copy of the GNU General Public License version
  123.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  123.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  123.21 + *
  123.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  123.23 + * or visit www.oracle.com if you need additional information or have any
  123.24 + * questions.
  123.25 + */
  123.26 +
  123.27 +/*
  123.28 + * @test
  123.29 + * @bug     7036199
  123.30 + * @summary Check that GarbageCollectionNotification contents are reasonable
  123.31 + * @author  Frederic Parain
  123.32 + * @run     main/othervm GarbageCollectionNotificationContentTest
  123.33 + */
  123.34 +
  123.35 +import java.util.*;
  123.36 +import java.lang.management.*;
  123.37 +import java.lang.reflect.*;
  123.38 +import javax.management.*;
  123.39 +import javax.management.openmbean.*;
  123.40 +import com.sun.management.GarbageCollectionNotificationInfo;
  123.41 +import com.sun.management.GcInfo;
  123.42 +import java.security.AccessController;
  123.43 +import java.security.PrivilegedAction;
  123.44 +import java.lang.reflect.Field;
  123.45 +
  123.46 +public class GarbageCollectionNotificationContentTest {
  123.47 +    private static HashMap<String,GarbageCollectionNotificationInfo> listenerInvoked
  123.48 +        = new HashMap<String,GarbageCollectionNotificationInfo>();
  123.49 +    static volatile long count = 0;
  123.50 +    static volatile long number = 0;
  123.51 +    static Object synchronizer = new Object();
  123.52 +
  123.53 +    static class GcListener implements NotificationListener {
  123.54 +        public void handleNotification(Notification notif, Object handback) {
  123.55 +            String type = notif.getType();
  123.56 +            if (type.equals(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION)) {
  123.57 +                GarbageCollectionNotificationInfo gcNotif =
  123.58 +                    GarbageCollectionNotificationInfo.from((CompositeData) notif.getUserData());
  123.59 +                String source = ((ObjectName)notif.getSource()).getCanonicalName();
  123.60 +                synchronized(synchronizer) {
  123.61 +                    if(listenerInvoked.get(source) == null) {
  123.62 +                            listenerInvoked.put(((ObjectName)notif.getSource()).getCanonicalName(),gcNotif);
  123.63 +                            count++;
  123.64 +                            if(count >= number) {
  123.65 +                                synchronizer.notify();
  123.66 +                            }
  123.67 +                    }
  123.68 +                }
  123.69 +            }
  123.70 +        }
  123.71 +    }
  123.72 +
  123.73 +    public static void main(String[] args) throws Exception {
  123.74 +        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
  123.75 +        final Boolean isNotificationSupported = AccessController.doPrivileged (new PrivilegedAction<Boolean>() {
  123.76 +                public Boolean run() {
  123.77 +                    try {
  123.78 +                        Class cl = Class.forName("sun.management.VMManagementImpl");
  123.79 +                        Field f = cl.getDeclaredField("gcNotificationSupport");
  123.80 +                        f.setAccessible(true);
  123.81 +                        return f.getBoolean(null);
  123.82 +                    } catch(ClassNotFoundException e) {
  123.83 +                        return false;
  123.84 +                    } catch(NoSuchFieldException e) {
  123.85 +                        return false;
  123.86 +                    } catch(IllegalAccessException e) {
  123.87 +                        return false;
  123.88 +                    }
  123.89 +                }
  123.90 +            });
  123.91 +        if(!isNotificationSupported) {
  123.92 +            System.out.println("GC Notification not supported by the JVM, test skipped");
  123.93 +            return;
  123.94 +        }
  123.95 +        final ObjectName gcMXBeanPattern =
  123.96 +                new ObjectName("java.lang:type=GarbageCollector,*");
  123.97 +        Set<ObjectName> names =
  123.98 +                mbs.queryNames(gcMXBeanPattern, null);
  123.99 +        if (names.isEmpty())
 123.100 +            throw new Exception("Test incorrect: no GC MXBeans");
 123.101 +        number = names.size();
 123.102 +        for (ObjectName n : names) {
 123.103 +            if(mbs.isInstanceOf(n,"javax.management.NotificationEmitter")) {
 123.104 +                listenerInvoked.put(n.getCanonicalName(),null);
 123.105 +                GcListener listener = new GcListener();
 123.106 +                mbs.addNotificationListener(n, listener, null, null);
 123.107 +            }
 123.108 +        }
 123.109 +        // Invocation of System.gc() to trigger major GC
 123.110 +        System.gc();
 123.111 +        // Allocation of many short living and small objects to trigger minor GC
 123.112 +        Object data[] = new Object[32];
 123.113 +        for(int i = 0; i<100000000; i++) {
 123.114 +            data[i%32] = new int[8];
 123.115 +        }
 123.116 +        int wakeup = 0;
 123.117 +        synchronized(synchronizer) {
 123.118 +            while(count != number) {
 123.119 +                synchronizer.wait(10000);
 123.120 +                wakeup++;
 123.121 +                if(wakeup > 10)
 123.122 +                    break;
 123.123 +            }
 123.124 +        }
 123.125 +        for (GarbageCollectionNotificationInfo notif : listenerInvoked.values() ) {
 123.126 +            checkGarbageCollectionNotificationInfoContent(notif);
 123.127 +        }
 123.128 +        System.out.println("Test passed");
 123.129 +    }
 123.130 +
 123.131 +    private static void checkGarbageCollectionNotificationInfoContent(GarbageCollectionNotificationInfo notif) throws Exception {
 123.132 +        System.out.println("GC notification for "+notif.getGcName());
 123.133 +        System.out.print("Action: "+notif.getGcAction());
 123.134 +        System.out.println(" Cause: "+notif.getGcCause());
 123.135 +        GcInfo info = notif.getGcInfo();
 123.136 +        System.out.print("GC Info #" + info.getId());
 123.137 +        System.out.print(" start:" + info.getStartTime());
 123.138 +        System.out.print(" end:" + info.getEndTime());
 123.139 +        System.out.println(" (" + info.getDuration() + "ms)");
 123.140 +        Map<String, MemoryUsage> usage = info.getMemoryUsageBeforeGc();
 123.141 +
 123.142 +        List<String> pnames = new ArrayList<String>();
 123.143 +        for (Map.Entry entry : usage.entrySet() ) {
 123.144 +            String poolname = (String) entry.getKey();
 123.145 +            pnames.add(poolname);
 123.146 +            MemoryUsage busage = (MemoryUsage) entry.getValue();
 123.147 +            MemoryUsage ausage = (MemoryUsage) info.getMemoryUsageAfterGc().get(poolname);
 123.148 +            if (ausage == null) {
 123.149 +                throw new RuntimeException("After Gc Memory does not exist" +
 123.150 +                    " for " + poolname);
 123.151 +            }
 123.152 +            System.out.println("Usage for pool " + poolname);
 123.153 +            System.out.println("   Before GC: " + busage);
 123.154 +            System.out.println("   After GC: " + ausage);
 123.155 +        }
 123.156 +
 123.157 +        // check if memory usage for all memory pools are returned
 123.158 +        List<MemoryPoolMXBean> pools = ManagementFactory.getMemoryPoolMXBeans();
 123.159 +        for (MemoryPoolMXBean p : pools ) {
 123.160 +            if (!pnames.contains(p.getName())) {
 123.161 +                throw new RuntimeException("GcInfo does not contain " +
 123.162 +                    "memory usage for pool " + p.getName());
 123.163 +            }
 123.164 +        }
 123.165 +    }
 123.166 +}
   124.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   124.2 +++ b/test/com/sun/management/GarbageCollectorMXBean/GarbageCollectionNotificationTest.java	Wed May 18 18:18:04 2011 -0700
   124.3 @@ -0,0 +1,128 @@
   124.4 +/*
   124.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   124.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   124.7 + *
   124.8 + * This code is free software; you can redistribute it and/or modify it
   124.9 + * under the terms of the GNU General Public License version 2 only, as
  124.10 + * published by the Free Software Foundation.
  124.11 + *
  124.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  124.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  124.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  124.15 + * version 2 for more details (a copy is included in the LICENSE file that
  124.16 + * accompanied this code).
  124.17 + *
  124.18 + * You should have received a copy of the GNU General Public License version
  124.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  124.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  124.21 + *
  124.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  124.23 + * or visit www.oracle.com if you need additional information or have any
  124.24 + * questions.
  124.25 + */
  124.26 +
  124.27 +/*
  124.28 + * @test
  124.29 + * @bug     7036199
  124.30 + * @summary Check that GarbageCollection notification are thrown by every GarbageCollectorMXBean
  124.31 + * @author  Frederic Parain
  124.32 + * @run     main/othervm GarbageCollectionNotificationTest
  124.33 + */
  124.34 +
  124.35 +import java.util.*;
  124.36 +import java.lang.management.*;
  124.37 +import java.lang.reflect.*;
  124.38 +import javax.management.*;
  124.39 +import javax.management.openmbean.*;
  124.40 +import com.sun.management.GarbageCollectionNotificationInfo;
  124.41 +import com.sun.management.GcInfo;
  124.42 +import java.security.AccessController;
  124.43 +import java.security.PrivilegedAction;
  124.44 +import java.lang.reflect.Field;
  124.45 +
  124.46 +public class GarbageCollectionNotificationTest {
  124.47 +    private static HashMap<String,Boolean> listenerInvoked = new HashMap<String,Boolean>();
  124.48 +    static volatile long count = 0;
  124.49 +    static volatile long number = 0;
  124.50 +    static Object synchronizer = new Object();
  124.51 +
  124.52 +    static class GcListener implements NotificationListener {
  124.53 +        public void handleNotification(Notification notif, Object handback) {
  124.54 +            String type = notif.getType();
  124.55 +            if (type.equals(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION)) {
  124.56 +                GarbageCollectionNotificationInfo gcNotif =
  124.57 +                    GarbageCollectionNotificationInfo.from((CompositeData) notif.getUserData());
  124.58 +                String source = ((ObjectName)notif.getSource()).getCanonicalName();
  124.59 +                synchronized(synchronizer) {
  124.60 +                    if(!listenerInvoked.get(source)) {
  124.61 +                            listenerInvoked.put(((ObjectName)notif.getSource()).getCanonicalName(),true);
  124.62 +                            count++;
  124.63 +                            if(count >= number) {
  124.64 +                                synchronizer.notify();
  124.65 +                            }
  124.66 +                    }
  124.67 +                }
  124.68 +            }
  124.69 +        }
  124.70 +    }
  124.71 +
  124.72 +    public static void main(String[] args) throws Exception {
  124.73 +        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
  124.74 +        final Boolean isNotificationSupported = AccessController.doPrivileged (new PrivilegedAction<Boolean>() {
  124.75 +                public Boolean run() {
  124.76 +                    try {
  124.77 +                        Class cl = Class.forName("sun.management.VMManagementImpl");
  124.78 +                        Field f = cl.getDeclaredField("gcNotificationSupport");
  124.79 +                        f.setAccessible(true);
  124.80 +                        return f.getBoolean(null);
  124.81 +                    } catch(ClassNotFoundException e) {
  124.82 +                        return false;
  124.83 +                    } catch(NoSuchFieldException e) {
  124.84 +                        return false;
  124.85 +                    } catch(IllegalAccessException e) {
  124.86 +                        return false;
  124.87 +                    }
  124.88 +                }
  124.89 +            });
  124.90 +        if(!isNotificationSupported) {
  124.91 +            System.out.println("GC Notification not supported by the JVM, test skipped");
  124.92 +            return;
  124.93 +        }
  124.94 +        final ObjectName gcMXBeanPattern =
  124.95 +                new ObjectName("java.lang:type=GarbageCollector,*");
  124.96 +        Set<ObjectName> names =
  124.97 +                mbs.queryNames(gcMXBeanPattern, null);
  124.98 +        if (names.isEmpty())
  124.99 +            throw new Exception("Test incorrect: no GC MXBeans");
 124.100 +        number = names.size();
 124.101 +        for (ObjectName n : names) {
 124.102 +            if(mbs.isInstanceOf(n,"javax.management.NotificationEmitter")) {
 124.103 +                listenerInvoked.put(n.getCanonicalName(),false);
 124.104 +                GcListener listener = new GcListener();
 124.105 +                mbs.addNotificationListener(n, listener, null, null);
 124.106 +            }
 124.107 +        }
 124.108 +        // Invocation of System.gc() to trigger major GC
 124.109 +        System.gc();
 124.110 +        // Allocation of many short living and small objects to trigger minor GC
 124.111 +        Object data[] = new Object[32];
 124.112 +        for(int i = 0; i<100000000; i++) {
 124.113 +            data[i%32] = new int[8];
 124.114 +        }
 124.115 +        int wakeup = 0;
 124.116 +        synchronized(synchronizer) {
 124.117 +            while(count != number) {
 124.118 +                synchronizer.wait(10000);
 124.119 +                wakeup++;
 124.120 +                if(wakeup > 10)
 124.121 +                    break;
 124.122 +            }
 124.123 +        }
 124.124 +        for (String source : listenerInvoked.keySet()) {
 124.125 +            if(!listenerInvoked.get(source))
 124.126 +                throw new Exception("Test incorrect: notifications have not been sent for "
 124.127 +                                    + source);
 124.128 +        }
 124.129 +        System.out.println("Test passed");
 124.130 +    }
 124.131 +}
   125.1 --- a/test/com/sun/nio/sctp/SctpChannel/SocketOptionTests.java	Wed May 18 16:32:05 2011 -0700
   125.2 +++ b/test/com/sun/nio/sctp/SctpChannel/SocketOptionTests.java	Wed May 18 18:18:04 2011 -0700
   125.3 @@ -40,7 +40,7 @@
   125.4  import com.sun.nio.sctp.SctpSocketOption;
   125.5  import java.security.AccessController;
   125.6  import sun.security.action.GetPropertyAction;
   125.7 -import static com.sun.nio.sctp.SctpStandardSocketOption.*;
   125.8 +import static com.sun.nio.sctp.SctpStandardSocketOptions.*;
   125.9  import static java.lang.System.out;
  125.10  
  125.11  public class SocketOptionTests {
   126.1 --- a/test/com/sun/nio/sctp/SctpMultiChannel/SocketOptionTests.java	Wed May 18 16:32:05 2011 -0700
   126.2 +++ b/test/com/sun/nio/sctp/SctpMultiChannel/SocketOptionTests.java	Wed May 18 18:18:04 2011 -0700
   126.3 @@ -48,7 +48,7 @@
   126.4  import com.sun.nio.sctp.SctpSocketOption;
   126.5  import java.security.AccessController;
   126.6  import sun.security.action.GetPropertyAction;
   126.7 -import static com.sun.nio.sctp.SctpStandardSocketOption.*;
   126.8 +import static com.sun.nio.sctp.SctpStandardSocketOptions.*;
   126.9  import static java.lang.System.out;
  126.10  
  126.11  public class SocketOptionTests {
   127.1 --- a/test/java/awt/Component/Revalidate/Revalidate.java	Wed May 18 16:32:05 2011 -0700
   127.2 +++ b/test/java/awt/Component/Revalidate/Revalidate.java	Wed May 18 18:18:04 2011 -0700
   127.3 @@ -26,7 +26,7 @@
   127.4    @bug 7036669
   127.5    @summary Test Component.revalidate() method
   127.6    @author anthony.petrov@oracle.com: area=awt.component
   127.7 -  @run main Revalidate
   127.8 +  @run main/othervm -Djava.awt.smartInvalidate=true Revalidate
   127.9  */
  127.10  
  127.11  import java.awt.*;
   128.1 --- a/test/java/awt/Container/ValidateRoot/InvalidateMustRespectValidateRoots.java	Wed May 18 16:32:05 2011 -0700
   128.2 +++ b/test/java/awt/Container/ValidateRoot/InvalidateMustRespectValidateRoots.java	Wed May 18 18:18:04 2011 -0700
   128.3 @@ -26,7 +26,7 @@
   128.4    @bug 6852592
   128.5    @summary invalidate() must stop when it encounters a validate root
   128.6    @author anthony.petrov@sun.com
   128.7 -  @run main InvalidateMustRespectValidateRoots
   128.8 +  @run main/othervm -Djava.awt.smartInvalidate=true InvalidateMustRespectValidateRoots
   128.9  */
  128.10  
  128.11  import javax.swing.*;
   129.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   129.2 +++ b/test/java/awt/Paint/PgramUserBoundsTest.java	Wed May 18 18:18:04 2011 -0700
   129.3 @@ -0,0 +1,126 @@
   129.4 +/*
   129.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   129.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   129.7 + *
   129.8 + * This code is free software; you can redistribute it and/or modify it
   129.9 + * under the terms of the GNU General Public License version 2 only, as
  129.10 + * published by the Free Software Foundation.
  129.11 + *
  129.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  129.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  129.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  129.15 + * version 2 for more details (a copy is included in the LICENSE file that
  129.16 + * accompanied this code).
  129.17 + *
  129.18 + * You should have received a copy of the GNU General Public License version
  129.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  129.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  129.21 + *
  129.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  129.23 + * or visit www.oracle.com if you need additional information or have any
  129.24 + * questions.
  129.25 + */
  129.26 +
  129.27 +/**
  129.28 + * @test
  129.29 + * @bug 7043054
  129.30 + * @summary Verifies that Paint objects receive the appropriate user space
  129.31 + *          bounds in their createContext() method
  129.32 + * @run main PgramUserBoundsTest
  129.33 + */
  129.34 +
  129.35 +import java.awt.Color;
  129.36 +import java.awt.Graphics2D;
  129.37 +import java.awt.Paint;
  129.38 +import java.awt.PaintContext;
  129.39 +import java.awt.RenderingHints;
  129.40 +import java.awt.Rectangle;
  129.41 +import java.awt.geom.AffineTransform;
  129.42 +import java.awt.geom.Line2D;
  129.43 +import java.awt.geom.Rectangle2D;
  129.44 +import java.awt.image.BufferedImage;
  129.45 +import java.awt.image.ColorModel;
  129.46 +
  129.47 +public class PgramUserBoundsTest {
  129.48 +    static final int MinX = 10;
  129.49 +    static final int MinY = 20;
  129.50 +    static final int MaxX = 30;
  129.51 +    static final int MaxY = 50;
  129.52 +    static AffineTransform identity = new AffineTransform();
  129.53 +
  129.54 +    public static void main(String argv[]) {
  129.55 +        BufferedImage bimg =
  129.56 +            new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
  129.57 +        Graphics2D g2d = bimg.createGraphics();
  129.58 +        g2d.setPaint(new BoundsCheckerPaint(MinX, MinY, MaxX, MaxY));
  129.59 +        testAll(g2d);
  129.60 +        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
  129.61 +                             RenderingHints.VALUE_ANTIALIAS_ON);
  129.62 +        testAll(g2d);
  129.63 +    }
  129.64 +
  129.65 +    static void testAll(Graphics2D g2d) {
  129.66 +        g2d.setTransform(identity);
  129.67 +        g2d.translate(100, 100);
  129.68 +        testPrimitives(g2d);
  129.69 +
  129.70 +        g2d.setTransform(identity);
  129.71 +        g2d.scale(10, 10);
  129.72 +        testPrimitives(g2d);
  129.73 +
  129.74 +        g2d.setTransform(identity);
  129.75 +        g2d.rotate(Math.PI/6);
  129.76 +        testPrimitives(g2d);
  129.77 +    }
  129.78 +
  129.79 +    static void testPrimitives(Graphics2D g2d) {
  129.80 +        testLine(g2d);
  129.81 +        testRect(g2d);
  129.82 +    }
  129.83 +
  129.84 +    static void testLine(Graphics2D g2d) {
  129.85 +        testLine(g2d, MinX, MinY, MaxX, MaxY);
  129.86 +        testLine(g2d, MaxX, MinY, MinX, MaxY);
  129.87 +        testLine(g2d, MinX, MaxY, MaxX, MinY);
  129.88 +        testLine(g2d, MaxX, MaxY, MinX, MinY);
  129.89 +    }
  129.90 +
  129.91 +    static void testRect(Graphics2D g2d) {
  129.92 +        g2d.fillRect(MinX, MinY, MaxX - MinX, MaxY - MinY);
  129.93 +        g2d.fill(new Rectangle(MinX, MinY, MaxX - MinX, MaxY - MinY));
  129.94 +    }
  129.95 +
  129.96 +    static void testLine(Graphics2D g2d, int x1, int y1, int x2, int y2) {
  129.97 +        g2d.drawLine(x1, y1, x2, y2);
  129.98 +        g2d.draw(new Line2D.Double(x1, y1, x2, y2));
  129.99 +    }
 129.100 +
 129.101 +    static class BoundsCheckerPaint implements Paint {
 129.102 +        private Color c = Color.WHITE;
 129.103 +        private Rectangle2D expectedBounds;
 129.104 +
 129.105 +        public BoundsCheckerPaint(double x1, double y1,
 129.106 +                                  double x2, double y2)
 129.107 +        {
 129.108 +            expectedBounds = new Rectangle2D.Double();
 129.109 +            expectedBounds.setFrameFromDiagonal(x1, y1, x2, y2);
 129.110 +        }
 129.111 +
 129.112 +        public int getTransparency() {
 129.113 +            return c.getTransparency();
 129.114 +        }
 129.115 +
 129.116 +        public PaintContext createContext(ColorModel cm,
 129.117 +                                          Rectangle deviceBounds,
 129.118 +                                          Rectangle2D userBounds,
 129.119 +                                          AffineTransform xform,
 129.120 +                                          RenderingHints hints)
 129.121 +        {
 129.122 +            System.out.println("user bounds = "+userBounds);
 129.123 +            if (!userBounds.equals(expectedBounds)) {
 129.124 +                throw new RuntimeException("bounds fail to match");
 129.125 +            }
 129.126 +            return c.createContext(cm, deviceBounds, userBounds, xform, hints);
 129.127 +        }
 129.128 +    }
 129.129 +}
   130.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   130.2 +++ b/test/java/awt/Toolkit/Headless/ExceptionContract/ExceptionContract.java	Wed May 18 18:18:04 2011 -0700
   130.3 @@ -0,0 +1,336 @@
   130.4 +/*
   130.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   130.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   130.7 + *
   130.8 + * This code is free software; you can redistribute it and/or modify it
   130.9 + * under the terms of the GNU General Public License version 2 only, as
  130.10 + * published by the Free Software Foundation.  Oracle designates this
  130.11 + * particular file as subject to the "Classpath" exception as provided
  130.12 + * by Oracle in the LICENSE file that accompanied this code.
  130.13 + *
  130.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
  130.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  130.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  130.17 + * version 2 for more details (a copy is included in the LICENSE file that
  130.18 + * accompanied this code).
  130.19 + *
  130.20 + * You should have received a copy of the GNU General Public License version
  130.21 + * 2 along with this work; if not, write to the Free Software Foundation,
  130.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  130.23 + *
  130.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  130.25 + * or visit www.oracle.com if you need additional information or have any
  130.26 + * questions.
  130.27 + */
  130.28 +
  130.29 +/*
  130.30 +  @test
  130.31 +  @bug 7040577
  130.32 +  @library ../../../regtesthelpers
  130.33 +  @build Sysout
  130.34 +  @summary Default implementation of Toolkit.loadSystemColors(int[]) and many others doesn't throw HE in hl env
  130.35 +  @author andrei dmitriev: area=awt.headless
  130.36 +  @run main/othervm -Djava.awt.headless=true ExceptionContract
  130.37 +*/
  130.38 +
  130.39 +import java.awt.*;
  130.40 +import java.util.Properties;
  130.41 +import test.java.awt.regtesthelpers.Sysout;
  130.42 +
  130.43 +import java.awt.datatransfer.Clipboard;
  130.44 +import java.awt.dnd.*;
  130.45 +import java.awt.dnd.peer.DragSourceContextPeer;
  130.46 +import java.awt.font.TextAttribute;
  130.47 +import java.awt.im.InputMethodHighlight;
  130.48 +import java.awt.image.*;
  130.49 +import java.awt.peer.*;
  130.50 +import java.net.URL;
  130.51 +import java.util.Map;
  130.52 +import java.util.Properties;
  130.53 +
  130.54 +public class ExceptionContract {
  130.55 +
  130.56 +    private static boolean passed = false;
  130.57 +    public static void main(String[] args)  {
  130.58 +        //Case1
  130.59 +        try{
  130.60 +            new _Toolkit().getLockingKeyState(1);
  130.61 +        } catch (HeadlessException he){
  130.62 +            passed = true;
  130.63 +        }
  130.64 +        if (!passed){
  130.65 +            throw new RuntimeException("Tk.getLockingKeyState() didn't throw HeadlessException while in the headless mode.");
  130.66 +        }
  130.67 +
  130.68 +        passed = false;
  130.69 +        //Case2
  130.70 +        try{
  130.71 +            new _Toolkit().setLockingKeyState(1, true);
  130.72 +        } catch (HeadlessException he){
  130.73 +            passed = true;
  130.74 +        }
  130.75 +        if (!passed){
  130.76 +            throw new RuntimeException("Tk.setLockingKeyState() didn't throw HeadlessException while in the headless mode.");
  130.77 +        }
  130.78 +
  130.79 +        passed = false;
  130.80 +        //Case3
  130.81 +        try{
  130.82 +            new _Toolkit().createCustomCursor(new BufferedImage(16, 16, BufferedImage.TYPE_INT_RGB), new Point(0,0), "Custom cursor");
  130.83 +        } catch (HeadlessException he){
  130.84 +            he.printStackTrace();
  130.85 +            passed = true;
  130.86 +        }
  130.87 +        if (!passed){
  130.88 +            throw new RuntimeException("Tk.createCustomCursor(args) didn't throw HeadlessException while in the headless mode.");
  130.89 +        }
  130.90 +
  130.91 +    }
  130.92 +
  130.93 +    static class _Toolkit extends Toolkit {
  130.94 +
  130.95 +        @Override
  130.96 +        public Cursor createCustomCursor(Image cursor, Point hotSpot, String name)
  130.97 +            throws IndexOutOfBoundsException, HeadlessException
  130.98 +        {
  130.99 +            return super.createCustomCursor(cursor, hotSpot, name);
 130.100 +        }
 130.101 +
 130.102 +
 130.103 +        @Override
 130.104 +        public void setLockingKeyState(int keyCode, boolean on) throws UnsupportedOperationException {
 130.105 +            super.setLockingKeyState(keyCode, on);
 130.106 +        }
 130.107 +
 130.108 +        @Override
 130.109 +        public boolean getLockingKeyState(int keyCode) throws UnsupportedOperationException {
 130.110 +            return super.getLockingKeyState(keyCode);
 130.111 +        }
 130.112 +
 130.113 +
 130.114 +        @Override
 130.115 +        public void loadSystemColors(int[] systemColors) throws HeadlessException {
 130.116 +            return;
 130.117 +        }
 130.118 +
 130.119 +        @Override
 130.120 +        protected DesktopPeer createDesktopPeer(Desktop target) throws HeadlessException {
 130.121 +            return null;
 130.122 +        }
 130.123 +
 130.124 +        @Override
 130.125 +        protected ButtonPeer createButton(Button target) throws HeadlessException {
 130.126 +            return null;
 130.127 +        }
 130.128 +
 130.129 +        @Override
 130.130 +        protected TextFieldPeer createTextField(TextField target) throws HeadlessException {
 130.131 +            return null;
 130.132 +        }
 130.133 +
 130.134 +        @Override
 130.135 +        protected LabelPeer createLabel(Label target) throws HeadlessException {
 130.136 +            return null;
 130.137 +        }
 130.138 +
 130.139 +        @Override
 130.140 +        protected ListPeer createList(List target) throws HeadlessException {
 130.141 +            return null;
 130.142 +        }
 130.143 +
 130.144 +        @Override
 130.145 +        protected CheckboxPeer createCheckbox(Checkbox target) throws HeadlessException {
 130.146 +            return null;
 130.147 +        }
 130.148 +
 130.149 +        @Override
 130.150 +        protected ScrollbarPeer createScrollbar(Scrollbar target) throws HeadlessException {
 130.151 +            return null;
 130.152 +        }
 130.153 +
 130.154 +        @Override
 130.155 +        protected ScrollPanePeer createScrollPane(ScrollPane target) throws HeadlessException {
 130.156 +            return null;
 130.157 +        }
 130.158 +
 130.159 +        @Override
 130.160 +        protected TextAreaPeer createTextArea(TextArea target) throws HeadlessException {
 130.161 +            return null;
 130.162 +        }
 130.163 +
 130.164 +        @Override
 130.165 +        protected ChoicePeer createChoice(Choice target) throws HeadlessException {
 130.166 +            return null;
 130.167 +        }
 130.168 +
 130.169 +        @Override
 130.170 +        protected FramePeer createFrame(Frame target) throws HeadlessException {
 130.171 +            return null;
 130.172 +        }
 130.173 +
 130.174 +        @Override
 130.175 +        protected CanvasPeer createCanvas(Canvas target) {
 130.176 +            return null;
 130.177 +        }
 130.178 +
 130.179 +        @Override
 130.180 +        protected PanelPeer createPanel(Panel target) {
 130.181 +            return null;
 130.182 +        }
 130.183 +
 130.184 +        @Override
 130.185 +        protected WindowPeer createWindow(Window target) throws HeadlessException {
 130.186 +            return null;
 130.187 +        }
 130.188 +
 130.189 +        @Override
 130.190 +        protected DialogPeer createDialog(Dialog target) throws HeadlessException {
 130.191 +            return null;
 130.192 +        }
 130.193 +
 130.194 +        @Override
 130.195 +        protected MenuBarPeer createMenuBar(MenuBar target) throws HeadlessException {
 130.196 +            return null;
 130.197 +        }
 130.198 +
 130.199 +        @Override
 130.200 +        protected MenuPeer createMenu(Menu target) throws HeadlessException {
 130.201 +            return null;
 130.202 +        }
 130.203 +
 130.204 +        @Override
 130.205 +        protected PopupMenuPeer createPopupMenu(PopupMenu target) throws HeadlessException {
 130.206 +            return null;
 130.207 +        }
 130.208 +
 130.209 +        @Override
 130.210 +        protected MenuItemPeer createMenuItem(MenuItem target) throws HeadlessException {
 130.211 +            return null;
 130.212 +        }
 130.213 +
 130.214 +        @Override
 130.215 +        protected FileDialogPeer createFileDialog(FileDialog target) throws HeadlessException {
 130.216 +            return null;
 130.217 +        }
 130.218 +
 130.219 +        @Override
 130.220 +        protected CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target) throws HeadlessException {
 130.221 +            return null;
 130.222 +        }
 130.223 +
 130.224 +        @Override
 130.225 +        protected FontPeer getFontPeer(String name, int style) {
 130.226 +            return null;
 130.227 +        }
 130.228 +
 130.229 +        @Override
 130.230 +        public Dimension getScreenSize() throws HeadlessException {
 130.231 +            return null;
 130.232 +        }
 130.233 +
 130.234 +        @Override
 130.235 +        public int getScreenResolution() throws HeadlessException {
 130.236 +            return 0;
 130.237 +        }
 130.238 +
 130.239 +        @Override
 130.240 +        public ColorModel getColorModel() throws HeadlessException {
 130.241 +            return null;
 130.242 +        }
 130.243 +
 130.244 +        @Override
 130.245 +        public String[] getFontList() {
 130.246 +            return new String[0];
 130.247 +        }
 130.248 +
 130.249 +        @Override
 130.250 +        public FontMetrics getFontMetrics(Font font) {
 130.251 +            return null;
 130.252 +        }
 130.253 +
 130.254 +        @Override
 130.255 +        public void sync() {
 130.256 +
 130.257 +        }
 130.258 +
 130.259 +        @Override
 130.260 +        public Image getImage(String filename) {
 130.261 +            return null;
 130.262 +        }
 130.263 +
 130.264 +        @Override
 130.265 +        public Image getImage(URL url) {
 130.266 +            return null;
 130.267 +        }
 130.268 +
 130.269 +        @Override
 130.270 +        public Image createImage(String filename) {
 130.271 +            return null;
 130.272 +        }
 130.273 +
 130.274 +        @Override
 130.275 +        public Image createImage(URL url) {
 130.276 +            return null;
 130.277 +        }
 130.278 +
 130.279 +        @Override
 130.280 +        public boolean prepareImage(Image image, int width, int height, ImageObserver observer) {
 130.281 +            return false;
 130.282 +        }
 130.283 +
 130.284 +        @Override
 130.285 +        public int checkImage(Image image, int width, int height, ImageObserver observer) {
 130.286 +            return 0;
 130.287 +        }
 130.288 +
 130.289 +        @Override
 130.290 +        public Image createImage(ImageProducer producer) {
 130.291 +            return null;
 130.292 +        }
 130.293 +
 130.294 +        @Override
 130.295 +        public Image createImage(byte[] imagedata, int imageoffset, int imagelength) {
 130.296 +            return null;
 130.297 +        }
 130.298 +
 130.299 +        @Override
 130.300 +        public PrintJob getPrintJob(Frame frame, String jobtitle, Properties props) {
 130.301 +            return null;
 130.302 +        }
 130.303 +
 130.304 +        @Override
 130.305 +        public void beep() {
 130.306 +
 130.307 +        }
 130.308 +
 130.309 +        @Override
 130.310 +        public Clipboard getSystemClipboard() throws HeadlessException {
 130.311 +            return null;
 130.312 +        }
 130.313 +
 130.314 +        @Override
 130.315 +        protected EventQueue getSystemEventQueueImpl() {
 130.316 +            return null;
 130.317 +        }
 130.318 +
 130.319 +        @Override
 130.320 +        public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
 130.321 +            return null;
 130.322 +        }
 130.323 +
 130.324 +        @Override
 130.325 +        public boolean isModalityTypeSupported(Dialog.ModalityType modalityType) {
 130.326 +            return false;
 130.327 +        }
 130.328 +
 130.329 +        @Override
 130.330 +        public boolean isModalExclusionTypeSupported(Dialog.ModalExclusionType modalExclusionType) {
 130.331 +            return false;
 130.332 +        }
 130.333 +
 130.334 +        @Override
 130.335 +        public Map<TextAttribute, ?> mapInputMethodHighlight(InputMethodHighlight highlight) throws HeadlessException {
 130.336 +            return null;
 130.337 +        }
 130.338 +    }
 130.339 +}
   131.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   131.2 +++ b/test/java/awt/geom/Arc2D/SerializationTest.java	Wed May 18 18:18:04 2011 -0700
   131.3 @@ -0,0 +1,100 @@
   131.4 +/*
   131.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   131.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   131.7 + *
   131.8 + * This code is free software; you can redistribute it and/or modify it
   131.9 + * under the terms of the GNU General Public License version 2 only, as
  131.10 + * published by the Free Software Foundation.
  131.11 + *
  131.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  131.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  131.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  131.15 + * version 2 for more details (a copy is included in the LICENSE file that
  131.16 + * accompanied this code).
  131.17 + *
  131.18 + * You should have received a copy of the GNU General Public License version
  131.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  131.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  131.21 + *
  131.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  131.23 + * or visit www.oracle.com if you need additional information or have any
  131.24 + * questions.
  131.25 + */
  131.26 +
  131.27 +/**
  131.28 + * @test
  131.29 + * @bug 7040717 6522514
  131.30 + * @summary Verifies that subclasses of Arc2D can be serialized.
  131.31 + * @run main SerializationTest
  131.32 + */
  131.33 +
  131.34 +import java.awt.geom.Rectangle2D;
  131.35 +import java.awt.geom.Arc2D;
  131.36 +import java.io.Serializable;
  131.37 +import java.io.File;
  131.38 +import java.io.FileInputStream;
  131.39 +import java.io.FileOutputStream;
  131.40 +import java.io.ObjectInputStream;
  131.41 +import java.io.ObjectOutputStream;
  131.42 +
  131.43 +public class SerializationTest {
  131.44 +    static boolean failed;
  131.45 +    public static void main(String args[]) {
  131.46 +        test(new Arc());
  131.47 +        test(new ArcF());
  131.48 +        test(new ArcD());
  131.49 +        if (failed) throw new RuntimeException("some tests failed");
  131.50 +    }
  131.51 +
  131.52 +    public static void test(Object a) {
  131.53 +        try {
  131.54 +            File objectbin = new File("object.bin");
  131.55 +            FileOutputStream fos = new FileOutputStream(objectbin);
  131.56 +            ObjectOutputStream out = new ObjectOutputStream(fos);
  131.57 +            out.writeObject(a);
  131.58 +            fos.close();
  131.59 +            FileInputStream fis = new FileInputStream(objectbin);
  131.60 +            ObjectInputStream in = new ObjectInputStream(fis);
  131.61 +            Object o = in.readObject();
  131.62 +            fis.close();
  131.63 +            System.err.println(o);
  131.64 +        } catch (Throwable ex) {
  131.65 +            ex.printStackTrace();
  131.66 +            failed = true;
  131.67 +        }
  131.68 +    }
  131.69 +
  131.70 +    static class Arc extends Arc2D implements Serializable {
  131.71 +        public Arc() {
  131.72 +            super(Arc2D.OPEN);
  131.73 +        }
  131.74 +
  131.75 +        public Rectangle2D makeBounds(double x, double y, double w, double h) {
  131.76 +            return new Rectangle2D.Double(x, y, w, h);
  131.77 +        }
  131.78 +        public double getX() { return 0; }
  131.79 +        public double getY() { return 0; }
  131.80 +        public double getWidth() { return 0; }
  131.81 +        public double getHeight() { return 0; }
  131.82 +        public double getAngleExtent() { return 0; }
  131.83 +        public double getAngleStart() { return 0; }
  131.84 +        public void setAngleExtent(double angExt) { }
  131.85 +        public void setAngleStart(double angExt) { }
  131.86 +        public void setFrame(double x, double y, double w, double h) {}
  131.87 +        public void setArc(double x, double y, double w, double h,
  131.88 +                           double s, double e, int c)
  131.89 +        {
  131.90 +        }
  131.91 +        public boolean isEmpty() { return false; };
  131.92 +    }
  131.93 +
  131.94 +    static class ArcF extends Arc2D.Float implements Serializable {
  131.95 +        public ArcF() {
  131.96 +        }
  131.97 +    }
  131.98 +
  131.99 +    static class ArcD extends Arc2D.Double implements Serializable {
 131.100 +        public ArcD() {
 131.101 +        }
 131.102 +    }
 131.103 +}
   132.1 --- a/test/java/nio/channels/AsynchronousServerSocketChannel/Basic.java	Wed May 18 16:32:05 2011 -0700
   132.2 +++ b/test/java/nio/channels/AsynchronousServerSocketChannel/Basic.java	Wed May 18 18:18:04 2011 -0700
   132.3 @@ -29,7 +29,7 @@
   132.4  
   132.5  import java.nio.channels.*;
   132.6  import java.net.*;
   132.7 -import static java.net.StandardSocketOption.*;
   132.8 +import static java.net.StandardSocketOptions.*;
   132.9  import java.io.IOException;
  132.10  import java.util.Set;
  132.11  import java.util.concurrent.ExecutionException;
   133.1 --- a/test/java/nio/channels/AsynchronousSocketChannel/Basic.java	Wed May 18 16:32:05 2011 -0700
   133.2 +++ b/test/java/nio/channels/AsynchronousSocketChannel/Basic.java	Wed May 18 18:18:04 2011 -0700
   133.3 @@ -29,7 +29,7 @@
   133.4  
   133.5  import java.nio.ByteBuffer;
   133.6  import java.nio.channels.*;
   133.7 -import static java.net.StandardSocketOption.*;
   133.8 +import static java.net.StandardSocketOptions.*;
   133.9  import java.net.*;
  133.10  import java.util.Random;
  133.11  import java.util.concurrent.*;
  133.12 @@ -383,7 +383,7 @@
  133.13          // write bytes and close connection
  133.14          SocketChannel sc = server.accept();
  133.15          ByteBuffer src = genBuffer();
  133.16 -        sc.setOption(StandardSocketOption.SO_SNDBUF, src.remaining());
  133.17 +        sc.setOption(StandardSocketOptions.SO_SNDBUF, src.remaining());
  133.18          while (src.hasRemaining())
  133.19              sc.write(src);
  133.20          sc.close();
   134.1 --- a/test/java/nio/channels/DatagramChannel/BasicMulticastTests.java	Wed May 18 16:32:05 2011 -0700
   134.2 +++ b/test/java/nio/channels/DatagramChannel/BasicMulticastTests.java	Wed May 18 18:18:04 2011 -0700
   134.3 @@ -52,7 +52,7 @@
   134.4              StandardProtocolFamily.INET : StandardProtocolFamily.INET6;
   134.5  
   134.6          DatagramChannel dc = DatagramChannel.open(family)
   134.7 -            .setOption(StandardSocketOption.SO_REUSEADDR, true)
   134.8 +            .setOption(StandardSocketOptions.SO_REUSEADDR, true)
   134.9              .bind(new InetSocketAddress(source, 0));
  134.10  
  134.11          // check existing key is returned
  134.12 @@ -115,7 +115,7 @@
  134.13          System.out.println("Exception Tests");
  134.14  
  134.15          DatagramChannel dc = DatagramChannel.open(StandardProtocolFamily.INET)
  134.16 -            .setOption(StandardSocketOption.SO_REUSEADDR, true)
  134.17 +            .setOption(StandardSocketOptions.SO_REUSEADDR, true)
  134.18              .bind(new InetSocketAddress(0));
  134.19  
  134.20          InetAddress group = InetAddress.getByName("225.4.5.6");
   135.1 --- a/test/java/nio/channels/DatagramChannel/MulticastSendReceiveTests.java	Wed May 18 16:32:05 2011 -0700
   135.2 +++ b/test/java/nio/channels/DatagramChannel/MulticastSendReceiveTests.java	Wed May 18 18:18:04 2011 -0700
   135.3 @@ -59,7 +59,7 @@
   135.4              StandardProtocolFamily.INET6 : StandardProtocolFamily.INET;
   135.5          DatagramChannel dc = DatagramChannel.open(family)
   135.6              .bind(new InetSocketAddress(local, 0))
   135.7 -            .setOption(StandardSocketOption.IP_MULTICAST_IF, nif);
   135.8 +            .setOption(StandardSocketOptions.IP_MULTICAST_IF, nif);
   135.9          int id = rand.nextInt();
  135.10          byte[] msg = Integer.toString(id).getBytes("UTF-8");
  135.11          ByteBuffer buf = ByteBuffer.wrap(msg);
  135.12 @@ -146,7 +146,7 @@
  135.13          System.out.format("\nTest DatagramChannel to %s socket\n", family.name());
  135.14          try (DatagramChannel dc = (family == UNSPEC) ?
  135.15                  DatagramChannel.open() : DatagramChannel.open(family)) {
  135.16 -            dc.setOption(StandardSocketOption.SO_REUSEADDR, true)
  135.17 +            dc.setOption(StandardSocketOptions.SO_REUSEADDR, true)
  135.18                .bind(new InetSocketAddress(0));
  135.19  
  135.20              // join group
   136.1 --- a/test/java/nio/channels/DatagramChannel/SocketOptionTests.java	Wed May 18 16:32:05 2011 -0700
   136.2 +++ b/test/java/nio/channels/DatagramChannel/SocketOptionTests.java	Wed May 18 18:18:04 2011 -0700
   136.3 @@ -31,7 +31,7 @@
   136.4  import java.net.*;
   136.5  import java.io.IOException;
   136.6  import java.util.*;
   136.7 -import static java.net.StandardSocketOption.*;
   136.8 +import static java.net.StandardSocketOptions.*;
   136.9  
  136.10  public class SocketOptionTests {
  136.11  
   137.1 --- a/test/java/nio/channels/FileChannel/ClosedByInterrupt.java	Wed May 18 16:32:05 2011 -0700
   137.2 +++ b/test/java/nio/channels/FileChannel/ClosedByInterrupt.java	Wed May 18 18:18:04 2011 -0700
   137.3 @@ -52,13 +52,16 @@
   137.4                  fc.write(bb);
   137.5          }
   137.6  
   137.7 -        // test with 1-8 concurrent threads
   137.8 -        for (int i=1; i<=8; i++) {
   137.9 +        // test with 1-16 concurrent threads
  137.10 +        for (int i=1; i<=16; i++) {
  137.11              System.out.format("%d thread(s)%n", i);
  137.12              test(f, i);
  137.13              if (failed)
  137.14                  break;
  137.15          }
  137.16 +
  137.17 +        if (failed)
  137.18 +            throw new RuntimeException("Test failed");
  137.19      }
  137.20  
  137.21      /**
  137.22 @@ -132,12 +135,14 @@
  137.23                          // give the interruptible thread a chance
  137.24                          try {
  137.25                              Thread.sleep(rand.nextInt(50));
  137.26 -                        } catch (InterruptedException ignore) { }
  137.27 +                        } catch (InterruptedException e) {
  137.28 +                            unexpected(e);
  137.29 +                        }
  137.30                      }
  137.31                  }
  137.32              } catch (ClosedByInterruptException e) {
  137.33                  if (interruptible) {
  137.34 -                    if (Thread.currentThread().isInterrupted()) {
  137.35 +                    if (Thread.interrupted()) {
  137.36                          expected(e + " thrown and interrupt status set");
  137.37                      } else {
  137.38                          unexpected(e + " thrown but interrupt status not set");
  137.39 @@ -158,7 +163,7 @@
  137.40      }
  137.41  
  137.42      static void expected(Exception e) {
  137.43 -        System.out.format("%s (not expected)%n", e);
  137.44 +        System.out.format("%s (expected)%n", e);
  137.45      }
  137.46  
  137.47      static void expected(String msg) {
   138.1 --- a/test/java/nio/channels/ServerSocketChannel/SocketOptionTests.java	Wed May 18 16:32:05 2011 -0700
   138.2 +++ b/test/java/nio/channels/ServerSocketChannel/SocketOptionTests.java	Wed May 18 18:18:04 2011 -0700
   138.3 @@ -32,7 +32,7 @@
   138.4  import java.net.*;
   138.5  import java.io.IOException;
   138.6  import java.util.*;
   138.7 -import static java.net.StandardSocketOption.*;
   138.8 +import static java.net.StandardSocketOptions.*;
   138.9  
  138.10  public class SocketOptionTests {
  138.11  
   139.1 --- a/test/java/nio/channels/SocketChannel/Shutdown.java	Wed May 18 16:32:05 2011 -0700
   139.2 +++ b/test/java/nio/channels/SocketChannel/Shutdown.java	Wed May 18 18:18:04 2011 -0700
   139.3 @@ -39,7 +39,7 @@
   139.4      static void acceptAndReset(ServerSocketChannel ssc) throws IOException {
   139.5          SocketChannel peer = ssc.accept();
   139.6          try {
   139.7 -            peer.setOption(StandardSocketOption.SO_LINGER, 0);
   139.8 +            peer.setOption(StandardSocketOptions.SO_LINGER, 0);
   139.9              peer.configureBlocking(false);
  139.10              peer.write(ByteBuffer.wrap(new byte[128*1024]));
  139.11          } finally {
   140.1 --- a/test/java/nio/channels/SocketChannel/SocketOptionTests.java	Wed May 18 16:32:05 2011 -0700
   140.2 +++ b/test/java/nio/channels/SocketChannel/SocketOptionTests.java	Wed May 18 18:18:04 2011 -0700
   140.3 @@ -32,7 +32,7 @@
   140.4  import java.net.*;
   140.5  import java.io.IOException;
   140.6  import java.util.*;
   140.7 -import static java.net.StandardSocketOption.*;
   140.8 +import static java.net.StandardSocketOptions.*;
   140.9  
  140.10  public class SocketOptionTests {
  140.11  
   141.1 --- a/test/java/nio/charset/StandardCharset/Standard.java	Wed May 18 16:32:05 2011 -0700
   141.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   141.3 @@ -1,124 +0,0 @@
   141.4 -/*
   141.5 - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   141.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   141.7 - *
   141.8 - * This code is free software; you can redistribute it and/or modify it
   141.9 - * under the terms of the GNU General Public License version 2 only, as
  141.10 - * published by the Free Software Foundation.
  141.11 - *
  141.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
  141.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  141.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  141.15 - * version 2 for more details (a copy is included in the LICENSE file that
  141.16 - * accompanied this code).
  141.17 - *
  141.18 - * You should have received a copy of the GNU General Public License version
  141.19 - * 2 along with this work; if not, write to the Free Software Foundation,
  141.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  141.21 - *
  141.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  141.23 - * or visit www.oracle.com if you need additional information or have any
  141.24 - * questions.
  141.25 - */
  141.26 -
  141.27 -/*
  141.28 - * @test
  141.29 - * @bug 4884238
  141.30 - * @summary Test standard charset name constants.
  141.31 - * @author Mike Duigou
  141.32 - * @run main Standard
  141.33 - */
  141.34 -
  141.35 -import java.lang.reflect.Field;
  141.36 -import java.lang.reflect.Modifier;
  141.37 -import java.io.*;
  141.38 -import java.nio.charset.*;
  141.39 -import java.util.Arrays;
  141.40 -import java.util.HashSet;
  141.41 -import java.util.Set;
  141.42 -
  141.43 -public class Standard {
  141.44 -
  141.45 -    private final static String standardCharsets[] = {
  141.46 -        "US-ASCII", "ISO-8859-1", "UTF-8",
  141.47 -        "UTF-16BE", "UTF-16LE", "UTF-16" };
  141.48 -
  141.49 -    public static void realMain(String[] args) {
  141.50 -        check(StandardCharset.US_ASCII instanceof Charset);
  141.51 -        check(StandardCharset.ISO_8859_1 instanceof Charset);
  141.52 -        check(StandardCharset.UTF_8 instanceof Charset);
  141.53 -        check(StandardCharset.UTF_16BE instanceof Charset);
  141.54 -        check(StandardCharset.UTF_16LE instanceof Charset);
  141.55 -        check(StandardCharset.UTF_16 instanceof Charset);
  141.56 -
  141.57 -        check("US-ASCII".equals(StandardCharset.US_ASCII.name()));
  141.58 -        check("ISO-8859-1".equals(StandardCharset.ISO_8859_1.name()));
  141.59 -        check("UTF-8".equals(StandardCharset.UTF_8.name()));
  141.60 -        check("UTF-16BE".equals(StandardCharset.UTF_16BE.name()));
  141.61 -        check("UTF-16LE".equals(StandardCharset.UTF_16LE.name()));
  141.62 -        check("UTF-16".equals(StandardCharset.UTF_16.name()));
  141.63 -
  141.64 -        Set<String> charsets = new HashSet<>();
  141.65 -        Field standardCharsetFields[] = StandardCharset.class.getFields();
  141.66 -
  141.67 -        for(Field charsetField : standardCharsetFields) {
  141.68 -            check(StandardCharset.class == charsetField.getDeclaringClass());
  141.69 -            check(Modifier.isFinal(charsetField.getModifiers()));
  141.70 -            check(Modifier.isStatic(charsetField.getModifiers()));
  141.71 -            check(Modifier.isPublic(charsetField.getModifiers()));
  141.72 -            Object value;
  141.73 -            try {
  141.74 -                value = charsetField.get(null);
  141.75 -            } catch(IllegalAccessException failure) {
  141.76 -                unexpected(failure);
  141.77 -                continue;
  141.78 -            }
  141.79 -            check(value instanceof Charset);
  141.80 -            charsets.add(((Charset)value).name());
  141.81 -        }
  141.82 -
  141.83 -        check(charsets.containsAll(Arrays.asList(standardCharsets)));
  141.84 -        charsets.removeAll(Arrays.asList(standardCharsets));
  141.85 -        check(charsets.isEmpty());
  141.86 -    }
  141.87 -
  141.88 -    //--------------------- Infrastructure ---------------------------
  141.89 -    static volatile int passed = 0, failed = 0;
  141.90 -    static void pass() { passed++; }
  141.91 -    static void fail() { failed++; Thread.dumpStack(); }
  141.92 -    static void fail(String msg) { System.out.println(msg); fail(); }
  141.93 -    static void unexpected(Throwable t) { failed++; t.printStackTrace(); }
  141.94 -    static void check(boolean cond) { if (cond) pass(); else fail(); }
  141.95 -    static void equal(Object x, Object y) {
  141.96 -        if (x == null ? y == null : x.equals(y)) pass();
  141.97 -        else {System.out.println(x + " not equal to " + y); fail();}}
  141.98 -    static void equal2(Object x, Object y) {equal(x, y); equal(y, x);}
  141.99 -    public static void main(String[] args) throws Throwable {
 141.100 -        try { realMain(args); } catch (Throwable t) { unexpected(t); }
 141.101 -
 141.102 -        System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
 141.103 -        if (failed > 0) throw new Exception("Some tests failed");
 141.104 -    }
 141.105 -    private static abstract class Fun {abstract void f() throws Throwable;}
 141.106 -    private static void THROWS(Class<? extends Throwable> k, Fun... fs) {
 141.107 -          for (Fun f : fs)
 141.108 -              try { f.f(); fail("Expected " + k.getName() + " not thrown"); }
 141.109 -              catch (Throwable t) {
 141.110 -                  if (k.isAssignableFrom(t.getClass())) pass();
 141.111 -                  else unexpected(t);}}
 141.112 -    static byte[] serializedForm(Object obj) {
 141.113 -        try {
 141.114 -            ByteArrayOutputStream baos = new ByteArrayOutputStream();
 141.115 -            new ObjectOutputStream(baos).writeObject(obj);
 141.116 -            return baos.toByteArray();
 141.117 -        } catch (IOException e) { throw new Error(e); }}
 141.118 -    static Object readObject(byte[] bytes)
 141.119 -        throws IOException, ClassNotFoundException {
 141.120 -        InputStream is = new ByteArrayInputStream(bytes);
 141.121 -        return new ObjectInputStream(is).readObject();}
 141.122 -    @SuppressWarnings("unchecked")
 141.123 -    static <T> T serialClone(T obj) {
 141.124 -        try { return (T) readObject(serializedForm(obj)); }
 141.125 -        catch (Exception e) { throw new Error(e); }}
 141.126 -
 141.127 -}
   142.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   142.2 +++ b/test/java/nio/charset/StandardCharsets/Standard.java	Wed May 18 18:18:04 2011 -0700
   142.3 @@ -0,0 +1,124 @@
   142.4 +/*
   142.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   142.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   142.7 + *
   142.8 + * This code is free software; you can redistribute it and/or modify it
   142.9 + * under the terms of the GNU General Public License version 2 only, as
  142.10 + * published by the Free Software Foundation.
  142.11 + *
  142.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  142.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  142.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  142.15 + * version 2 for more details (a copy is included in the LICENSE file that
  142.16 + * accompanied this code).
  142.17 + *
  142.18 + * You should have received a copy of the GNU General Public License version
  142.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  142.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  142.21 + *
  142.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  142.23 + * or visit www.oracle.com if you need additional information or have any
  142.24 + * questions.
  142.25 + */
  142.26 +
  142.27 +/*
  142.28 + * @test
  142.29 + * @bug 4884238
  142.30 + * @summary Test standard charset name constants.
  142.31 + * @author Mike Duigou
  142.32 + * @run main Standard
  142.33 + */
  142.34 +
  142.35 +import java.lang.reflect.Field;
  142.36 +import java.lang.reflect.Modifier;
  142.37 +import java.io.*;
  142.38 +import java.nio.charset.*;
  142.39 +import java.util.Arrays;
  142.40 +import java.util.HashSet;
  142.41 +import java.util.Set;
  142.42 +
  142.43 +public class Standard {
  142.44 +
  142.45 +    private final static String standardCharsets[] = {
  142.46 +        "US-ASCII", "ISO-8859-1", "UTF-8",
  142.47 +        "UTF-16BE", "UTF-16LE", "UTF-16" };
  142.48 +
  142.49 +    public static void realMain(String[] args) {
  142.50 +        check(StandardCharsets.US_ASCII instanceof Charset);
  142.51 +        check(StandardCharsets.ISO_8859_1 instanceof Charset);
  142.52 +        check(StandardCharsets.UTF_8 instanceof Charset);
  142.53 +        check(StandardCharsets.UTF_16BE instanceof Charset);
  142.54 +        check(StandardCharsets.UTF_16LE instanceof Charset);
  142.55 +        check(StandardCharsets.UTF_16 instanceof Charset);
  142.56 +
  142.57 +        check("US-ASCII".equals(StandardCharsets.US_ASCII.name()));
  142.58 +        check("ISO-8859-1".equals(StandardCharsets.ISO_8859_1.name()));
  142.59 +        check("UTF-8".equals(StandardCharsets.UTF_8.name()));
  142.60 +        check("UTF-16BE".equals(StandardCharsets.UTF_16BE.name()));
  142.61 +        check("UTF-16LE".equals(StandardCharsets.UTF_16LE.name()));
  142.62 +        check("UTF-16".equals(StandardCharsets.UTF_16.name()));
  142.63 +
  142.64 +        Set<String> charsets = new HashSet<>();
  142.65 +        Field standardCharsetFields[] = StandardCharsets.class.getFields();
  142.66 +
  142.67 +        for(Field charsetField : standardCharsetFields) {
  142.68 +            check(StandardCharsets.class == charsetField.getDeclaringClass());
  142.69 +            check(Modifier.isFinal(charsetField.getModifiers()));
  142.70 +            check(Modifier.isStatic(charsetField.getModifiers()));
  142.71 +            check(Modifier.isPublic(charsetField.getModifiers()));
  142.72 +            Object value;
  142.73 +            try {
  142.74 +                value = charsetField.get(null);
  142.75 +            } catch(IllegalAccessException failure) {
  142.76 +                unexpected(failure);
  142.77 +                continue;
  142.78 +            }
  142.79 +            check(value instanceof Charset);
  142.80 +            charsets.add(((Charset)value).name());
  142.81 +        }
  142.82 +
  142.83 +        check(charsets.containsAll(Arrays.asList(standardCharsets)));
  142.84 +        charsets.removeAll(Arrays.asList(standardCharsets));
  142.85 +        check(charsets.isEmpty());
  142.86 +    }
  142.87 +
  142.88 +    //--------------------- Infrastructure ---------------------------
  142.89 +    static volatile int passed = 0, failed = 0;
  142.90 +    static void pass() { passed++; }
  142.91 +    static void fail() { failed++; Thread.dumpStack(); }
  142.92 +    static void fail(String msg) { System.out.println(msg); fail(); }
  142.93 +    static void unexpected(Throwable t) { failed++; t.printStackTrace(); }
  142.94 +    static void check(boolean cond) { if (cond) pass(); else fail(); }
  142.95 +    static void equal(Object x, Object y) {
  142.96 +        if (x == null ? y == null : x.equals(y)) pass();
  142.97 +        else {System.out.println(x + " not equal to " + y); fail();}}
  142.98 +    static void equal2(Object x, Object y) {equal(x, y); equal(y, x);}
  142.99 +    public static void main(String[] args) throws Throwable {
 142.100 +        try { realMain(args); } catch (Throwable t) { unexpected(t); }
 142.101 +
 142.102 +        System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
 142.103 +        if (failed > 0) throw new Exception("Some tests failed");
 142.104 +    }
 142.105 +    private static abstract class Fun {abstract void f() throws Throwable;}
 142.106 +    private static void THROWS(Class<? extends Throwable> k, Fun... fs) {
 142.107 +          for (Fun f : fs)
 142.108 +              try { f.f(); fail("Expected " + k.getName() + " not thrown"); }
 142.109 +              catch (Throwable t) {
 142.110 +                  if (k.isAssignableFrom(t.getClass())) pass();
 142.111 +                  else unexpected(t);}}
 142.112 +    static byte[] serializedForm(Object obj) {
 142.113 +        try {
 142.114 +            ByteArrayOutputStream baos = new ByteArrayOutputStream();
 142.115 +            new ObjectOutputStream(baos).writeObject(obj);
 142.116 +            return baos.toByteArray();
 142.117 +        } catch (IOException e) { throw new Error(e); }}
 142.118 +    static Object readObject(byte[] bytes)
 142.119 +        throws IOException, ClassNotFoundException {
 142.120 +        InputStream is = new ByteArrayInputStream(bytes);
 142.121 +        return new ObjectInputStream(is).readObject();}
 142.122 +    @SuppressWarnings("unchecked")
 142.123 +    static <T> T serialClone(T obj) {
 142.124 +        try { return (T) readObject(serializedForm(obj)); }
 142.125 +        catch (Exception e) { throw new Error(e); }}
 142.126 +
 142.127 +}
   143.1 --- a/test/java/nio/file/Files/CheckPermissions.java	Wed May 18 16:32:05 2011 -0700
   143.2 +++ b/test/java/nio/file/Files/CheckPermissions.java	Wed May 18 18:18:04 2011 -0700
   143.3 @@ -540,7 +540,7 @@
   143.4  
   143.5              try (WatchService watcher = FileSystems.getDefault().newWatchService()) {
   143.6                  prepare();
   143.7 -                testdir.register(watcher, StandardWatchEventKind.ENTRY_DELETE);
   143.8 +                testdir.register(watcher, StandardWatchEventKinds.ENTRY_DELETE);
   143.9                  assertCheckRead(testdir);
  143.10              }
  143.11  
   144.1 --- a/test/java/nio/file/WatchService/Basic.java	Wed May 18 16:32:05 2011 -0700
   144.2 +++ b/test/java/nio/file/WatchService/Basic.java	Wed May 18 18:18:04 2011 -0700
   144.3 @@ -29,7 +29,7 @@
   144.4   */
   144.5  
   144.6  import java.nio.file.*;
   144.7 -import static java.nio.file.StandardWatchEventKind.*;
   144.8 +import static java.nio.file.StandardWatchEventKinds.*;
   144.9  import java.nio.file.attribute.*;
  144.10  import java.io.*;
  144.11  import java.util.*;
  144.12 @@ -100,7 +100,7 @@
  144.13              // remove key and check that we got the ENTRY_CREATE event
  144.14              takeExpectedKey(watcher, myKey);
  144.15              checkExpectedEvent(myKey.pollEvents(),
  144.16 -                StandardWatchEventKind.ENTRY_CREATE, name);
  144.17 +                StandardWatchEventKinds.ENTRY_CREATE, name);
  144.18  
  144.19              System.out.println("reset key");
  144.20              if (!myKey.reset())
  144.21 @@ -121,7 +121,7 @@
  144.22              Files.delete(file);
  144.23              takeExpectedKey(watcher, myKey);
  144.24              checkExpectedEvent(myKey.pollEvents(),
  144.25 -                StandardWatchEventKind.ENTRY_DELETE, name);
  144.26 +                StandardWatchEventKinds.ENTRY_DELETE, name);
  144.27  
  144.28              System.out.println("reset key");
  144.29              if (!myKey.reset())
  144.30 @@ -149,7 +149,7 @@
  144.31              // remove key and check that we got the ENTRY_MODIFY event
  144.32              takeExpectedKey(watcher, myKey);
  144.33              checkExpectedEvent(myKey.pollEvents(),
  144.34 -                StandardWatchEventKind.ENTRY_MODIFY, name);
  144.35 +                StandardWatchEventKinds.ENTRY_MODIFY, name);
  144.36              System.out.println("OKAY");
  144.37  
  144.38              // done
  144.39 @@ -424,7 +424,7 @@
  144.40              // check that key1 got ENTRY_CREATE
  144.41              takeExpectedKey(watcher1, key1);
  144.42              checkExpectedEvent(key1.pollEvents(),
  144.43 -                StandardWatchEventKind.ENTRY_CREATE, name2);
  144.44 +                StandardWatchEventKinds.ENTRY_CREATE, name2);
  144.45  
  144.46              // check that key2 got zero events
  144.47              WatchKey key = watcher2.poll();
  144.48 @@ -437,7 +437,7 @@
  144.49              // check that key2 got ENTRY_DELETE
  144.50              takeExpectedKey(watcher2, key2);
  144.51              checkExpectedEvent(key2.pollEvents(),
  144.52 -                StandardWatchEventKind.ENTRY_DELETE, name1);
  144.53 +                StandardWatchEventKinds.ENTRY_DELETE, name1);
  144.54  
  144.55              // check that key1 got zero events
  144.56              key = watcher1.poll();
  144.57 @@ -458,7 +458,7 @@
  144.58              Files.createFile(file1);
  144.59              takeExpectedKey(watcher2, key2);
  144.60              checkExpectedEvent(key2.pollEvents(),
  144.61 -                StandardWatchEventKind.ENTRY_CREATE, name1);
  144.62 +                StandardWatchEventKinds.ENTRY_CREATE, name1);
  144.63  
  144.64              System.out.println("OKAY");
  144.65  
   145.1 --- a/test/java/nio/file/WatchService/FileTreeModifier.java	Wed May 18 16:32:05 2011 -0700
   145.2 +++ b/test/java/nio/file/WatchService/FileTreeModifier.java	Wed May 18 18:18:04 2011 -0700
   145.3 @@ -28,7 +28,7 @@
   145.4   */
   145.5  
   145.6  import java.nio.file.*;
   145.7 -import static java.nio.file.StandardWatchEventKind.*;
   145.8 +import static java.nio.file.StandardWatchEventKinds.*;
   145.9  import java.io.IOException;
  145.10  import java.io.OutputStream;
  145.11  import java.util.*;
   146.1 --- a/test/java/nio/file/WatchService/LotsOfEvents.java	Wed May 18 16:32:05 2011 -0700
   146.2 +++ b/test/java/nio/file/WatchService/LotsOfEvents.java	Wed May 18 18:18:04 2011 -0700
   146.3 @@ -29,7 +29,7 @@
   146.4   */
   146.5  
   146.6  import java.nio.file.*;
   146.7 -import static java.nio.file.StandardWatchEventKind.*;
   146.8 +import static java.nio.file.StandardWatchEventKinds.*;
   146.9  import java.io.IOException;
  146.10  import java.io.OutputStream;
  146.11  import java.util.*;
   147.1 --- a/test/java/nio/file/WatchService/SensitivityModifier.java	Wed May 18 16:32:05 2011 -0700
   147.2 +++ b/test/java/nio/file/WatchService/SensitivityModifier.java	Wed May 18 18:18:04 2011 -0700
   147.3 @@ -29,7 +29,7 @@
   147.4   */
   147.5  
   147.6  import java.nio.file.*;
   147.7 -import static java.nio.file.StandardWatchEventKind.*;
   147.8 +import static java.nio.file.StandardWatchEventKinds.*;
   147.9  import java.io.OutputStream;
  147.10  import java.io.IOException;
  147.11  import java.util.Random;
   148.1 --- a/test/java/nio/file/WatchService/WithSecurityManager.java	Wed May 18 16:32:05 2011 -0700
   148.2 +++ b/test/java/nio/file/WatchService/WithSecurityManager.java	Wed May 18 18:18:04 2011 -0700
   148.3 @@ -66,7 +66,7 @@
   148.4          // attempt to register directory
   148.5          try {
   148.6              dir.register(dir.getFileSystem().newWatchService(),
   148.7 -                         new WatchEvent.Kind<?>[]{ StandardWatchEventKind.ENTRY_CREATE },
   148.8 +                         new WatchEvent.Kind<?>[]{ StandardWatchEventKinds.ENTRY_CREATE },
   148.9                           modifiers);
  148.10              if (expectedToFail)
  148.11                  throw new RuntimeException("SecurityException not thrown");
   149.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   149.2 +++ b/test/java/text/Bidi/Bug7041232.java	Wed May 18 18:18:04 2011 -0700
   149.3 @@ -0,0 +1,48 @@
   149.4 +/*
   149.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   149.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   149.7 + *
   149.8 + * This code is free software; you can redistribute it and/or modify it
   149.9 + * under the terms of the GNU General Public License version 2 only, as
  149.10 + * published by the Free Software Foundation.
  149.11 + *
  149.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  149.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  149.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  149.15 + * version 2 for more details (a copy is included in the LICENSE file that
  149.16 + * accompanied this code).
  149.17 + *
  149.18 + * You should have received a copy of the GNU General Public License version
  149.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  149.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  149.21 + *
  149.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  149.23 + * or visit www.oracle.com if you need additional information or have any
  149.24 + * questions.
  149.25 + */
  149.26 +
  149.27 +/*
  149.28 + * @test
  149.29 + * @bug 7041232
  149.30 + * @summary verify that an unexpected exception isn't thrown for unnatural data to keep backward compatibility with JDK 6.
  149.31 + */
  149.32 +import java.text.*;
  149.33 +
  149.34 +public class Bug7041232 {
  149.35 +
  149.36 +    public static void main(String[] args) {
  149.37 +        String UnicodeChars;
  149.38 +        StringBuffer sb = new StringBuffer();
  149.39 +
  149.40 +        // Generates String which includes U+2028(line separator) and
  149.41 +        // U+2029(paragraph separator)
  149.42 +        for (int i = 0x2000; i < 0x2100; i++) {
  149.43 +            sb.append((char)i);
  149.44 +        }
  149.45 +        UnicodeChars = sb.toString();
  149.46 +
  149.47 +        Bidi bidi = new Bidi(UnicodeChars, Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT);
  149.48 +        bidi.createLineBidi(0, UnicodeChars.length());
  149.49 +    }
  149.50 +
  149.51 +}
   150.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   150.2 +++ b/test/java/util/logging/LoggingDeadlock3.java	Wed May 18 18:18:04 2011 -0700
   150.3 @@ -0,0 +1,81 @@
   150.4 +/*
   150.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   150.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   150.7 + *
   150.8 + * This code is free software; you can redistribute it and/or modify it
   150.9 + * under the terms of the GNU General Public License version 2 only, as
  150.10 + * published by the Free Software Foundation.
  150.11 + *
  150.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  150.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  150.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  150.15 + * version 2 for more details (a copy is included in the LICENSE file that
  150.16 + * accompanied this code).
  150.17 + *
  150.18 + * You should have received a copy of the GNU General Public License version
  150.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  150.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  150.21 + *
  150.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  150.23 + * or visit www.oracle.com if you need additional information or have any
  150.24 + * questions.
  150.25 + */
  150.26 +
  150.27 +/*
  150.28 + * @test
  150.29 + * @bug     6487638 7041595
  150.30 + * @summary Calling LogManager.addLogger() and Logger.getLogger() cause deadlock
  150.31 + * @author  Serguei Spitsyn
  150.32 + * @build LoggingDeadlock3
  150.33 + * @run main/timeout=15 LoggingDeadlock3
  150.34 + */
  150.35 +
  150.36 +import java.io.*;
  150.37 +import java.util.logging.LogManager;
  150.38 +import java.util.logging.Logger;
  150.39 +
  150.40 +public class LoggingDeadlock3 {
  150.41 +  static final int         ITER_CNT   = 50000;
  150.42 +  static final String      MSG_PASSED = "LoggingDeadlock3: passed";
  150.43 +  static final LogManager  logMgr     = LogManager.getLogManager();
  150.44 +  static final PrintStream out        = System.out;
  150.45 +
  150.46 +  public static void main(String args[]) throws Exception {
  150.47 +    String tstSrc = System.getProperty("test.src");
  150.48 +    File   fname  = new File(tstSrc, "LoggingDeadlock3.props");
  150.49 +    String prop   = fname.getCanonicalPath();
  150.50 +    System.setProperty("java.util.logging.config.file", prop);
  150.51 +    logMgr.readConfiguration();
  150.52 +
  150.53 +    Thread t1 = new Thread(new AddLogger());
  150.54 +    Thread t2 = new Thread(new GetLogger());
  150.55 +    t1.start(); t2.start();
  150.56 +    t1.join();  t2.join();
  150.57 +    out.println("\n" + MSG_PASSED);
  150.58 +  }
  150.59 +
  150.60 +  public static class MyLogger extends Logger {
  150.61 +    protected MyLogger(String name) { super(name, null); }
  150.62 +  }
  150.63 +
  150.64 +  public static class GetLogger implements Runnable {
  150.65 +    public void run() {
  150.66 +      for (int cnt = 0; cnt < ITER_CNT * 8; cnt++) {
  150.67 +        Logger logger = Logger.getLogger("com.sun.Hello"+cnt/10);
  150.68 +        if (cnt % 1000  == 0) out.print("1");
  150.69 +        if (cnt % 10000 == 0) out.println();
  150.70 +      }
  150.71 +    }
  150.72 +  }
  150.73 +
  150.74 +  public static class AddLogger implements Runnable {
  150.75 +    public void run() {
  150.76 +      for (int cnt = 0; cnt < ITER_CNT; cnt++) {
  150.77 +        Logger addLogger = new MyLogger("com.sun.Hello"+cnt);
  150.78 +        logMgr.addLogger(addLogger);
  150.79 +        if (cnt % 100  == 0) out.print("2");
  150.80 +        if (cnt % 1000 == 0) out.println();
  150.81 +      }
  150.82 +    }
  150.83 +  }
  150.84 +}
   151.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   151.2 +++ b/test/java/util/logging/LoggingDeadlock3.props	Wed May 18 18:18:04 2011 -0700
   151.3 @@ -0,0 +1,3 @@
   151.4 +com.sun.LEVEL=FINE
   151.5 +com.sun.level=FINE
   151.6 +com.sun.Hello.level=INFO
   152.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   152.2 +++ b/test/java/util/logging/LoggingDeadlock4.java	Wed May 18 18:18:04 2011 -0700
   152.3 @@ -0,0 +1,111 @@
   152.4 +/*
   152.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   152.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   152.7 + *
   152.8 + * This code is free software; you can redistribute it and/or modify it
   152.9 + * under the terms of the GNU General Public License version 2 only, as
  152.10 + * published by the Free Software Foundation.
  152.11 + *
  152.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  152.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  152.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  152.15 + * version 2 for more details (a copy is included in the LICENSE file that
  152.16 + * accompanied this code).
  152.17 + *
  152.18 + * You should have received a copy of the GNU General Public License version
  152.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  152.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  152.21 + *
  152.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  152.23 + * or visit www.oracle.com if you need additional information or have any
  152.24 + * questions.
  152.25 + */
  152.26 +
  152.27 +/*
  152.28 + * @test
  152.29 + * @bug     6977677
  152.30 + * @summary Deadlock between LogManager.<clinit> and Logger.getLogger()
  152.31 + * @author  Daniel D. Daugherty
  152.32 + * @build LoggingDeadlock4
  152.33 + * @run main/timeout=15 LoggingDeadlock4
  152.34 + */
  152.35 +
  152.36 +import java.awt.Container;
  152.37 +import java.util.concurrent.CountDownLatch;
  152.38 +import java.util.logging.LogManager;
  152.39 +import java.util.logging.Logger;
  152.40 +
  152.41 +public class LoggingDeadlock4 {
  152.42 +    private static CountDownLatch barrier      = new CountDownLatch(1);
  152.43 +    private static CountDownLatch lmIsRunning  = new CountDownLatch(1);
  152.44 +    private static CountDownLatch logIsRunning = new CountDownLatch(1);
  152.45 +
  152.46 +    public static void main(String[] args) {
  152.47 +        System.out.println("main: LoggingDeadlock4 is starting.");
  152.48 +
  152.49 +        // Loading the java.awt.Container class will create a
  152.50 +        // sun.util.logging.PlatformLogger$JavaLogger object
  152.51 +        // that has to be redirected when the LogManager class
  152.52 +        // is initialized. This can cause a deadlock between
  152.53 +        // LogManager.<clinit> and Logger.getLogger().
  152.54 +        try {
  152.55 +            Class.forName("java.awt.Container");
  152.56 +        } catch (ClassNotFoundException cnfe) {
  152.57 +            throw new RuntimeException("Test failed: could not load"
  152.58 +                + " java.awt.Container." + cnfe);
  152.59 +        }
  152.60 +
  152.61 +        Thread lmThread = new Thread("LogManagerThread") {
  152.62 +            public void run() {
  152.63 +                // let main know LogManagerThread is running
  152.64 +                lmIsRunning.countDown();
  152.65 +
  152.66 +                System.out.println(Thread.currentThread().getName()
  152.67 +                    + ": is running.");
  152.68 +
  152.69 +                try {
  152.70 +                    barrier.await();  // wait for race to start
  152.71 +                } catch (InterruptedException e) {
  152.72 +                }
  152.73 +
  152.74 +                LogManager manager = LogManager.getLogManager();
  152.75 +            }
  152.76 +        };
  152.77 +        lmThread.start();
  152.78 +
  152.79 +        Thread logThread = new Thread("LoggerThread") {
  152.80 +            public void run() {
  152.81 +                // let main know LoggerThread is running
  152.82 +                logIsRunning.countDown();
  152.83 +
  152.84 +                System.out.println(Thread.currentThread().getName()
  152.85 +                    + ": is running.");
  152.86 +
  152.87 +                try {
  152.88 +                    barrier.await();  // wait for race to start
  152.89 +                } catch (InterruptedException e) {
  152.90 +                }
  152.91 +
  152.92 +                Logger foo = Logger.getLogger("foo logger");
  152.93 +            }
  152.94 +        };
  152.95 +        logThread.start();
  152.96 +
  152.97 +        try {
  152.98 +            // wait for LogManagerThread and LoggerThread to get going
  152.99 +            lmIsRunning.await();
 152.100 +            logIsRunning.await();
 152.101 +        } catch (InterruptedException e) {
 152.102 +        }
 152.103 +
 152.104 +        barrier.countDown();  // start the race
 152.105 +
 152.106 +        try {
 152.107 +            lmThread.join();
 152.108 +            logThread.join();
 152.109 +        } catch (InterruptedException ie) {
 152.110 +        }
 152.111 +
 152.112 +        System.out.println("main: LoggingDeadlock4 is done.");
 152.113 +    }
 152.114 +}
   153.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   153.2 +++ b/test/javax/management/timer/StartTest.java	Wed May 18 18:18:04 2011 -0700
   153.3 @@ -0,0 +1,98 @@
   153.4 +/*
   153.5 + * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
   153.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   153.7 + *
   153.8 + * This code is free software; you can redistribute it and/or modify it
   153.9 + * under the terms of the GNU General Public License version 2 only, as
  153.10 + * published by the Free Software Foundation.
  153.11 + *
  153.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  153.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  153.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  153.15 + * version 2 for more details (a copy is included in the LICENSE file that
  153.16 + * accompanied this code).
  153.17 + *
  153.18 + * You should have received a copy of the GNU General Public License version
  153.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  153.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  153.21 + *
  153.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  153.23 + * or visit www.oracle.com if you need additional information or have any
  153.24 + * questions.
  153.25 + */
  153.26 +
  153.27 +/*
  153.28 + * @test
  153.29 + * @bug 6659215
  153.30 + * @summary Test on timer start method with past notifications
  153.31 + * @author Shanliang JIANG
  153.32 + * @run clean StartTest
  153.33 + * @run build StartTest
  153.34 + * @run main StartTest
  153.35 + */
  153.36 +
  153.37 +import java.util.Date;
  153.38 +import javax.management.timer.Timer;
  153.39 +import javax.management.Notification;
  153.40 +import javax.management.NotificationListener;
  153.41 +
  153.42 +public class StartTest {
  153.43 +    public static void main(String[] args) throws Exception {
  153.44 +        System.out.println(
  153.45 +            ">>> Test on timer start method with past notifications.");
  153.46 +
  153.47 +        System.out.println(">>> Create a Timer object.");
  153.48 +        Timer timer = new Timer();
  153.49 +
  153.50 +        System.out.println(
  153.51 +            ">>> Set the flag (setSendPastNotification) to true.");
  153.52 +        timer.setSendPastNotifications(true);
  153.53 +
  153.54 +        timer.addNotificationListener(myListener, null, null);
  153.55 +
  153.56 +        System.out.println(">>> Add notifications: " + SENT);
  153.57 +
  153.58 +        Date date = new Date();
  153.59 +        for (int i = 0; i < SENT; i++) {
  153.60 +            timer.addNotification(
  153.61 +                "testType" + i, "testMsg" + i, "testData" + i, date);
  153.62 +        }
  153.63 +
  153.64 +        System.out.println(">>> The notifications should be sent at " + date);
  153.65 +        System.out.println(">>> Sleep 100 ms to have past notifications.");
  153.66 +        Thread.sleep(100);
  153.67 +
  153.68 +        System.out.println(">>> Start the timer at " + new Date());
  153.69 +        timer.start();
  153.70 +
  153.71 +        System.out.println(">>> Stop the timer.");
  153.72 +        Thread.sleep(100);
  153.73 +        stopping = true;
  153.74 +        timer.stop();
  153.75 +
  153.76 +        if (received != SENT) {
  153.77 +            throw new RuntimeException(
  153.78 +                "Expected to receive " + SENT + " but got " + received);
  153.79 +        }
  153.80 +
  153.81 +        System.out.println(">>> Received all expected notifications.");
  153.82 +
  153.83 +        System.out.println(">>> Bye bye!");
  153.84 +    }
  153.85 +
  153.86 +    private static NotificationListener myListener =
  153.87 +        new NotificationListener() {
  153.88 +            public void handleNotification(Notification n, Object hb) {
  153.89 +                if (!stopping) {
  153.90 +                    received++;
  153.91 +                    System.out.println(
  153.92 +                        ">>> myListener-handleNotification: received " +
  153.93 +                        n.getSequenceNumber());
  153.94 +            }
  153.95 +        }
  153.96 +    };
  153.97 +
  153.98 +    private static int SENT = 10;
  153.99 +    private static volatile int received = 0;
 153.100 +    private static volatile boolean stopping = false;
 153.101 +}
   154.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   154.2 +++ b/test/javax/swing/JComboBox/7031551/bug7031551.java	Wed May 18 18:18:04 2011 -0700
   154.3 @@ -0,0 +1,123 @@
   154.4 +/*
   154.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   154.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   154.7 + *
   154.8 + * This code is free software; you can redistribute it and/or modify it
   154.9 + * under the terms of the GNU General Public License version 2 only, as
  154.10 + * published by the Free Software Foundation.
  154.11 + *
  154.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  154.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  154.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  154.15 + * version 2 for more details (a copy is included in the LICENSE file that
  154.16 + * accompanied this code).
  154.17 + *
  154.18 + * You should have received a copy of the GNU General Public License version
  154.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  154.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  154.21 + *
  154.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  154.23 + * or visit www.oracle.com if you need additional information or have any
  154.24 + * questions.
  154.25 + */
  154.26 +
  154.27 +/* @test
  154.28 + * @bug 7031551
  154.29 + * @summary Generics: JComboBox
  154.30 + * @author Pavel Porvatov
  154.31 + */
  154.32 +
  154.33 +import javax.swing.*;
  154.34 +import java.util.Vector;
  154.35 +
  154.36 +public class bug7031551 {
  154.37 +
  154.38 +    private static final String TEST_ELEMENT1 = "Test1";
  154.39 +    private static final String TEST_ELEMENT2 = "Test2";
  154.40 +    private static final String TEST_ELEMENT3 = "Test3";
  154.41 +
  154.42 +    /**
  154.43 +     * @param args the command line arguments
  154.44 +     */
  154.45 +    @SuppressWarnings("unchecked")
  154.46 +    public static void main(String[] args) {
  154.47 +        testRawSignatures();
  154.48 +        testGenericSignatures();
  154.49 +    }
  154.50 +
  154.51 +    @SuppressWarnings("unchecked")
  154.52 +    private static void testRawSignatures() {
  154.53 +        // Test JComboBox
  154.54 +        ComboBoxModel rawTestModel = new DefaultComboBoxModel();
  154.55 +
  154.56 +        JComboBox rawTestComboBox = new JComboBox();
  154.57 +        rawTestComboBox = new JComboBox(rawTestModel);
  154.58 +        rawTestComboBox = new JComboBox(new Object[]{TEST_ELEMENT1});
  154.59 +        rawTestComboBox = new JComboBox(new Vector());
  154.60 +
  154.61 +        Object unused1 = rawTestComboBox.getPrototypeDisplayValue();
  154.62 +        rawTestComboBox.setPrototypeDisplayValue(TEST_ELEMENT1);
  154.63 +
  154.64 +        ListCellRenderer unused2 = rawTestComboBox.getRenderer();
  154.65 +        rawTestComboBox.setRenderer(new DefaultListCellRenderer());
  154.66 +
  154.67 +        ComboBoxModel unused3 = rawTestComboBox.getModel();
  154.68 +        rawTestComboBox.setModel(rawTestModel);
  154.69 +
  154.70 +        rawTestComboBox.addItem(TEST_ELEMENT2);
  154.71 +        rawTestComboBox.insertItemAt(TEST_ELEMENT3, 1);
  154.72 +        rawTestComboBox.removeItem(TEST_ELEMENT2);
  154.73 +        assertEquals(rawTestComboBox.getItemAt(0), TEST_ELEMENT3);
  154.74 +        rawTestComboBox.removeAllItems();
  154.75 +
  154.76 +        // Test DefaultComboBoxModel
  154.77 +        DefaultComboBoxModel testModel = new DefaultComboBoxModel();
  154.78 +        testModel = new DefaultComboBoxModel(new Vector());
  154.79 +        testModel = new DefaultComboBoxModel(new Object[]{TEST_ELEMENT1});
  154.80 +
  154.81 +        testModel.addElement(TEST_ELEMENT2);
  154.82 +        testModel.insertElementAt(TEST_ELEMENT3, 1);
  154.83 +        assertEquals(testModel.getElementAt(2), TEST_ELEMENT2);
  154.84 +    }
  154.85 +
  154.86 +    private static void testGenericSignatures() {
  154.87 +        // Test JComboBox
  154.88 +        ComboBoxModel<String> stringTestModel = new DefaultComboBoxModel<String>();
  154.89 +
  154.90 +        JComboBox<String> stringTestComboBox = new JComboBox<String>();
  154.91 +        stringTestComboBox = new JComboBox<String>(stringTestModel);
  154.92 +        stringTestComboBox = new JComboBox<String>(new String[]{TEST_ELEMENT1});
  154.93 +        stringTestComboBox = new JComboBox<String>(new Vector<String>());
  154.94 +
  154.95 +        String unused1 = stringTestComboBox.getPrototypeDisplayValue();
  154.96 +        stringTestComboBox.setPrototypeDisplayValue(TEST_ELEMENT1);
  154.97 +
  154.98 +        ListCellRenderer<? super String> unused2 = stringTestComboBox.getRenderer();
  154.99 +        stringTestComboBox.setRenderer(new DefaultListCellRenderer());
 154.100 +
 154.101 +        ComboBoxModel unused3 = stringTestComboBox.getModel();
 154.102 +        stringTestComboBox.setModel(stringTestModel);
 154.103 +
 154.104 +        stringTestComboBox.addItem(TEST_ELEMENT2);
 154.105 +        stringTestComboBox.insertItemAt(TEST_ELEMENT3, 1);
 154.106 +        stringTestComboBox.removeItem(TEST_ELEMENT2);
 154.107 +        assertEquals(stringTestComboBox.getItemAt(0), TEST_ELEMENT3);
 154.108 +        stringTestComboBox.removeAllItems();
 154.109 +
 154.110 +        // Test DefaultComboBoxModel
 154.111 +        DefaultComboBoxModel<String> testModel = new DefaultComboBoxModel<String>();
 154.112 +        testModel = new DefaultComboBoxModel<String>(new Vector<String>());
 154.113 +        testModel = new DefaultComboBoxModel<String>(new String[]{TEST_ELEMENT1});
 154.114 +
 154.115 +        testModel.addElement(TEST_ELEMENT2);
 154.116 +        testModel.insertElementAt(TEST_ELEMENT3, 1);
 154.117 +        assertEquals(testModel.getElementAt(2), TEST_ELEMENT2);
 154.118 +    }
 154.119 +
 154.120 +    private static void assertEquals(Object expectedObject, Object actualObject) {
 154.121 +        if (!expectedObject.equals(actualObject)) {
 154.122 +            throw new RuntimeException("Expected: " + expectedObject + " but was: " + actualObject);
 154.123 +        }
 154.124 +    }
 154.125 +}
 154.126 +
   155.1 --- a/test/javax/swing/JTable/6788484/bug6788484.java	Wed May 18 16:32:05 2011 -0700
   155.2 +++ b/test/javax/swing/JTable/6788484/bug6788484.java	Wed May 18 18:18:04 2011 -0700
   155.3 @@ -1,5 +1,5 @@
   155.4  /*
   155.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
   155.6 + * Copyright (c) 2010, 2011 Oracle and/or its affiliates. All rights reserved.
   155.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   155.8   *
   155.9   * This code is free software; you can redistribute it and/or modify it
  155.10 @@ -24,9 +24,17 @@
  155.11  /* @test
  155.12     @bug 6788484
  155.13     @summary NPE in DefaultTableCellHeaderRenderer.getColumnSortOrder() with null table
  155.14 +   @compile -XDignore.symbol.file=true bug6788484.java
  155.15     @author Alexander Potochkin
  155.16     @run main bug6788484
  155.17  */
  155.18 +
  155.19 +/*
  155.20 + * Compile with -XDignore.symbol.file=true option as a workaround for
  155.21 + * specific behaviour described in 6380059 which restricts proprietary
  155.22 + * package loading
  155.23 + */
  155.24 +
  155.25  import sun.swing.table.DefaultTableCellHeaderRenderer;
  155.26  
  155.27  import javax.swing.*;