changeset 9385:c9117a5defe9 jdk8u20-b05

Merge
author lana
date Wed, 05 Mar 2014 15:34:27 -0800
parents a709f70a4f45 (current diff) 9515f6ec843c (diff)
children 51b8212782e9
files
diffstat 45 files changed, 935 insertions(+), 226 deletions(-) [+]
line wrap: on
line diff
--- a/make/mapfiles/libjava/mapfile-vers	Wed Mar 05 12:31:29 2014 -0800
+++ b/make/mapfiles/libjava/mapfile-vers	Wed Mar 05 15:34:27 2014 -0800
@@ -79,7 +79,7 @@
 		Java_java_io_FileInputStream_close0;
 		Java_java_io_FileInputStream_initIDs;
 		Java_java_io_FileInputStream_open;
-		Java_java_io_FileInputStream_read;
+		Java_java_io_FileInputStream_read0;
 		Java_java_io_FileInputStream_readBytes;
 		Java_java_io_FileInputStream_skip;
 		Java_java_io_FileOutputStream_close0;
@@ -98,11 +98,11 @@
 		Java_java_io_RandomAccessFile_initIDs;
 		Java_java_io_RandomAccessFile_length;
 		Java_java_io_RandomAccessFile_open;
-		Java_java_io_RandomAccessFile_read;
+		Java_java_io_RandomAccessFile_read0;
 		Java_java_io_RandomAccessFile_readBytes;
 		Java_java_io_RandomAccessFile_seek0;
 		Java_java_io_RandomAccessFile_setLength;
-		Java_java_io_RandomAccessFile_write;
+		Java_java_io_RandomAccessFile_write0;
 		Java_java_io_RandomAccessFile_writeBytes;
 		Java_java_io_UnixFileSystem_canonicalize0;
 		Java_java_io_UnixFileSystem_checkAccess;
--- a/make/mapfiles/libjfr/mapfile-vers	Wed Mar 05 12:31:29 2014 -0800
+++ b/make/mapfiles/libjfr/mapfile-vers	Wed Mar 05 15:34:27 2014 -0800
@@ -34,6 +34,7 @@
       Java_oracle_jrockit_jfr_VMJFR_getPeriod;
       Java_oracle_jrockit_jfr_VMJFR_descriptors;
       Java_oracle_jrockit_jfr_VMJFR_redefineClass0;
+      Java_oracle_jrockit_jfr_VMJFR_retransformClasses0;
       JNI_OnLoad;
   local:
       *;
--- a/src/macosx/classes/com/apple/laf/AquaImageFactory.java	Wed Mar 05 12:31:29 2014 -0800
+++ b/src/macosx/classes/com/apple/laf/AquaImageFactory.java	Wed Mar 05 15:34:27 2014 -0800
@@ -48,6 +48,7 @@
 import com.apple.laf.AquaUtils.RecyclableSingleton;
 import java.util.Arrays;
 import java.util.List;
+import sun.awt.image.MultiResolutionBufferedImage;
 import sun.awt.image.MultiResolutionImage;
 
 public class AquaImageFactory {
@@ -230,7 +231,7 @@
 
         @Override
         protected Image getInstance() {
-            return Toolkit.getDefaultToolkit().getImage("NSImage://" + namedImage);
+            return getNSIcon(namedImage);
         }
     }
 
