changeset 10999:277b0f9f4632

Merge
author lana
date Thu, 06 Aug 2015 12:18:41 -0700
parents be5faa9c7704 6d41ca44d1e2
children f2a9fa9e2f50 492f4fb4a130
files
diffstat 10 files changed, 53 insertions(+), 69 deletions(-) [+]
line wrap: on
line diff
--- a/src/macosx/native/sun/awt/CFRetainedResource.m	Tue Jul 28 22:48:30 2015 -0700
+++ b/src/macosx/native/sun/awt/CFRetainedResource.m	Thu Aug 06 12:18:41 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,10 +40,17 @@
     if (releaseOnAppKitThread) {
         // Releasing resources on the main AppKit message loop only
         // Releasing resources on the nested loops may cause dangling 
-        // pointers after the nested loop is exited 
-        [NSApp postRunnableEvent:^(){
-            CFRelease(jlong_to_ptr(ptr));
-        }];
+        // pointers after the nested loop is exited
+        if ([NSApp respondsToSelector:@selector(postRunnableEvent:)]) {
+            [NSApp postRunnableEvent:^() {
+                CFRelease(jlong_to_ptr(ptr));
+            }];
+        } else {
+            // could happen if we are embedded inside SWT/FX application,
+            [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^() {
+                CFRelease(jlong_to_ptr(ptr));
+            }];
+        }
     } else {
 
 JNF_COCOA_ENTER(env);
--- a/src/share/classes/sun/applet/AppletPanel.java	Tue Jul 28 22:48:30 2015 -0700
+++ b/src/share/classes/sun/applet/AppletPanel.java	Thu Aug 06 12:18:41 2015 -0700
@@ -682,12 +682,7 @@
 
         if (toFocus != null) {
             if (parent instanceof EmbeddedFrame) {
-                // JDK-8056915: Try to request focus to the embedder first and
-                // activate the embedded frame through it
-                if (!((EmbeddedFrame) parent).requestFocusToEmbedder()) {
-                    // Otherwise activate the embedded frame directly
-                    ((EmbeddedFrame) parent).synthesizeWindowActivation(true);
-                }
+                ((EmbeddedFrame) parent).synthesizeWindowActivation(true);
             }
             // EmbeddedFrame might have focus before the applet was added.
             // Thus after its activation the most recent focus owner will be
--- a/src/share/classes/sun/awt/EmbeddedFrame.java	Tue Jul 28 22:48:30 2015 -0700
+++ b/src/share/classes/sun/awt/EmbeddedFrame.java	Thu Aug 06 12:18:41 2015 -0700
@@ -361,15 +361,6 @@
     public void synthesizeWindowActivation(boolean doActivate) {}
 
     /**
-     * Requests the focus to the embedder.
-     *
-     * @return {@code true} if focus request was successful, and {@code false} otherwise.
-     */
-    public boolean requestFocusToEmbedder() {
-        return false;
-    }
-
-    /**
      * Moves this embedded frame to a new location. The top-left corner of
      * the new location is specified by the <code>x</code> and <code>y</code>
      * parameters relative to the native parent component.
--- a/src/windows/classes/sun/awt/windows/WEmbeddedFrame.java	Tue Jul 28 22:48:30 2015 -0700
+++ b/src/windows/classes/sun/awt/windows/WEmbeddedFrame.java	Thu Aug 06 12:18:41 2015 -0700
@@ -248,14 +248,6 @@
         }
     }
 
-    @SuppressWarnings("deprecation")
-    public boolean requestFocusToEmbedder() {
-        if (isEmbeddedInIE) {
-            return ((WEmbeddedFramePeer) getPeer()).requestFocusToEmbedder();
-        }
-        return false;
-    }
-
     public void registerAccelerator(AWTKeyStroke stroke) {}
     public void unregisterAccelerator(AWTKeyStroke stroke) {}
 
--- a/src/windows/classes/sun/awt/windows/WEmbeddedFramePeer.java	Tue Jul 28 22:48:30 2015 -0700
+++ b/src/windows/classes/sun/awt/windows/WEmbeddedFramePeer.java	Thu Aug 06 12:18:41 2015 -0700
@@ -79,10 +79,4 @@
         return !Win32GraphicsEnvironment.isDWMCompositionEnabled();
     }
 
-    /**
-     * Sets the focus to plugin control window, the parent of embedded frame.
-     * Eventually, it will synthesizeWindowActivation to activate the embedded frame,
-     * if plugin control window gets the focus.
-     */
-    public native boolean requestFocusToEmbedder();
 }
--- a/src/windows/native/sun/windows/awt_Frame.cpp	Tue Jul 28 22:48:30 2015 -0700
+++ b/src/windows/native/sun/windows/awt_Frame.cpp	Thu Aug 06 12:18:41 2015 -0700
@@ -1961,29 +1961,6 @@
     CATCH_BAD_ALLOC;
 }
 
