changeset 6433:0357fb004af6

Merge
author lana
date Wed, 26 Jun 2013 11:30:12 -0700
parents db5a29c812ee 8368ea442be1
children b6c2cee3cc16
files
diffstat 8 files changed, 111 insertions(+), 93 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/java/util/jar/pack/Code.java	Fri Jun 21 11:18:59 2013 -0700
+++ b/src/share/classes/com/sun/java/util/jar/pack/Code.java	Wed Jun 26 11:30:12 2013 -0700
@@ -146,7 +146,6 @@
         int verbose = getPackage().verbose;
         if (verbose > 2)
             System.out.println("Reference scan "+this);
-        Class cls = thisClass();
         refs.addAll(Arrays.asList(handler_class));
         if (fixups != null) {
             fixups.visitRefs(refs);
--- a/src/share/classes/com/sun/java/util/jar/pack/ConstantPool.java	Fri Jun 21 11:18:59 2013 -0700
+++ b/src/share/classes/com/sun/java/util/jar/pack/ConstantPool.java	Wed Jun 26 11:30:12 2013 -0700
@@ -670,53 +670,55 @@
         return new String(sig);
     }
 
-    static private int skipClassNameChars(String sig, int i) {
-        int len = sig.length();
-        for (; i < len; i++) {
-            char ch = sig.charAt(i);
-            if (ch <= ' ')  break;
-            if (ch >= ';' && ch <= '@')  break;
-        }
-        return i;
+    static private int skipTo(char semi, String sig, int i) {
+        i = sig.indexOf(semi, i);
+        return (i >= 0) ? i : sig.length();
     }
 
     static String[] structureSignature(String sig) {
-        sig = sig.intern();
-
-        int formLen = 0;
-        int nparts = 1;
-        for (int i = 0; i < sig.length(); i++) {
-            char ch = sig.charAt(i);
-            formLen++;
-            if (ch == 'L') {
-                nparts++;
-                int i2 = skipClassNameChars(sig, i+1);
-                i = i2-1;  // keep the semicolon in the form
-                int i3 = sig.indexOf('<', i+1);
-                if (i3 > 0 && i3 < i2)
-                    i = i3-1;
-            }
-        }
-        char[] form = new char[formLen];
-        if (nparts == 1) {
+        int firstl = sig.indexOf('L');
+        if (firstl < 0) {
             String[] parts = { sig };
             return parts;
         }
-        String[] parts = new String[nparts];
-        int j = 0;
-        int k = 1;
-        for (int i = 0; i < sig.length(); i++) {
-            char ch = sig.charAt(i);
-            form[j++] = ch;
-            if (ch == 'L') {
-                int i2 = skipClassNameChars(sig, i+1);
-                parts[k++] = sig.substring(i+1, i2);
-                i = i2;
-                --i;  // keep the semicolon in the form
+        // Segment the string like sig.split("L\\([^;<]*\\)").
+        // N.B.: Previous version of this code did a more complex match,
+        // to next ch < ' ' or ch in [';'..'@'].  The only important
+        // characters are ';' and '<', since they are part of the
+        // signature syntax.
+        // Examples:
+        //   "(Ljava/lang/Object;IJLLoo;)V" => {"(L;IJL;)V", "java/lang/Object", "Loo"}
+        //   "Ljava/util/List<Ljava/lang/String;>;" => {"L<L;>;", "java/util/List", "java/lang/String"}
+        char[] form = null;
+        String[] parts = null;
+        for (int pass = 0; pass <= 1; pass++) {
+            // pass 0 is a sizing pass, pass 1 packs the arrays
+            int formPtr = 0;
+            int partPtr = 1;
+            int nextsemi = 0, nextangl = 0;  // next ';' or '<', or zero, or sigLen
+            int lastj = 0;
+            for (int i = firstl + 1, j; i > 0; i = sig.indexOf('L', j) + 1) {
+                // sig[i-1] is 'L', while sig[j] will be the first ';' or '<' after it
+                // each part is in sig[i .. j-1]
+                if (nextsemi < i)  nextsemi = skipTo(';', sig, i);
+                if (nextangl < i)  nextangl = skipTo('<', sig, i);
+                j = (nextsemi < nextangl ? nextsemi : nextangl);
+                if (pass != 0) {
+                    sig.getChars(lastj, i, form, formPtr);
+                    parts[partPtr] = sig.substring(i, j);
+                }
+                formPtr += (i - lastj);
+                partPtr += 1;
+                lastj = j;
             }
+            if (pass != 0) {
+                sig.getChars(lastj, sig.length(), form, formPtr);
+                break;
+            }
+            formPtr += (sig.length() - lastj);
+            form = new char[formPtr];
+            parts = new String[partPtr];
         }
-        assert(j == formLen);
-        assert(k == parts.length);
         parts[0] = new String(form);
         //assert(flattenSignature(parts).equals(sig));
         return parts;
--- a/src/solaris/classes/sun/awt/X11/XKeyboardFocusManagerPeer.java	Fri Jun 21 11:18:59 2013 -0700
+++ b/src/solaris/classes/sun/awt/X11/XKeyboardFocusManagerPeer.java	Wed Jun 26 11:30:12 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, 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
@@ -26,9 +26,11 @@
 
 import java.awt.Component;
 import java.awt.Window;
-import sun.util.logging.PlatformLogger;
+
+import sun.awt.AWTAccessor;
 import sun.awt.CausedFocusEvent;
 import sun.awt.KeyboardFocusManagerPeerImpl;
+import sun.util.logging.PlatformLogger;
 
 public class XKeyboardFocusManagerPeer extends KeyboardFocusManagerPeerImpl {
     private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.awt.X11.focus.XKeyboardFocusManagerPeer");
@@ -68,13 +70,13 @@
 
         synchronized(this) {
             if (currentFocusedWindow != null) {
-                from = (XWindowPeer)currentFocusedWindow.getPeer();
+                from = (XWindowPeer)AWTAccessor.getComponentAccessor().getPeer(currentFocusedWindow);
             }
 
             currentFocusedWindow = win;
 
             if (currentFocusedWindow != null) {
-                to = (XWindowPeer)currentFocusedWindow.getPeer();
+                to = (XWindowPeer)AWTAccessor.getComponentAccessor().getPeer(currentFocusedWindow);
             }
         }
 
--- a/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.html	Fri Jun 21 11:18:59 2013 -0700
+++ b/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.html	Wed Jun 26 11:30:12 2013 -0700
@@ -1,6 +1,5 @@
 <html>
-<!--  
-
+<!--
   @test
   @bug 8005932
   @summary Java 7 on mac os x only provides text clipboard formats
@@ -9,10 +8,9 @@
   @library ../../regtesthelpers/process
   @build Util
   @build ProcessResults ProcessCommunicator
+  @run applet/othervm MissedHtmlAndRtfBug.html
+-->
 
-
-  @run applet/othervm MissedHtmlAndRtfBug.html
-*/>
 <head>
     <title>Java 7 on mac os x only provides text clipboard formats</title>
 </head>
--- a/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java	Fri Jun 21 11:18:59 2013 -0700
+++ b/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java	Wed Jun 26 11:30:12 2013 -0700
@@ -22,17 +22,10 @@
  */
 
 /*
-  @test
-  @bug 8005932
-  @summary Java 7 on mac os x only provides text clipboard formats
-  @author mikhail.cherkasov@oracle.com
-  @library ../../regtesthelpers
-  @library ../../regtesthelpers/process
-  @build Util
-  @build ProcessResults ProcessCommunicator
-
-
-  @run applet/othervm MissedHtmlAndRtfBug.html
+  This is a part of MissedHtmlAndRtfBug.html test. Do not add any JTREG tags here
+  bug 8005932
+  summary Java 7 on mac os x only provides text clipboard formats
+  author mikhail.cherkasov@oracle.com
 */
 import java.awt.*;
 import java.awt.datatransfer.DataFlavor;
--- a/test/java/awt/event/KeyEvent/KeyReleasedInAppletTest/KeyReleasedInAppletTest.java	Fri Jun 21 11:18:59 2013 -0700
+++ b/test/java/awt/event/KeyEvent/KeyReleasedInAppletTest/KeyReleasedInAppletTest.java	Wed Jun 26 11:30:12 2013 -0700
@@ -39,13 +39,10 @@
 import java.util.Hashtable;
 
 /*
-@test
-@bug 8010009
-@summary [macosx] Unable type into online word games on MacOSX
-@author petr.pchelko : area=awt.keyboard
-@run clean *
-@run build TestApplet
-@run applet/manual=yesno KeyReleasedInAppletTest.html
+ This is a part of test KeyReleasedInAppletTest.html. Do not add any JTREG tags here
+ bug 8010009
+ summary [macosx] Unable type into online word games on MacOSX
+ author petr.pchelko : area=awt.keyboard
 */
 
 public class KeyReleasedInAppletTest extends JApplet {
--- a/test/java/lang/ThreadGroup/Suspend.java	Fri Jun 21 11:18:59 2013 -0700
+++ b/test/java/lang/ThreadGroup/Suspend.java	Wed Jun 26 11:30:12 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, 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
@@ -23,47 +23,55 @@
 
 /**
  * @test
- * @bug 4176355
+ * @bug 4176355 7181748
  * @summary Suspending a ThreadGroup that contains the current thread has
  *          unpredictable results.
  */
 
 public class Suspend implements Runnable {
-    private static Thread first=null;
-    private static Thread second=null;
-    private static ThreadGroup group = new ThreadGroup("");
-    private static int count = 0;
 
-    Suspend() {
-        Thread thread = new Thread(group, this);
-        if (first == null)
-            first = thread;
-        else
-            second = thread;
-
-        thread.start();
-    }
+    private static volatile int count = 0;
+    private static final ThreadGroup group = new ThreadGroup("");
+    private static final Thread first = new Thread(group, new Suspend());
+    private static final Thread second = new Thread(group, new Suspend());
 
     public void run() {
         while (true) {
             try {
-                Thread.sleep(1000); // Give other thread a chance to start
-                if (Thread.currentThread() == first)
-                    group.suspend();
-                else
+                Thread.sleep(100);
+                if (Thread.currentThread() == first) {
+                    if (second.isAlive()) {
+                        group.suspend();
+                    }
+                } else {
                     count++;
-            } catch(InterruptedException e){
+                }
+            } catch (InterruptedException e) {
             }
         }
     }
 
     public static void main(String[] args) throws Exception {
-        for (int i=0; i<2; i++)
-            new Suspend();
-        Thread.sleep(3000);
+        // Launch two threads as part of the same thread group
+        first.start();
+        second.start();
+
+        // Wait for the thread group suspend to be issued
+        while (!first.isAlive() || !second.isAlive()) {
+            Thread.sleep(100);
+        }
+        Thread.sleep(1000);
+        // Suppose, the thread group is now suspended
+
+        count = 0;
+        Thread.sleep(1000);
+
+        // Increment of the count indicates that the second thread is still running
         boolean failed = (count > 1);
-        first.stop(); second.stop();
-        if (failed)
+        first.stop();
+        second.stop();
+        if (failed) {
             throw new RuntimeException("Failure.");
+        }
     }
 }
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLEngineImpl/SSLEngineDeadlock.java	Fri Jun 21 11:18:59 2013 -0700
+++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLEngineImpl/SSLEngineDeadlock.java	Wed Jun 26 11:30:12 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, 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
@@ -75,6 +75,7 @@
 import java.io.*;
 import java.security.*;
 import java.nio.*;
+import java.lang.management.*;
 
 public class SSLEngineDeadlock {
 
@@ -145,6 +146,8 @@
             }
             SSLEngineDeadlock test = new SSLEngineDeadlock();
             test.runTest();
+
+            detectDeadLock();
         }
         System.out.println("Test Passed.");
     }
@@ -362,6 +365,22 @@
     }
 
     /*
+     * Detect dead lock
+     */
+    private static void detectDeadLock() throws Exception {
+        ThreadMXBean threadBean = ManagementFactory.getThreadMXBean();
+        long[] threadIds = threadBean.findDeadlockedThreads();
+        if (threadIds != null && threadIds.length != 0) {
+            for (long id : threadIds) {
+                ThreadInfo info =
+                    threadBean.getThreadInfo(id, Integer.MAX_VALUE);
+                System.out.println("Deadlocked ThreadInfo: " + info);
+            }
+            throw new Exception("Found Deadlock!");
+        }
+    }
+
+    /*
      * Logging code
      */
     private static boolean resultOnce = true;