@@ -294,11 +295,27 @@
     }
 
     public static Icon getMenuItemCheckIcon() {
-        return new InvertableImageIcon(AquaUtils.generateLightenedImage(Toolkit.getDefaultToolkit().getImage("NSImage://NSMenuItemSelection"), 25));
+        return new InvertableImageIcon(AquaUtils.generateLightenedImage(
+                getNSIcon("NSMenuItemSelection"), 25));
     }
 
     public static Icon getMenuItemDashIcon() {
-        return new InvertableImageIcon(AquaUtils.generateLightenedImage(Toolkit.getDefaultToolkit().getImage("NSImage://NSMenuMixedState"), 25));
+        return new InvertableImageIcon(AquaUtils.generateLightenedImage(
+                getNSIcon("NSMenuMixedState"), 25));
+    }
+
+    private static Image getNSIcon(String imageName) {
+        Image icon = Toolkit.getDefaultToolkit()
+                .getImage("NSImage://" + imageName);
+
+        if (icon instanceof MultiResolutionImage) {
+            return icon;
+        }
+
+        Image icon2x = AquaUtils.getCImageCreator().createImageFromName(
+                imageName, 2 * icon.getWidth(null), 2 * icon.getHeight(null));
+        return new MultiResolutionBufferedImage(
+                BufferedImage.TYPE_INT_ARGB_PRE, 0, icon, icon2x);
     }
 
     public static class NineSliceMetrics {
--- a/src/macosx/classes/com/apple/laf/AquaUtils.java	Wed Mar 05 12:31:29 2014 -0800
+++ b/src/macosx/classes/com/apple/laf/AquaUtils.java	Wed Mar 05 15:34:27 2014 -0800
@@ -48,6 +48,7 @@
 import sun.swing.SwingUtilities2;
 
 import com.apple.laf.AquaImageFactory.SlicedImageControl;
+import sun.awt.image.MultiResolutionBufferedImage;
 
 final class AquaUtils {
 
@@ -123,6 +124,13 @@
 
     static Image generateLightenedImage(final Image image, final int percent) {
         final GrayFilter filter = new GrayFilter(true, percent);
+        return (image instanceof MultiResolutionBufferedImage)
+                ? ((MultiResolutionBufferedImage) image).map(
+                        rv -> generateLightenedImage(rv, filter))
+                : generateLightenedImage(image, filter);
+    }
+
+    static Image generateLightenedImage(Image image, ImageFilter filter) {
         final ImageProducer prod = new FilteredImageSource(image.getSource(), filter);
         return Toolkit.getDefaultToolkit().createImage(prod);
     }
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Wed Mar 05 12:31:29 2014 -0800
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Wed Mar 05 15:34:27 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -583,7 +583,12 @@
                     // setVisible could have changed the native maximized state
                     deliverZoom(true);
                 } else {
-                    switch (((Frame)target).getExtendedState()) {
+                    int frameState = ((Frame)target).getExtendedState();
+                    if ((frameState & Frame.ICONIFIED) != 0) {
+                        // Treat all state bit masks with ICONIFIED bit as ICONIFIED state.
+                        frameState = Frame.ICONIFIED;
+                    }
+                    switch (frameState) {
                         case Frame.ICONIFIED:
                             CWrapper.NSWindow.miniaturize(nsWindowPtr);
                             break;
@@ -788,6 +793,10 @@
         if (prevWindowState == windowState) return;
 
         final long nsWindowPtr = getNSWindowPtr();
+        if ((windowState & Frame.ICONIFIED) != 0) {
+            // Treat all state bit masks with ICONIFIED bit as ICONIFIED state.
+            windowState = Frame.ICONIFIED;
+        }
         switch (windowState) {
             case Frame.ICONIFIED:
                 if (prevWindowState == Frame.MAXIMIZED_BOTH) {
--- a/src/macosx/native/sun/awt/CDataTransferer.m	Wed Mar 05 12:31:29 2014 -0800
+++ b/src/macosx/native/sun/awt/CDataTransferer.m	Wed Mar 05 15:34:27 2014 -0800
@@ -28,6 +28,7 @@
 
 #import <AppKit/AppKit.h>
 #import <JavaNativeFoundation/JavaNativeFoundation.h>
+#import "jni_util.h"
 
 #include "ThreadUtilities.h"
 
@@ -172,7 +173,9 @@
         NSData *tiffImage = [imageRep TIFFRepresentation];
         jsize tiffSize = (jsize)[tiffImage length]; // #warning 64-bit: -length returns NSUInteger, but NewByteArray takes jsize
         returnValue = (*env)->NewByteArray(env, tiffSize);
+        CHECK_NULL_RETURN(returnValue, nil);
         jbyte *tiffData = (jbyte *)(*env)->GetPrimitiveArrayCritical(env, returnValue, 0);
+        CHECK_NULL_RETURN(tiffData, nil);
         [tiffImage getBytes:tiffData];
         (*env)->ReleasePrimitiveArrayCritical(env, returnValue, tiffData, 0); // Do not use JNI_COMMIT, as that will not free the buffer copy when +ProtectJavaHeap is on.
         [imageRep release];
@@ -184,12 +187,13 @@
 
 static jobject getImageForByteStream(JNIEnv *env, jbyteArray sourceData)
 {
-    if (sourceData == NULL) return NULL;
+    CHECK_NULL_RETURN(sourceData, NULL);
 
     jsize sourceSize = (*env)->GetArrayLength(env, sourceData);
     if (sourceSize == 0) return NULL;
 
     jbyte *sourceBytes = (*env)->GetPrimitiveArrayCritical(env, sourceData, NULL);
+    CHECK_NULL_RETURN(sourceBytes, NULL);
     NSData *rawData = [NSData dataWithBytes:sourceBytes length:sourceSize];
 
     NSImage *newImage = [[NSImage alloc] initWithData:rawData];
@@ -197,8 +201,7 @@
     [newImage release];
 
     (*env)->ReleasePrimitiveArrayCritical(env, sourceData, sourceBytes, JNI_ABORT);
-
-    if (newImage == nil) return NULL;
+    CHECK_NULL_RETURN(newImage, NULL);
 
     // The ownership of the NSImage is passed to the new CImage jobject. No need to release it.
     static JNF_CLASS_CACHE(jc_CImage, "sun/lwawt/macosx/CImage");
@@ -231,7 +234,8 @@
     if (filenameCount == 0) return nil;
 
     // Get the java.lang.String class object:
-    jclass stringClazz = (*env)->FindClass(env, "java/lang/String"); // can't be null
+    jclass stringClazz = (*env)->FindClass(env, "java/lang/String");
+    CHECK_NULL_RETURN(stringClazz, nil);
     jobject jfilenameArray = (*env)->NewObjectArray(env, filenameCount, stringClazz, NULL); // AWT_THREADING Safe (known object)
     if ((*env)->ExceptionOccurred(env)) {
         (*env)->ExceptionDescribe(env);
--- a/src/macosx/native/sun/awt/LWCToolkit.m	Wed Mar 05 12:31:29 2014 -0800
+++ b/src/macosx/native/sun/awt/LWCToolkit.m	Wed Mar 05 15:34:27 2014 -0800
@@ -200,13 +200,17 @@
     gNumberOfButtons = sun_lwawt_macosx_LWCToolkit_BUTTONS;
 
     jclass inputEventClazz = (*env)->FindClass(env, "java/awt/event/InputEvent");
+    CHECK_NULL(inputEventClazz);
     jmethodID getButtonDownMasksID = (*env)->GetStaticMethodID(env, inputEventClazz, "getButtonDownMasks", "()[I");
+    CHECK_NULL(getButtonDownMasksID);
     jintArray obj = (jintArray)(*env)->CallStaticObjectMethod(env, inputEventClazz, getButtonDownMasksID);
     jint * tmp = (*env)->GetIntArrayElements(env, obj, JNI_FALSE);
+    CHECK_NULL(tmp);
 
     gButtonDownMasks = (jint*)SAFE_SIZE_ARRAY_ALLOC(malloc, sizeof(jint), gNumberOfButtons);
     if (gButtonDownMasks == NULL) {
         gNumberOfButtons = 0;
+        (*env)->ReleaseIntArrayElements(env, obj, tmp, JNI_ABORT);
         JNU_ThrowOutOfMemoryError(env, NULL);
         return;
     }
@@ -240,7 +244,7 @@
     return ((ia & 0xFF) << 24) | ((ir & 0xFF) << 16) | ((ig & 0xFF) << 8) | ((ib & 0xFF) << 0);
 }
 
-void doLoadNativeColors(JNIEnv *env, jintArray jColors, BOOL useAppleColors) {
+BOOL doLoadNativeColors(JNIEnv *env, jintArray jColors, BOOL useAppleColors) {
     jint len = (*env)->GetArrayLength(env, jColors);
 
     UInt32 colorsArray[len];
@@ -254,8 +258,12 @@
     }];
 
     jint *_colors = (*env)->GetPrimitiveArrayCritical(env, jColors, 0);
+    if (_colors == NULL) {
+        return NO;
+    }
     memcpy(_colors, colors, len * sizeof(UInt32));
     (*env)->ReleasePrimitiveArrayCritical(env, jColors, _colors, 0);
+    return YES;
 }
 
 /**
@@ -267,8 +275,9 @@
 (JNIEnv *env, jobject peer, jintArray jSystemColors, jintArray jAppleColors)
 {
 JNF_COCOA_ENTER(env);
-    doLoadNativeColors(env, jSystemColors, NO);
-    doLoadNativeColors(env, jAppleColors, YES);
+    if (doLoadNativeColors(env, jSystemColors, NO)) {
+        doLoadNativeColors(env, jAppleColors, YES);
+    }
 JNF_COCOA_EXIT(env);
 }
 
--- a/src/share/classes/java/io/FileInputStream.java	Wed Mar 05 12:31:29 2014 -0800
+++ b/src/share/classes/java/io/FileInputStream.java	Wed Mar 05 15:34:27 2014 -0800
@@ -51,6 +51,12 @@
     /* File Descriptor - handle to the open file */
     private final FileDescriptor fd;
 
+    /**
+     * The path of the referenced file
+     * (null if the stream is created with a file descriptor)
+     */
+    private final String path;
+
     private FileChannel channel = null;
 
     private final Object closeLock = new Object();
@@ -128,6 +134,7 @@
         }
         fd = new FileDescriptor();
         fd.attach(this);
+        path = name;
         open(name);
     }
 
@@ -164,6 +171,7 @@
             security.checkRead(fdObj);
         }
         fd = fdObj;
+        path = null;
 
         /*
          * FileDescriptor is being shared by streams.
@@ -186,7 +194,11 @@
      *             file is reached.
      * @exception  IOException  if an I/O error occurs.
      */
-    public native int read() throws IOException;
+    public int read() throws IOException {
+        return read0();
+    }
+
+    private native int read0() throws IOException;
 
     /**
      * Reads a subarray as a sequence of bytes.
@@ -345,7 +357,7 @@
     public FileChannel getChannel() {
         synchronized (this) {
             if (channel == null) {
-                channel = FileChannelImpl.open(fd, true, false, this);
+                channel = FileChannelImpl.open(fd, path, true, false, this);
             }
             return channel;
         }
--- a/src/share/classes/java/io/FileOutputStream.java	Wed Mar 05 12:31:29 2014 -0800
+++ b/src/share/classes/java/io/FileOutputStream.java	Wed Mar 05 15:34:27 2014 -0800
@@ -67,6 +67,12 @@
      */
     private FileChannel channel;
 
+    /**
+     * The path of the referenced file
+     * (null if the stream is created with a file descriptor)
+     */
+    private final String path;
+
     private final Object closeLock = new Object();
     private volatile boolean closed = false;
 
@@ -202,6 +208,7 @@
         this.fd = new FileDescriptor();
         fd.attach(this);
         this.append = append;
+        this.path = name;
 
         open(name, append);
     }
@@ -239,6 +246,7 @@
         }
         this.fd = fdObj;
         this.append = false;
+        this.path = null;
 
         fd.attach(this);
     }
@@ -376,7 +384,7 @@
     public FileChannel getChannel() {
         synchronized (this) {
             if (channel == null) {
-                channel = FileChannelImpl.open(fd, false, true, append, this);
+                channel = FileChannelImpl.open(fd, path, false, true, append, this);
             }
             return channel;
         }
--- a/src/share/classes/java/io/RandomAccessFile.java	Wed Mar 05 12:31:29 2014 -0800
+++ b/src/share/classes/java/io/RandomAccessFile.java	Wed Mar 05 15:34:27 2014 -0800
@@ -62,6 +62,12 @@
     private FileChannel channel = null;
     private boolean rw;
 
+    /**
+     * The path of the referenced file
+     * (null if the stream is created with a file descriptor)
+     */
+    private final String path;
+
     private Object closeLock = new Object();
     private volatile boolean closed = false;
 
@@ -233,6 +239,7 @@
         }
         fd = new FileDescriptor();
         fd.attach(this);
+        path = name;
         open(name, imode);
     }
 