-JNIEXPORT jboolean JNICALL
-Java_sun_awt_windows_WEmbeddedFramePeer_requestFocusToEmbedder(JNIEnv *env, jobject self)
-{
-    jboolean result = JNI_FALSE;
-
-    TRY;
-
-    AwtFrame *frame = NULL;
-
-    PDATA pData;
-    JNI_CHECK_PEER_GOTO(self, ret);
-    frame = (AwtFrame *)pData;
-
-    // JDK-8056915: During initial applet activation, set focus to plugin control window
-    HWND hwndParent = ::GetParent(frame->GetHWnd());
-
-    result = SetFocusToPluginControl(hwndParent);
-
-    CATCH_BAD_ALLOC_RET(JNI_FALSE);
-ret:
-    return result;
-}
-
 } /* extern "C" */
 
 static bool SetFocusToPluginControl(HWND hwndPlugin)
--- a/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java	Tue Jul 28 22:48:30 2015 -0700
+++ b/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java	Thu Aug 06 12:18:41 2015 -0700
@@ -168,6 +168,11 @@
         try {
             returned = target.invokeWithArguments(args);
         } catch (Throwable ex) {
+            if (CodeCacheOverflowProcessor.isThrowableCausedByVME(ex)) {
+                // This error will be treated by CodeCacheOverflowProcessor
+                // to prevent the test from failing because of code cache overflow.
+                throw new Error(ex);
+            }
             testCase.assertCatch(ex);
             returned = ex;
         }
--- a/test/java/rmi/testlibrary/TestLibrary.java	Tue Jul 28 22:48:30 2015 -0700
+++ b/test/java/rmi/testlibrary/TestLibrary.java	Thu Aug 06 12:18:41 2015 -0700
@@ -383,6 +383,16 @@
     }
 
     /**
+     * Creates an RMI {@link Registry} on an ephemeral port.
+     *
+     * @returns an RMI Registry
+     * @throws RemoteException if there was a problem creating a Registry.
+     */
+    public static Registry createRegistryOnEphemeralPort() throws RemoteException {
+        return LocateRegistry.createRegistry(0);
+    }
+
+    /**
      * Returns the port number the RMI {@link Registry} is running on.
      *
      * @param registry the registry to find the port of.
--- a/test/java/rmi/transport/pinClientSocketFactory/PinClientSocketFactory.java	Tue Jul 28 22:48:30 2015 -0700
+++ b/test/java/rmi/transport/pinClientSocketFactory/PinClientSocketFactory.java	Thu Aug 06 12:18:41 2015 -0700
@@ -58,7 +58,6 @@
 
 public class PinClientSocketFactory {
 
-    private static final int PORT = TestLibrary.getUnusedRandomPort();
     private static final int SESSIONS = 50;
 
     public interface Factory extends Remote {
@@ -96,10 +95,13 @@
         }
         UnicastRemoteObject.unexportObject(factoryImpl, true);
 
-        Registry registryImpl = LocateRegistry.createRegistry(PORT);
+        Registry registryImpl = TestLibrary.createRegistryOnEphemeralPort();
+        int port = TestLibrary.getRegistryPort(registryImpl);
+        System.out.println("Registry listening on port " + port);
+
         CSF csf = new CSF();
         Reference<CSF> registryRef = new WeakReference<CSF>(csf);
-        Registry registryStub = LocateRegistry.getRegistry("", PORT, csf);
+        Registry registryStub = LocateRegistry.getRegistry("", port, csf);
         csf = null;
         registryStub.list();
         registryStub = null;
--- a/test/java/util/regex/RegExTest.java	Tue Jul 28 22:48:30 2015 -0700
+++ b/test/java/util/regex/RegExTest.java	Thu Aug 06 12:18:41 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, 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 @@
  * 6358731 6178785 6284152 6231989 6497148 6486934 6233084 6504326 6635133
  * 6350801 6676425 6878475 6919132 6931676 6948903 6990617 7014645 7039066
  * 7067045 7014640 7189363 8007395 8013252 8013254 8012646 8023647 6559590
- * 8027645
+ * 8027645 6854417
  */
 
 import java.util.regex.*;
@@ -3131,15 +3131,26 @@
             // Create a short pattern to search for
             int patternLength = generator.nextInt(7) + 4;
             StringBuffer patternBuffer = new StringBuffer(patternLength);
-            for (int x=0; x<patternLength; x++) {
-                int ch = baseCharacter + generator.nextInt(26);
-                if (Character.isSupplementaryCodePoint(ch)) {
-                    patternBuffer.append(Character.toChars(ch));
-                } else {
-                    patternBuffer.append((char)ch);
+            String pattern;
+            retry: for (;;) {
+                for (int x=0; x<patternLength; x++) {
+                    int ch = baseCharacter + generator.nextInt(26);
+                    if (Character.isSupplementaryCodePoint(ch)) {
+                        patternBuffer.append(Character.toChars(ch));
+                    } else {
+                        patternBuffer.append((char)ch);
+                    }
                 }
+                pattern = patternBuffer.toString();
+
+                // Avoid patterns that start and end with the same substring
+                // See JDK-6854417
+                for (int x=1; x <patternLength; x++) {
+                    if (pattern.startsWith(pattern.substring(x)))
+                        continue retry;
+                }
+                break;
             }
-            String pattern =  patternBuffer.toString();
             Pattern p = Pattern.compile(pattern);
 
             // Create a buffer with random ASCII chars that does