diff --git a/make/com/sun/nio/sctp/FILES_java.gmk b/make/com/sun/nio/sctp/FILES_java.gmk index 9d9c1a98e91b7a39322873936f90a2393896e157..725131e7280a882ded08ecf6b155ac15c302bf63 100644 --- a/make/com/sun/nio/sctp/FILES_java.gmk +++ b/make/com/sun/nio/sctp/FILES_java.gmk @@ -38,7 +38,7 @@ FILES_java = \ com/sun/nio/sctp/SctpMultiChannel.java \ com/sun/nio/sctp/SctpServerChannel.java \ com/sun/nio/sctp/SctpSocketOption.java \ - com/sun/nio/sctp/SctpStandardSocketOption.java \ + com/sun/nio/sctp/SctpStandardSocketOptions.java \ com/sun/nio/sctp/SendFailedNotification.java \ com/sun/nio/sctp/ShutdownNotification.java \ \ diff --git a/make/java/management/mapfile-vers b/make/java/management/mapfile-vers index 1fb36b78c496141e0ec96f67fafb66d8f213daaa..21b92d45f9e3e2c612664f0c5ebaed822c6938ea 100644 --- a/make/java/management/mapfile-vers +++ b/make/java/management/mapfile-vers @@ -49,6 +49,7 @@ SUNWprivate_1.1 { Java_sun_management_Flag_setStringValue; Java_sun_management_GarbageCollectorImpl_getCollectionCount; Java_sun_management_GarbageCollectorImpl_getCollectionTime; + Java_sun_management_GarbageCollectorImpl_setNotificationEnabled; Java_sun_management_GcInfoBuilder_fillGcAttributeInfo; Java_sun_management_GcInfoBuilder_getLastGcInfo0; Java_sun_management_GcInfoBuilder_getNumGcExtAttributes; diff --git a/make/java/nio/FILES_java.gmk b/make/java/nio/FILES_java.gmk index d09a966db3802d72e9eb34c67cc06fca8a0772ec..41397cacdc0dd408144108ab0ca7f9c8c7d905ee 100644 --- a/make/java/nio/FILES_java.gmk +++ b/make/java/nio/FILES_java.gmk @@ -71,7 +71,7 @@ FILES_src = \ java/nio/charset/CoderMalfunctionError.java \ java/nio/charset/CodingErrorAction.java \ java/nio/charset/MalformedInputException.java \ - java/nio/charset/StandardCharset.java \ + java/nio/charset/StandardCharsets.java \ java/nio/charset/UnmappableCharacterException.java \ \ java/nio/charset/spi/CharsetProvider.java \ @@ -116,7 +116,7 @@ FILES_src = \ java/nio/file/SimpleFileVisitor.java \ java/nio/file/StandardCopyOption.java \ java/nio/file/StandardOpenOption.java \ - java/nio/file/StandardWatchEventKind.java \ + java/nio/file/StandardWatchEventKinds.java \ java/nio/file/TempFileHelper.java \ java/nio/file/WatchEvent.java \ java/nio/file/WatchKey.java \ diff --git a/make/sun/xawt/mapfile-vers b/make/sun/xawt/mapfile-vers index 096bfe553264856292e9587fc67e9bb6b81f6398..8a12b69c31494a3c55a960a83f52e49c5371ab16 100644 --- a/make/sun/xawt/mapfile-vers +++ b/make/sun/xawt/mapfile-vers @@ -158,7 +158,6 @@ SUNWprivate_1.1 { Java_sun_awt_X11_XRobotPeer_mouseReleaseImpl; Java_sun_awt_X11_XRobotPeer_mouseWheelImpl; Java_sun_awt_X11_XRobotPeer_setup; - Java_sun_awt_X11_XRobotPeer__1dispose; Java_sun_awt_X11_XToolkit_getNumberOfButtonsImpl; Java_java_awt_Component_initIDs; Java_java_awt_Container_initIDs; diff --git a/src/share/classes/com/sun/management/GarbageCollectionNotificationInfo.java b/src/share/classes/com/sun/management/GarbageCollectionNotificationInfo.java new file mode 100644 index 0000000000000000000000000000000000000000..64fb94b3fb82f68baf46f829981206e4e2904db1 --- /dev/null +++ b/src/share/classes/com/sun/management/GarbageCollectionNotificationInfo.java @@ -0,0 +1,237 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.management; + +import javax.management.Notification; +import javax.management.openmbean.CompositeData; +import javax.management.openmbean.CompositeDataView; +import javax.management.openmbean.CompositeType; +import java.util.Collection; +import java.util.Collections; +import sun.management.GarbageCollectionNotifInfoCompositeData; + +/** + * The information about a garbage collection + * + *

+ * A garbage collection notification is emitted by {@link GarbageCollectorMXBean} + * when the Java virtual machine completes a garbage collection action + * The notification emitted will contain the garbage collection notification + * information about the status of the memory: + * + *

  • The name of the garbage collector used perform the collection.
  • + *
  • The action performed by the garbage collector.
  • + *
  • The cause of the garbage collection action.
  • + *
  • A {@link GcInfo} object containing some statistics about the GC cycle + (start time, end time) and the memory usage before and after + the GC cycle.
  • + * + * + *

    + * A {@link CompositeData CompositeData} representing + * the {@code GarbageCollectionNotificationInfo} object + * is stored in the + * {@linkplain javax.management.Notification#setUserData userdata} + * of a {@linkplain javax.management.Notification notification}. + * The {@link #from from} method is provided to convert from + * a {@code CompositeData} to a {@code GarbageCollectionNotificationInfo} + * object. For example: + * + *

    + *      Notification notif;
    + *
    + *      // receive the notification emitted by a GarbageCollectorMXBean and set to notif
    + *      ...
    + *
    + *      String notifType = notif.getType();
    + *      if (notifType.equals(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION)) {
    + *          // retrieve the garbage collection notification information
    + *          CompositeData cd = (CompositeData) notif.getUserData();
    + *          GarbageCollectionNotificationInfo info = GarbageCollectionNotificationInfo.from(cd);
    + *          ....
    + *      }
    + * 
    + * + *

    + * The type of the notification emitted by a {@code GarbageCollectorMXBean} is: + *

    + **/ + +public class GarbageCollectionNotificationInfo implements CompositeDataView { + + private final String gcName; + private final String gcAction; + private final String gcCause; + private final GcInfo gcInfo; + private final CompositeData cdata; + + /** + * Notification type denoting that + * the Java virtual machine has completed a garbage collection cycle. + * This notification is emitted by a {@link GarbageCollectorMXBean}. + * The value of this notification type is + * {@code com.sun.management.gc.notification}. + */ + public static final String GARBAGE_COLLECTION_NOTIFICATION = + "com.sun.management.gc.notification"; + + /** + * Constructs a {@code GarbageCollectionNotificationInfo} object. + * + * @param gcName The name of the garbage collector used to perform the collection + * @param gcAction The name of the action performed by the garbage collector + * @param gcCause The cause the garbage collection action + * @param gcInfo a GcInfo object providing statistics about the GC cycle + */ + public GarbageCollectionNotificationInfo(String gcName, + String gcAction, + String gcCause, + GcInfo gcInfo) { + if (gcName == null) { + throw new NullPointerException("Null gcName"); + } + if (gcAction == null) { + throw new NullPointerException("Null gcAction"); + } + if (gcCause == null) { + throw new NullPointerException("Null gcCause"); + } + this.gcName = gcName; + this.gcAction = gcAction; + this.gcCause = gcCause; + this.gcInfo = gcInfo; + this.cdata = new GarbageCollectionNotifInfoCompositeData(this); + } + + GarbageCollectionNotificationInfo(CompositeData cd) { + GarbageCollectionNotifInfoCompositeData.validateCompositeData(cd); + + this.gcName = GarbageCollectionNotifInfoCompositeData.getGcName(cd); + this.gcAction = GarbageCollectionNotifInfoCompositeData.getGcAction(cd); + this.gcCause = GarbageCollectionNotifInfoCompositeData.getGcCause(cd); + this.gcInfo = GarbageCollectionNotifInfoCompositeData.getGcInfo(cd); + this.cdata = cd; + } + + /** + * Returns the name of the garbage collector used to perform the collection + * + * @return the name of the garbage collector used to perform the collection + */ + public String getGcName() { + return gcName; + } + + /** + * Returns the action of the performed by the garbage collector + * + * @return the the action of the performed by the garbage collector + */ + public String getGcAction() { + return gcAction; + } + + /** + * Returns the cause the garbage collection + * + * @return the the cause the garbage collection + */ + public String getGcCause() { + return gcCause; + } + + /** + * Returns the GC information related to the last garbage collection + * + * @return the GC information related to the + * last garbage collection + */ + public GcInfo getGcInfo() { + return gcInfo; + } + + /** + * Returns a {@code GarbageCollectionNotificationInfo} object represented by the + * given {@code CompositeData}. + * The given {@code CompositeData} must contain + * the following attributes: + *
    + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    Attribute NameType
    gcName{@code java.lang.String}
    gcAction{@code java.lang.String}
    gcCause{@code java.lang.String}
    gcInfo{@code javax.management.openmbean.CompositeData}
    + *
    + * + * @param cd {@code CompositeData} representing a + * {@code GarbageCollectionNotificationInfo} + * + * @throws IllegalArgumentException if {@code cd} does not + * represent a {@code GarbaageCollectionNotificationInfo} object. + * + * @return a {@code GarbageCollectionNotificationInfo} object represented + * by {@code cd} if {@code cd} is not {@code null}; + * {@code null} otherwise. + */ + public static GarbageCollectionNotificationInfo from(CompositeData cd) { + if (cd == null) { + return null; + } + + if (cd instanceof GarbageCollectionNotifInfoCompositeData) { + return ((GarbageCollectionNotifInfoCompositeData) cd).getGarbageCollectionNotifInfo(); + } else { + return new GarbageCollectionNotificationInfo(cd); + } + } + + public CompositeData toCompositeData(CompositeType ct) { + return cdata; + } + +} diff --git a/src/share/classes/com/sun/nio/sctp/MessageInfo.java b/src/share/classes/com/sun/nio/sctp/MessageInfo.java index ca3e13fc47aaacb15613f26e5aeae8b13dcdc20b..b851b77ac4301149303381041eb3a51d037b7c16 100644 --- a/src/share/classes/com/sun/nio/sctp/MessageInfo.java +++ b/src/share/classes/com/sun/nio/sctp/MessageInfo.java @@ -179,7 +179,7 @@ public abstract class MessageInfo { * completely received. For messages being sent {@code true} indicates that * the message is complete, {@code false} indicates that the message is not * complete. How the send channel interprets this value depends on the value - * of its {@link SctpStandardSocketOption#SCTP_EXPLICIT_COMPLETE + * of its {@link SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE * SCTP_EXPLICIT_COMPLETE} socket option. * * @return {@code true} if, and only if, the message is complete @@ -192,7 +192,7 @@ public abstract class MessageInfo { *

    For messages being sent {@code true} indicates that * the message is complete, {@code false} indicates that the message is not * complete. How the send channel interprets this value depends on the value - * of its {@link SctpStandardSocketOption#SCTP_EXPLICIT_COMPLETE + * of its {@link SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE * SCTP_EXPLICIT_COMPLETE} socket option. * * @param complete diff --git a/src/share/classes/com/sun/nio/sctp/SctpChannel.java b/src/share/classes/com/sun/nio/sctp/SctpChannel.java index 8e0472ef1fa2b94c05235654b990d669be69205d..d040a7a07ea2af92e4d5cd37f380fd30320b32d2 100644 --- a/src/share/classes/com/sun/nio/sctp/SctpChannel.java +++ b/src/share/classes/com/sun/nio/sctp/SctpChannel.java @@ -65,55 +65,55 @@ import java.nio.channels.SelectionKey; * Description * * - * {@link SctpStandardSocketOption#SCTP_DISABLE_FRAGMENTS + * {@link SctpStandardSocketOptions#SCTP_DISABLE_FRAGMENTS * SCTP_DISABLE_FRAGMENTS} * Enables or disables message fragmentation * * - * {@link SctpStandardSocketOption#SCTP_EXPLICIT_COMPLETE + * {@link SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE * SCTP_EXPLICIT_COMPLETE} * Enables or disables explicit message completion * * - * {@link SctpStandardSocketOption#SCTP_FRAGMENT_INTERLEAVE + * {@link SctpStandardSocketOptions#SCTP_FRAGMENT_INTERLEAVE * SCTP_FRAGMENT_INTERLEAVE} * Controls how the presentation of messages occur for the message * receiver * * - * {@link SctpStandardSocketOption#SCTP_INIT_MAXSTREAMS + * {@link SctpStandardSocketOptions#SCTP_INIT_MAXSTREAMS * SCTP_INIT_MAXSTREAMS} * The maximum number of streams requested by the local endpoint during * association initialization * * - * {@link SctpStandardSocketOption#SCTP_NODELAY SCTP_NODELAY} + * {@link SctpStandardSocketOptions#SCTP_NODELAY SCTP_NODELAY} * Enables or disable a Nagle-like algorithm * * - * {@link SctpStandardSocketOption#SCTP_PRIMARY_ADDR + * {@link SctpStandardSocketOptions#SCTP_PRIMARY_ADDR * SCTP_PRIMARY_ADDR} * Requests that the local SCTP stack use the given peer address as the * association primary * * - * {@link SctpStandardSocketOption#SCTP_SET_PEER_PRIMARY_ADDR + * {@link SctpStandardSocketOptions#SCTP_SET_PEER_PRIMARY_ADDR * SCTP_SET_PEER_PRIMARY_ADDR} * Requests that the peer mark the enclosed address as the association * primary * * - * {@link SctpStandardSocketOption#SO_SNDBUF + * {@link SctpStandardSocketOptions#SO_SNDBUF * SO_SNDBUF} * The size of the socket send buffer * * - * {@link SctpStandardSocketOption#SO_RCVBUF + * {@link SctpStandardSocketOptions#SO_RCVBUF * SO_RCVBUF} * The size of the socket receive buffer * * - * {@link SctpStandardSocketOption#SO_LINGER + * {@link SctpStandardSocketOptions#SO_LINGER * SO_LINGER} * Linger on close if data is present (when configured in blocking mode * only) @@ -449,7 +449,7 @@ public abstract class SctpChannel *

    This is a convience method and is equivalent to evaluating the * following expression: *

    -     * setOption(SctpStandardSocketOption.SCTP_INIT_MAXSTREAMS, SctpStandardSocketOption.InitMaxStreams.create(maxInStreams, maxOutStreams))
    +     * setOption(SctpStandardSocketOptions.SCTP_INIT_MAXSTREAMS, SctpStandardSocketOption.InitMaxStreams.create(maxInStreams, maxOutStreams))
          *  .connect(remote);
          * 
    * @@ -651,7 +651,7 @@ public abstract class SctpChannel * @throws IOException * If an I/O error occurs * - * @see SctpStandardSocketOption + * @see SctpStandardSocketOptions */ public abstract T getOption(SctpSocketOption name) throws IOException; @@ -680,7 +680,7 @@ public abstract class SctpChannel * @throws IOException * If an I/O error occurs * - * @see SctpStandardSocketOption + * @see SctpStandardSocketOptions */ public abstract SctpChannel setOption(SctpSocketOption name, T value) throws IOException; @@ -731,7 +731,7 @@ public abstract class SctpChannel * MessageInfo} will return {@code false}, and more invocations of this * method will be necessary to completely consume the messgae. Only * one message at a time will be partially delivered in any stream. The - * socket option {@link SctpStandardSocketOption#SCTP_FRAGMENT_INTERLEAVE + * socket option {@link SctpStandardSocketOptions#SCTP_FRAGMENT_INTERLEAVE * SCTP_FRAGMENT_INTERLEAVE} controls various aspects of what interlacing of * messages occurs. * @@ -804,7 +804,7 @@ public abstract class SctpChannel * and sufficient room becomes available, then the remaining bytes in the * given byte buffer are transmitted as a single message. Sending a message * is atomic unless explicit message completion {@link - * SctpStandardSocketOption#SCTP_EXPLICIT_COMPLETE SCTP_EXPLICIT_COMPLETE} + * SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE SCTP_EXPLICIT_COMPLETE} * socket option is enabled on this channel's socket. * *

    The message is transferred from the byte buffer as if by a regular diff --git a/src/share/classes/com/sun/nio/sctp/SctpMultiChannel.java b/src/share/classes/com/sun/nio/sctp/SctpMultiChannel.java index b2f0378064fb39b06a576bb49583f8afa190ddba..229d18ec039378132233e64252a160a48a795f95 100644 --- a/src/share/classes/com/sun/nio/sctp/SctpMultiChannel.java +++ b/src/share/classes/com/sun/nio/sctp/SctpMultiChannel.java @@ -69,55 +69,55 @@ import java.nio.channels.SelectionKey; * Description * * - * {@link SctpStandardSocketOption#SCTP_DISABLE_FRAGMENTS + * {@link SctpStandardSocketOptions#SCTP_DISABLE_FRAGMENTS * SCTP_DISABLE_FRAGMENTS} * Enables or disables message fragmentation * * - * {@link SctpStandardSocketOption#SCTP_EXPLICIT_COMPLETE + * {@link SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE * SCTP_EXPLICIT_COMPLETE} * Enables or disables explicit message completion * * - * {@link SctpStandardSocketOption#SCTP_FRAGMENT_INTERLEAVE + * {@link SctpStandardSocketOptions#SCTP_FRAGMENT_INTERLEAVE * SCTP_FRAGMENT_INTERLEAVE} * Controls how the presentation of messages occur for the message * receiver * * - * {@link SctpStandardSocketOption#SCTP_INIT_MAXSTREAMS + * {@link SctpStandardSocketOptions#SCTP_INIT_MAXSTREAMS * SCTP_INIT_MAXSTREAMS} * The maximum number of streams requested by the local endpoint during * association initialization * * - * {@link SctpStandardSocketOption#SCTP_NODELAY SCTP_NODELAY} + * {@link SctpStandardSocketOptions#SCTP_NODELAY SCTP_NODELAY} * Enables or disable a Nagle-like algorithm * * - * {@link SctpStandardSocketOption#SCTP_PRIMARY_ADDR + * {@link SctpStandardSocketOptions#SCTP_PRIMARY_ADDR * SCTP_PRIMARY_ADDR} * Requests that the local SCTP stack use the given peer address as the * association primary * * - * {@link SctpStandardSocketOption#SCTP_SET_PEER_PRIMARY_ADDR + * {@link SctpStandardSocketOptions#SCTP_SET_PEER_PRIMARY_ADDR * SCTP_SET_PEER_PRIMARY_ADDR} * Requests that the peer mark the enclosed address as the association * primary * * - * {@link SctpStandardSocketOption#SO_SNDBUF + * {@link SctpStandardSocketOptions#SO_SNDBUF * SO_SNDBUF} * The size of the socket send buffer * * - * {@link SctpStandardSocketOption#SO_RCVBUF + * {@link SctpStandardSocketOptions#SO_RCVBUF * SO_RCVBUF} * The size of the socket receive buffer * * - * {@link SctpStandardSocketOption#SO_LINGER + * {@link SctpStandardSocketOptions#SO_LINGER * SO_LINGER} * Linger on close if data is present (when configured in blocking mode * only) @@ -450,7 +450,7 @@ public abstract class SctpMultiChannel * @throws IOException * If an I/O error occurs * - * @see SctpStandardSocketOption + * @see SctpStandardSocketOptions */ public abstract T getOption(SctpSocketOption name, Association association) @@ -489,7 +489,7 @@ public abstract class SctpMultiChannel * @throws IOException * If an I/O error occurs * - * @see SctpStandardSocketOption + * @see SctpStandardSocketOptions */ public abstract SctpMultiChannel setOption(SctpSocketOption name, T value, @@ -542,7 +542,7 @@ public abstract class SctpMultiChannel * MessageInfo} will return {@code false}, and more invocations of this * method will be necessary to completely consume the messgae. Only * one message at a time will be partially delivered in any stream. The - * socket option {@link SctpStandardSocketOption#SCTP_FRAGMENT_INTERLEAVE + * socket option {@link SctpStandardSocketOptions#SCTP_FRAGMENT_INTERLEAVE * SCTP_FRAGMENT_INTERLEAVE} controls various aspects of what interlacing of * messages occurs. * @@ -635,14 +635,14 @@ public abstract class SctpMultiChannel * underlying output buffer, then the remaining bytes in the given byte * buffer are transmitted as a single message. Sending a message * is atomic unless explicit message completion {@link - * SctpStandardSocketOption#SCTP_EXPLICIT_COMPLETE SCTP_EXPLICIT_COMPLETE} + * SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE SCTP_EXPLICIT_COMPLETE} * socket option is enabled on this channel's socket. * *

    If this channel is in non-blocking mode, there is sufficient room * in the underlying output buffer, and an implicit association setup is * required, then the remaining bytes in the given byte buffer are * transmitted as a single message, subject to {@link - * SctpStandardSocketOption#SCTP_EXPLICIT_COMPLETE SCTP_EXPLICIT_COMPLETE}. + * SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE SCTP_EXPLICIT_COMPLETE}. * If for any reason the message cannot * be delivered an {@link AssociationChangeNotification association * changed} notification is put on the SCTP stack with its {@code event} parameter set diff --git a/src/share/classes/com/sun/nio/sctp/SctpServerChannel.java b/src/share/classes/com/sun/nio/sctp/SctpServerChannel.java index 5c762edfe3585d4bb2cd4dba62b99a9cc92e6d62..3867fc9ca347cc1836d65b22cf31dcad3bbc97ef 100644 --- a/src/share/classes/com/sun/nio/sctp/SctpServerChannel.java +++ b/src/share/classes/com/sun/nio/sctp/SctpServerChannel.java @@ -53,7 +53,7 @@ import java.nio.channels.spi.AbstractSelectableChannel; * Description * * - * {@link SctpStandardSocketOption#SCTP_INIT_MAXSTREAMS + * {@link SctpStandardSocketOptions#SCTP_INIT_MAXSTREAMS * SCTP_INIT_MAXSTREAMS} * The maximum number of streams requested by the local endpoint during * association initialization @@ -360,7 +360,7 @@ public abstract class SctpServerChannel * @throws IOException * If an I/O error occurs * - * @see SctpStandardSocketOption + * @see SctpStandardSocketOptions */ public abstract T getOption(SctpSocketOption name) throws IOException; @@ -388,7 +388,7 @@ public abstract class SctpServerChannel * @throws IOException * If an I/O error occurs * - * @see SctpStandardSocketOption + * @see SctpStandardSocketOptions */ public abstract SctpServerChannel setOption(SctpSocketOption name, T value) diff --git a/src/share/classes/com/sun/nio/sctp/SctpSocketOption.java b/src/share/classes/com/sun/nio/sctp/SctpSocketOption.java index 37f954d71207d45f78804d898f0a9a558e6ab0c0..3e60dbfa090e97cd3da22926b5a44e62c4e9b644 100644 --- a/src/share/classes/com/sun/nio/sctp/SctpSocketOption.java +++ b/src/share/classes/com/sun/nio/sctp/SctpSocketOption.java @@ -33,6 +33,6 @@ import java.net.SocketOption; * * @since 1.7 * - * @see SctpStandardSocketOption + * @see SctpStandardSocketOptions */ public interface SctpSocketOption extends SocketOption { } diff --git a/src/share/classes/com/sun/nio/sctp/SctpStandardSocketOption.java b/src/share/classes/com/sun/nio/sctp/SctpStandardSocketOptions.java similarity index 97% rename from src/share/classes/com/sun/nio/sctp/SctpStandardSocketOption.java rename to src/share/classes/com/sun/nio/sctp/SctpStandardSocketOptions.java index 47ffa98238a2e49db48696cf26a54c74fe15a5c7..22c5f4a005b2269ac009ca110fdcdacf3630f702 100644 --- a/src/share/classes/com/sun/nio/sctp/SctpStandardSocketOption.java +++ b/src/share/classes/com/sun/nio/sctp/SctpStandardSocketOptions.java @@ -34,8 +34,8 @@ import sun.nio.ch.SctpStdSocketOption; * * @since 1.7 */ -public class SctpStandardSocketOption { - private SctpStandardSocketOption() {} +public class SctpStandardSocketOptions { + private SctpStandardSocketOptions() {} /** * Enables or disables message fragmentation. * @@ -127,7 +127,7 @@ public class SctpStandardSocketOption { * association initialization. * *

    The value of this socket option is an {@link - * SctpStandardSocketOption.InitMaxStreams InitMaxStreams}, that represents + * SctpStandardSocketOptions.InitMaxStreams InitMaxStreams}, that represents * the maximum number of inbound and outbound streams that an association * on the channel is prepared to support. * @@ -157,9 +157,9 @@ public class SctpStandardSocketOption { * the endpoints default value. */ public static final SctpSocketOption - SCTP_INIT_MAXSTREAMS = - new SctpStdSocketOption( - "SCTP_INIT_MAXSTREAMS", SctpStandardSocketOption.InitMaxStreams.class); + SCTP_INIT_MAXSTREAMS = + new SctpStdSocketOption( + "SCTP_INIT_MAXSTREAMS", SctpStandardSocketOptions.InitMaxStreams.class); /** * Enables or disables a Nagle-like algorithm. @@ -310,7 +310,7 @@ public class SctpStandardSocketOption { * This class is used to set the maximum number of inbound/outbound streams * used by the local endpoint during association initialization. An * instance of this class is used to set the {@link - * SctpStandardSocketOption#SCTP_INIT_MAXSTREAMS SCTP_INIT_MAXSTREAMS} + * SctpStandardSocketOptions#SCTP_INIT_MAXSTREAMS SCTP_INIT_MAXSTREAMS} * socket option. * * @since 1.7 diff --git a/src/share/classes/java/awt/Component.java b/src/share/classes/java/awt/Component.java index f577887abe67c4caf7831dd385c71e25909a3427..2225633c0db5d6783b57663ae335b14fb7ed52ac 100644 --- a/src/share/classes/java/awt/Component.java +++ b/src/share/classes/java/awt/Component.java @@ -2887,11 +2887,12 @@ public abstract class Component implements ImageObserver, MenuContainer, /** * Invalidates this component and its ancestors. *

    - * All the ancestors of this component up to the nearest validate root are - * marked invalid also. If there is no a validate root container for this - * component, all of its ancestors up to the root of the hierarchy are - * marked invalid as well. Marking a container invalid indicates - * that the container needs to be laid out. + * By default, all the ancestors of the component up to the top-most + * container of the hierarchy are marked invalid. If the {@code + * java.awt.smartInvalidate} system property is set to {@code true}, + * invalidation stops on the nearest validate root of this component. + * Marking a container invalid indicates that the container needs to + * be laid out. *

    * This method is called automatically when any layout-related information * changes (e.g. setting the bounds of the component, or adding the diff --git a/src/share/classes/java/awt/Container.java b/src/share/classes/java/awt/Container.java index 88f0865b187128a72ef555892d04799f5189e423..c59aa90bc5f238f14ee02d9e7267366e5f4831dc 100644 --- a/src/share/classes/java/awt/Container.java +++ b/src/share/classes/java/awt/Container.java @@ -41,6 +41,8 @@ import java.io.ObjectStreamField; import java.io.PrintStream; import java.io.PrintWriter; +import java.security.AccessController; + import java.util.Arrays; import java.util.EventListener; import java.util.HashSet; @@ -60,6 +62,8 @@ import sun.awt.dnd.SunDropTargetEvent; import sun.java2d.pipe.Region; +import sun.security.action.GetBooleanAction; + /** * A generic Abstract Window Toolkit(AWT) container object is a component * that can contain other AWT components. @@ -1506,12 +1510,18 @@ public class Container extends Component { * Layout-related changes, such as bounds of the validate root descendants, * do not affect the layout of the validate root parent. This peculiarity * enables the {@code invalidate()} method to stop invalidating the - * component hierarchy when the method encounters a validate root. + * component hierarchy when the method encounters a validate root. However, + * to preserve backward compatibility this new optimized behavior is + * enabled only when the {@code java.awt.smartInvalidate} system property + * value is set to {@code true}. *

    - * If a component hierarchy contains validate roots, the {@code validate()} - * method must be invoked on the validate root of a previously invalidated - * component, rather than on the top-level container (such as a {@code - * Frame} object) to restore the validity of the hierarchy later. + * If a component hierarchy contains validate roots and the new optimized + * {@code invalidate()} behavior is enabled, the {@code validate()} method + * must be invoked on the validate root of a previously invalidated + * component to restore the validity of the hierarchy later. Otherwise, + * calling the {@code validate()} method on the top-level container (such + * as a {@code Frame} object) should be used to restore the validity of the + * component hierarchy. *

    * The {@code Window} class and the {@code Applet} class are the validate * roots in AWT. Swing introduces more validate roots. @@ -1527,13 +1537,20 @@ public class Container extends Component { return false; } + private static final boolean isJavaAwtSmartInvalidate; + static { + // Don't lazy-read because every app uses invalidate() + isJavaAwtSmartInvalidate = AccessController.doPrivileged( + new GetBooleanAction("java.awt.smartInvalidate")); + } + /** * Invalidates the parent of the container unless the container * is a validate root. */ @Override void invalidateParent() { - if (!isValidateRoot()) { + if (!isJavaAwtSmartInvalidate || !isValidateRoot()) { super.invalidateParent(); } } @@ -1572,9 +1589,8 @@ public class Container extends Component { * automatically. Note that the ancestors of the container may be * invalidated also (see {@link Component#invalidate} for details.) * Therefore, to restore the validity of the hierarchy, the {@code - * validate()} method should be invoked on a validate root of an - * invalidated component, or on the top-most container if the hierarchy - * does not contain validate roots. + * validate()} method should be invoked on the top-most invalid + * container of the hierarchy. *

    * Validating the container may be a quite time-consuming operation. For * performance reasons a developer may postpone the validation of the diff --git a/src/share/classes/java/awt/Toolkit.java b/src/share/classes/java/awt/Toolkit.java index 6e00e6afdbf260aba46d82a34b09e98b0be903f1..3ac2714dcef892da3bb4d97a96f61fa2123715bb 100644 --- a/src/share/classes/java/awt/Toolkit.java +++ b/src/share/classes/java/awt/Toolkit.java @@ -466,10 +466,7 @@ public abstract class Toolkit { */ protected void loadSystemColors(int[] systemColors) throws HeadlessException { - if (GraphicsEnvironment.isHeadless()){ - throw new HeadlessException(); - } - + GraphicsEnvironment.checkHeadless(); } /** @@ -504,10 +501,7 @@ public abstract class Toolkit { */ public void setDynamicLayout(boolean dynamic) throws HeadlessException { - if (GraphicsEnvironment.isHeadless()){ - throw new HeadlessException(); - } - + GraphicsEnvironment.checkHeadless(); } /** @@ -531,9 +525,8 @@ public abstract class Toolkit { */ protected boolean isDynamicLayoutSet() throws HeadlessException { - if (GraphicsEnvironment.isHeadless()){ - throw new HeadlessException(); - } + GraphicsEnvironment.checkHeadless(); + if (this != Toolkit.getDefaultToolkit()) { return Toolkit.getDefaultToolkit().isDynamicLayoutSet(); } else { @@ -569,9 +562,8 @@ public abstract class Toolkit { */ public boolean isDynamicLayoutActive() throws HeadlessException { - if (GraphicsEnvironment.isHeadless()){ - throw new HeadlessException(); - } + GraphicsEnvironment.checkHeadless(); + if (this != Toolkit.getDefaultToolkit()) { return Toolkit.getDefaultToolkit().isDynamicLayoutActive(); } else { @@ -615,9 +607,7 @@ public abstract class Toolkit { */ public Insets getScreenInsets(GraphicsConfiguration gc) throws HeadlessException { - if (GraphicsEnvironment.isHeadless()){ - throw new HeadlessException(); - } + GraphicsEnvironment.checkHeadless(); if (this != Toolkit.getDefaultToolkit()) { return Toolkit.getDefaultToolkit().getScreenInsets(gc); } else { @@ -1200,10 +1190,7 @@ public abstract class Toolkit { * security manager's checkPermission method with a * RuntimePermission("queuePrintJob") permission. * - * @param frame the parent of the print dialog. May be null if and only - * if jobAttributes is not null and jobAttributes.getDialog() - * returns JobAttributes.DialogType.NONE or - * JobAttributes.DialogType.COMMON. + * @param frame the parent of the print dialog. May not be null. * @param jobtitle the title of the PrintJob. A null title is equivalent * to "". * @param jobAttributes a set of job attributes which will control the @@ -1359,9 +1346,8 @@ public abstract class Toolkit { * @since 1.4 */ public Clipboard getSystemSelection() throws HeadlessException { - if (GraphicsEnvironment.isHeadless()){ - throw new HeadlessException(); - } + GraphicsEnvironment.checkHeadless(); + if (this != Toolkit.getDefaultToolkit()) { return Toolkit.getDefaultToolkit().getSystemSelection(); } else { @@ -1391,9 +1377,7 @@ public abstract class Toolkit { * @since JDK1.1 */ public int getMenuShortcutKeyMask() throws HeadlessException { - if (GraphicsEnvironment.isHeadless()){ - throw new HeadlessException(); - } + GraphicsEnvironment.checkHeadless(); return Event.CTRL_MASK; } @@ -1418,7 +1402,10 @@ public abstract class Toolkit { * @since 1.3 */ public boolean getLockingKeyState(int keyCode) - throws UnsupportedOperationException { + throws UnsupportedOperationException + { + GraphicsEnvironment.checkHeadless(); + if (! (keyCode == KeyEvent.VK_CAPS_LOCK || keyCode == KeyEvent.VK_NUM_LOCK || keyCode == KeyEvent.VK_SCROLL_LOCK || keyCode == KeyEvent.VK_KANA_LOCK)) { throw new IllegalArgumentException("invalid key for Toolkit.getLockingKeyState"); @@ -1449,7 +1436,10 @@ public abstract class Toolkit { * @since 1.3 */ public void setLockingKeyState(int keyCode, boolean on) - throws UnsupportedOperationException { + throws UnsupportedOperationException + { + GraphicsEnvironment.checkHeadless(); + if (! (keyCode == KeyEvent.VK_CAPS_LOCK || keyCode == KeyEvent.VK_NUM_LOCK || keyCode == KeyEvent.VK_SCROLL_LOCK || keyCode == KeyEvent.VK_KANA_LOCK)) { throw new IllegalArgumentException("invalid key for Toolkit.setLockingKeyState"); @@ -1523,9 +1513,8 @@ public abstract class Toolkit { */ public Dimension getBestCursorSize(int preferredWidth, int preferredHeight) throws HeadlessException { - if (GraphicsEnvironment.isHeadless()){ - throw new HeadlessException(); - } + GraphicsEnvironment.checkHeadless(); + // Override to implement custom cursor support. if (this != Toolkit.getDefaultToolkit()) { return Toolkit.getDefaultToolkit(). @@ -1553,9 +1542,8 @@ public abstract class Toolkit { * @since 1.2 */ public int getMaximumCursorColors() throws HeadlessException { - if (GraphicsEnvironment.isHeadless()){ - throw new HeadlessException(); - } + GraphicsEnvironment.checkHeadless(); + // Override to implement custom cursor support. if (this != Toolkit.getDefaultToolkit()) { return Toolkit.getDefaultToolkit().getMaximumCursorColors(); @@ -1605,9 +1593,8 @@ public abstract class Toolkit { public boolean isFrameStateSupported(int state) throws HeadlessException { - if (GraphicsEnvironment.isHeadless()){ - throw new HeadlessException(); - } + GraphicsEnvironment.checkHeadless(); + if (this != Toolkit.getDefaultToolkit()) { return Toolkit.getDefaultToolkit(). isFrameStateSupported(state); @@ -2614,9 +2601,8 @@ public abstract class Toolkit { * @since 1.7 */ public boolean areExtraMouseButtonsEnabled() throws HeadlessException { - if (GraphicsEnvironment.isHeadless()){ - throw new HeadlessException(); - } + GraphicsEnvironment.checkHeadless(); + return Toolkit.getDefaultToolkit().areExtraMouseButtonsEnabled(); } } diff --git a/src/share/classes/java/lang/SafeVarargs.java b/src/share/classes/java/lang/SafeVarargs.java index b0c03a9162b18510adfb2d537f584dafc2c2f768..818ea21bafb56369e965e95b550e55d86f8bc988 100644 --- a/src/share/classes/java/lang/SafeVarargs.java +++ b/src/share/classes/java/lang/SafeVarargs.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ import java.lang.annotation.*; * constructor does not perform potentially unsafe operations on its * varargs parameter. Applying this annotation to a method or * constructor suppresses unchecked warnings about a - * non-reifiable variable-arity (vararg) type and suppresses + * non-reifiable variable arity (vararg) type and suppresses * unchecked warnings about parameterized array creation at call * sites. * @@ -41,11 +41,10 @@ import java.lang.annotation.*; * additional usage restrictions on this annotation type; it is a * compile-time error if a method or constructor declaration is * annotated with a {@code @SafeVarargs} annotation, and either: - *

      - *
    • the declaration is a fixed-arity method or constructor + *
    • the declaration is a fixed arity method or constructor * - *
    • the declaration is a variable-arity method that is neither + *
    • the declaration is a variable arity method that is neither * {@code static} nor {@code final}. * *
    @@ -55,15 +54,28 @@ import java.lang.annotation.*; * *
      * - *
    • The variable-arity parameter has a reifiable element type, + *
    • The variable arity parameter has a reifiable element type, * which includes primitive types, {@code Object}, and {@code String}. * (The unchecked warnings this annotation type suppresses already do * not occur for a reifiable element type.) * *
    • The body of the method or constructor declaration performs * potentially unsafe operations, such as an assignment to an element - * of the variable-arity parameter's array that generates an unchecked - * warning. + * of the variable arity parameter's array that generates an unchecked + * warning. Some unsafe operations do not trigger an unchecked + * warning. For example, the aliasing in + * + *
      + * @SafeVarargs // Not actually safe!
      + * static void m(List<String>... stringLists) {
      + *   Object[] array = stringLists;
      + *   List<Integer> tmpList = Arrays.asList(42);
      + *   array[0] = tmpList; // Semantically invalid, but compiles without warnings
      + *   String s = stringLists[0].get(0); // Oh no, ClassCastException at runtime!
      + * }
      + * 
      + * + * leads to a {@code ClassCastException} at runtime. * *

      Future versions of the platform may mandate compiler errors for * such unsafe operations. diff --git a/src/share/classes/java/lang/Throwable.java b/src/share/classes/java/lang/Throwable.java index d70fe26841ab8e6e86d7c95314aa7a86d54e92bc..2319aafd00fa2fab3f70b889a2f879da451f473b 100644 --- a/src/share/classes/java/lang/Throwable.java +++ b/src/share/classes/java/lang/Throwable.java @@ -336,7 +336,10 @@ public class Throwable implements Serializable { * Disabling of suppression should only occur in exceptional * circumstances where special requirements exist, such as a * virtual machine reusing exception objects under low-memory - * situations. + * situations. Circumstances where a given exception object is + * repeatedly caught and rethrown, such as to implement control + * flow between two sub-systems, is another situation where + * immutable throwable objects would be appropriate. * * @param message the detail message. * @param cause the cause. (A {@code null} value is permitted, @@ -423,6 +426,18 @@ public class Throwable implements Serializable { * {@link #Throwable(String,Throwable)}, this method cannot be called * even once. * + *

      An example of using this method on a legacy throwable type + * without other support for setting the cause is: + * + *

      +     * try {
      +     *     lowLevelOp();
      +     * } catch (LowLevelException le) {
      +     *     throw (HighLevelException)
      +     *           new HighLevelException().initCause(le); // Legacy constructor
      +     * }
      +     * 
      + * * @param cause the cause (which is saved for later retrieval by the * {@link #getCause()} method). (A {@code null} value is * permitted, and indicates that the cause is nonexistent or @@ -762,7 +777,8 @@ public class Throwable implements Serializable { * @see java.lang.Throwable#printStackTrace() */ public synchronized Throwable fillInStackTrace() { - if (stackTrace != null) { + if (stackTrace != null || + backtrace != null /* Out of protocol state */ ) { fillInStackTrace(0); stackTrace = UNASSIGNED_STACK; } @@ -788,7 +804,8 @@ public class Throwable implements Serializable { * this throwable is permitted to return a zero-length array from this * method. Generally speaking, the array returned by this method will * contain one element for every frame that would be printed by - * {@code printStackTrace}. + * {@code printStackTrace}. Writes to the returned array do not + * affect future calls to this method. * * @return an array of stack trace elements representing the stack trace * pertaining to this throwable. @@ -801,7 +818,8 @@ public class Throwable implements Serializable { private synchronized StackTraceElement[] getOurStackTrace() { // Initialize stack trace field with information from // backtrace if this is the first call to this method - if (stackTrace == UNASSIGNED_STACK) { + if (stackTrace == UNASSIGNED_STACK || + (stackTrace == null && backtrace != null) /* Out of protocol state */) { int depth = getStackTraceDepth(); stackTrace = new StackTraceElement[depth]; for (int i=0; i < depth; i++) @@ -849,7 +867,8 @@ public class Throwable implements Serializable { } synchronized (this) { - if (this.stackTrace == null) // Immutable stack + if (this.stackTrace == null && // Immutable stack + backtrace == null) // Test for out of protocol state return; this.stackTrace = defensiveCopy; } @@ -971,8 +990,8 @@ public class Throwable implements Serializable { /** * Appends the specified exception to the exceptions that were * suppressed in order to deliver this exception. This method is - * typically called (automatically and implicitly) by the {@code - * try}-with-resources statement. + * thread-safe and typically called (automatically and implicitly) + * by the {@code try}-with-resources statement. * *

      The suppression behavior is enabled unless disabled * {@linkplain #Throwable(String, Throwable, boolean, boolean) via @@ -1043,7 +1062,9 @@ public class Throwable implements Serializable { * * If no exceptions were suppressed or {@linkplain * #Throwable(String, Throwable, boolean, boolean) suppression is - * disabled}, an empty array is returned. + * disabled}, an empty array is returned. This method is + * thread-safe. Writes to the returned array do not affect future + * calls to this method. * * @return an array containing all of the exceptions that were * suppressed to deliver this exception. diff --git a/src/share/classes/java/net/SocketOption.java b/src/share/classes/java/net/SocketOption.java index 65dfe3c5a6b80bedc7afb5f5db51c43917fd429a..d3c5972ee0212b806bc2d3ee887d3a82f4deb029 100644 --- a/src/share/classes/java/net/SocketOption.java +++ b/src/share/classes/java/net/SocketOption.java @@ -38,7 +38,7 @@ package java.net; * * @since 1.7 * - * @see StandardSocketOption + * @see StandardSocketOptions */ public interface SocketOption { diff --git a/src/share/classes/java/net/StandardSocketOption.java b/src/share/classes/java/net/StandardSocketOptions.java similarity index 99% rename from src/share/classes/java/net/StandardSocketOption.java rename to src/share/classes/java/net/StandardSocketOptions.java index bc9589689d32e705967336e39b48c420fca3bab5..b9bea8d0ab55b32979eb6cd68519ed063568e346 100644 --- a/src/share/classes/java/net/StandardSocketOption.java +++ b/src/share/classes/java/net/StandardSocketOptions.java @@ -38,8 +38,8 @@ package java.net; * @since 1.7 */ -public final class StandardSocketOption { - private StandardSocketOption() { } +public final class StandardSocketOptions { + private StandardSocketOptions() { } // -- SOL_SOCKET -- diff --git a/src/share/classes/java/nio/channels/AsynchronousServerSocketChannel.java b/src/share/classes/java/nio/channels/AsynchronousServerSocketChannel.java index c2b74d21c49c0ed42969d248bcc47823afc68af8..1b5a67f3c6d0c6931e384c45e8b37e3ef2c27a56 100644 --- a/src/share/classes/java/nio/channels/AsynchronousServerSocketChannel.java +++ b/src/share/classes/java/nio/channels/AsynchronousServerSocketChannel.java @@ -58,11 +58,11 @@ import java.io.IOException; * Description * * - * {@link java.net.StandardSocketOption#SO_RCVBUF SO_RCVBUF} + * {@link java.net.StandardSocketOptions#SO_RCVBUF SO_RCVBUF} * The size of the socket receive buffer * * - * {@link java.net.StandardSocketOption#SO_REUSEADDR SO_REUSEADDR} + * {@link java.net.StandardSocketOptions#SO_REUSEADDR SO_REUSEADDR} * Re-use address * * diff --git a/src/share/classes/java/nio/channels/AsynchronousSocketChannel.java b/src/share/classes/java/nio/channels/AsynchronousSocketChannel.java index 99692b3849408651e2dc1dbc297de084cc395aa8..d78800b65d396bb07d25a103fa4f9ad0249e0e3b 100644 --- a/src/share/classes/java/nio/channels/AsynchronousSocketChannel.java +++ b/src/share/classes/java/nio/channels/AsynchronousSocketChannel.java @@ -68,23 +68,23 @@ import java.nio.ByteBuffer; * Description * * - * {@link java.net.StandardSocketOption#SO_SNDBUF SO_SNDBUF} + * {@link java.net.StandardSocketOptions#SO_SNDBUF SO_SNDBUF} * The size of the socket send buffer * * - * {@link java.net.StandardSocketOption#SO_RCVBUF SO_RCVBUF} + * {@link java.net.StandardSocketOptions#SO_RCVBUF SO_RCVBUF} * The size of the socket receive buffer * * - * {@link java.net.StandardSocketOption#SO_KEEPALIVE SO_KEEPALIVE} + * {@link java.net.StandardSocketOptions#SO_KEEPALIVE SO_KEEPALIVE} * Keep connection alive * * - * {@link java.net.StandardSocketOption#SO_REUSEADDR SO_REUSEADDR} + * {@link java.net.StandardSocketOptions#SO_REUSEADDR SO_REUSEADDR} * Re-use address * * - * {@link java.net.StandardSocketOption#TCP_NODELAY TCP_NODELAY} + * {@link java.net.StandardSocketOptions#TCP_NODELAY TCP_NODELAY} * Disable the Nagle algorithm * * diff --git a/src/share/classes/java/nio/channels/DatagramChannel.java b/src/share/classes/java/nio/channels/DatagramChannel.java index 0d99dc4e0d9eae9428d6a5abd2b6e52806d52e87..f4a6110b017e3182c523881f81995aafb7b2a684 100644 --- a/src/share/classes/java/nio/channels/DatagramChannel.java +++ b/src/share/classes/java/nio/channels/DatagramChannel.java @@ -63,37 +63,37 @@ import java.nio.channels.spi.SelectorProvider; * Description * * - * {@link java.net.StandardSocketOption#SO_SNDBUF SO_SNDBUF} + * {@link java.net.StandardSocketOptions#SO_SNDBUF SO_SNDBUF} * The size of the socket send buffer * * - * {@link java.net.StandardSocketOption#SO_RCVBUF SO_RCVBUF} + * {@link java.net.StandardSocketOptions#SO_RCVBUF SO_RCVBUF} * The size of the socket receive buffer * * - * {@link java.net.StandardSocketOption#SO_REUSEADDR SO_REUSEADDR} + * {@link java.net.StandardSocketOptions#SO_REUSEADDR SO_REUSEADDR} * Re-use address * * - * {@link java.net.StandardSocketOption#SO_BROADCAST SO_BROADCAST} + * {@link java.net.StandardSocketOptions#SO_BROADCAST SO_BROADCAST} * Allow transmission of broadcast datagrams * * - * {@link java.net.StandardSocketOption#IP_TOS IP_TOS} + * {@link java.net.StandardSocketOptions#IP_TOS IP_TOS} * The Type of Service (ToS) octet in the Internet Protocol (IP) header * * - * {@link java.net.StandardSocketOption#IP_MULTICAST_IF IP_MULTICAST_IF} + * {@link java.net.StandardSocketOptions#IP_MULTICAST_IF IP_MULTICAST_IF} * The network interface for Internet Protocol (IP) multicast datagrams * * - * {@link java.net.StandardSocketOption#IP_MULTICAST_TTL + * {@link java.net.StandardSocketOptions#IP_MULTICAST_TTL * IP_MULTICAST_TTL} * The time-to-live for Internet Protocol (IP) multicast * datagrams * * - * {@link java.net.StandardSocketOption#IP_MULTICAST_LOOP + * {@link java.net.StandardSocketOptions#IP_MULTICAST_LOOP * IP_MULTICAST_LOOP} * Loopback for Internet Protocol (IP) multicast datagrams * diff --git a/src/share/classes/java/nio/channels/MulticastChannel.java b/src/share/classes/java/nio/channels/MulticastChannel.java index d22f0d5a58ea22f9ebef001532de30ba686e825a..5b61f77ff8ab67f10269f0ad1b6dbd7846e74b2b 100644 --- a/src/share/classes/java/nio/channels/MulticastChannel.java +++ b/src/share/classes/java/nio/channels/MulticastChannel.java @@ -30,7 +30,7 @@ import java.net.NetworkInterface; import java.io.IOException; import java.net.ProtocolFamily; // javadoc import java.net.StandardProtocolFamily; // javadoc -import java.net.StandardSocketOption; // javadoc +import java.net.StandardSocketOptions; // javadoc /** * A network channel that supports Internet Protocol (IP) multicasting. @@ -93,7 +93,7 @@ import java.net.StandardSocketOption; // javadoc * a specific address, rather than the wildcard address then it is implementation * specific if multicast datagrams are received by the socket.

    • * - *
    • The {@link StandardSocketOption#SO_REUSEADDR SO_REUSEADDR} option should be + *

    • The {@link StandardSocketOptions#SO_REUSEADDR SO_REUSEADDR} option should be * enabled prior to {@link NetworkChannel#bind binding} the socket. This is * required to allow multiple members of the group to bind to the same * address.

    • @@ -107,9 +107,9 @@ import java.net.StandardSocketOption; // javadoc * NetworkInterface ni = NetworkInterface.getByName("hme0"); * * DatagramChannel dc = DatagramChannel.open(StandardProtocolFamily.INET) - * .setOption(StandardSocketOption.SO_REUSEADDR, true) + * .setOption(StandardSocketOptions.SO_REUSEADDR, true) * .bind(new InetSocketAddress(5000)) - * .setOption(StandardSocketOption.IP_MULTICAST_IF, ni); + * .setOption(StandardSocketOptions.IP_MULTICAST_IF, ni); * * InetAddress group = InetAddress.getByName("225.4.5.6"); * diff --git a/src/share/classes/java/nio/channels/NetworkChannel.java b/src/share/classes/java/nio/channels/NetworkChannel.java index f8a169d8c0a14eee3953889e0a4229d6c941c4dc..4d4abfdb75cb53abc0543a0492f38436fdeafa51 100644 --- a/src/share/classes/java/nio/channels/NetworkChannel.java +++ b/src/share/classes/java/nio/channels/NetworkChannel.java @@ -124,7 +124,7 @@ public interface NetworkChannel * @throws IOException * If an I/O error occurs * - * @see java.net.StandardSocketOption + * @see java.net.StandardSocketOptions */ NetworkChannel setOption(SocketOption name, T value) throws IOException; @@ -144,7 +144,7 @@ public interface NetworkChannel * @throws IOException * If an I/O error occurs * - * @see java.net.StandardSocketOption + * @see java.net.StandardSocketOptions */ T getOption(SocketOption name) throws IOException; diff --git a/src/share/classes/java/nio/channels/ServerSocketChannel.java b/src/share/classes/java/nio/channels/ServerSocketChannel.java index 2711594a57e1e9cef6051f4ccb47293550bcfb81..127fb5bcd407d31ee5ff5ba86375d26fc9c2a181 100644 --- a/src/share/classes/java/nio/channels/ServerSocketChannel.java +++ b/src/share/classes/java/nio/channels/ServerSocketChannel.java @@ -52,11 +52,11 @@ import java.nio.channels.spi.SelectorProvider; * Description * * - * {@link java.net.StandardSocketOption#SO_RCVBUF SO_RCVBUF} + * {@link java.net.StandardSocketOptions#SO_RCVBUF SO_RCVBUF} * The size of the socket receive buffer * * - * {@link java.net.StandardSocketOption#SO_REUSEADDR SO_REUSEADDR} + * {@link java.net.StandardSocketOptions#SO_REUSEADDR SO_REUSEADDR} * Re-use address * * diff --git a/src/share/classes/java/nio/channels/SocketChannel.java b/src/share/classes/java/nio/channels/SocketChannel.java index 03ac42a3e947696e26e17b9781e73b09b59917e6..d5f43ba7750d2c5bc0668faf6a7443fcac276c95 100644 --- a/src/share/classes/java/nio/channels/SocketChannel.java +++ b/src/share/classes/java/nio/channels/SocketChannel.java @@ -72,28 +72,28 @@ import java.nio.channels.spi.SelectorProvider; * Description * * - * {@link java.net.StandardSocketOption#SO_SNDBUF SO_SNDBUF} + * {@link java.net.StandardSocketOptions#SO_SNDBUF SO_SNDBUF} * The size of the socket send buffer * * - * {@link java.net.StandardSocketOption#SO_RCVBUF SO_RCVBUF} + * {@link java.net.StandardSocketOptions#SO_RCVBUF SO_RCVBUF} * The size of the socket receive buffer * * - * {@link java.net.StandardSocketOption#SO_KEEPALIVE SO_KEEPALIVE} + * {@link java.net.StandardSocketOptions#SO_KEEPALIVE SO_KEEPALIVE} * Keep connection alive * * - * {@link java.net.StandardSocketOption#SO_REUSEADDR SO_REUSEADDR} + * {@link java.net.StandardSocketOptions#SO_REUSEADDR SO_REUSEADDR} * Re-use address * * - * {@link java.net.StandardSocketOption#SO_LINGER SO_LINGER} + * {@link java.net.StandardSocketOptions#SO_LINGER SO_LINGER} * Linger on close if data is present (when configured in blocking mode * only) * * - * {@link java.net.StandardSocketOption#TCP_NODELAY TCP_NODELAY} + * {@link java.net.StandardSocketOptions#TCP_NODELAY TCP_NODELAY} * Disable the Nagle algorithm * * diff --git a/src/share/classes/java/nio/charset/Charset.java b/src/share/classes/java/nio/charset/Charset.java index 51dbe1504dc4c7f13f7b13ee59e2a36ed8e95880..1a30ba961032dd7c7045106cba4d266993c33f8a 100644 --- a/src/share/classes/java/nio/charset/Charset.java +++ b/src/share/classes/java/nio/charset/Charset.java @@ -215,7 +215,7 @@ import sun.security.action.GetPropertyAction; * determined during virtual-machine startup and typically depends upon the * locale and charset being used by the underlying operating system.

      * - *

      The {@link StandardCharset} class defines constants for each of the + *

      The {@link StandardCharsets} class defines constants for each of the * standard charsets. * *

      Terminology

      diff --git a/src/share/classes/java/nio/charset/StandardCharset.java b/src/share/classes/java/nio/charset/StandardCharsets.java similarity index 96% rename from src/share/classes/java/nio/charset/StandardCharset.java rename to src/share/classes/java/nio/charset/StandardCharsets.java index edec058bc45d382fb3d2f58f750fe042ed5ee19b..b2572c361cf00be752726d715fce942160089786 100644 --- a/src/share/classes/java/nio/charset/StandardCharset.java +++ b/src/share/classes/java/nio/charset/StandardCharsets.java @@ -32,10 +32,10 @@ package java.nio.charset; * @see Standard Charsets * @since 1.7 */ -public final class StandardCharset { +public final class StandardCharsets { - private StandardCharset() { - throw new AssertionError("No java.nio.charset.StandardCharset instances for you!"); + private StandardCharsets() { + throw new AssertionError("No java.nio.charset.StandardCharsets instances for you!"); } /** * Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the diff --git a/src/share/classes/java/nio/file/Path.java b/src/share/classes/java/nio/file/Path.java index 2d2e977d49de54367f04e09978ccd9fc0a94c54b..370c38dbac285e08608d515a35be1560ef0ce6c9 100644 --- a/src/share/classes/java/nio/file/Path.java +++ b/src/share/classes/java/nio/file/Path.java @@ -72,7 +72,7 @@ import java.util.Iterator; * directory and is UTF-8 encoded. *
        *     Path path = FileSystems.getDefault().getPath("logs", "access.log");
      - *     BufferReader reader = Files.newBufferedReader(path, StandardCharset.UTF_8);
      + *     BufferReader reader = Files.newBufferedReader(path, StandardCharsets.UTF_8);
        * 
      * *

      Interoperability

      @@ -609,11 +609,11 @@ public interface Path * directory can be watched. The {@code events} parameter is the events to * register and may contain the following events: *
        - *
      • {@link StandardWatchEventKind#ENTRY_CREATE ENTRY_CREATE} - + *
      • {@link StandardWatchEventKinds#ENTRY_CREATE ENTRY_CREATE} - * entry created or moved into the directory
      • - *
      • {@link StandardWatchEventKind#ENTRY_DELETE ENTRY_DELETE} - + *
      • {@link StandardWatchEventKinds#ENTRY_DELETE ENTRY_DELETE} - * entry deleted or moved out of the directory
      • - *
      • {@link StandardWatchEventKind#ENTRY_MODIFY ENTRY_MODIFY} - + *
      • {@link StandardWatchEventKinds#ENTRY_MODIFY ENTRY_MODIFY} - * entry in directory was modified
      • *
      * @@ -622,7 +622,7 @@ public interface Path * that locates the directory entry that is created, deleted, or modified. * *

      The set of events may include additional implementation specific - * event that are not defined by the enum {@link StandardWatchEventKind} + * event that are not defined by the enum {@link StandardWatchEventKinds} * *

      The {@code modifiers} parameter specifies modifiers that * qualify how the directory is registered. This release does not define any diff --git a/src/share/classes/java/nio/file/StandardWatchEventKind.java b/src/share/classes/java/nio/file/StandardWatchEventKinds.java similarity index 94% rename from src/share/classes/java/nio/file/StandardWatchEventKind.java rename to src/share/classes/java/nio/file/StandardWatchEventKinds.java index 6064d75a7fa0d335c9138736e7a323359164dfd8..ef111e2bf7d15b439ac6c6d9c6a471ca0f0a56af 100644 --- a/src/share/classes/java/nio/file/StandardWatchEventKind.java +++ b/src/share/classes/java/nio/file/StandardWatchEventKinds.java @@ -31,8 +31,8 @@ package java.nio.file; * @since 1.7 */ -public final class StandardWatchEventKind { - private StandardWatchEventKind() { } +public final class StandardWatchEventKinds { + private StandardWatchEventKinds() { } /** * A special event to indicate that events may have been lost or @@ -44,8 +44,8 @@ public final class StandardWatchEventKind { * * @see WatchService */ - public static final WatchEvent.Kind OVERFLOW = - new StdWatchEventKind("OVERFLOW", Void.class); + public static final WatchEvent.Kind OVERFLOW = + new StdWatchEventKind("OVERFLOW", Object.class); /** * Directory entry created. diff --git a/src/share/classes/java/nio/file/WatchEvent.java b/src/share/classes/java/nio/file/WatchEvent.java index 4328828fe22dc1fdc137f05a36f5fe841f9d02fd..cab199f0b572ead46b84d895dcafe9f1c789a4b8 100644 --- a/src/share/classes/java/nio/file/WatchEvent.java +++ b/src/share/classes/java/nio/file/WatchEvent.java @@ -50,7 +50,7 @@ public interface WatchEvent { * An event kind, for the purposes of identification. * * @since 1.7 - * @see StandardWatchEventKind + * @see StandardWatchEventKinds */ public static interface Kind { /** @@ -98,9 +98,9 @@ public interface WatchEvent { /** * Returns the context for the event. * - *

      In the case of {@link StandardWatchEventKind#ENTRY_CREATE ENTRY_CREATE}, - * {@link StandardWatchEventKind#ENTRY_DELETE ENTRY_DELETE}, and {@link - * StandardWatchEventKind#ENTRY_MODIFY ENTRY_MODIFY} events the context is + *

      In the case of {@link StandardWatchEventKinds#ENTRY_CREATE ENTRY_CREATE}, + * {@link StandardWatchEventKinds#ENTRY_DELETE ENTRY_DELETE}, and {@link + * StandardWatchEventKinds#ENTRY_MODIFY ENTRY_MODIFY} events the context is * a {@code Path} that is the {@link Path#relativize relative} path between * the directory registered with the watch service, and the entry that is * created, deleted, or modified. diff --git a/src/share/classes/java/nio/file/WatchService.java b/src/share/classes/java/nio/file/WatchService.java index 58e633610c04ec5a37ccb95b694d134b24d4de6b..5a63fcd872227a5e127c3c45fde69f20c6d2aaff 100644 --- a/src/share/classes/java/nio/file/WatchService.java +++ b/src/share/classes/java/nio/file/WatchService.java @@ -68,7 +68,7 @@ import java.util.concurrent.TimeUnit; * of events that it may accumulate. Where an implementation knowingly * discards events then it arranges for the key's {@link WatchKey#pollEvents * pollEvents} method to return an element with an event type of {@link - * StandardWatchEventKind#OVERFLOW OVERFLOW}. This event can be used by the + * StandardWatchEventKinds#OVERFLOW OVERFLOW}. This event can be used by the * consumer as a trigger to re-examine the state of the object. * *

      When an event is reported to indicate that a file in a watched directory @@ -87,7 +87,7 @@ import java.util.concurrent.TimeUnit; * are detected, their timeliness, and whether their ordering is preserved are * highly implementation specific. For example, when a file in a watched * directory is modified then it may result in a single {@link - * StandardWatchEventKind#ENTRY_MODIFY ENTRY_MODIFY} event in some + * StandardWatchEventKinds#ENTRY_MODIFY ENTRY_MODIFY} event in some * implementations but several events in other implementations. Short-lived * files (meaning files that are deleted very quickly after they are created) * may not be detected by primitive implementations that periodically poll the diff --git a/src/share/classes/java/nio/file/Watchable.java b/src/share/classes/java/nio/file/Watchable.java index 41ef35200e7e91a2806305cc81f974690c0decd1..f84437c5c6990c97d6d252a9cfb2a4f1f7d938dd 100644 --- a/src/share/classes/java/nio/file/Watchable.java +++ b/src/share/classes/java/nio/file/Watchable.java @@ -53,7 +53,7 @@ public interface Watchable { * those specified by the {@code events} and {@code modifiers} parameters. * Changing the event set does not cause pending events for the object to be * discarded. Objects are automatically registered for the {@link - * StandardWatchEventKind#OVERFLOW OVERFLOW} event. This event is not + * StandardWatchEventKinds#OVERFLOW OVERFLOW} event. This event is not * required to be present in the array of events. * *

      Otherwise the file system object has not yet been registered with the diff --git a/src/share/classes/java/sql/BatchUpdateException.java b/src/share/classes/java/sql/BatchUpdateException.java index 4fa6241169fc21e37ecf008e735db988c73b1c26..8405da2dac70e738f6047bca13d57c5d412c15bb 100644 --- a/src/share/classes/java/sql/BatchUpdateException.java +++ b/src/share/classes/java/sql/BatchUpdateException.java @@ -89,7 +89,7 @@ public class BatchUpdateException extends SQLException { * The cause is not initialized, and may subsequently be * initialized by a call to the * {@link Throwable#initCause(java.lang.Throwable)} method. The vendor code - * is intialized to 0. + * is initialized to 0. *

      * * @param reason a description of the exception @@ -188,7 +188,7 @@ public class BatchUpdateException extends SQLException { * @since 1.6 */ public BatchUpdateException(Throwable cause) { - this(null, null, 0, null, cause); + this((cause == null ? null : cause.toString()), null, 0, null, cause); } /** @@ -214,7 +214,7 @@ public class BatchUpdateException extends SQLException { * @since 1.6 */ public BatchUpdateException(int []updateCounts , Throwable cause) { - this(null, null, 0, updateCounts, cause); + this((cause == null ? null : cause.toString()), null, 0, updateCounts, cause); } /** diff --git a/src/share/classes/java/util/Formatter.java b/src/share/classes/java/util/Formatter.java index 5ca126ab31d61f153831aa796834281b5389a946..bcd36ea61204f2bfa875a93432537d7df7733721 100644 --- a/src/share/classes/java/util/Formatter.java +++ b/src/share/classes/java/util/Formatter.java @@ -826,7 +826,7 @@ import sun.misc.FormattedFloatingDecimal; * *

    • Float and Double * - *
    • BigDecimal + *
    • BigDecimal * * * @@ -1362,7 +1362,7 @@ import sun.misc.FormattedFloatingDecimal; * precision is not provided, then all of the digits as returned by {@link * Double#toHexString(double)} will be output. * - *

      BigDecimal + *

      BigDecimal * *

      The following conversions may be applied {@link java.math.BigDecimal * BigDecimal}. @@ -1372,7 +1372,7 @@ import sun.misc.FormattedFloatingDecimal; * {@code 'e'} * '\u0065' * Requires the output to be formatted using computerized scientific notation. The computerized scientific notation. The localization algorithm is applied. * *

      The formatting of the magnitude m depends upon its value. @@ -1427,11 +1427,11 @@ import sun.misc.FormattedFloatingDecimal; * *

      If m is greater than or equal to 10-4 but less * than 10precision then it is represented in decimal format. + * href="#bdecimal">decimal format. * *

      If m is less than 10-4 or greater than or equal to * 10precision, then it is represented in computerized scientific notation. + * href="#bscientific">computerized scientific notation. * *

      The total number of significant digits in m is equal to the * precision. If the precision is not specified, then the default value is @@ -1447,7 +1447,7 @@ import sun.misc.FormattedFloatingDecimal; * * {@code 'f'} * '\u0066' - * Requires the output to be formatted using decimal + * Requires the output to be formatted using decimal * format. The localization algorithm is * applied. * diff --git a/src/share/classes/java/util/concurrent/Phaser.java b/src/share/classes/java/util/concurrent/Phaser.java index c4ebe2378cbda7d11a0146578b0d5e8ff69891ef..bdafbbb7a9da29206415192b586b0fc94e8e1ea1 100644 --- a/src/share/classes/java/util/concurrent/Phaser.java +++ b/src/share/classes/java/util/concurrent/Phaser.java @@ -159,7 +159,7 @@ import java.util.concurrent.locks.LockSupport; * void runTasks(List tasks) { * final Phaser phaser = new Phaser(1); // "1" to register self * // create and start threads - * for (Runnable task : tasks) { + * for (final Runnable task : tasks) { * phaser.register(); * new Thread() { * public void run() { diff --git a/src/share/classes/java/util/concurrent/locks/LockSupport.java b/src/share/classes/java/util/concurrent/locks/LockSupport.java index f0cd3bc04568549e41aa99d43e61954b922c1d11..7b829f63a0689acf888ce1e8b50ed5c24fc40d2f 100644 --- a/src/share/classes/java/util/concurrent/locks/LockSupport.java +++ b/src/share/classes/java/util/concurrent/locks/LockSupport.java @@ -275,10 +275,14 @@ public class LockSupport { * snapshot -- the thread may have since unblocked or blocked on a * different blocker object. * + * @param t the thread * @return the blocker + * @throws NullPointerException if argument is null * @since 1.6 */ public static Object getBlocker(Thread t) { + if (t == null) + throw new NullPointerException(); return unsafe.getObjectVolatile(t, parkBlockerOffset); } diff --git a/src/share/classes/java/util/logging/LogManager.java b/src/share/classes/java/util/logging/LogManager.java index cf49a0a69b71e462199984d3f0d6c2359a3de85c..a28b0d8a8244a5752ef84dbf2496c34580f8047f 100644 --- a/src/share/classes/java/util/logging/LogManager.java +++ b/src/share/classes/java/util/logging/LogManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -342,12 +342,35 @@ public class LogManager { // already been created with the given name it is returned. // Otherwise a new logger instance is created and registered // in the LogManager global namespace. + + // This method will always return a non-null Logger object. + // Synchronization is not required here. All synchronization for + // adding a new Logger object is handled by addLogger(). Logger demandLogger(String name) { Logger result = getLogger(name); if (result == null) { - result = new Logger(name, null); - addLogger(result); - result = getLogger(name); + // only allocate the new logger once + Logger newLogger = new Logger(name, null); + do { + if (addLogger(newLogger)) { + // We successfully added the new Logger that we + // created above so return it without refetching. + return newLogger; + } + + // We didn't add the new Logger that we created above + // because another thread added a Logger with the same + // name after our null check above and before our call + // to addLogger(). We have to refetch the Logger because + // addLogger() returns a boolean instead of the Logger + // reference itself. However, if the thread that created + // the other Logger is not holding a strong reference to + // the other Logger, then it is possible for the other + // Logger to be GC'ed after we saw it in addLogger() and + // before we can refetch it. If it has been GC'ed then + // we'll just loop around and try again. + result = getLogger(name); + } while (result == null); } return result; } diff --git a/src/share/classes/java/util/logging/Logger.java b/src/share/classes/java/util/logging/Logger.java index 87f6867169f55bb65413ca6b8666c90d23aafa74..e3ce6bdac605d0cc57e20643a874f89b85ca401f 100644 --- a/src/share/classes/java/util/logging/Logger.java +++ b/src/share/classes/java/util/logging/Logger.java @@ -310,7 +310,20 @@ public class Logger { * @return a suitable Logger * @throws NullPointerException if the name is null. */ - public static synchronized Logger getLogger(String name) { + + // Synchronization is not required here. All synchronization for + // adding a new Logger object is handled by LogManager.addLogger(). + public static Logger getLogger(String name) { + // This method is intentionally not a wrapper around a call + // to getLogger(name, resourceBundleName). If it were then + // this sequence: + // + // getLogger("Foo", "resourceBundleForFoo"); + // getLogger("Foo"); + // + // would throw an IllegalArgumentException in the second call + // because the wrapper would result in an attempt to replace + // the existing "resourceBundleForFoo" with null. LogManager manager = LogManager.getLogManager(); return manager.demandLogger(name); } @@ -355,7 +368,10 @@ public class Logger { * a different resource bundle name. * @throws NullPointerException if the name is null. */ - public static synchronized Logger getLogger(String name, String resourceBundleName) { + + // Synchronization is not required here. All synchronization for + // adding a new Logger object is handled by LogManager.addLogger(). + public static Logger getLogger(String name, String resourceBundleName) { LogManager manager = LogManager.getLogManager(); Logger result = manager.demandLogger(name); if (result.resourceBundleName == null) { @@ -417,7 +433,10 @@ public class Logger { * @throws MissingResourceException if the resourceBundleName is non-null and * no corresponding resource can be found. */ - public static synchronized Logger getAnonymousLogger(String resourceBundleName) { + + // Synchronization is not required here. All synchronization for + // adding a new anonymous Logger object is handled by doSetParent(). + public static Logger getAnonymousLogger(String resourceBundleName) { LogManager manager = LogManager.getLogManager(); // cleanup some Loggers that have been GC'ed manager.drainLoggerRefQueueBounded(); diff --git a/src/share/classes/java/util/regex/Pattern.java b/src/share/classes/java/util/regex/Pattern.java index fa302cfbab7268c1b9c5c42a043675257f952503..d89eca9845d7c915f629021a30cd7419264669f5 100644 --- a/src/share/classes/java/util/regex/Pattern.java +++ b/src/share/classes/java/util/regex/Pattern.java @@ -213,7 +213,7 @@ import java.util.Arrays; * A character in the Greek block (block) * \p{Lu} * An uppercase letter (category) - * \p{isAlphabetic} + * \p{IsAlphabetic} * An alphabetic character (binary property) * \p{Sc} * A currency symbol diff --git a/src/share/classes/java/util/zip/ZipCoder.java b/src/share/classes/java/util/zip/ZipCoder.java index 62844916f3d22e24bcd4e2522bad1d3e671233d7..12404cb38acf819385d3f4b545ad1cbc3a176069 100644 --- a/src/share/classes/java/util/zip/ZipCoder.java +++ b/src/share/classes/java/util/zip/ZipCoder.java @@ -28,7 +28,7 @@ package java.util.zip; import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.Charset; -import java.nio.charset.StandardCharset; +import java.nio.charset.StandardCharsets; import java.nio.charset.CharsetDecoder; import java.nio.charset.CharsetEncoder; import java.nio.charset.CoderResult; @@ -107,7 +107,7 @@ final class ZipCoder { if (isUTF8) return getBytes(s); if (utf8 == null) - utf8 = new ZipCoder(StandardCharset.UTF_8); + utf8 = new ZipCoder(StandardCharsets.UTF_8); return utf8.getBytes(s); } @@ -116,7 +116,7 @@ final class ZipCoder { if (isUTF8) return toString(ba, len); if (utf8 == null) - utf8 = new ZipCoder(StandardCharset.UTF_8); + utf8 = new ZipCoder(StandardCharsets.UTF_8); return utf8.toString(ba, len); } @@ -132,7 +132,7 @@ final class ZipCoder { private ZipCoder(Charset cs) { this.cs = cs; - this.isUTF8 = cs.name().equals(StandardCharset.UTF_8.name()); + this.isUTF8 = cs.name().equals(StandardCharsets.UTF_8.name()); } static ZipCoder get(Charset charset) { diff --git a/src/share/classes/java/util/zip/ZipFile.java b/src/share/classes/java/util/zip/ZipFile.java index d1861ad732c805781a1ce8130ff9311d1540ab07..9693809331a38a5c286e8c6456526360c5a6ee0c 100644 --- a/src/share/classes/java/util/zip/ZipFile.java +++ b/src/share/classes/java/util/zip/ZipFile.java @@ -31,7 +31,7 @@ import java.io.IOException; import java.io.EOFException; import java.io.File; import java.nio.charset.Charset; -import java.nio.charset.StandardCharset; +import java.nio.charset.StandardCharsets; import java.util.ArrayDeque; import java.util.Deque; import java.util.Enumeration; @@ -141,7 +141,7 @@ class ZipFile implements ZipConstants, Closeable { * @since 1.3 */ public ZipFile(File file, int mode) throws IOException { - this(file, mode, StandardCharset.UTF_8); + this(file, mode, StandardCharsets.UTF_8); } /** diff --git a/src/share/classes/java/util/zip/ZipInputStream.java b/src/share/classes/java/util/zip/ZipInputStream.java index ebfcce146ccf697b042a8397a4f8bee1e5b999f4..a60adb8040e1e51477feda15ec64d79a39d0d4d9 100644 --- a/src/share/classes/java/util/zip/ZipInputStream.java +++ b/src/share/classes/java/util/zip/ZipInputStream.java @@ -30,7 +30,7 @@ import java.io.IOException; import java.io.EOFException; import java.io.PushbackInputStream; import java.nio.charset.Charset; -import java.nio.charset.StandardCharset; +import java.nio.charset.StandardCharsets; import static java.util.zip.ZipConstants64.*; /** @@ -76,7 +76,7 @@ class ZipInputStream extends InflaterInputStream implements ZipConstants { * @param in the actual input stream */ public ZipInputStream(InputStream in) { - this(in, StandardCharset.UTF_8); + this(in, StandardCharsets.UTF_8); } /** diff --git a/src/share/classes/java/util/zip/ZipOutputStream.java b/src/share/classes/java/util/zip/ZipOutputStream.java index c0b59488002a924e845d8316bcfb9ec8200b1e0c..91f7f75ece205dfee0955e3d921c0472178553e8 100644 --- a/src/share/classes/java/util/zip/ZipOutputStream.java +++ b/src/share/classes/java/util/zip/ZipOutputStream.java @@ -28,7 +28,7 @@ package java.util.zip; import java.io.OutputStream; import java.io.IOException; import java.nio.charset.Charset; -import java.nio.charset.StandardCharset; +import java.nio.charset.StandardCharsets; import java.util.Vector; import java.util.HashSet; import static java.util.zip.ZipConstants64.*; @@ -101,7 +101,7 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants { * @param out the actual output stream */ public ZipOutputStream(OutputStream out) { - this(out, StandardCharset.UTF_8); + this(out, StandardCharsets.UTF_8); } /** diff --git a/src/share/classes/javax/imageio/metadata/doc-files/jpeg_metadata.html b/src/share/classes/javax/imageio/metadata/doc-files/jpeg_metadata.html index 721bdb2e702798a527903c7ec047d01b966ff48f..5d3b0ea5e7d573b247a6db56734d47bcd3e7bc1f 100644 --- a/src/share/classes/javax/imageio/metadata/doc-files/jpeg_metadata.html +++ b/src/share/classes/javax/imageio/metadata/doc-files/jpeg_metadata.html @@ -211,6 +211,20 @@ to any listeners.

      +Optional ColorSpace support: +Handling of PhotoYCC (YCC), PhotoYCCA (YCCA), RGBA and YCbCrA color spaces +by the standard plugin, as described below, is dependent on capabilities +of the libraries used to interpret the JPEG data. Thus all consequential +behaviors are optional. If the support is not available when decoding, +the color space will be treated as unrecognized and the appropriate +default color space for the specified number of component channels +may be used. +When writing, an Exception may be thrown if no suitable conversion +can be applied before encoding. +But where the support for these color spaces is available, the behavior +must be as documented. +

      + When reading, the contents of the stream are interpreted by the usual JPEG conventions, as follows: @@ -241,8 +255,11 @@ JPEG conventions, as follows: 2-channel images are assumed to be grayscale with an alpha channel. For 3- and 4-channel images, the component ids are consulted. If these values are 1-3 for a 3-channel image, then the image is assumed to be - YCbCr. If these values are 1-4 for a 4-channel image, then the image - is assumed to be YCbCrA. If these values are > 4, they are checked + YCbCr. Subject to the availability of the + optional color space support + described above, if these values are 1-4 for a 4-channel image, + then the image is assumed to be YCbCrA. + If these values are > 4, they are checked against the ASCII codes for 'R', 'G', 'B', 'A', 'C', 'c'. These can encode the following colorspaces:

      @@ -346,12 +363,16 @@ If no metadata object is specified, then the following defaults apply: component ids in the frame and scan headers are set to 1, 2, and 3. -

    • RGBA images are converted to YCbCrA, subsampled in the +
    • Subject to the optional library support + described above, + RGBA images are converted to YCbCrA, subsampled in the chrominance channels by half both vertically and horizontally, and written without any special marker segments. The component ids in the frame and scan headers are set to 1, 2, 3, and 4. -
    • PhotoYCC and YCCAimages are subsampled by half in the chrominance +
    • Subject to the optional library support + described above, + PhotoYCC and YCCAimages are subsampled by half in the chrominance channels both vertically and horizontally and written with an Adobe APP14 marker segment and 'Y','C', and 'c' (and 'A' if an alpha channel is present) as component ids in the frame @@ -433,6 +454,8 @@ in the frame header node of the metadata object, regardless of color space.)
    • RGBA images: + Subject to the optional library support + described above,
      • If an app0JFIF node is present in the metadata object, it is ignored and a warning is sent to listeners, as JFIF does not @@ -456,6 +479,8 @@ in the frame header node of the metadata object, regardless of color space.)
    • PhotoYCC Images: + Subject to the optional library support + described above,
      • If an app0JFIF node is present in the metadata object, the image is converted to sRGB, and then to YCbCr during encoding, @@ -471,6 +496,8 @@ in the frame header node of the metadata object, regardless of color space.)
    • PhotoYCCA Images: + Subject to the optional library support + described above,
      • If an app0JFIF node is present in the metadata object, it is ignored and a warning is sent to listeners, as JFIF does not diff --git a/src/share/classes/javax/management/loading/package.html b/src/share/classes/javax/management/loading/package.html index 7b7ca68a99fe405340b3801d575d8ec9bb1ca56c..1cfeef73bfa0fa155a1b24d6626fb63557d69d38 100644 --- a/src/share/classes/javax/management/loading/package.html +++ b/src/share/classes/javax/management/loading/package.html @@ -2,7 +2,7 @@ javax.management.loading package