@@ -272,7 +279,7 @@
     public final FileChannel getChannel() {
         synchronized (this) {
             if (channel == null) {
-                channel = FileChannelImpl.open(fd, true, rw, this);
+                channel = FileChannelImpl.open(fd, path, true, rw, this);
             }
             return channel;
         }
@@ -309,7 +316,11 @@
      * @exception  IOException  if an I/O error occurs. Not thrown if
      *                          end-of-file has been reached.
      */
-    public native int read() throws IOException;
+    public int read() throws IOException {
+        return read0();
+    }
+
+    private native int read0() throws IOException;
 
     /**
      * Reads a sub array as a sequence of bytes.
@@ -457,7 +468,11 @@
      * @param      b   the {@code byte} to be written.
      * @exception  IOException  if an I/O error occurs.
      */
-    public native void write(int b) throws IOException;
+    public void write(int b) throws IOException {
+        write0(b);
+    }
+
+    private native void write0(int b) throws IOException;
 
     /**
      * Writes a sub array as a sequence of bytes.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/sun/awt/image/MultiResolutionBufferedImage.java	Wed Mar 05 15:34:27 2014 -0800
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package sun.awt.image;
+
+import java.awt.Image;
+import java.awt.Graphics;
+import java.awt.image.BufferedImage;
+import java.util.Arrays;
+import java.util.List;
+import java.util.function.Function;
+
+public class MultiResolutionBufferedImage extends BufferedImage
+        implements MultiResolutionImage {
+
+    Image[] resolutionVariants;
+    int baseIndex;
+
+    public MultiResolutionBufferedImage(int imageType, int baseIndex, Image... images) {
+        super(images[baseIndex].getWidth(null), images[baseIndex].getHeight(null),
+                imageType);
+        this.baseIndex = baseIndex;
+        this.resolutionVariants = images;
+        Graphics g = getGraphics();
+        g.drawImage(images[baseIndex], 0, 0, null);
+        g.dispose();
+        images[baseIndex] = this;
+    }
+
+    @Override
+    public Image getResolutionVariant(int width, int height) {
+        for (Image image : resolutionVariants) {
+            if (width <= image.getWidth(null) && height <= image.getHeight(null)) {
+                return image;
+            }
+        }
+        return this;
+    }
+
+    @Override
+    public List<Image> getResolutionVariants() {
+        return Arrays.asList(resolutionVariants);
+    }
+
+    public MultiResolutionBufferedImage map(Function<Image, Image> mapper) {
+        return new MultiResolutionBufferedImage(getType(), baseIndex,
+                Arrays.stream(resolutionVariants).map(mapper)
+                        .toArray(length -> new Image[length]));
+    }
+}
--- a/src/share/classes/sun/nio/ch/FileChannelImpl.java	Wed Mar 05 12:31:29 2014 -0800
+++ b/src/share/classes/sun/nio/ch/FileChannelImpl.java	Wed Mar 05 15:34:27 2014 -0800
@@ -29,10 +29,20 @@
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.nio.MappedByteBuffer;
-import java.nio.channels.*;
+import java.nio.channels.ClosedByInterruptException;
+import java.nio.channels.ClosedChannelException;
+import java.nio.channels.FileChannel;
+import java.nio.channels.FileLock;
+import java.nio.channels.FileLockInterruptionException;
+import java.nio.channels.NonReadableChannelException;
+import java.nio.channels.NonWritableChannelException;
+import java.nio.channels.OverlappingFileLockException;
+import java.nio.channels.ReadableByteChannel;
+import java.nio.channels.WritableByteChannel;
+import java.security.AccessController;
 import java.util.ArrayList;
 import java.util.List;
-import java.security.AccessController;
+
 import sun.misc.Cleaner;
 import sun.security.action.GetPropertyAction;
 
@@ -56,13 +66,17 @@
     // Required to prevent finalization of creating stream (immutable)
     private final Object parent;
 
+    // The path of the referenced file
+    // (null if the parent stream is created with a file descriptor)
+    private final String path;
+
     // Thread-safe set of IDs of native threads, for signalling
     private final NativeThreadSet threads = new NativeThreadSet(2);
 
     // Lock for operations involving position and size
     private final Object positionLock = new Object();
 
-    private FileChannelImpl(FileDescriptor fd, boolean readable,
+    private FileChannelImpl(FileDescriptor fd, String path, boolean readable,
                             boolean writable, boolean append, Object parent)
     {
         this.fd = fd;
@@ -70,23 +84,24 @@
         this.writable = writable;
         this.append = append;
         this.parent = parent;
+        this.path = path;
         this.nd = new FileDispatcherImpl(append);
     }
 
     // Used by FileInputStream.getChannel() and RandomAccessFile.getChannel()
-    public static FileChannel open(FileDescriptor fd,
+    public static FileChannel open(FileDescriptor fd, String path,
                                    boolean readable, boolean writable,
                                    Object parent)
     {
-        return new FileChannelImpl(fd, readable, writable, false, parent);
+        return new FileChannelImpl(fd, path, readable, writable, false, parent);
     }
 
     // Used by FileOutputStream.getChannel
-    public static FileChannel open(FileDescriptor fd,
+    public static FileChannel open(FileDescriptor fd, String path,
                                    boolean readable, boolean writable,
                                    boolean append, Object parent)
     {
-        return new FileChannelImpl(fd, readable, writable, append, parent);
+        return new FileChannelImpl(fd, path, readable, writable, append, parent);
     }
 
     private void ensureOpen() throws IOException {
@@ -110,7 +125,7 @@
             }
         }
 
-        nd.preClose(fd);
+        // signal any threads blocked on this channel
         threads.signalAndWait();
 
         if (parent != null) {
--- a/src/share/classes/sun/nio/ch/NativeThreadSet.java	Wed Mar 05 12:31:29 2014 -0800
+++ b/src/share/classes/sun/nio/ch/NativeThreadSet.java	Wed Mar 05 15:34:27 2014 -0800
@@ -82,8 +82,9 @@
 
     // Signals all threads in this set.
     //
-    void signalAndWait() {
-        synchronized (this) {
+    synchronized void signalAndWait() {
+        boolean interrupted = false;
+        while (used > 0) {
             int u = used;
             int n = elts.length;
             for (int i = 0; i < n; i++) {
@@ -96,16 +97,15 @@
                     break;
             }
             waitingToEmpty = true;
-            boolean interrupted = false;
-            while (used > 0) {
-                try {
-                    wait();
-                } catch (InterruptedException e) {
-                    interrupted = true;
-                }
+            try {
+                wait(50);
+            } catch (InterruptedException e) {
+                interrupted = true;
+            } finally {
+                waitingToEmpty = false;
             }
-            if (interrupted)
-                Thread.currentThread().interrupt();
         }
+        if (interrupted)
+            Thread.currentThread().interrupt();
     }
 }
--- a/src/share/classes/sun/nio/ch/SimpleAsynchronousFileChannelImpl.java	Wed Mar 05 12:31:29 2014 -0800
+++ b/src/share/classes/sun/nio/ch/SimpleAsynchronousFileChannelImpl.java	Wed Mar 05 15:34:27 2014 -0800
@@ -88,7 +88,6 @@
         invalidateAllLocks();
 
         // signal any threads blocked on this channel
-        nd.preClose(fdObj);
         threads.signalAndWait();
 
         // wait until all async I/O operations have completely gracefully
--- a/src/share/instrument/Reentrancy.c	Wed Mar 05 12:31:29 2014 -0800
+++ b/src/share/instrument/Reentrancy.c	Wed Mar 05 15:34:27 2014 -0800
@@ -130,6 +130,7 @@
             error = confirmingTLSSet (  jvmtienv,
                                         thread,
                                         JPLIS_CURRENTLY_INSIDE_TOKEN);
+            check_phase_ret_false(error);
             jplis_assert(error == JVMTI_ERROR_NONE);
             if ( error != JVMTI_ERROR_NONE ) {
                 result = JNI_FALSE;
@@ -158,6 +159,7 @@
     error = confirmingTLSSet(   jvmtienv,
                                 thread,
                                 JPLIS_CURRENTLY_OUTSIDE_TOKEN);
+    check_phase_ret(error);
     jplis_assert(error == JVMTI_ERROR_NONE);
 
 }
--- a/src/share/native/com/sun/java/util/jar/pack/coding.cpp	Wed Mar 05 12:31:29 2014 -0800
+++ b/src/share/native/com/sun/java/util/jar/pack/coding.cpp	Wed Mar 05 15:34:27 2014 -0800
@@ -32,6 +32,8 @@
 #include <stdlib.h>
 #include <stdarg.h>
 
+#include "jni_util.h"
+
 #include "defines.h"
 #include "bytes.h"
 #include "utils.h"
@@ -147,7 +149,7 @@
       break;
   }
   coding* ptr = NEW(coding, 1);
-  CHECK_NULL_0(ptr);
+  CHECK_NULL_RETURN(ptr, 0);
   coding* c = ptr->initFrom(spec);
   if (c == null) {
     mtrace('f', ptr, 0);
--- a/src/share/native/com/sun/java/util/jar/pack/defines.h	Wed Mar 05 12:31:29 2014 -0800
+++ b/src/share/native/com/sun/java/util/jar/pack/defines.h	Wed Mar 05 15:34:27 2014 -0800
@@ -158,10 +158,6 @@
 #define CHECK_(y)               _CHECK_DO(aborting(), return y)
 #define CHECK_0                 _CHECK_DO(aborting(), return 0)
 
-#define CHECK_NULL(p)           _CHECK_DO((p)==null, return)
-#define CHECK_NULL_(y,p)        _CHECK_DO((p)==null, return y)
-#define CHECK_NULL_0(p)         _CHECK_DO((p)==null, return 0)
-
 #define CHECK_COUNT(t)          if (t < 0){abort("bad value count");} CHECK
 
 #define STR_TRUE   "true"
--- a/src/share/native/common/jni_util.h	Wed Mar 05 12:31:29 2014 -0800
+++ b/src/share/native/common/jni_util.h	Wed Mar 05 15:34:27 2014 -0800
@@ -297,6 +297,21 @@
         }                                       \
     } while (0)                                 \
 
+#ifdef __cplusplus
+#define JNU_CHECK_EXCEPTION(env)                \
+    do {                                        \
+        if ((env)->ExceptionCheck()) {          \
+            return;                             \
+        }                                       \
+    } while (0)                                 \
+
+#define JNU_CHECK_EXCEPTION_RETURN(env, y)      \
+    do {                                        \
+        if ((env)->ExceptionCheck()) {          \
+            return (y);                         \
+        }                                       \
+    } while (0)
+#else
 #define JNU_CHECK_EXCEPTION(env)                \
     do {                                        \
         if ((*env)->ExceptionCheck(env)) {      \
@@ -310,7 +325,7 @@
             return (y);                         \
         }                                       \
     } while (0)
-
+#endif /* __cplusplus */
 /************************************************************************
  * Debugging utilities
  */
--- a/src/share/native/java/io/FileInputStream.c	Wed Mar 05 12:31:29 2014 -0800
+++ b/src/share/native/java/io/FileInputStream.c	Wed Mar 05 15:34:27 2014 -0800
@@ -62,7 +62,7 @@
 }
 
 JNIEXPORT jint JNICALL
-Java_java_io_FileInputStream_read(JNIEnv *env, jobject this) {
+Java_java_io_FileInputStream_read0(JNIEnv *env, jobject this) {
     return readSingle(env, this, fis_fd);
 }
 
--- a/src/share/native/java/io/RandomAccessFile.c	Wed Mar 05 12:31:29 2014 -0800
+++ b/src/share/native/java/io/RandomAccessFile.c	Wed Mar 05 15:34:27 2014 -0800
@@ -64,7 +64,7 @@
 }
 
 JNIEXPORT jint JNICALL
-Java_java_io_RandomAccessFile_read(JNIEnv *env, jobject this) {
+Java_java_io_RandomAccessFile_read0(JNIEnv *env, jobject this) {
     return readSingle(env, this, raf_fd);
 }
 
@@ -75,7 +75,7 @@
 }
 
 JNIEXPORT void JNICALL
-Java_java_io_RandomAccessFile_write(JNIEnv *env, jobject this, jint byte) {
+Java_java_io_RandomAccessFile_write0(JNIEnv *env, jobject this, jint byte) {
     writeSingle(env, this, byte, JNI_FALSE, raf_fd);
 }
 
--- a/src/solaris/classes/sun/nio/fs/SolarisUserDefinedFileAttributeView.java	Wed Mar 05 12:31:29 2014 -0800
+++ b/src/solaris/classes/sun/nio/fs/SolarisUserDefinedFileAttributeView.java	Wed Mar 05 15:34:27 2014 -0800
@@ -149,7 +149,7 @@
                 int afd = openat(fd, nameAsBytes(file,name), (O_RDONLY|O_XATTR), 0);
 
                 // wrap with channel
-                FileChannel fc = UnixChannelFactory.newFileChannel(afd, true, false);
+                FileChannel fc = UnixChannelFactory.newFileChannel(afd, file.toString(), true, false);
 
                 // read to EOF (nothing we can do if I/O error occurs)
                 try {
@@ -190,7 +190,7 @@
                                  UnixFileModeAttribute.ALL_PERMISSIONS);
 
                 // wrap with channel
-                FileChannel fc = UnixChannelFactory.newFileChannel(afd, false, true);
+                FileChannel fc = UnixChannelFactory.newFileChannel(afd, file.toString(), false, true);
 
                 // write value (nothing we can do if I/O error occurs)
                 try {
--- a/src/solaris/classes/sun/nio/fs/UnixChannelFactory.java	Wed Mar 05 12:31:29 2014 -0800
+++ b/src/solaris/classes/sun/nio/fs/UnixChannelFactory.java	Wed Mar 05 15:34:27 2014 -0800
@@ -100,10 +100,10 @@
     /**
      * Constructs a file channel from an existing (open) file descriptor
      */
-    static FileChannel newFileChannel(int fd, boolean reading, boolean writing) {
+    static FileChannel newFileChannel(int fd, String path, boolean reading, boolean writing) {
         FileDescriptor fdObj = new FileDescriptor();
         fdAccess.set(fdObj, fd);
-        return FileChannelImpl.open(fdObj, reading, writing, null);
+        return FileChannelImpl.open(fdObj, path, reading, writing, null);
     }
 
     /**
@@ -134,7 +134,7 @@
             throw new IllegalArgumentException("APPEND + TRUNCATE_EXISTING not allowed");
 
         FileDescriptor fdObj = open(dfd, path, pathForPermissionCheck, flags, mode);
-        return FileChannelImpl.open(fdObj, flags.read, flags.write, flags.append, null);
+        return FileChannelImpl.open(fdObj, path.toString(), flags.read, flags.write, flags.append, null);
     }
 
     /**
--- a/src/solaris/native/java/net/PlainDatagramSocketImpl.c	Wed Mar 05 12:31:29 2014 -0800
+++ b/src/solaris/native/java/net/PlainDatagramSocketImpl.c	Wed Mar 05 15:34:27 2014 -0800
@@ -517,6 +517,8 @@
         } else if (ret == JVM_IO_ERR) {
             if (errno == EBADF) {
                  JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
+            } else if (errno == ENOMEM) {
+                 JNU_ThrowOutOfMemoryError(env, "NET_Timeout native heap allocation failed");
             } else {
                  NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", "Peek failed");
             }
@@ -617,15 +619,18 @@
                             "Receive timed out");
             return -1;
         } else if (ret == JVM_IO_ERR) {
+            if (errno == ENOMEM) {
+                JNU_ThrowOutOfMemoryError(env, "NET_Timeout native heap allocation failed");
 #ifdef __linux__
-            if (errno == EBADF) {
+            } else if (errno == EBADF) {
                 JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
             } else {
                 NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", "Receive failed");
+#else
+            } else {
+                JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
+#endif
             }
-#else
-            JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
-#endif
             return -1;
         } else if (ret == JVM_IO_INTR) {
             JNU_ThrowByName(env, JNU_JAVAIOPKG "InterruptedIOException",
@@ -835,15 +840,18 @@
                     JNU_ThrowByName(env, JNU_JAVANETPKG "SocketTimeoutException",
                                     "Receive timed out");
                 } else if (ret == JVM_IO_ERR) {
+                     if (errno == ENOMEM) {
+                        JNU_ThrowOutOfMemoryError(env, "NET_Timeout native heap allocation failed");
 #ifdef __linux__
-                    if (errno == EBADF) {
+                     } else if (errno == EBADF) {
                          JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
                      } else {
                          NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", "Receive failed");
+#else
+                     } else {
+                         JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
+#endif
                      }
-#else
-                     JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
-#endif
                 } else if (ret == JVM_IO_INTR) {
                     JNU_ThrowByName(env, JNU_JAVAIOPKG "InterruptedIOException",
                                     "operation interrupted");
--- a/src/solaris/native/java/net/PlainSocketImpl.c	Wed Mar 05 12:31:29 2014 -0800
+++ b/src/solaris/native/java/net/PlainSocketImpl.c	Wed Mar 05 15:34:27 2014 -0800
@@ -708,7 +708,6 @@
         } else {
             ret = NET_Timeout(fd, timeout);
         }
-
         if (ret == 0) {
             JNU_ThrowByName(env, JNU_JAVANETPKG "SocketTimeoutException",
                             "Accept timed out");
@@ -716,6 +715,8 @@
         } else if (ret == JVM_IO_ERR) {
             if (errno == EBADF) {
                JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
+            } else if (errno == ENOMEM) {
+               JNU_ThrowOutOfMemoryError(env, "NET_Timeout native heap allocation failed");
             } else {
                NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", "Accept failed");
             }
--- a/src/solaris/native/java/net/SocketInputStream.c	Wed Mar 05 12:31:29 2014 -0800
+++ b/src/solaris/native/java/net/SocketInputStream.c	Wed Mar 05 15:34:27 2014 -0800
@@ -108,6 +108,8 @@
             } else if (nread == JVM_IO_ERR) {
                 if (errno == EBADF) {
                      JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
+                 } else if (errno == ENOMEM) {
+                     JNU_ThrowOutOfMemoryError(env, "NET_Timeout native heap allocation failed");
                  } else {
                      NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
                                                   "select/poll failed");
--- a/src/solaris/native/java/net/bsd_close.c	Wed Mar 05 12:31:29 2014 -0800
+++ b/src/solaris/native/java/net/bsd_close.c	Wed Mar 05 15:34:27 2014 -0800
@@ -25,6 +25,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <sys/param.h>
 #include <signal.h>
 #include <pthread.h>
 #include <sys/types.h>
@@ -35,7 +36,6 @@
 #include <sys/uio.h>
 #include <unistd.h>
 #include <errno.h>
-
 #include <sys/poll.h>
 
 /*
@@ -347,6 +347,10 @@
 int NET_Timeout(int s, long timeout) {
     long prevtime = 0, newtime;
     struct timeval t, *tp = &t;
+    fd_set fds;
+    fd_set* fdsp = NULL;
+    int allocated = 0;
+    threadEntry_t self;
     fdEntry_t *fdEntry = getFdEntry(s);
 
     /*
@@ -376,20 +380,29 @@
         t.tv_usec = 0;
     }
 
+    if (s < FD_SETSIZE) {
+        fdsp = &fds;
+        FD_ZERO(fdsp);
+    } else {
+        int length = (howmany(s+1, NFDBITS)) * sizeof(int);
+        fdsp = (fd_set *) calloc(1, length);
+        if (fdsp == NULL) {
+            return -1;   // errno will be set to ENOMEM
+        }
+        allocated = 1;
+    }
+    FD_SET(s, fdsp);
+
     for(;;) {
-        fd_set rfds;
         int rv;
-        threadEntry_t self;
 
         /*
          * call select on the fd. If interrupted by our wakeup signal
          * errno will be set to EBADF.
          */
-        FD_ZERO(&rfds);
-        FD_SET(s, &rfds);
 
         startOp(fdEntry, &self);
-        rv = select(s+1, &rfds, 0, 0, tp);
+        rv = select(s+1, fdsp, 0, 0, tp);
         endOp(fdEntry, &self);
 
         /*
@@ -403,6 +416,8 @@
                 newtime = now.tv_sec * 1000  +  now.tv_usec / 1000;
                 timeout -= newtime - prevtime;
                 if (timeout <= 0) {
+                    if (allocated != 0)
+                        free(fdsp);
                     return 0;
                 }
                 prevtime = newtime;
@@ -410,6 +425,8 @@
                 t.tv_usec = (timeout % 1000) * 1000;
             }
         } else {
+            if (allocated != 0)
+                free(fdsp);
             return rv;
         }
 
--- a/src/solaris/native/java/net/linux_close.c	Wed Mar 05 12:31:29 2014 -0800
+++ b/src/solaris/native/java/net/linux_close.c	Wed Mar 05 15:34:27 2014 -0800
@@ -34,7 +34,6 @@
 #include <sys/uio.h>
 #include <unistd.h>
 #include <errno.h>
-
 #include <sys/poll.h>
 
 /*
--- a/src/solaris/native/sun/awt/gtk2_interface.c	Wed Mar 05 12:31:29 2014 -0800
+++ b/src/solaris/native/sun/awt/gtk2_interface.c	Wed Mar 05 15:34:27 2014 -0800
@@ -32,6 +32,7 @@
 #include "java_awt_Transparency.h"
 #include "jvm_md.h"
 #include "sizecalc.h"
+#include <jni_util.h>
 
 #define GTK2_LIB_VERSIONED VERSIONED_JNI_LIB_NAME("gtk-x11-2.0", "0")
 #define GTK2_LIB JNI_LIB_NAME("gtk-x11-2.0")
@@ -456,13 +457,19 @@
     const gchar * const * schemes = NULL;
 
     jclass cls_action = (*env)->FindClass(env, "java/awt/Desktop$Action");
+    CHECK_NULL(cls_action);
     jclass cls_xDesktopPeer = (*env)->FindClass(env, "sun/awt/X11/XDesktopPeer");
+    CHECK_NULL(cls_xDesktopPeer);
     jfieldID fld_supportedActions = (*env)->GetStaticFieldID(env, cls_xDesktopPeer, "supportedActions", "Ljava/util/List;");
+    CHECK_NULL(fld_supportedActions);
     jobject supportedActions = (*env)->GetStaticObjectField(env, cls_xDesktopPeer, fld_supportedActions);
 
     jclass cls_arrayList = (*env)->FindClass(env, "java/util/ArrayList");
+    CHECK_NULL(cls_arrayList);
     jmethodID mid_arrayListAdd = (*env)->GetMethodID(env, cls_arrayList, "add", "(Ljava/lang/Object;)Z");
+    CHECK_NULL(mid_arrayListAdd);
     jmethodID mid_arrayListClear = (*env)->GetMethodID(env, cls_arrayList, "clear", "()V");
+    CHECK_NULL(mid_arrayListClear);
 
     (*env)->CallVoidMethod(env, supportedActions, mid_arrayListClear);
 
--- a/src/solaris/native/sun/nio/ch/NativeThread.c	Wed Mar 05 12:31:29 2014 -0800
+++ b/src/solaris/native/sun/nio/ch/NativeThread.c	Wed Mar 05 15:34:27 2014 -0800
@@ -32,27 +32,32 @@
 #include "sun_nio_ch_NativeThread.h"
 #include "nio_util.h"
 
-
 #ifdef __linux__
-#include <pthread.h>
-#include <sys/signal.h>
-
-/* Also defined in src/solaris/native/java/net/linux_close.c */
-#define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
+  #include <pthread.h>
+  #include <sys/signal.h>
+  /* Also defined in net/linux_close.c */
+  #define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
+#elif __solaris__
+  #include <thread.h>
+  #include <signal.h>
+  #define INTERRUPT_SIGNAL (SIGRTMAX - 2)
+#elif _ALLBSD_SOURCE
+  #include <pthread.h>
+  #include <signal.h>
+  /* Also defined in net/bsd_close.c */
+  #define INTERRUPT_SIGNAL SIGIO
+#else
+  #error "missing platform-specific definition here"
+#endif
 
 static void
 nullHandler(int sig)
 {
 }
 
-#endif
-
-
 JNIEXPORT void JNICALL
 Java_sun_nio_ch_NativeThread_init(JNIEnv *env, jclass cl)
 {
-#ifdef __linux__
-
     /* Install the null handler for INTERRUPT_SIGNAL.  This might overwrite the
      * handler previously installed by java/net/linux_close.c, but that's okay
      * since neither handler actually does anything.  We install our own
@@ -67,25 +72,27 @@
     sigemptyset(&sa.sa_mask);
     if (sigaction(INTERRUPT_SIGNAL, &sa, &osa) < 0)
         JNU_ThrowIOExceptionWithLastError(env, "sigaction");
-
-#endif
 }
 
 JNIEXPORT jlong JNICALL
 Java_sun_nio_ch_NativeThread_current(JNIEnv *env, jclass cl)
 {
-#ifdef __linux__
-    return (long)pthread_self();
+#ifdef __solaris__
+    return (jlong)thr_self();
 #else
-    return -1;
+    return (jlong)pthread_self();
 #endif
 }
 
 JNIEXPORT void JNICALL
 Java_sun_nio_ch_NativeThread_signal(JNIEnv *env, jclass cl, jlong thread)
 {
-#ifdef __linux__
-    if (pthread_kill((pthread_t)thread, INTERRUPT_SIGNAL))
+    int ret;
+#ifdef __solaris__
+    ret = thr_kill((thread_t)thread, INTERRUPT_SIGNAL);
+#else
+    ret = pthread_kill((pthread_t)thread, INTERRUPT_SIGNAL);
+#endif
+    if (ret != 0)
         JNU_ThrowIOExceptionWithLastError(env, "Thread signal failed");
-#endif
 }
--- a/src/windows/classes/sun/nio/fs/WindowsChannelFactory.java	Wed Mar 05 12:31:29 2014 -0800
+++ b/src/windows/classes/sun/nio/fs/WindowsChannelFactory.java	Wed Mar 05 15:34:27 2014 -0800
@@ -25,19 +25,22 @@
 
 package sun.nio.fs;
 
-import java.nio.file.*;
-import java.nio.channels.*;
 import java.io.FileDescriptor;
 import java.io.IOException;
-import java.util.*;
+import java.nio.channels.AsynchronousFileChannel;
+import java.nio.channels.FileChannel;
+import java.nio.file.LinkOption;
+import java.nio.file.OpenOption;
+import java.nio.file.StandardOpenOption;
+import java.util.Set;
 
 import com.sun.nio.file.ExtendedOpenOption;
 
+import sun.misc.JavaIOFileDescriptorAccess;
+import sun.misc.SharedSecrets;
 import sun.nio.ch.FileChannelImpl;
 import sun.nio.ch.ThreadPool;
 import sun.nio.ch.WindowsAsynchronousFileChannelImpl;
-import sun.misc.SharedSecrets;
-import sun.misc.JavaIOFileDescriptorAccess;
 
 import static sun.nio.fs.WindowsNativeDispatcher.*;
 import static sun.nio.fs.WindowsConstants.*;
@@ -157,7 +160,7 @@
             throw new IllegalArgumentException("APPEND + TRUNCATE_EXISTING not allowed");
 
         FileDescriptor fdObj = open(pathForWindows, pathToCheck, flags, pSecurityDescriptor);
-        return FileChannelImpl.open(fdObj, flags.read, flags.write, flags.append, null);
+        return FileChannelImpl.open(fdObj, pathForWindows, flags.read, flags.write, flags.append, null);
     }
 
     /**
--- a/test/ProblemList.txt	Wed Mar 05 12:31:29 2014 -0800
+++ b/test/ProblemList.txt	Wed Mar 05 15:34:27 2014 -0800
@@ -183,11 +183,6 @@
 # 6963118
 java/nio/channels/Selector/Wakeup.java                          windows-all
 
-# 7133499, 7133497
-java/nio/channels/AsyncCloseAndInterrupt.java                   macosx-all
-java/nio/channels/AsynchronousFileChannel/Lock.java             macosx-all
-java/nio/channels/FileChannel/Transfer.java                     macosx-all
-
 # 7141822
 java/nio/channels/DatagramChannel/ChangingAddress.java          macosx-all
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/Frame/ExceptionOnSetExtendedStateTest/ExceptionOnSetExtendedStateTest.java	Wed Mar 05 15:34:27 2014 -0800
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+   @bug 8032078
+   @summary Frame.setExtendedState throws RuntimeException, if
+            windowState=ICONIFIED|MAXIMIZED_BOTH, on OS X
+   @author Anton Litvinov
+*/
+
+import java.awt.*;
+
+import sun.awt.SunToolkit;
+
+public class ExceptionOnSetExtendedStateTest {
+    private static final int[] frameStates = { Frame.NORMAL, Frame.ICONIFIED, Frame.MAXIMIZED_BOTH };
+    private static final SunToolkit toolkit = (SunToolkit)Toolkit.getDefaultToolkit();
+
+    private static boolean validatePlatform() {
+        String osName = System.getProperty("os.name");
+        if (osName == null) {
+            throw new RuntimeException("Name of the current OS could not be retrieved.");
+        }
+        return osName.startsWith("Mac");
+    }
+
+    private static void testStateChange(int oldState, int newState, boolean decoratedFrame) {
+        System.out.println(String.format(
+            "testStateChange: oldState='%d', newState='%d', decoratedFrame='%b'",
+            oldState, newState, decoratedFrame));
+
+        Frame frame = new Frame("ExceptionOnSetExtendedStateTest");
+        frame.setSize(200, 200);
+        frame.setUndecorated(!decoratedFrame);
+        frame.setVisible(true);
+        toolkit.realSync();
+
+        frame.setExtendedState(oldState);
+        sleep(1000);
+        frame.setExtendedState(newState);
+
+        boolean stateWasNotChanged = true;
+        int currentState = 0;
+        for (int i = 0; (i < 3) && stateWasNotChanged; i++) {
+            sleep(1000);
+            currentState = frame.getExtendedState();
+            if ((currentState == newState) ||
+                (((newState & Frame.ICONIFIED) != 0) && ((currentState & Frame.ICONIFIED) != 0))) {
+                stateWasNotChanged = false;
+            }
+        }
+        frame.dispose();
+
+        if (stateWasNotChanged) {
+            throw new RuntimeException(String.format(
+                "Frame state was not changed. currentState='%d'", currentState));
+        }
+    }
+
+    private static void sleep(int millis) {
+        try {
+            Thread.sleep(millis);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static void main(String[] args) {
+        if (!validatePlatform()) {
+            System.out.println("This test is only for OS X.");
+            return;
+        }
+
+        // Verify that changing states of decorated/undecorated frame to/from supported states
+        // and the state bit mask ICONIFIED | MAXIMIZED_BOTH does not raise RuntimeException.
+        for (int i = 0; i < frameStates.length; i++) {
+            testStateChange(frameStates[i], Frame.ICONIFIED | Frame.MAXIMIZED_BOTH, true);
+            testStateChange(frameStates[i], Frame.ICONIFIED | Frame.MAXIMIZED_BOTH, false);
+            testStateChange(Frame.ICONIFIED | Frame.MAXIMIZED_BOTH, frameStates[i], true);
+            testStateChange(Frame.ICONIFIED | Frame.MAXIMIZED_BOTH, frameStates[i], false);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/lang/instrument/DaemonThread/DummyAgent.java	Wed Mar 05 15:34:27 2014 -0800
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2014 Goldman Sachs.
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.lang.instrument.ClassFileTransformer;
+import java.lang.instrument.IllegalClassFormatException;
+import java.lang.instrument.Instrumentation;
+import java.security.ProtectionDomain;
+
+public class DummyAgent implements ClassFileTransformer {
+    @Override
+    public byte[] transform(ClassLoader loader, String className,
+                            Class<?> classBeingRedefined, ProtectionDomain protectionDomain,
+                            byte[] classfileBuffer) throws IllegalClassFormatException {
+
+        /* The Daemon Thread bug is timing dependent and you want the transform method
+         * to return ASAP - so just return the buffer will be fine
+         */
+        return classfileBuffer;
+    }
+
+    public static void premain(String agentArgs, Instrumentation inst) {
+        inst.addTransformer(new DummyAgent(), false);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/lang/instrument/DaemonThread/DummyClass.java	Wed Mar 05 15:34:27 2014 -0800
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2014 Goldman Sachs.
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* Just a dummy class for loading */
+public class DummyClass {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/lang/instrument/DaemonThread/TestDaemonThread.java	Wed Mar 05 15:34:27 2014 -0800
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2014 Goldman Sachs.
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/* @test
+ * @bug 7142035
+ * @summary Assert in java.lang.instrument agents during shutdown when classloading occurs after shutdown
+ * @library /lib/testlibrary
+ *
+ * @build DummyAgent DummyClass TestDaemonThreadLauncher TestDaemonThread
+ * @run shell ../MakeJAR3.sh DummyAgent
+ * @run main TestDaemonThreadLauncher /timeout=240
+ *
+ */
+import java.io.File;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+public class TestDaemonThread implements Runnable{
+    File classpath;
+
+    public TestDaemonThread(File classpath) {
+        this.classpath = classpath;
+    }
+
+    @Override
+    public void run() {
+
+
+        try {
+            URL u = this.getClass().getClassLoader().getResource("DummyClass.class");
+            String path = u.getPath();
+            String parent = u.getPath().substring(0, path.lastIndexOf('/')+1);
+            URL parentURL = new URL(u, parent);
+            System.out.println(parentURL);
+            /* Load lots of class by creating multiple classloaders */
+            for(;;) {
+                ClassLoader cl = new URLClassLoader(new URL[] {parentURL}, null);
+                cl.loadClass("DummyClass");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+           Thread t = new Thread(new TestDaemonThread(new File(args[0])));
+           /* The important part of the bug is that a Daemon thread can continue to load classes after shutdown */
+           t.setDaemon(true);
+           t.start();
+           Thread.sleep(200);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/lang/instrument/DaemonThread/TestDaemonThreadLauncher.java	Wed Mar 05 15:34:27 2014 -0800
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2014 Goldman Sachs.
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import jdk.testlibrary.JDKToolLauncher;
+import jdk.testlibrary.OutputAnalyzer;
+import jdk.testlibrary.ProcessTools;
+
+import java.io.IOException;
+import java.nio.file.Path;
+
+public class TestDaemonThreadLauncher {
+
+    private static ProcessBuilder processBuilder = new ProcessBuilder();
+
+    public static void main(String args[]) throws Exception {
+        for(int i=0; i<50; i++) {
+            ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-javaagent:DummyAgent.jar", "TestDaemonThread", ".");
+            OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());
+            analyzer.shouldNotContain("ASSERTION FAILED");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/net/ServerSocket/AnotherSelectFdsLimit.java	Wed Mar 05 15:34:27 2014 -0800
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8035897
+ * @summary FD_SETSIZE should be set on macosx
+ * @run main/othervm AnotherSelectFdsLimit 1023
+ * @run main/othervm AnotherSelectFdsLimit 1024
+ * @run main/othervm AnotherSelectFdsLimit 1025
+ * @run main/othervm AnotherSelectFdsLimit 1600
+ */
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.SocketTimeoutException;
+import java.util.ArrayList;
+import java.util.List;
+
+public class AnotherSelectFdsLimit {
+    static final int DEFAULT_FDS_TO_USE = 1600;
+
+    public static void main(String [] args) throws Exception {
+        if (!System.getProperty("os.name").contains("OS X")) {
+            System.out.println("Test only run on MAC. Exiting.");
+            return;
+        }
+
+        int fdsToUse = DEFAULT_FDS_TO_USE;
+        if (args.length == 1)
+            fdsToUse = Integer.parseInt(args[0]);
+
+        System.out.println("Using " + fdsToUse + " fds.");
+
+        List<Thread> threads = new ArrayList<>();
+        for (int i=0; i<fdsToUse; i++)
+            threads.add(new WorkerThread());
+
+        for (Thread t : threads)
+            t.start();
+
+        for (Thread t : threads)
+            t.join();
+    }
+
+    static class WorkerThread extends Thread {
+        public void run() {
+            try (ServerSocket ss = new ServerSocket(0)) {
+                ss.setSoTimeout(2000);
+                ss.accept();
+            } catch (SocketTimeoutException x) {
+                // expected
+            } catch (IOException x) {
+                throw new java.io.UncheckedIOException(x);
+            }
+        }
+    }
+}
--- a/test/java/nio/channels/Selector/ByteServer.java	Wed Mar 05 12:31:29 2014 -0800
+++ b/test/java/nio/channels/Selector/ByteServer.java	Wed Mar 05 15:34:27 2014 -0800
@@ -22,52 +22,54 @@
  */
 
 /**
- *
- * Utility class for tests. A simple server, which waits for a connection,
- * writes out n bytes and waits.
+ * Utility class for tests. A simple "in-thread" server to accept connections
+ * and write bytes.
  * @author kladko
  */
 
 import java.net.Socket;
 import java.net.ServerSocket;
-
-public class ByteServer {
+import java.net.SocketAddress;
+import java.net.InetSocketAddress;
+import java.io.IOException;
+import java.io.Closeable;
 
-    public static final String LOCALHOST = "localhost";
-    private int bytecount;
-    private Socket  socket;
-    private ServerSocket  serversocket;
-    private Thread serverthread;
-    volatile Exception savedException;
+public class ByteServer implements Closeable {
 
-    public ByteServer(int bytecount) throws Exception{
-        this.bytecount = bytecount;
-        serversocket = new ServerSocket(0);
+    private final ServerSocket ss;
+    private Socket s;
+
+    ByteServer() throws IOException {
+        this.ss = new ServerSocket(0);
     }
 
-    public int port() {
-        return serversocket.getLocalPort();
+    SocketAddress address() {
+        return new InetSocketAddress(ss.getInetAddress(), ss.getLocalPort());
     }
 
-    public void start() {
-        serverthread = new Thread() {
-            public void run() {
-                try {
-                    socket = serversocket.accept();
-                    socket.getOutputStream().write(new byte[bytecount]);
-                    socket.getOutputStream().flush();
-                } catch (Exception e) {
-                    System.err.println("Exception in ByteServer: " + e);
-                    System.exit(1);
-                }
-            }
-        };
-        serverthread.start();
+    void acceptConnection() throws IOException {
+        if (s != null)
+            throw new IllegalStateException("already connected");
+        this.s = ss.accept();
     }
 
-    public void exit() throws Exception {
-        serverthread.join();
-        socket.close();
-        serversocket.close();
+    void closeConnection() throws IOException {
+        Socket s = this.s;
+        if (s != null) {
+            this.s = null;
+            s.close();
+        }
+    }
+
+    void write(int count) throws IOException {
+        if (s == null)
+            throw new IllegalStateException("no connection");
+        s.getOutputStream().write(new byte[count]);
+    }
+
+    public void close() throws IOException {
+        if (s != null)
+            s.close();
+        ss.close();
     }
 }
--- a/test/java/nio/channels/Selector/ReadAfterConnect.java	Wed Mar 05 12:31:29 2014 -0800
+++ b/test/java/nio/channels/Selector/ReadAfterConnect.java	Wed Mar 05 15:34:27 2014 -0800
@@ -27,27 +27,25 @@
  * @author kladko
  */
 
-import java.net.*;
-import java.nio.*;
-import java.nio.channels.*;
+import java.nio.channels.Selector;
+import java.nio.channels.SelectionKey;
+import java.nio.channels.SocketChannel;
 
 public class ReadAfterConnect {
+    public static void main(String[] argv) throws Exception {
+        try (ByteServer server = new ByteServer();
+             SocketChannel sc = SocketChannel.open(server.address())) {
 
-    public static void main(String[] argv) throws Exception {
-        ByteServer server = new ByteServer(0); // server: accept connection and do nothing
-        server.start();
-        InetSocketAddress isa = new InetSocketAddress(
-                InetAddress.getByName(ByteServer.LOCALHOST), server.port());
-        Selector sel = Selector.open();
-        SocketChannel sc = SocketChannel.open();
-        sc.connect(isa);
-        sc.configureBlocking(false);
-        sc.register(sel, SelectionKey.OP_READ);
-        // Previously channel would get selected here, although there is nothing to read
-        if (sel.selectNow() != 0)
-            throw new Exception("Select returned nonzero value");
-        sc.close();
-        server.exit();
+            server.acceptConnection();
+
+            try (Selector sel = Selector.open()) {
+                sc.configureBlocking(false);
+                sc.register(sel, SelectionKey.OP_READ);
+                // Previously channel would get selected here, although there is nothing to read
+                if (sel.selectNow() != 0)
+                    throw new Exception("Select returned nonzero value");
+            }
+        }
     }
 
 }
--- a/test/java/nio/channels/Selector/SelectAfterRead.java	Wed Mar 05 12:31:29 2014 -0800
+++ b/test/java/nio/channels/Selector/SelectAfterRead.java	Wed Mar 05 15:34:27 2014 -0800
@@ -28,60 +28,62 @@
  * @author kladko
  */
 
-import java.net.*;
-import java.nio.*;
-import java.nio.channels.*;
+import java.nio.ByteBuffer;
+import java.nio.channels.Selector;
+import java.nio.channels.SelectionKey;
+import java.nio.channels.SocketChannel;
 
 public class SelectAfterRead {
 
-    final static int TIMEOUT = 1000;
+    private static final int TIMEOUT = 1000;
 
     public static void main(String[] argv) throws Exception {
-        InetAddress lh = InetAddress.getByName(ByteServer.LOCALHOST);
 
         // server: accept connection and write one byte
-        ByteServer server = new ByteServer(1);
-        server.start();
-        Selector sel = Selector.open();
-        SocketChannel sc = SocketChannel.open();
-        sc.connect(new InetSocketAddress(lh, server.port()));
-        sc.read(ByteBuffer.allocate(1));
-        sc.configureBlocking(false);
-        sc.register(sel, SelectionKey.OP_READ);
-        // previously on Windows select would select channel here, although there was
-        // nothing to read
-        if (sel.selectNow() != 0)
-            throw new Exception("Select returned nonzero value");
-        sc.close();
-        sel.close();
-        server.exit();
+        try (ByteServer server = new ByteServer();
+             SocketChannel sc = SocketChannel.open(server.address())) {
+
+            server.acceptConnection();
+            server.write(1);
+
+            try (Selector sel = Selector.open()) {
+                sc.read(ByteBuffer.allocate(1));
+                sc.configureBlocking(false);
+                sc.register(sel, SelectionKey.OP_READ);
+                // previously on Windows select would select channel here, although there was
+                // nothing to read
+                if (sel.selectNow() != 0)
+                    throw new Exception("Select returned nonzero value");
+            }
+        }
 
         // Now we will test a two reads combination
         // server: accept connection and write two bytes
-        server = new ByteServer(2);
-        server.start();
-        sc = SocketChannel.open();
-        sc.connect(new InetSocketAddress(lh, server.port()));
-        sc.configureBlocking(false);
-        sel = Selector.open();
-        sc.register(sel, SelectionKey.OP_READ);
-        if (sel.select(TIMEOUT) != 1)
-            throw new Exception("One selected key expected");
-        sel.selectedKeys().clear();
-        // previously on Windows a channel would get selected only once
-        if (sel.selectNow() != 1)
-            throw new Exception("One selected key expected");
-        // Previously on Windows two consequent reads would cause select()
-        // to select a channel, although there was nothing remaining to
-        // read in the channel
-        if (sc.read(ByteBuffer.allocate(1)) != 1)
-            throw new Exception("One byte expected");
-        if (sc.read(ByteBuffer.allocate(1)) != 1)
-            throw new Exception("One byte expected");
-        if (sel.selectNow() != 0)
-            throw new Exception("Select returned nonzero value");
-        sc.close();
-        sel.close();
-        server.exit();
+        try (ByteServer server = new ByteServer();
+             SocketChannel sc = SocketChannel.open(server.address())) {
+
+            server.acceptConnection();
+            server.write(2);
+
+            try (Selector sel = Selector.open()) {
+                sc.configureBlocking(false);
+                sc.register(sel, SelectionKey.OP_READ);
+                if (sel.select(TIMEOUT) != 1)
+                    throw new Exception("One selected key expected");
+                sel.selectedKeys().clear();
+                // previously on Windows a channel would get selected only once
+                if (sel.selectNow() != 1)
+                    throw new Exception("One selected key expected");
+                // Previously on Windows two consequent reads would cause select()
+                // to select a channel, although there was nothing remaining to
+                // read in the channel
+                if (sc.read(ByteBuffer.allocate(1)) != 1)
+                    throw new Exception("One byte expected");
+                if (sc.read(ByteBuffer.allocate(1)) != 1)
+                    throw new Exception("One byte expected");
+                if (sel.selectNow() != 0)
+                    throw new Exception("Select returned nonzero value");
+            }
+        }
     }
 }
--- a/test/java/nio/channels/Selector/SelectWrite.java	Wed Mar 05 12:31:29 2014 -0800
+++ b/test/java/nio/channels/Selector/SelectWrite.java	Wed Mar 05 15:34:27 2014 -0800
@@ -22,36 +22,33 @@
  */
 
 /* @test
-   @bug 4645302
-   @summary Socket with OP_WRITE would get selected only once
-   @author kladko
+ * @bug 4645302
+ * @summary Socket with OP_WRITE would get selected only once
+ * @author kladko
  */
 
-import java.net.*;
-import java.nio.*;
-import java.nio.channels.*;
-
+import java.nio.channels.Selector;
+import java.nio.channels.SelectionKey;
+import java.nio.channels.SocketChannel;
 
 public class SelectWrite {
 
     public static void main(String[] argv) throws Exception {
-        ByteServer server = new ByteServer(0);
-        // server: accept connection and do nothing
-        server.start();
-        InetSocketAddress isa = new InetSocketAddress(
-                InetAddress.getByName(ByteServer.LOCALHOST), server.port());
-        Selector sel = Selector.open();
-        SocketChannel sc = SocketChannel.open();
-        sc.connect(isa);
-        sc.configureBlocking(false);
-        sc.register(sel, SelectionKey.OP_WRITE);
-        sel.select();
-        sel.selectedKeys().clear();
-        if (sel.select() == 0) {
-            throw new Exception("Select returned zero");
+        try (ByteServer server = new ByteServer();
+             SocketChannel sc = SocketChannel.open(server.address())) {
+
+            server.acceptConnection();
+
+            try (Selector sel = Selector.open()) {
+                sc.configureBlocking(false);
+                sc.register(sel, SelectionKey.OP_WRITE);
+                sel.select();
+                sel.selectedKeys().clear();
+                if (sel.select() == 0) {
+                    throw new Exception("Select returned zero");
+                }
+            }
         }
-        sc.close();
-        sel.close();
     }
 
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/swing/JMenuItem/8031573/bug8031573.html	Wed Mar 05 15:34:27 2014 -0800
@@ -0,0 +1,40 @@
+<!--
+ Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html>
+<body>
+
+Verify that high resolution system icons are used JCheckBoxMenuItem 
+on HiDPI displays.
+
+If the display does not support HiDPI mode press PASS.
+
+1. Run the test on HiDPI Display.
+2. Press the Menu in the applet
+3. Check that the icon on the JCheckBoxMenuItem is smooth
+If so, press PASS, else press FAIL.
+
+<applet  code="bug8031573.class" width=250 height=250></applet>
+
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/swing/JMenuItem/8031573/bug8031573.java	Wed Mar 05 15:34:27 2014 -0800
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.awt.FlowLayout;
+import javax.swing.JApplet;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.SwingUtilities;
+
+/* @test
+ * @bug 8031573
+ * @summary [macosx] Checkmarks of JCheckBoxMenuItems aren't rendered
+ *           in high resolution on Retina
+ * @author Alexander Scherbatiy
+ * @run applet/manual=yesno bug8031573.html
+ */
+public class bug8031573 extends JApplet {
+
+    @Override
+    public void init() {
+        try {
+            SwingUtilities.invokeAndWait(new Runnable() {
+
+                @Override
+                public void run() {
+                    JMenuBar bar = new JMenuBar();
+                    JMenu menu = new JMenu("Menu");
+                    JCheckBoxMenuItem checkBoxMenuItem
+                            = new JCheckBoxMenuItem("JCheckBoxMenuItem");
+                    checkBoxMenuItem.setSelected(true);
+                    menu.add(checkBoxMenuItem);
+                    bar.add(menu);
+                    setJMenuBar(bar);
+                }
+            });
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+}
--- a/test/javax/xml/jaxp/transform/8004476/TestBase.java	Wed Mar 05 12:31:29 2014 -0800
+++ b/test/javax/xml/jaxp/transform/8004476/TestBase.java	Wed Mar 05 15:34:27 2014 -0800
@@ -1,7 +1,26 @@
 /*
  * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
  */
+
 import java.security.Policy;
 
 /**
--- a/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java	Wed Mar 05 12:31:29 2014 -0800
+++ b/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java	Wed Mar 05 15:34:27 2014 -0800
@@ -32,6 +32,7 @@
 import java.util.List;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicReference;
+import jdk.testlibrary.ProcessTools;
 
 /**
  * @test
@@ -43,11 +44,9 @@
  *          both agent properties and jvmstat buffer.
  * @build jdk.testlibrary.ProcessTools
  * @build TestManager TestApplication
- * @run main/othervm/timeout=300 LocalManagementTest
+ * @run main/othervm/timeout=300 -XX:+UsePerfData LocalManagementTest
  */
 
-import jdk.testlibrary.ProcessTools;
-
 public class LocalManagementTest {
     private static final  String TEST_CLASSPATH = System.getProperty("test.class.path");
     private static final  String TEST_JDK = System.getProperty("test.jdk");
@@ -240,4 +239,4 @@
             }
         }
     }
-}
\ No newline at end of file
+}