Index: /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/com/sun/corba/se/impl/interceptors/ClientRequestInfoImpl.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/com/sun/corba/se/impl/interceptors/ClientRequestInfoImpl.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/com/sun/corba/se/impl/interceptors/ClientRequestInfoImpl.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -216,5 +216,5 @@
     // ClientRequestInfo validity table (see ptc/00-08-06 table 21-1).
     // Note: These must be in the same order as specified in contants.
-    protected static final boolean validCall[][] = {
+    private static final boolean validCall[][] = {
         // LEGEND:
         // s_req = send_request     r_rep = receive_reply
Index: /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/com/sun/corba/se/impl/interceptors/ServerRequestInfoImpl.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/com/sun/corba/se/impl/interceptors/ServerRequestInfoImpl.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/com/sun/corba/se/impl/interceptors/ServerRequestInfoImpl.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -196,5 +196,5 @@
     // ServerRequestInfo validity table (see ptc/00-08-06 table 21-2).
     // Note: These must be in the same order as specified in contants.
-    protected static final boolean validCall[][] = {
+    private static final boolean validCall[][] = {
         // LEGEND:
         // r_rsc = receive_request_service_contexts
Index: /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -131,8 +131,21 @@
                                                   CORBALogDomains.RPC_ENCODING);
 
-    public static Util instance = null;
+    private static Util instance = null;
 
     public Util() {
-        instance = this;
+        setInstance(this);
+    }
+
+    private static void setInstance( Util util ) {
+        assert instance == null : "Instance already defined";
+        instance = util;
+    } 
+
+    public static Util getInstance() {
+        return instance;
+    }
+ 
+    public static boolean isInstanceDefined() {
+        return instance != null;
     }
 
Index: /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase_R.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase_R.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase_R.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -94,5 +94,5 @@
         activeObjectMap.putServant( servant, entry ) ;
 
-        if (Util.instance != null) {
+        if (Util.isInstanceDefined()) {
             POAManagerImpl pm = (POAManagerImpl)poa.the_POAManager() ;
             POAFactory factory = pm.getFactory() ;
@@ -134,5 +134,5 @@
         activeObjectMap.remove(key);
 
-        if (Util.instance != null) {
+        if (Util.isInstanceDefined()) {
             POAManagerImpl pm = (POAManagerImpl)poa.the_POAManager() ;
             POAFactory factory = pm.getFactory() ;
Index: /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/com/sun/corba/se/impl/oa/toa/TOAFactory.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/com/sun/corba/se/impl/oa/toa/TOAFactory.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/com/sun/corba/se/impl/oa/toa/TOAFactory.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -79,6 +79,6 @@
     public void shutdown( boolean waitForCompletion )
     {
-        if (Util.instance != null) {
-            Util.instance.unregisterTargetsForORB(orb);
+        if (Util.isInstanceDefined()) {
+            Util.getInstance().unregisterTargetsForORB(orb);
         }
     }
Index: /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/com/sun/corba/se/impl/orb/ParserTable.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/com/sun/corba/se/impl/orb/ParserTable.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/com/sun/corba/se/impl/orb/ParserTable.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -107,5 +107,7 @@
     public ParserData[] getParserData()
     {
-        return parserData ;
+        ParserData[] parserArray = new ParserData[parserData.length];
+        System.arraycopy(parserData, 0, parserArray, 0, parserData.length);
+        return parserArray;
     }
 
Index: /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryId_1_3.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryId_1_3.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryId_1_3.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -63,5 +63,5 @@
 
     public static final RepositoryIdCache_1_3 cache = new RepositoryIdCache_1_3();
-    public static final byte[] IDL_IDENTIFIER_CHARS = {
+    private static final byte[] IDL_IDENTIFIER_CHARS = {
 
         // 0 1 2 3  4 5 6 7  8 9 a b  c d e f
@@ -181,5 +181,5 @@
     public static final String kRemoteValueRepID = "";
 
-    public static final Hashtable kSpecialArrayTypeStrings = new Hashtable();
+    private static final Hashtable kSpecialArrayTypeStrings = new Hashtable();
 
     static {
@@ -190,5 +190,5 @@
     }
 
-    public static final Hashtable kSpecialCasesRepIDs = new Hashtable();
+    private static final Hashtable kSpecialCasesRepIDs = new Hashtable();
 
     static {
@@ -198,5 +198,5 @@
     }
 
-    public static final Hashtable kSpecialCasesStubValues = new Hashtable();
+    private static final Hashtable kSpecialCasesStubValues = new Hashtable();
 
     static {
@@ -210,5 +210,5 @@
 
 
-    public static final Hashtable kSpecialCasesVersions = new Hashtable();
+    private static final Hashtable kSpecialCasesVersions = new Hashtable();
 
     static {
@@ -221,5 +221,5 @@
     }
 
-    public static final Hashtable kSpecialCasesClasses = new Hashtable();
+    private static final Hashtable kSpecialCasesClasses = new Hashtable();
 
     static {
@@ -233,5 +233,5 @@
     }
 
-    public static final Hashtable kSpecialCasesArrayPrefix = new Hashtable();
+    private static final Hashtable kSpecialCasesArrayPrefix = new Hashtable();
 
     static {
@@ -244,5 +244,5 @@
     }
 
-    public static final Hashtable kSpecialPrimitives = new Hashtable();
+    private static final Hashtable kSpecialPrimitives = new Hashtable();
 
     static {
Index: /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryId_1_3_1.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryId_1_3_1.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryId_1_3_1.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -64,5 +64,5 @@
     // legal use of '.' in a Java name.
 
-    public static final byte[] IDL_IDENTIFIER_CHARS = {
+    private static final byte[] IDL_IDENTIFIER_CHARS = {
 
         // 0 1 2 3  4 5 6 7  8 9 a b  c d e f
@@ -199,5 +199,5 @@
     public static final String kRemoteValueRepID = "";
 
-    public static final Hashtable kSpecialArrayTypeStrings = new Hashtable();
+    private static final Hashtable kSpecialArrayTypeStrings = new Hashtable();
 
     static {
@@ -208,5 +208,5 @@
     }
 
-    public static final Hashtable kSpecialCasesRepIDs = new Hashtable();
+    private static final Hashtable kSpecialCasesRepIDs = new Hashtable();
 
     static {
@@ -216,5 +216,5 @@
     }
 
-    public static final Hashtable kSpecialCasesStubValues = new Hashtable();
+    private static final Hashtable kSpecialCasesStubValues = new Hashtable();
 
     static {
@@ -228,5 +228,5 @@
 
 
-    public static final Hashtable kSpecialCasesVersions = new Hashtable();
+    private static final Hashtable kSpecialCasesVersions = new Hashtable();
 
     static {
@@ -239,5 +239,5 @@
     }
 
-    public static final Hashtable kSpecialCasesClasses = new Hashtable();
+    private static final Hashtable kSpecialCasesClasses = new Hashtable();
 
     static {
@@ -251,5 +251,5 @@
     }
 
-    public static final Hashtable kSpecialCasesArrayPrefix = new Hashtable();
+    private static final Hashtable kSpecialCasesArrayPrefix = new Hashtable();
 
     static {
@@ -262,5 +262,5 @@
     }
 
-    public static final Hashtable kSpecialPrimitives = new Hashtable();
+    private static final Hashtable kSpecialPrimitives = new Hashtable();
 
     static {
Index: /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/com/sun/corba/se/impl/protocol/LocalClientRequestDispatcherBase.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/com/sun/corba/se/impl/protocol/LocalClientRequestDispatcherBase.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/com/sun/corba/se/impl/protocol/LocalClientRequestDispatcherBase.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -53,5 +53,5 @@
     // If isNextIsLocalValid.get() == Boolean.TRUE,
     // the next call to isLocal should be valid
-    protected static ThreadLocal isNextCallValid = new ThreadLocal() {
+    private static final ThreadLocal isNextCallValid = new ThreadLocal() {
             protected synchronized Object initialValue() {
                 return Boolean.TRUE;
Index: /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/com/sun/corba/se/impl/util/RepositoryId.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/com/sun/corba/se/impl/util/RepositoryId.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/com/sun/corba/se/impl/util/RepositoryId.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -58,5 +58,5 @@
     // legal use of '.' in a Java name.
 
-    public static final byte[] IDL_IDENTIFIER_CHARS = {
+    private static final byte[] IDL_IDENTIFIER_CHARS = {
 
         // 0 1 2 3  4 5 6 7  8 9 a b  c d e f
@@ -96,5 +96,5 @@
     private static IdentityHashtable classSeqToRepStr = new IdentityHashtable();
 
-    private static IdentityHashtable repStrToByteArray = new IdentityHashtable();
+    private static final IdentityHashtable repStrToByteArray = new IdentityHashtable();
     private static Hashtable repStrToClass = new Hashtable();
 
@@ -193,5 +193,5 @@
     public static final String kRemoteValueRepID = "";
 
-    public static final Hashtable kSpecialArrayTypeStrings = new Hashtable();
+    private static final Hashtable kSpecialArrayTypeStrings = new Hashtable();
 
     static {
@@ -202,5 +202,5 @@
     }
 
-    public static final Hashtable kSpecialCasesRepIDs = new Hashtable();
+    private static final Hashtable kSpecialCasesRepIDs = new Hashtable();
 
     static {
@@ -210,5 +210,5 @@
     }
 
-    public static final Hashtable kSpecialCasesStubValues = new Hashtable();
+    private static final Hashtable kSpecialCasesStubValues = new Hashtable();
 
     static {
@@ -222,5 +222,5 @@
 
 
-    public static final Hashtable kSpecialCasesVersions = new Hashtable();
+    private static final Hashtable kSpecialCasesVersions = new Hashtable();
 
     static {
@@ -233,5 +233,5 @@
     }
 
-    public static final Hashtable kSpecialCasesClasses = new Hashtable();
+    private static final Hashtable kSpecialCasesClasses = new Hashtable();
 
     static {
@@ -245,5 +245,5 @@
     }
 
-    public static final Hashtable kSpecialCasesArrayPrefix = new Hashtable();
+    private static final Hashtable kSpecialCasesArrayPrefix = new Hashtable();
 
     static {
@@ -256,5 +256,5 @@
     }
 
-    public static final Hashtable kSpecialPrimitives = new Hashtable();
+    private static final Hashtable kSpecialPrimitives = new Hashtable();
 
     static {
Index: /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/com/sun/corba/se/spi/logging/CORBALogDomains.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/com/sun/corba/se/spi/logging/CORBALogDomains.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/com/sun/corba/se/spi/logging/CORBALogDomains.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -59,5 +59,5 @@
 
     // Top level log domain for CORBA
-    public static String TOP_LEVEL_DOMAIN  = "javax.enterprise.resource.corba";
+    public static final String TOP_LEVEL_DOMAIN  = "javax.enterprise.resource.corba";
 
     public static final String RPC              = "rpc" ;
Index: /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/sun/rmi/rmic/iiop/IDLNames.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/sun/rmi/rmic/iiop/IDLNames.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/sun/rmi/rmic/iiop/IDLNames.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -72,4 +72,32 @@
     };
 
+    // Legal IDL Identifier characters (1 = legal). Note
+    // that '.' (2E) is marked as legal even though it is
+    // not legal in IDL. This allows us to treat a fully
+    // qualified Java name with '.' package separators
+    // uniformly, and is safe because that is the only
+    // legal use of '.' in a Java name.
+
+    private static final byte[] IDL_IDENTIFIER_CHARS = {
+
+        // 0 1 2 3  4 5 6 7  8 9 a b  c d e f
+        0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 00-0f
+        0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 10-1f
+        0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,1,0, // 20-2f
+        1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0, // 30-3f
+        0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 40-4f
+        1,1,1,1, 1,1,1,1, 1,1,1,0, 0,0,0,1, // 50-5f
+        0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 60-6f
+        1,1,1,1, 1,1,1,1, 1,1,1,0, 0,0,0,0, // 70-7f
+        0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 80-8f
+        0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 90-9f
+        0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // a0-af
+        0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // b0-bf
+        1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // c0-cf
+        0,1,1,1, 1,1,1,0, 1,1,1,1, 1,0,0,1, // d0-df
+        1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // e0-ef
+        0,1,1,1, 1,1,1,0, 1,1,1,1, 1,0,0,1, // f0-ff
+    };
+
     //_____________________________________________________________________
     // Public Interfaces
@@ -140,5 +168,5 @@
 
         // Now see if we have any remaining illegal characters (see
-        // RepositoryId.IDL_IDENTIFIER_CHARS array)...
+        // IDL_IDENTIFIER_CHARS array)...
 
         int length = result.length();
@@ -149,5 +177,5 @@
             char c = result.charAt(i);
 
-            if (c > 255 || RepositoryId.IDL_IDENTIFIER_CHARS[c] == 0) {
+            if (c > 255 || IDL_IDENTIFIER_CHARS[c] == 0) {
 
                 // We gotta convert. Have we already started?
Index: /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/sun/rmi/rmic/iiop/StubGenerator.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/sun/rmi/rmic/iiop/StubGenerator.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/corba/src/share/classes/sun/rmi/rmic/iiop/StubGenerator.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -426,5 +426,5 @@
 
         p.plnI("public String[] _ids() { ");
-        p.pln("return _type_ids;");
+        p.pln("return (String[]) _type_ids.clone();");
         p.pOln("}");
 
@@ -1861,9 +1861,9 @@
         if(POATie){
         p.plnI("public String[] _all_interfaces(org.omg.PortableServer.POA poa, byte[] objectId){");
-        p.pln("return _type_ids;");
+        p.pln("return (String[]) _type_ids.clone();");
         p.pOln("}");
         } else {
         p.plnI("public String[] _ids() { ");
-        p.pln("return _type_ids;");
+        p.pln("return (String[]) _type_ids.clone();");
         p.pOln("}");
         }
Index: /branches/vendor/oracle/openjdk6/current/hotspot/make/linux/Makefile
===================================================================
--- /branches/vendor/oracle/openjdk6/current/hotspot/make/linux/Makefile	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/hotspot/make/linux/Makefile	(revision 404)
@@ -231,5 +231,5 @@
 # Disable this check by setting DISABLE_HOTSPOT_OS_VERSION_CHECK=ok.
 
-SUPPORTED_OS_VERSION = 2.4% 2.5% 2.6% 2.7%
+SUPPORTED_OS_VERSION = 2.4% 2.5% 2.6% 3%
 OS_VERSION := $(shell uname -r)
 EMPTY_IF_NOT_SUPPORTED = $(filter $(SUPPORTED_OS_VERSION),$(OS_VERSION))
Index: /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/ci/ciField.cpp
===================================================================
--- /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/ci/ciField.cpp	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/ci/ciField.cpp	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -68,5 +68,5 @@
 // ------------------------------------------------------------------
 // ciField::ciField
-ciField::ciField(ciInstanceKlass* klass, int index): _known_to_link_with(NULL) {
+ciField::ciField(ciInstanceKlass* klass, int index): _known_to_link_with_put(NULL), _known_to_link_with_get(NULL) {
   ASSERT_IN_VM;
   CompilerThread *thread = CompilerThread::current();
@@ -144,5 +144,5 @@
 }
 
-ciField::ciField(fieldDescriptor *fd): _known_to_link_with(NULL) {
+ciField::ciField(fieldDescriptor *fd): _known_to_link_with_put(NULL), _known_to_link_with_get(NULL) {
   ASSERT_IN_VM;
 
@@ -313,4 +313,8 @@
                         Bytecodes::Code bc) {
   VM_ENTRY_MARK;
+  assert(bc == Bytecodes::_getstatic || bc == Bytecodes::_putstatic ||
+         bc == Bytecodes::_getfield  || bc == Bytecodes::_putfield,
+         "unexpected bytecode");
+
   if (_offset == -1) {
     // at creation we couldn't link to our holder so we need to
@@ -320,6 +324,20 @@
   }
 
-  if (_known_to_link_with == accessing_klass) {
-    return true;
+  // Check for static/nonstatic mismatch
+  bool is_static = (bc == Bytecodes::_getstatic || bc == Bytecodes::_putstatic);
+  if (is_static != this->is_static()) {
+    return false;
+  }
+
+  // Get and put can have different accessibility rules
+  bool is_put    = (bc == Bytecodes::_putfield  || bc == Bytecodes::_putstatic);
+  if (is_put) {
+    if (_known_to_link_with_put == accessing_klass) {
+      return true;
+    }
+  } else {
+    if (_known_to_link_with_get == accessing_klass) {
+      return true;
+    }
   }
 
@@ -332,6 +350,11 @@
 
   // update the hit-cache, unless there is a problem with memory scoping:
-  if (accessing_klass->is_shared() || !is_shared())
-    _known_to_link_with = accessing_klass;
+  if (accessing_klass->is_shared() || !is_shared()) {
+    if (is_put) {
+      _known_to_link_with_put = accessing_klass;
+    } else {
+      _known_to_link_with_get = accessing_klass;
+    }
+  }
 
   return true;
Index: /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/ci/ciField.hpp
===================================================================
--- /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/ci/ciField.hpp	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/ci/ciField.hpp	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -50,5 +50,6 @@
   int              _offset;
   bool             _is_constant;
-  ciInstanceKlass* _known_to_link_with;
+  ciInstanceKlass* _known_to_link_with_put;
+  ciInstanceKlass* _known_to_link_with_get;
   ciConstant       _constant_value;
 
Index: /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/classfile/altHashing.cpp
===================================================================
--- /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/classfile/altHashing.cpp	(revision 404)
+++ /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/classfile/altHashing.cpp	(revision 404)
@@ -0,0 +1,304 @@
+/*
+ * Copyright (c) 2012, 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.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "classfile/altHashing.hpp"
+#include "classfile/symbolTable.hpp"
+#include "classfile/systemDictionary.hpp"
+#include "oops/markOop.hpp"
+#include "runtime/thread.hpp"
+
+// Get the hash code of the classes mirror if it exists, otherwise just
+// return a random number, which is one of the possible hash code used for
+// objects.  We don't want to call the synchronizer hash code to install
+// this value because it may safepoint.
+intptr_t object_hash(klassOop k) {
+  intptr_t hc = Klass::cast(k)->java_mirror()->mark()->hash();
+  return hc != markOopDesc::no_hash ? hc : os::random();
+}
+
+// Seed value used for each alternative hash calculated.
+jint AltHashing::compute_seed() {
+  jlong nanos = os::javaTimeNanos();
+  jlong now = os::javaTimeMillis();
+  jint SEED_MATERIAL[8] = {
+            (jint) object_hash(SystemDictionary::String_klass()),
+            (jint) object_hash(SystemDictionary::System_klass()),
+            (jint) os::random(),  // current thread isn't a java thread
+            (jint) (((julong)nanos) >> 32),
+            (jint) nanos,
+            (jint) (((julong)now) >> 32),
+            (jint) now,
+            (jint) (os::javaTimeNanos() >> 2)
+  };
+
+  return murmur3_32(SEED_MATERIAL, 8);
+}
+
+
+// Murmur3 hashing for Symbol
+jint AltHashing::murmur3_32(jint seed, const jbyte* data, int len) {
+  jint h1 = seed;
+  int count = len;
+  int offset = 0;
+
+  // body
+  while (count >= 4) {
+    jint k1 = (data[offset] & 0x0FF)
+        | (data[offset + 1] & 0x0FF) << 8
+        | (data[offset + 2] & 0x0FF) << 16
+        | data[offset + 3] << 24;
+
+    count -= 4;
+    offset += 4;
+
+    k1 *= 0xcc9e2d51;
+    k1 = Integer_rotateLeft(k1, 15);
+    k1 *= 0x1b873593;
+
+    h1 ^= k1;
+    h1 = Integer_rotateLeft(h1, 13);
+    h1 = h1 * 5 + 0xe6546b64;
+  }
+
+  // tail
+
+  if (count > 0) {
+    jint k1 = 0;
+
+    switch (count) {
+      case 3:
+        k1 ^= (data[offset + 2] & 0xff) << 16;
+      // fall through
+      case 2:
+        k1 ^= (data[offset + 1] & 0xff) << 8;
+      // fall through
+      case 1:
+        k1 ^= (data[offset] & 0xff);
+      // fall through
+      default:
+        k1 *= 0xcc9e2d51;
+        k1 = Integer_rotateLeft(k1, 15);
+        k1 *= 0x1b873593;
+        h1 ^= k1;
+    }
+  }
+
+  // finalization
+  h1 ^= len;
+
+  // finalization mix force all bits of a hash block to avalanche
+  h1 ^= ((unsigned int)h1) >> 16;
+  h1 *= 0x85ebca6b;
+  h1 ^= ((unsigned int)h1) >> 13;
+  h1 *= 0xc2b2ae35;
+  h1 ^= ((unsigned int)h1) >> 16;
+
+  return h1;
+}
+
+// Murmur3 hashing for Strings
+jint AltHashing::murmur3_32(jint seed, const jchar* data, int len) {
+  jint h1 = seed;
+
+  int off = 0;
+  int count = len;
+
+  // body
+  while (count >= 2) {
+    jchar d1 = data[off++] & 0xFFFF;
+    jchar d2 = data[off++];
+    jint k1 = (d1 | d2 << 16);
+
+    count -= 2;
+
+    k1 *= 0xcc9e2d51;
+    k1 = Integer_rotateLeft(k1, 15);
+    k1 *= 0x1b873593;
+
+    h1 ^= k1;
+    h1 = Integer_rotateLeft(h1, 13);
+    h1 = h1 * 5 + 0xe6546b64;
+  }
+
+  // tail
+
+  if (count > 0) {
+    int k1 = data[off];
+
+    k1 *= 0xcc9e2d51;
+    k1 = Integer_rotateLeft(k1, 15);
+    k1 *= 0x1b873593;
+    h1 ^= k1;
+  }
+
+  // finalization
+  h1 ^= len * 2; // (Character.SIZE / Byte.SIZE);
+
+  // finalization mix force all bits of a hash block to avalanche
+  h1 ^= ((unsigned int)h1) >> 16;
+  h1 *= 0x85ebca6b;
+  h1 ^= ((unsigned int)h1) >> 13;
+  h1 *= 0xc2b2ae35;
+  h1 ^= ((unsigned int)h1) >> 16;
+
+  return h1;
+}
+
+// Hash used for the seed.
+jint AltHashing::murmur3_32(jint seed, const int* data, int len) {
+  jint h1 = seed;
+
+  int off = 0;
+  int end = len;
+
+  // body
+  while (off < end) {
+    jint k1 = data[off++];
+
+    k1 *= 0xcc9e2d51;
+    k1 = Integer_rotateLeft(k1, 15);
+    k1 *= 0x1b873593;
+
+    h1 ^= k1;
+    h1 = Integer_rotateLeft(h1, 13);
+    h1 = h1 * 5 + 0xe6546b64;
+  }
+
+  // tail (always empty, as body is always 32-bit chunks)
+
+  // finalization
+
+  h1 ^= len * 4; // (Integer.SIZE / Byte.SIZE);
+
+  // finalization mix force all bits of a hash block to avalanche
+  h1 ^= ((juint)h1) >> 16;
+  h1 *= 0x85ebca6b;
+  h1 ^= ((juint)h1) >> 13;
+  h1 *= 0xc2b2ae35;
+  h1 ^= ((juint)h1) >> 16;
+
+  return h1;
+}
+
+jint AltHashing::murmur3_32(const int* data, int len) {
+  return murmur3_32(0, data, len);
+}
+
+#ifndef PRODUCT
+// Overloaded versions for internal test.
+jint AltHashing::murmur3_32(const jbyte* data, int len) {
+  return murmur3_32(0, data, len);
+}
+
+jint AltHashing::murmur3_32(const jchar* data, int len) {
+  return murmur3_32(0, data, len);
+}
+
+// Internal test for alternate hashing.  Translated from JDK version
+// test/sun/misc/Hashing.java
+static const jbyte ONE_BYTE[] = { (jbyte) 0x80};
+static const jbyte TWO_BYTE[] = { (jbyte) 0x80, (jbyte) 0x81};
+static const jchar ONE_CHAR[] = { (jchar) 0x8180};
+static const jbyte THREE_BYTE[] = { (jbyte) 0x80, (jbyte) 0x81, (jbyte) 0x82};
+static const jbyte FOUR_BYTE[] = { (jbyte) 0x80, (jbyte) 0x81, (jbyte) 0x82, (jbyte) 0x83};
+static const jchar TWO_CHAR[] = { (jchar) 0x8180, (jchar) 0x8382};
+static const jint ONE_INT[] = { 0x83828180};
+static const jbyte SIX_BYTE[] = { (jbyte) 0x80, (jbyte) 0x81, (jbyte) 0x82, (jbyte) 0x83, (jbyte) 0x84, (jbyte) 0x85};
+static const jchar THREE_CHAR[] = { (jchar) 0x8180, (jchar) 0x8382, (jchar) 0x8584};
+static const jbyte EIGHT_BYTE[] = {
+  (jbyte) 0x80, (jbyte) 0x81, (jbyte) 0x82,
+  (jbyte) 0x83, (jbyte) 0x84, (jbyte) 0x85,
+  (jbyte) 0x86, (jbyte) 0x87};
+static const jchar FOUR_CHAR[] = {
+  (jchar) 0x8180, (jchar) 0x8382,
+  (jchar) 0x8584, (jchar) 0x8786};
+
+static const jint TWO_INT[] = { 0x83828180, 0x87868584};
+
+static const juint MURMUR3_32_X86_CHECK_VALUE = 0xB0F57EE3;
+
+void AltHashing::testMurmur3_32_ByteArray() {
+  // printf("testMurmur3_32_ByteArray\n");
+
+  jbyte* vector = new jbyte[256];
+  jbyte* hashes = new jbyte[4 * 256];
+
+  for (int i = 0; i < 256; i++) {
+    vector[i] = (jbyte) i;
+  }
+
+  // Hash subranges {}, {0}, {0,1}, {0,1,2}, ..., {0,...,255}
+  for (int i = 0; i < 256; i++) {
+    jint hash = murmur3_32(256 - i, vector, i);
+    hashes[i * 4] = (jbyte) hash;
+    hashes[i * 4 + 1] = (jbyte) (((juint)hash) >> 8);
+    hashes[i * 4 + 2] = (jbyte) (((juint)hash) >> 16);
+    hashes[i * 4 + 3] = (jbyte) (((juint)hash) >> 24);
+  }
+
+  // hash to get const result.
+  juint final_hash = murmur3_32(hashes, 4*256);
+
+  assert (MURMUR3_32_X86_CHECK_VALUE == final_hash,
+    err_msg(
+        "Calculated hash result not as expected. Expected %08X got %08X\n",
+        MURMUR3_32_X86_CHECK_VALUE,
+        final_hash));
+}
+
+void AltHashing::testEquivalentHashes() {
+  jint jbytes, jchars, ints;
+
+  // printf("testEquivalentHashes\n");
+
+  jbytes = murmur3_32(TWO_BYTE, 2);
+  jchars = murmur3_32(ONE_CHAR, 1);
+  assert (jbytes == jchars,
+    err_msg("Hashes did not match. b:%08x != c:%08x\n", jbytes, jchars));
+
+  jbytes = murmur3_32(FOUR_BYTE, 4);
+  jchars = murmur3_32(TWO_CHAR, 2);
+  ints = murmur3_32(ONE_INT, 1);
+  assert ((jbytes == jchars) && (jbytes == ints),
+    err_msg("Hashes did not match. b:%08x != c:%08x != i:%08x\n", jbytes, jchars, ints));
+
+  jbytes = murmur3_32(SIX_BYTE, 6);
+  jchars = murmur3_32(THREE_CHAR, 3);
+  assert (jbytes == jchars,
+    err_msg("Hashes did not match. b:%08x != c:%08x\n", jbytes, jchars));
+
+  jbytes = murmur3_32(EIGHT_BYTE, 8);
+  jchars = murmur3_32(FOUR_CHAR, 4);
+  ints = murmur3_32(TWO_INT, 2);
+  assert ((jbytes == jchars) && (jbytes == ints),
+    err_msg("Hashes did not match. b:%08x != c:%08x != i:%08x\n", jbytes, jchars, ints));
+}
+
+// Returns true if the alternate hashcode is correct
+void AltHashing::test_alt_hash() {
+  testMurmur3_32_ByteArray();
+  testEquivalentHashes();
+}
+#endif // PRODUCT
Index: /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/classfile/altHashing.hpp
===================================================================
--- /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/classfile/altHashing.hpp	(revision 404)
+++ /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/classfile/altHashing.hpp	(revision 404)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2012, 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.
+ *
+ */
+
+#ifndef SHARE_VM_CLASSFILE_ALTHASHING_HPP
+#define SHARE_VM_CLASSFILE_ALTHASHING_HPP
+
+#include "prims/jni.h"
+#include "classfile/symbolTable.hpp"
+
+/**
+ * Hashing utilities.
+ *
+ * Implementation of Murmur3 hashing.
+ * This code was translated from src/share/classes/sun/misc/Hashing.java
+ * code in the JDK.
+ */
+
+class AltHashing : AllStatic {
+
+  // utility function copied from java/lang/Integer
+  static jint Integer_rotateLeft(jint i, int distance) {
+    return (i << distance) | (((juint)i) >> (32-distance));
+  }
+  static jint murmur3_32(const int* data, int len);
+  static jint murmur3_32(jint seed, const int* data, int len);
+
+#ifndef PRODUCT
+  // Hashing functions used for internal testing
+  static jint murmur3_32(const jbyte* data, int len);
+  static jint murmur3_32(const jchar* data, int len);
+  static void testMurmur3_32_ByteArray();
+  static void testEquivalentHashes();
+#endif // PRODUCT
+
+ public:
+  static jint compute_seed();
+  static jint murmur3_32(jint seed, const jbyte* data, int len);
+  static jint murmur3_32(jint seed, const jchar* data, int len);
+  NOT_PRODUCT(static void test_alt_hash();)
+};
+#endif // SHARE_VM_CLASSFILE_ALTHASHING_HPP
Index: /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/classfile/javaClasses.cpp
===================================================================
--- /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/classfile/javaClasses.cpp	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/classfile/javaClasses.cpp	(revision 404)
@@ -277,4 +277,26 @@
   }
   return result;
+}
+
+unsigned int java_lang_String::to_hash(oop java_string) {
+  int          length = java_lang_String::length(java_string);
+  // Zero length string will hash to zero with String.toHash() function.
+  if (length == 0) return 0;
+
+  typeArrayOop value  = java_lang_String::value(java_string);
+  int          offset = java_lang_String::offset(java_string);
+  return java_lang_String::to_hash(value->char_at_addr(offset), length);
+}
+
+unsigned int java_lang_String::hash_string(oop java_string) {
+  int          length = java_lang_String::length(java_string);
+  // Zero length string doesn't hash necessarily hash to zero.
+  if (length == 0) {
+    return StringTable::hash_string(NULL, 0);
+  }
+
+  typeArrayOop value  = java_lang_String::value(java_string);
+  int          offset = java_lang_String::offset(java_string);
+  return StringTable::hash_string(value->char_at_addr(offset), length);
 }
 
Index: /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/classfile/javaClasses.hpp
===================================================================
--- /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/classfile/javaClasses.hpp	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/classfile/javaClasses.hpp	(revision 404)
@@ -109,4 +109,28 @@
   static char*  as_platform_dependent_str(Handle java_string, TRAPS);
   static jchar* as_unicode_string(oop java_string, int& length);
+
+  // Compute the hash value for a java.lang.String object which would
+  // contain the characters passed in.
+  //
+  // As the hash value used by the String object itself, in
+  // String.hashCode().  This value is normally calculated in Java code
+  // in the String.hashCode method(), but is precomputed for String
+  // objects in the shared archive file.
+  // hash P(31) from Kernighan & Ritchie
+  //
+  // For this reason, THIS ALGORITHM MUST MATCH String.toHash().
+  template <typename T> static unsigned int to_hash(T* s, int len) {
+    unsigned int h = 0;
+    while (len-- > 0) {
+      h = 31*h + (unsigned int) *s;
+      s++;
+    }
+    return h;
+  }
+  static unsigned int to_hash(oop java_string);
+
+  // This is the string hash code used by the StringTable, which may be
+  // the same as String.toHash or an alternate hash code.
+  static unsigned int hash_string(oop java_string);
 
   static bool equals(oop java_string, jchar* chars, int len);
Index: /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/classfile/symbolTable.cpp
===================================================================
--- /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/classfile/symbolTable.cpp	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/classfile/symbolTable.cpp	(revision 404)
@@ -24,4 +24,5 @@
 
 #include "precompiled.hpp"
+#include "classfile/altHashing.hpp"
 #include "classfile/javaClasses.hpp"
 #include "classfile/symbolTable.hpp"
@@ -35,8 +36,30 @@
 #include "runtime/mutexLocker.hpp"
 #include "utilities/hashtable.inline.hpp"
+#include "utilities/numberSeq.hpp"
 
 // --------------------------------------------------------------------------
 
 SymbolTable* SymbolTable::_the_table = NULL;
+bool SymbolTable::_needs_rehashing = false;
+
+// Create a new table and using alternate hash code, populate the new table
+// with the existing strings.   Set flag to use the alternate hash code afterwards.
+void SymbolTable::rehash_table() {
+
+  assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
+  // This should never happen with -Xshare:dump but it might in testing mode.
+  if (DumpSharedSpaces) return;
+  // Create a new symbol table
+  SymbolTable* new_table = new SymbolTable();
+
+  the_table()->move_to(new_table);
+
+  // Delete the table and buckets (entries are reused in new table).
+  delete _the_table;
+  // Don't check if we need rehashing until the table gets unbalanced again.
+  // Then rehash with a new global seed.
+  _needs_rehashing = false;
+  _the_table = new_table;
+}
 
 // Lookup a symbol in a bucket.
@@ -44,5 +67,7 @@
 symbolOop SymbolTable::lookup(int index, const char* name,
                               int len, unsigned int hash) {
+  int count = 0;
   for (HashtableEntry* e = bucket(index); e != NULL; e = e->next()) {
+    count++;
     if (e->hash() == hash) {
       symbolOop sym = symbolOop(e->literal());
@@ -52,5 +77,16 @@
     }
   }
+  // If the bucket size is too deep check if this hash code is insufficient.
+  if (count >= BasicHashtable::rehash_count && !needs_rehashing()) {
+    _needs_rehashing = check_rehash_table(count);
+  }
   return NULL;
+}
+
+// Pick hashing algorithm.
+unsigned int SymbolTable::hash_symbol(const char* s, int len) {
+  return the_table()->use_alternate_hashcode() ?
+           AltHashing::murmur3_32(the_table()->seed(), (const jbyte*)s, len) :
+           java_lang_String::to_hash(s, len);
 }
 
@@ -72,6 +108,15 @@
   if (s != NULL) return s;
 
+  // We assume that lookup() has been called already, that it failed,
+  // and symbol was not found.  We create the symbol here.
+  symbolKlass* sk  = (symbolKlass*) Universe::symbolKlassObj()->klass_part();
+  symbolOop s_oop = sk->allocate_symbol((u1*)name, len, CHECK_NULL);
+  symbolHandle sym (THREAD, s_oop);
+
+  // Allocation must be done before grabbing the SymbolTable_lock lock
+  MutexLocker ml(SymbolTable_lock, THREAD);
+
   // Otherwise, add to symbol to table
-  return the_table()->basic_add(index, (u1*)name, len, hashValue, CHECK_NULL);
+  return the_table()->basic_add(sym, index, (u1*)name, len, hashValue, CHECK_NULL);
 }
 
@@ -109,5 +154,14 @@
   // ResourceMark.
 
-  return the_table()->basic_add(index, (u1*)buffer, len, hashValue, CHECK_NULL);
+  // We assume that lookup() has been called already, that it failed,
+  // and symbol was not found.  We create the symbol here.
+  symbolKlass* sk  = (symbolKlass*) Universe::symbolKlassObj()->klass_part();
+  symbolOop s_oop = sk->allocate_symbol((u1*)buffer, len, CHECK_NULL);
+  symbolHandle newsym (THREAD, s_oop);
+
+  // Allocation must be done before grabbing the SymbolTable_lock lock
+  MutexLocker ml(SymbolTable_lock, THREAD);
+
+  return the_table()->basic_add(newsym, index, (u1*)buffer, len, hashValue, CHECK_NULL);
 }
 
@@ -157,33 +211,65 @@
                       const char** names, int* lengths, int* cp_indices,
                       unsigned int* hashValues, TRAPS) {
-  SymbolTable* table = the_table();
-  bool added = table->basic_add(cp, names_count, names, lengths,
-                                cp_indices, hashValues, CHECK);
-  if (!added) {
+
+  symbolKlass* sk  = (symbolKlass*) Universe::symbolKlassObj()->klass_part();
+  symbolOop sym_oops[symbol_alloc_batch_size];
+  bool allocated = sk->allocate_symbols(names_count, names, lengths,
+                                        sym_oops, CHECK);
+  if (!allocated) {
     // do it the hard way
     for (int i=0; i<names_count; i++) {
+      assert(!Universe::heap()->is_in_reserved(names[i]) || GC_locker::is_active(),
+         "proposed name of symbol must be stable");
+
+      // We assume that lookup() has been called already, that it failed,
+      // and symbol was not found.  We create the symbol here.
+      symbolKlass* sk  = (symbolKlass*) Universe::symbolKlassObj()->klass_part();
+      symbolOop s_oop = sk->allocate_symbol((u1*)names[i], lengths[i], CHECK);
+      symbolHandle sym (THREAD, s_oop);
+
+      // Allocation must be done before grabbing the SymbolTable_lock lock
+      MutexLocker ml(SymbolTable_lock, THREAD);
+
+      SymbolTable* table = the_table();
       int index = table->hash_to_index(hashValues[i]);
-      symbolOop sym = table->basic_add(index, (u1*)names[i], lengths[i],
+      symbolOop s = table->basic_add(sym, index, (u1*)names[i], lengths[i],
                                        hashValues[i], CHECK);
-      cp->symbol_at_put(cp_indices[i], sym);
-    }
-  }
-}
-
-symbolOop SymbolTable::basic_add(int index, u1 *name, int len,
-                                 unsigned int hashValue, TRAPS) {
-  assert(!Universe::heap()->is_in_reserved(name) || GC_locker::is_active(),
-         "proposed name of symbol must be stable");
-
-  // We assume that lookup() has been called already, that it failed,
-  // and symbol was not found.  We create the symbol here.
-  symbolKlass* sk  = (symbolKlass*) Universe::symbolKlassObj()->klass_part();
-  symbolOop s_oop = sk->allocate_symbol(name, len, CHECK_NULL);
-  symbolHandle sym (THREAD, s_oop);
-
-  // Allocation must be done before grapping the SymbolTable_lock lock
+      cp->symbol_at_put(cp_indices[i], s);
+    }
+    return;
+  }
+
+  symbolHandle syms[symbol_alloc_batch_size];
+  for (int i=0; i<names_count; i++) {
+    syms[i] = symbolHandle(THREAD, sym_oops[i]);
+  }
+
+  // Allocation must be done before grabbing the SymbolTable_lock lock
   MutexLocker ml(SymbolTable_lock, THREAD);
 
+  SymbolTable* table = the_table();
+  bool added = table->basic_add(syms, cp, names_count, names, lengths,
+                                cp_indices, hashValues, CHECK);
+  assert(added, "should always return true");
+}
+
+symbolOop SymbolTable::basic_add(symbolHandle sym, int index_arg, u1 *name, int len,
+                                 unsigned int hashValue_arg, TRAPS) {
+  // Cannot hit a safepoint in this function because the "this" pointer can move.
+  No_Safepoint_Verifier nsv;
+
   assert(sym->equals((char*)name, len), "symbol must be properly initialized");
+
+  // Check if the symbol table has been rehashed, if so, need to recalculate
+  // the hash value and index.
+  unsigned int hashValue;
+  int index;
+  if (use_alternate_hashcode()) {
+    hashValue = hash_symbol((const char*)name, len);
+    index = hash_to_index(hashValue);
+  } else {
+    hashValue = hashValue_arg;
+    index = index_arg;
+  }
 
   // Since look-up was done lock-free, we need to check if another
@@ -202,30 +288,26 @@
 }
 
-bool SymbolTable::basic_add(constantPoolHandle cp, int names_count,
+bool SymbolTable::basic_add(symbolHandle* syms,
+                            constantPoolHandle cp, int names_count,
                             const char** names, int* lengths,
                             int* cp_indices, unsigned int* hashValues,
                             TRAPS) {
-  symbolKlass* sk  = (symbolKlass*) Universe::symbolKlassObj()->klass_part();
-  symbolOop sym_oops[symbol_alloc_batch_size];
-  bool allocated = sk->allocate_symbols(names_count, names, lengths,
-                                        sym_oops, CHECK_false);
-  if (!allocated) {
-    return false;
-  }
-  symbolHandle syms[symbol_alloc_batch_size];
-  int i;
-  for (i=0; i<names_count; i++) {
-    syms[i] = symbolHandle(THREAD, sym_oops[i]);
-  }
-
-  // Allocation must be done before grabbing the SymbolTable_lock lock
-  MutexLocker ml(SymbolTable_lock, THREAD);
-
-  for (i=0; i<names_count; i++) {
+  // Cannot hit a safepoint in this function because the "this" pointer can move.
+  No_Safepoint_Verifier nsv;
+
+  for (int i=0; i<names_count; i++) {
     assert(syms[i]->equals(names[i], lengths[i]), "symbol must be properly initialized");
+    // Check if the symbol table has been rehashed, if so, need to recalculate
+    // the hash value.
+    unsigned int hashValue;
+    if (use_alternate_hashcode()) {
+      hashValue = hash_symbol(names[i], lengths[i]);
+    } else {
+      hashValue = hashValues[i];
+    }
     // Since look-up was done lock-free, we need to check if another
     // thread beat us in the race to insert the symbol.
-    int index = hash_to_index(hashValues[i]);
-    symbolOop test = lookup(index, names[i], lengths[i], hashValues[i]);
+    int index = hash_to_index(hashValue);
+    symbolOop test = lookup(index, names[i], lengths[i], hashValue);
     if (test != NULL) {
       // A race occurred and another thread introduced the symbol, this one
@@ -234,13 +316,11 @@
     } else {
       symbolOop sym = syms[i]();
-      HashtableEntry* entry = new_entry(hashValues[i], sym);
+      HashtableEntry* entry = new_entry(hashValue, sym);
       add_entry(index, entry);
       cp->symbol_at_put(cp_indices[i], sym);
     }
   }
-
-  return true;
-}
-
+  return true;  // always returns true
+}
 
 void SymbolTable::verify() {
@@ -252,5 +332,5 @@
       s->verify();
       guarantee(s->is_perm(), "symbol not in permspace");
-      unsigned int h = hash_symbol((char*)s->bytes(), s->utf8_length());
+      unsigned int h = hash_symbol((const char*)s->bytes(), s->utf8_length());
       guarantee(p->hash() == h, "broken hash in symbol table entry");
       guarantee(the_table()->hash_to_index(h) == i,
@@ -260,4 +340,21 @@
 }
 
+void SymbolTable::dump(outputStream* st) {
+  NumberSeq summary;
+  for (int i = 0; i < the_table()->table_size(); ++i) {
+    int count = 0;
+    for (HashtableEntry* e = the_table()->bucket(i);
+       e != NULL; e = e->next()) {
+      count++;
+    }
+    summary.add((double)count);
+  }
+  st->print_cr("SymbolTable statistics:");
+  st->print_cr("Number of buckets       : %7d", summary.num());
+  st->print_cr("Average bucket size     : %7.0f", summary.avg());
+  st->print_cr("Variance of bucket size : %7.0f", summary.variance());
+  st->print_cr("Std. dev. of bucket size: %7.0f", summary.sd());
+  st->print_cr("Maximum bucket size     : %7.0f", summary.maximum());
+}
 
 //---------------------------------------------------------------------------
@@ -322,5 +419,4 @@
                     results_length, out_of_range);
 }
-
 #endif // PRODUCT
 
@@ -368,34 +464,19 @@
 
 
-// Compute the hash value for a java.lang.String object which would
-// contain the characters passed in. This hash value is used for at
-// least two purposes.
-//
-// (a) As the hash value used by the StringTable for bucket selection
-//     and comparison (stored in the HashtableEntry structures).  This
-//     is used in the String.intern() method.
-//
-// (b) As the hash value used by the String object itself, in
-//     String.hashCode().  This value is normally calculate in Java code
-//     in the String.hashCode method(), but is precomputed for String
-//     objects in the shared archive file.
-//
-//     For this reason, THIS ALGORITHM MUST MATCH String.hashCode().
-
-int StringTable::hash_string(jchar* s, int len) {
-  unsigned h = 0;
-  while (len-- > 0) {
-    h = 31*h + (unsigned) *s;
-    s++;
-  }
-  return h;
-}
-
-
 StringTable* StringTable::_the_table = NULL;
+
+bool StringTable::_needs_rehashing = false;
+
+// Pick hashing algorithm
+unsigned int StringTable::hash_string(const jchar* s, int len) {
+  return the_table()->use_alternate_hashcode() ? AltHashing::murmur3_32(the_table()->seed(), s, len) :
+                                    java_lang_String::to_hash(s, len);
+}
 
 oop StringTable::lookup(int index, jchar* name,
                         int len, unsigned int hash) {
+  int count = 0;
   for (HashtableEntry* l = bucket(index); l != NULL; l = l->next()) {
+    count++;
     if (l->hash() == hash) {
       if (java_lang_String::equals(l->literal(), name, len)) {
@@ -404,27 +485,32 @@
     }
   }
+  // If the bucket size is too deep check if this hash code is insufficient.
+  if (count >= BasicHashtable::rehash_count && !needs_rehashing()) {
+    _needs_rehashing = check_rehash_table(count);
+  }
   return NULL;
 }
 
 
-oop StringTable::basic_add(int index, Handle string_or_null, jchar* name,
-                           int len, unsigned int hashValue, TRAPS) {
-  debug_only(StableMemoryChecker smc(name, len * sizeof(name[0])));
-  assert(!Universe::heap()->is_in_reserved(name) || GC_locker::is_active(),
-         "proposed name of symbol must be stable");
-
-  Handle string;
-  // try to reuse the string if possible
-  if (!string_or_null.is_null() && string_or_null()->is_perm()) {
-    string = string_or_null;
-  } else {
-    string = java_lang_String::create_tenured_from_unicode(name, len, CHECK_NULL);
-  }
-
-  // Allocation must be done before grapping the SymbolTable_lock lock
-  MutexLocker ml(StringTable_lock, THREAD);
+oop StringTable::basic_add(int index_arg, Handle string, jchar* name,
+                           int len, unsigned int hashValue_arg, TRAPS) {
+
+  // Cannot hit a safepoint in this function because the "this" pointer can move.
+  No_Safepoint_Verifier nsv;
 
   assert(java_lang_String::equals(string(), name, len),
          "string must be properly initialized");
+
+  // Check if the symbol table has been rehashed, if so, need to recalculate
+  // the hash value and index before second lookup.
+  unsigned int hashValue;
+  int index;
+  if (use_alternate_hashcode()) {
+    hashValue = hash_string(name, len);
+    index = hash_to_index(hashValue);
+  } else {
+    hashValue = hashValue_arg;
+    index = index_arg;
+  }
 
   // Since look-up was done lock-free, we need to check if another
@@ -457,11 +543,26 @@
   unsigned int hashValue = hash_string(name, len);
   int index = the_table()->hash_to_index(hashValue);
-  oop string = the_table()->lookup(index, name, len, hashValue);
+  oop found_string = the_table()->lookup(index, name, len, hashValue);
 
   // Found
-  if (string != NULL) return string;
+  if (found_string != NULL) return found_string;
+
+  debug_only(StableMemoryChecker smc(name, len * sizeof(name[0])));
+  assert(!Universe::heap()->is_in_reserved(name) || GC_locker::is_active(),
+         "proposed name of symbol must be stable");
+
+  Handle string;
+  // try to reuse the string if possible
+  if (!string_or_null.is_null() && string_or_null()->is_perm()) {
+    string = string_or_null;
+  } else {
+    string = java_lang_String::create_tenured_from_unicode(name, len, CHECK_NULL);
+  }
+
+  // Allocation must be done before grabbing the StringTable_lock lock
+  MutexLocker ml(StringTable_lock, THREAD);
 
   // Otherwise, add to symbol to table
-  return the_table()->basic_add(index, string_or_null, name, len,
+  return the_table()->basic_add(index, string, name, len,
                                 hashValue, CHECK_NULL);
 }
@@ -518,2 +619,40 @@
   }
 }
+
+void StringTable::dump(outputStream* st) {
+  NumberSeq summary;
+  for (int i = 0; i < the_table()->table_size(); ++i) {
+    HashtableEntry* p = the_table()->bucket(i);
+    int count = 0;
+    for ( ; p != NULL; p = p->next()) {
+      count++;
+    }
+    summary.add((double)count);
+  }
+  st->print_cr("StringTable statistics:");
+  st->print_cr("Number of buckets       : %7d", summary.num());
+  st->print_cr("Average bucket size     : %7.0f", summary.avg());
+  st->print_cr("Variance of bucket size : %7.0f", summary.variance());
+  st->print_cr("Std. dev. of bucket size: %7.0f", summary.sd());
+  st->print_cr("Maximum bucket size     : %7.0f", summary.maximum());
+}
+
+
+// Create a new table and using alternate hash code, populate the new table
+// with the existing strings.   Set flag to use the alternate hash code afterwards.
+void StringTable::rehash_table() {
+  assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
+  // This should never happen with -Xshare:dump but it might in testing mode.
+  if (DumpSharedSpaces) return;
+  StringTable* new_table = new StringTable();
+
+  // Rehash the table
+  the_table()->move_to(new_table);
+
+  // Delete the table and buckets (entries are reused in new table).
+  delete _the_table;
+  // Don't check if we need rehashing until the table gets unbalanced again.
+  // Then rehash with a new global seed.
+  _needs_rehashing = false;
+  _the_table = new_table;
+}
Index: /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/classfile/symbolTable.hpp
===================================================================
--- /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/classfile/symbolTable.hpp	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/classfile/symbolTable.hpp	(revision 404)
@@ -41,4 +41,5 @@
 
 class BoolObjectClosure;
+class outputStream;
 
 
@@ -50,8 +51,11 @@
   static SymbolTable* _the_table;
 
+  // Set if one bucket is out of balance due to hash algorithm deficiency
+  static bool _needs_rehashing;
+
   // Adding elements
-  symbolOop basic_add(int index, u1* name, int len,
+  symbolOop basic_add(symbolHandle sym, int index, u1* name, int len,
                       unsigned int hashValue, TRAPS);
-  bool basic_add(constantPoolHandle cp, int names_count,
+  bool basic_add(symbolHandle* syms, constantPoolHandle cp, int names_count,
                  const char** names, int* lengths, int* cp_indices,
                  unsigned int* hashValues, TRAPS);
@@ -62,4 +66,6 @@
   };
 
+  static unsigned int hash_symbol(const char* s, int len);
+
   symbolOop lookup(int index, const char* name, int len, unsigned int hash);
 
@@ -70,5 +76,4 @@
     : Hashtable(symbol_table_size, sizeof (HashtableEntry), t,
                 number_of_entries) {}
-
 
 public:
@@ -138,4 +143,5 @@
   // Debugging
   static void verify();
+  static void dump(outputStream* st);
 
   // Sharing
@@ -149,4 +155,8 @@
     ((Hashtable*)the_table())->reverse(boundary);
   }
+
+  // Rehash the symbol table if it gets out of balance
+  static void rehash_table();
+  static bool needs_rehashing()         { return _needs_rehashing; }
 };
 
@@ -159,6 +169,9 @@
   static StringTable* _the_table;
 
+  // Set if one bucket is out of balance due to hash algorithm deficiency
+  static bool _needs_rehashing;
+
   static oop intern(Handle string_or_null, jchar* chars, int length, TRAPS);
-  oop basic_add(int index, Handle string_or_null, jchar* name, int len,
+  oop basic_add(int index, Handle string, jchar* name, int len,
                 unsigned int hashValue, TRAPS);
 
@@ -193,8 +206,4 @@
   }
 
-
-  static int hash_string(jchar* s, int len);
-
-
   // GC support
   //   Delete pointers to otherwise-unreachable objects.
@@ -208,4 +217,12 @@
   }
 
+  // Hashing algorithm, used as the hash value used by the
+  //     StringTable for bucket selection and comparison (stored in the
+  //     HashtableEntry structures).  This is used in the String.intern() method.
+  static unsigned int hash_string(const jchar* s, int len);
+
+  // Internal test.
+  static void test_alt_hash() PRODUCT_RETURN;
+
   // Probing
   static oop lookup(symbolOop symbol);
@@ -218,4 +235,5 @@
   // Debugging
   static void verify();
+  static void dump(outputStream* st);
 
   // Sharing
@@ -229,5 +247,8 @@
     ((BasicHashtable*)the_table())->reverse();
   }
+
+  // Rehash the symbol table if it gets out of balance
+  static void rehash_table();
+  static bool needs_rehashing() { return _needs_rehashing; }
 };
-
 #endif // SHARE_VM_CLASSFILE_SYMBOLTABLE_HPP
Index: /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/classfile/verifier.cpp
===================================================================
--- /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/classfile/verifier.cpp	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/classfile/verifier.cpp	(revision 404)
@@ -1872,8 +1872,8 @@
     VerificationType::reference_check(), CHECK_VERIFY(this));
   if (type == VerificationType::uninitialized_this_type()) {
-    // The method must be an <init> method of either this class, or one of its
-    // superclasses
+    // The method must be an <init> method of this class or its superclass
+    klassOop superk = current_class()->super();
     if (ref_class_type.name() != current_class()->name() &&
-        !name_in_supers(ref_class_type.name(), current_class())) {
+        ref_class_type.name() != superk->klass_part()->name()) {
       verify_error(bci, "Bad <init> method call");
       return;
Index: /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/compiler/compilerOracle.cpp
===================================================================
--- /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/compiler/compilerOracle.cpp	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/compiler/compilerOracle.cpp	(revision 404)
@@ -552,11 +552,20 @@
 
 static const char* cc_file() {
-  if (CompileCommandFile == NULL)
+#ifdef ASSERT
+  if (CompileCommandFile == NULL) {
     return ".hotspot_compiler";
+  }
+#endif
   return CompileCommandFile;
 }
+
+bool CompilerOracle::has_command_file() {
+  return cc_file() != NULL;
+}
+
 bool CompilerOracle::_quiet = false;
 
 void CompilerOracle::parse_from_file() {
+  assert(has_command_file(), "command file must be specified");
   FILE* stream = fopen(cc_file(), "rt");
   if (stream == NULL) return;
@@ -565,5 +574,5 @@
   int  pos = 0;
   int  c = getc(stream);
-  while(c != EOF) {
+  while(c != EOF && pos < (int)(sizeof(token)-1)) {
     if (c == '\n') {
       token[pos++] = '\0';
@@ -586,5 +595,5 @@
   const char* sp = str;
   int  c = *sp++;
-  while (c != '\0') {
+  while (c != '\0' && pos < (int)(sizeof(token)-1)) {
     if (c == '\n') {
       token[pos++] = '\0';
@@ -601,4 +610,5 @@
 
 void CompilerOracle::append_comment_to_file(const char* message) {
+  assert(has_command_file(), "command file must be specified");
   fileStream stream(fopen(cc_file(), "at"));
   stream.print("# ");
@@ -611,4 +621,5 @@
 
 void CompilerOracle::append_exclude_to_file(methodHandle method) {
+  assert(has_command_file(), "command file must be specified");
   fileStream stream(fopen(cc_file(), "at"));
   stream.print("exclude ");
@@ -625,5 +636,7 @@
   CompilerOracle::parse_from_string(CompileCommand, CompilerOracle::parse_from_line);
   CompilerOracle::parse_from_string(CompileOnly, CompilerOracle::parse_compile_only);
-  CompilerOracle::parse_from_file();
+  if (CompilerOracle::has_command_file()) {
+    CompilerOracle::parse_from_file();
+  }
   if (lists[PrintCommand] != NULL) {
     if (PrintAssembly) {
Index: /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/compiler/compilerOracle.hpp
===================================================================
--- /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/compiler/compilerOracle.hpp	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/compiler/compilerOracle.hpp	(revision 404)
@@ -39,4 +39,8 @@
 
  public:
+
+  // True if the command file has been specified or is implicit
+  static bool has_command_file();
+
   // Reads from file and adds to lists
   static void parse_from_file();
Index: /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/memory/dump.cpp
===================================================================
--- /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/memory/dump.cpp	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/memory/dump.cpp	(revision 404)
@@ -63,6 +63,6 @@
 // the hash can be shared.
 //
-// NOTE THAT the algorithm in StringTable::hash_string() MUST MATCH the
-// algorithm in java.lang.String.hashCode().
+// NOTE THAT we have to call java_lang_String::to_hash() to match the
+// algorithm in java.lang.String.toHash().
 
 class StringHashCodeClosure: public OopClosure {
@@ -89,5 +89,5 @@
           int offset = java_lang_String::offset(obj);
           jchar* s = value->char_at_addr(offset);
-          hash = StringTable::hash_string(s, length);
+          hash = java_lang_String::to_hash(s, length);
         }
         obj->int_field_put(hash_offset, hash);
Index: /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/opto/addnode.cpp
===================================================================
--- /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/opto/addnode.cpp	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/opto/addnode.cpp	(revision 404)
@@ -34,6 +34,4 @@
 
 // Portions of code courtesy of Clifford Click
-
-#define MAXFLOAT        ((float)3.40282346638528860e+38)
 
 // Classic Add functionality.  This covers all the usual 'add' behaviors for
Index: /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/opto/loopTransform.cpp
===================================================================
--- /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/opto/loopTransform.cpp	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/opto/loopTransform.cpp	(revision 404)
@@ -2722,4 +2722,6 @@
   _igvn.register_new_node_with_optimizer(result_mem);
 
+/* Disable following optimization until proper fix (add missing checks).
+
   // If this fill is tightly coupled to an allocation and overwrites
   // the whole body, allow it to take over the zeroing.
@@ -2745,4 +2747,5 @@
     }
   }
+*/
 
   // Redirect the old control and memory edges that are outside the loop.
Index: /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/opto/loopnode.cpp
===================================================================
--- /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/opto/loopnode.cpp	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/opto/loopnode.cpp	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -547,5 +547,5 @@
                       Node* expr, Node** trunc1, Node** trunc2, const TypeInt** trunc_type) {
   // Quick cutouts:
-  if (expr == NULL || expr->req() != 3)  return false;
+  if (expr == NULL || expr->req() != 3)  return NULL;
 
   Node *t1 = NULL;
Index: /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/opto/runtime.cpp
===================================================================
--- /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/opto/runtime.cpp	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/opto/runtime.cpp	(revision 404)
@@ -805,5 +805,6 @@
       tty->print_cr("# Method where it happened %s.%s ", Klass::cast(method->method_holder())->name()->as_C_string(), method->name()->as_C_string());
       tty->print_cr("#");
-      if (ShowMessageBoxOnError && UpdateHotSpotCompilerFileOnError) {
+      if (ShowMessageBoxOnError && UpdateHotSpotCompilerFileOnError &&
+          CompilerOracle::has_command_file()) {
         const char* title    = "HotSpot Runtime Error";
         const char* question = "Do you want to exclude compilation of this method in future runs?";
Index: /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/prims/jniCheck.cpp
===================================================================
--- /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/prims/jniCheck.cpp	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/prims/jniCheck.cpp	(revision 404)
@@ -102,5 +102,5 @@
       NativeReportJNIFatalError(thr, warn_wrong_jnienv);                 \
     }                                                                    \
-    __ENTRY(result_type, header, thr)
+    VM_ENTRY_BASE(result_type, header, thr)
 
 
Index: /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/prims/jvmtiEnter.xsl
===================================================================
--- /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/prims/jvmtiEnter.xsl	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/prims/jvmtiEnter.xsl	(revision 404)
@@ -427,5 +427,5 @@
     <xsl:text>ThreadInVMfromNative __tiv(current_thread);</xsl:text>
     <xsl:value-of select="$space"/>
-    <xsl:text>__ENTRY(jvmtiError, </xsl:text>
+    <xsl:text>VM_ENTRY_BASE(jvmtiError, </xsl:text>
     <xsl:apply-templates select="." mode="functionid"/>
     <xsl:text> , current_thread)</xsl:text>
Index: /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/prims/jvmtiEnv.cpp
===================================================================
--- /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/prims/jvmtiEnv.cpp	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/prims/jvmtiEnv.cpp	(revision 404)
@@ -171,5 +171,5 @@
 
     ThreadInVMfromNative __tiv(current_thread);
-    __ENTRY(jvmtiError, JvmtiEnv::GetThreadLocalStorage , current_thread)
+    VM_ENTRY_BASE(jvmtiError, JvmtiEnv::GetThreadLocalStorage , current_thread)
     debug_only(VMNativeEntryWrapper __vew;)
 
Index: /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/prims/jvmtiExport.cpp
===================================================================
--- /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/prims/jvmtiExport.cpp	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/prims/jvmtiExport.cpp	(revision 404)
@@ -374,5 +374,5 @@
     // transition code: native to VM
     ThreadInVMfromNative __tiv(current_thread);
-    __ENTRY(jvmtiEnv*, JvmtiExport::get_jvmti_interface, current_thread)
+    VM_ENTRY_BASE(jvmtiEnv*, JvmtiExport::get_jvmti_interface, current_thread)
     debug_only(VMNativeEntryWrapper __vew;)
 
Index: /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/runtime/arguments.cpp
===================================================================
--- /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/runtime/arguments.cpp	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/runtime/arguments.cpp	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -843,5 +843,5 @@
 
   int c = getc(stream);
-  while(c != EOF) {
+  while(c != EOF && pos < (int)(sizeof(token)-1)) {
     if (in_white_space) {
       if (in_comment) {
@@ -2957,4 +2957,5 @@
   }
 
+#ifdef ASSERT
   // Parse default .hotspotrc settings file
   if (!settings_file_specified) {
@@ -2963,4 +2964,5 @@
     }
   }
+#endif
 
   if (PrintVMOptions) {
Index: /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/runtime/globals.hpp
===================================================================
--- /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/runtime/globals.hpp	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/runtime/globals.hpp	(revision 404)
@@ -2512,4 +2512,7 @@
           "use heavyweight instead of lightweight Java monitors")           \
                                                                             \
+  product(bool, PrintStringTableStatistics, false,                          \
+          "print statistics about the StringTable and SymbolTable")         \
+                                                                            \
   notproduct(bool, PrintSymbolTableSizeHistogram, false,                    \
           "print histogram of the symbol table")                            \
Index: /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/runtime/init.cpp
===================================================================
--- /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/runtime/init.cpp	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/runtime/init.cpp	(revision 404)
@@ -24,4 +24,5 @@
 
 #include "precompiled.hpp"
+#include "classfile/symbolTable.hpp"
 #include "code/icBuffer.hpp"
 #include "gc_interface/collectedHeap.hpp"
@@ -154,4 +155,8 @@
       SafepointSynchronize::print_stat_on_exit();
     }
+    if (PrintStringTableStatistics) {
+      SymbolTable::dump(tty);
+      StringTable::dump(tty);
+    }
     ostream_exit();
   }
Index: /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/runtime/interfaceSupport.hpp
===================================================================
--- /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/runtime/interfaceSupport.hpp	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/runtime/interfaceSupport.hpp	(revision 404)
@@ -70,7 +70,7 @@
 };
 
-// InterfaceSupport provides functionality used by the __LEAF and __ENTRY
-// macros. These macros are used to guard entry points into the VM and
-// perform checks upon leave of the VM.
+// InterfaceSupport provides functionality used by the VM_LEAF_BASE and
+// VM_ENTRY_BASE macros. These macros are used to guard entry points into
+// the VM and perform checks upon leave of the VM.
 
 
@@ -424,5 +424,5 @@
 // LEAF routines do not lock, GC or throw exceptions
 
-#define __LEAF(result_type, header)                                  \
+#define VM_LEAF_BASE(result_type, header)                            \
   TRACE_CALL(result_type, header)                                    \
   debug_only(NoHandleMark __hm;)                                     \
@@ -432,5 +432,5 @@
 // ENTRY routines may lock, GC and throw exceptions
 
-#define __ENTRY(result_type, header, thread)                         \
+#define VM_ENTRY_BASE(result_type, header, thread)                   \
   TRACE_CALL(result_type, header)                                    \
   HandleMarkCleaner __hm(thread);                                    \
@@ -441,5 +441,5 @@
 // QUICK_ENTRY routines behave like ENTRY but without a handle mark
 
-#define __QUICK_ENTRY(result_type, header, thread)                   \
+#define VM_QUICK_ENTRY_BASE(result_type, header, thread)             \
   TRACE_CALL(result_type, header)                                    \
   debug_only(NoHandleMark __hm;)                                     \
@@ -454,5 +454,5 @@
   result_type header {                                               \
     ThreadInVMfromJava __tiv(thread);                                \
-    __ENTRY(result_type, header, thread)                             \
+    VM_ENTRY_BASE(result_type, header, thread)                       \
     debug_only(VMEntryWrapper __vew;)
 
@@ -460,5 +460,5 @@
 #define IRT_LEAF(result_type, header)                                \
   result_type header {                                               \
-    __LEAF(result_type, header)                                      \
+    VM_LEAF_BASE(result_type, header)                                \
     debug_only(No_Safepoint_Verifier __nspv(true);)
 
@@ -467,5 +467,5 @@
   result_type header {                                               \
     ThreadInVMfromJavaNoAsyncException __tiv(thread);                \
-    __ENTRY(result_type, header, thread)                             \
+    VM_ENTRY_BASE(result_type, header, thread)                       \
     debug_only(VMEntryWrapper __vew;)
 
@@ -478,5 +478,5 @@
     nmethodLocker _nmlock(nm);                                       \
     ThreadInVMfromJavaNoAsyncException __tiv(thread);                                \
-    __ENTRY(result_type, header, thread)
+    VM_ENTRY_BASE(result_type, header, thread)
 
 #define IRT_END }
@@ -488,5 +488,5 @@
   result_type header {                                               \
     ThreadInVMfromJava __tiv(thread);                                \
-    __ENTRY(result_type, header, thread)                             \
+    VM_ENTRY_BASE(result_type, header, thread)                       \
     debug_only(VMEntryWrapper __vew;)
 
@@ -494,5 +494,5 @@
 #define JRT_LEAF(result_type, header)                                \
   result_type header {                                               \
-  __LEAF(result_type, header)                                        \
+  VM_LEAF_BASE(result_type, header)                                  \
   debug_only(JRT_Leaf_Verifier __jlv;)
 
@@ -501,5 +501,5 @@
   result_type header {                                               \
     ThreadInVMfromJavaNoAsyncException __tiv(thread);                \
-    __ENTRY(result_type, header, thread)                             \
+    VM_ENTRY_BASE(result_type, header, thread)                       \
     debug_only(VMEntryWrapper __vew;)
 
@@ -534,9 +534,9 @@
     ThreadInVMfromNative __tiv(thread);                              \
     debug_only(VMNativeEntryWrapper __vew;)                          \
-    __ENTRY(result_type, header, thread)
+    VM_ENTRY_BASE(result_type, header, thread)
 
 
 // Ensure that the VMNativeEntryWrapper constructor, which can cause
-// a GC, is called outside the NoHandleMark (set via __QUICK_ENTRY).
+// a GC, is called outside the NoHandleMark (set via VM_QUICK_ENTRY_BASE).
 #define JNI_QUICK_ENTRY(result_type, header)                         \
 extern "C" {                                                         \
@@ -546,5 +546,5 @@
     ThreadInVMfromNative __tiv(thread);                              \
     debug_only(VMNativeEntryWrapper __vew;)                          \
-    __QUICK_ENTRY(result_type, header, thread)
+    VM_QUICK_ENTRY_BASE(result_type, header, thread)
 
 
@@ -554,5 +554,5 @@
     JavaThread* thread=JavaThread::thread_from_jni_environment(env); \
     assert( !VerifyJNIEnvThread || (thread == Thread::current()), "JNIEnv is only valid in same thread"); \
-    __LEAF(result_type, header)
+    VM_LEAF_BASE(result_type, header)
 
 
@@ -570,5 +570,5 @@
     ThreadInVMfromNative __tiv(thread);                              \
     debug_only(VMNativeEntryWrapper __vew;)                          \
-    __ENTRY(result_type, header, thread)
+    VM_ENTRY_BASE(result_type, header, thread)
 
 
@@ -579,5 +579,5 @@
     ThreadInVMfromNative __tiv(thread);                              \
     debug_only(VMNativeEntryWrapper __vew;)                          \
-    __ENTRY(result_type, header, thread)
+    VM_ENTRY_BASE(result_type, header, thread)
 
 
@@ -588,5 +588,5 @@
     ThreadInVMfromNative __tiv(thread);                              \
     debug_only(VMNativeEntryWrapper __vew;)                          \
-    __QUICK_ENTRY(result_type, header, thread)
+    VM_QUICK_ENTRY_BASE(result_type, header, thread)
 
 
@@ -595,5 +595,5 @@
   result_type JNICALL header {                                       \
     VM_Exit::block_if_vm_exited();                                   \
-    __LEAF(result_type, header)
+    VM_LEAF_BASE(result_type, header)
 
 
Index: /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/runtime/safepoint.cpp
===================================================================
--- /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/runtime/safepoint.cpp	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/runtime/safepoint.cpp	(revision 404)
@@ -24,4 +24,5 @@
 
 #include "precompiled.hpp"
+#include "classfile/symbolTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "code/codeCache.hpp"
@@ -502,6 +503,18 @@
   }
 
-  TraceTime t4("sweeping nmethods", TraceSafepointCleanupTime);
-  NMethodSweeper::scan_stacks();
+  {
+    TraceTime t4("sweeping nmethods", TraceSafepointCleanupTime);
+    NMethodSweeper::scan_stacks();
+  }
+
+  if (SymbolTable::needs_rehashing()) {
+    TraceTime t5("rehashing symbol table", TraceSafepointCleanupTime);
+    SymbolTable::rehash_table();
+  }
+
+  if (StringTable::needs_rehashing()) {
+    TraceTime t6("rehashing string table", TraceSafepointCleanupTime);
+    StringTable::rehash_table();
+  }
 }
 
Index: /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/utilities/hashtable.cpp
===================================================================
--- /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/utilities/hashtable.cpp	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/utilities/hashtable.cpp	(revision 404)
@@ -1,4 +1,3 @@
-/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+/* * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -24,5 +23,8 @@
 
 #include "precompiled.hpp"
+#include "classfile/altHashing.hpp"
+#include "classfile/javaClasses.hpp"
 #include "memory/allocation.inline.hpp"
+#include "memory/filemap.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/oop.inline.hpp"
@@ -70,5 +72,4 @@
 HashtableEntry* Hashtable::new_entry(unsigned int hashValue, oop obj) {
   HashtableEntry* entry;
-
   entry = (HashtableEntry*)BasicHashtable::new_entry(hashValue);
   entry->set_literal(obj);   // clears literal string field
@@ -86,11 +87,16 @@
   assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
   for (int i = 0; i < table_size(); ++i) {
-    for (HashtableEntry** p = bucket_addr(i); *p != NULL; ) {
-      HashtableEntry* entry = *p;
-      if (entry->is_shared()) {
+    HashtableEntry** p = bucket_addr(i);
+    HashtableEntry* entry = bucket(i);
+    while (entry != NULL) {
+      // Shared entries are normally at the end of the bucket and if we run into
+      // a shared entry, then there is nothing more to remove. However, if we
+      // have rehashed the table, then the shared entries are no longer at the
+      // end of the bucket.
+      if (entry->is_shared() && !use_alternate_hashcode()) {
         break;
       }
       assert(entry->literal() != NULL, "just checking");
-      if (is_alive->do_object_b(entry->literal())) {
+      if (entry->is_shared() || is_alive->do_object_b(entry->literal())) {
         p = entry->next_addr();
       } else {
@@ -98,4 +104,5 @@
         free_entry(entry);
       }
+      entry = (HashtableEntry*)HashtableEntry::make_ptr(*p);
     }
   }
@@ -120,4 +127,94 @@
       entry = (HashtableEntry*)HashtableEntry::make_ptr(*p);
     }
+  }
+}
+
+
+// Check to see if the hashtable is unbalanced.  The caller set a flag to
+// rehash at the next safepoint.  If this bucket is 60 times greater than the
+// expected average bucket length, it's an unbalanced hashtable.
+// This is somewhat an arbitrary heuristic but if one bucket gets to
+// rehash_count which is currently 100, there's probably something wrong.
+
+bool BasicHashtable::check_rehash_table(int count) {
+  assert(table_size() != 0, "underflow");
+  if (count > (((double)number_of_entries()/(double)table_size())*rehash_multiple)) {
+    // Set a flag for the next safepoint, which should be at some guaranteed
+    // safepoint interval.
+    return true;
+  }
+  return false;
+}
+
+unsigned int Hashtable::new_hash(oop string) {
+  ResourceMark rm;
+  int length;
+  if (java_lang_String::is_instance(string)) {
+    jchar* chars = java_lang_String::as_unicode_string(string, length);
+    // Use alternate hashing algorithm on the string
+    return AltHashing::murmur3_32(seed(), chars, length);
+  } else {
+    // Use alternate hashing algorithm on this symbol.
+    symbolOop symOop = (symbolOop) string;
+    return AltHashing::murmur3_32(seed(), (const jbyte*)symOop->bytes(), symOop->utf8_length());
+  }
+}
+
+// Create a new table and using alternate hash code, populate the new table
+// with the existing elements.   This can be used to change the hash code
+// and could in the future change the size of the table.
+
+void Hashtable::move_to(Hashtable* new_table) {
+  // Initialize the global seed for hashing.
+  assert(new_table->seed() == 0, "should be zero");
+  _seed = AltHashing::compute_seed();
+  assert(seed() != 0, "shouldn't be zero");
+  new_table->set_seed(_seed);
+
+  int saved_entry_count = this->number_of_entries();
+  
+  // Iterate through the table and create a new entry for the new table
+  for (int i = 0; i < new_table->table_size(); ++i) {
+    for (HashtableEntry* p = bucket(i); p != NULL; ) {
+      HashtableEntry* next = p->next();
+      oop string = p->literal();
+      // Use alternate hashing algorithm on the symbol in the first table
+      unsigned int hashValue = new_hash(string);
+      // Get a new index relative to the new table (can also change size)
+      int index = new_table->hash_to_index(hashValue);
+      p->set_hash(hashValue);
+      // Keep the shared bit in the Hashtable entry to indicate that this entry
+      // can't be deleted.   The shared bit is the LSB in the _next field so
+      // walking the hashtable past these entries requires
+      // BasicHashtableEntry::make_ptr() call.
+      bool keep_shared = p->is_shared();
+      unlink_entry(p);
+      new_table->add_entry(index, p);
+      if (keep_shared) {
+        p->set_shared();
+      }
+      p = next;
+    }
+  }
+  // give the new table the free list as well
+  new_table->copy_freelist(this);
+  assert(new_table->number_of_entries() == saved_entry_count, "lost entry on dictionary copy?");
+
+  // Destroy memory used by the buckets in the hashtable.  The memory
+  // for the elements has been used in a new table and is not
+  // destroyed.  The memory reuse will benefit resizing the SystemDictionary
+  // to avoid a memory allocation spike at safepoint.
+  free_buckets();
+}
+
+void BasicHashtable::free_buckets() {
+  if (NULL != _buckets) {
+    // Don't delete the buckets in the shared space.  They aren't
+    // allocated by os::malloc
+    if (!UseSharedSpaces ||
+        !FileMapInfo::current_info()->is_in_shared_space(_buckets)) {
+       FREE_C_HEAP_ARRAY(HashtableBucket, _buckets);
+    }
+    _buckets = NULL;
   }
 }
Index: /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/utilities/hashtable.hpp
===================================================================
--- /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/utilities/hashtable.hpp	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/utilities/hashtable.hpp	(revision 404)
@@ -178,4 +178,9 @@
 #endif
 
+  enum {
+    rehash_count = 100,
+    rehash_multiple = 60
+  };
+
   void initialize(int table_size, int entry_size, int number_of_entries);
 
@@ -193,4 +198,27 @@
   BasicHashtableEntry* new_entry(unsigned int hashValue);
 
+  // Check that the table is unbalanced
+  bool check_rehash_table(int count);
+
+  // Used when moving the entry to another table
+  // Clean up links, but do not add to free_list
+  void unlink_entry(BasicHashtableEntry* entry) {
+    entry->set_next(NULL);
+    --_number_of_entries;
+  }
+
+  // Move over freelist and free block for allocation
+  void copy_freelist(BasicHashtable* src) {
+    _free_list = src->_free_list;
+    src->_free_list = NULL;
+    _first_free_entry = src->_first_free_entry;
+    src->_first_free_entry = NULL;
+    _end_block = src->_end_block;
+    src->_end_block = NULL;
+  }
+
+  // Free the buckets in this hashtable
+  void free_buckets();
+
 public:
   void set_entry(int index, BasicHashtableEntry* entry);
@@ -211,9 +239,9 @@
 public:
   Hashtable(int table_size, int entry_size)
-    : BasicHashtable(table_size, entry_size) { }
+    : BasicHashtable(table_size, entry_size), _seed(0)  { }
 
   Hashtable(int table_size, int entry_size,
                    HashtableBucket* buckets, int number_of_entries)
-    : BasicHashtable(table_size, entry_size, buckets, number_of_entries) { }
+    : BasicHashtable(table_size, entry_size, buckets, number_of_entries), _seed(0) { }
 
   // Invoke "f->do_oop" on the locations of all oops in the table.
@@ -235,6 +263,4 @@
 protected:
 
-  static unsigned int hash_symbol(const char* s, int len);
-
   unsigned int compute_hash(symbolHandle name) {
     return (unsigned int) name->identity_hash();
@@ -257,4 +283,15 @@
     return (HashtableEntry**)BasicHashtable::bucket_addr(i);
   }
+
+  // Function to move these elements into the new table.
+  void move_to(Hashtable* new_table);
+  bool use_alternate_hashcode()  { return _seed != 0; }
+  jint seed()                    { return _seed; }
+  void set_seed(jint seed)       { _seed = seed; }
+
+ private:
+  jint _seed;
+
+  unsigned int new_hash(oop string);
 };
 
Index: /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/utilities/hashtable.inline.hpp
===================================================================
--- /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/utilities/hashtable.inline.hpp	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/hotspot/src/share/vm/utilities/hashtable.inline.hpp	(revision 404)
@@ -30,25 +30,4 @@
 
 // Inline function definitions for hashtable.hpp.
-
-
-// --------------------------------------------------------------------------
-// Hash function
-
-// We originally used hashpjw, but hash P(31) gives just as good results
-// and is slighly faster. We would like a hash function that looks at every
-// character, since package names have large common prefixes, and also because
-// hash_or_fail does error checking while iterating.
-
-// hash P(31) from Kernighan & Ritchie
-
-inline unsigned int Hashtable::hash_symbol(const char* s, int len) {
-  unsigned int h = 0;
-  while (len-- > 0) {
-    h = 31*h + (unsigned) *s;
-    s++;
-  }
-  return h;
-}
-
 
 // --------------------------------------------------------------------------
Index: /branches/vendor/oracle/openjdk6/current/hotspot/test/runtime/7110720/Test7110720.sh
===================================================================
--- /branches/vendor/oracle/openjdk6/current/hotspot/test/runtime/7110720/Test7110720.sh	(revision 404)
+++ /branches/vendor/oracle/openjdk6/current/hotspot/test/runtime/7110720/Test7110720.sh	(revision 404)
@@ -0,0 +1,129 @@
+#
+#  Copyright (c) 2012, 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 Test7110720.sh
+# @bug 7110720
+# @summary improve VM configuration file loading
+# @run shell Test7110720.sh
+#
+
+if [ "${TESTSRC}" = "" ]
+  then TESTSRC=.
+fi
+
+if [ "${TESTJAVA}" = "" ]
+then
+  PARENT=`dirname \`which java\``
+  TESTJAVA=`dirname ${PARENT}`
+  echo "TESTJAVA not set, selecting " ${TESTJAVA}
+  echo "If this is incorrect, try setting the variable manually."
+fi
+
+if [ "${TESTCLASSES}" = "" ]
+then
+  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
+  exit 1
+fi
+
+# set platform-dependent variables
+OS=`uname -s`
+case "$OS" in
+  SunOS | Linux )
+    FS="/"
+    RM=/bin/rm
+    CP=/bin/cp
+    MV=/bin/mv
+    ;;
+  Windows_* )
+    FS="\\"
+    RM=rm
+    CP=cp
+    MV=mv
+    ;;
+  * )
+    echo "Unrecognized system!"
+    exit 1;
+    ;;
+esac
+
+
+JAVA=${TESTJAVA}${FS}bin${FS}java
+
+# Don't test debug builds, they do read the config files:
+${JAVA} ${TESTVMOPTS} -version 2>&1 | grep "debug" >/dev/null
+if [ "$?" = "0" ]; then
+  echo Skipping test for debug build.
+  exit 0
+fi
+
+ok=yes
+
+$RM -f .hotspot_compiler .hotspotrc
+
+${JAVA} ${TESTVMOPTS} -version 2>&1 | grep "garbage in" >/dev/null
+if [ "$?" = "0" ]; then
+  echo "FAILED: base case failure"
+  exit 1
+fi
+
+
+echo "garbage in, garbage out" > .hotspot_compiler
+${JAVA} ${TESTVMOPTS} -version 2>&1 | grep "garbage in" >/dev/null
+if [ "$?" = "0" ]; then
+  echo "FAILED: .hotspot_compiler was read"
+  ok=no
+fi
+
+$MV .hotspot_compiler hs_comp.txt
+${JAVA} ${TESTVMOPTS} -XX:CompileCommandFile=hs_comp.txt -version 2>&1 | grep "garbage in" >/dev/null
+if [ "$?" = "1" ]; then
+  echo "FAILED: explicit compiler command file not read"
+  ok=no
+fi
+
+$RM -f .hotspot_compiler hs_comp.txt
+
+echo "garbage" > .hotspotrc
+${JAVA} ${TESTVMOPTS} -version 2>&1 | grep "garbage" >/dev/null
+if [ "$?" = "0" ]; then
+  echo "FAILED: .hotspotrc was read"
+  ok=no
+fi
+
+$MV .hotspotrc hs_flags.txt
+${JAVA} ${TESTVMOPTS} -XX:Flags=hs_flags.txt -version 2>&1 | grep "garbage" >/dev/null
+if [ "$?" = "1" ]; then
+  echo "FAILED: explicit flags file not read"
+  ok=no
+fi
+
+if [ "${ok}" = "no" ]; then 
+  echo "Some tests failed."
+  exit 1
+else 
+  echo "Passed"
+  exit 0
+fi
+
Index: /branches/vendor/oracle/openjdk6/current/hotspot/test/runtime/7160757/Test7160757.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/hotspot/test/runtime/7160757/Test7160757.java	(revision 404)
+++ /branches/vendor/oracle/openjdk6/current/hotspot/test/runtime/7160757/Test7160757.java	(revision 404)
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2012, 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 Test7160757.java
+ * @bug 7160757
+ * @summary Tests that superclass initialization is not skipped
+ */
+
+public class Test7160757 {
+
+    public static void main(String args[]) throws Exception {
+
+        ClassLoader loader = new SLoader();
+        try {
+            Class.forName("S", true, loader);
+            System.out.println("FAILED");
+            throw new Exception("Should have thrown a VerifyError.");
+        } catch (VerifyError e) {
+            System.out.println(e);
+            System.out.println("PASSED");
+        }
+    }
+
+    static class SLoader extends ClassLoader {
+
+        /**
+         * public class S extends Throwable {
+         *     public S() {
+         *         aload_0
+         *         invokespecial Object.<init>()
+         *         return
+         *     }
+         * }
+         */
+        static byte b(int i) { return (byte)i; }
+        static byte S_class[] = {
+            b(0xca), b(0xfe), b(0xba), b(0xbe), 0x00, 0x00, 0x00, 0x32,
+            0x00, 0x0c, 0x0a, 0x00, 0x0b, 0x00, 0x07, 0x07,
+            0x00, 0x08, 0x07, 0x00, 0x09, 0x01, 0x00, 0x06,
+            0x3c, 0x69, 0x6e, 0x69, 0x74, 0x3e, 0x01, 0x00,
+            0x03, 0x28, 0x29, 0x56, 0x01, 0x00, 0x04, 0x43,
+            0x6f, 0x64, 0x65, 0x0c, 0x00, 0x04, 0x00, 0x05,
+            0x01, 0x00, 0x01, 0x53, 0x01, 0x00, 0x13, 0x6a,
+            0x61, 0x76, 0x61, 0x2f, 0x6c, 0x61, 0x6e, 0x67,
+            0x2f, 0x54, 0x68, 0x72, 0x6f, 0x77, 0x61, 0x62,
+            0x6c, 0x65, 0x01, 0x00, 0x10, 0x6a, 0x61, 0x76,
+            0x61, 0x2f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x4f,
+            0x62, 0x6a, 0x65, 0x63, 0x74, 0x07, 0x00, 0x0a,
+            0x00, 0x21, 0x00, 0x02, 0x00, 0x03, 0x00, 0x00,
+            0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x04,
+            0x00, 0x05, 0x00, 0x01, 0x00, 0x06, 0x00, 0x00,
+            0x00, 0x11, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00,
+            0x00, 0x05, 0x2a, b(0xb7), 0x00, 0x01, b(0xb1), 0x00,
+            0x00, 0x00, 0x00, 0x00, 0x00
+        };
+    
+        public Class findClass(String name) throws ClassNotFoundException {
+            return defineClass(name, S_class, 0, S_class.length);
+        }
+    }
+}
Index: /branches/vendor/oracle/openjdk6/current/jaxp/jaxp.properties
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jaxp/jaxp.properties	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jaxp/jaxp.properties	(revision 404)
@@ -26,6 +26,6 @@
 drops.master.copy.base=${drops.dir}
 
-jaxp_src.bundle.name=jaxp144_03.zip
-jaxp_src.bundle.md5.checksum=9eea471ad474040265c688858fcf09aa
+jaxp_src.bundle.name=jaxp144_04.zip
+jaxp_src.bundle.md5.checksum=0ace787aa12177d201947e8ba0ba9bdd
 jaxp_src.master.bundle.dir=${drops.master.copy.base}
 jaxp_src.master.bundle.url.base=http://download.java.net/jaxp/openjdk/jdk6
Index: /branches/vendor/oracle/openjdk6/current/jdk/make/com/sun/jmx/Makefile
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/make/com/sun/jmx/Makefile	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/make/com/sun/jmx/Makefile	(revision 404)
@@ -1,4 +1,4 @@
 #
-# Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
@@ -99,4 +99,19 @@
 # org.omg.stub (6375696)
 # 
+# To ensure the latest stub generator files are picked up from corba repo
+# when available, we need to run with latest rmic version available. rmic 
+# launch tool not built at this stage but we can invoke via rmi class.
+
+RMIC_JAVA = $(OUTPUTDIR)/bin/java
+# need to treat 64bit solaris differently
+ifeq ($(PLATFORM)-$(LIBARCH), solaris-amd64)
+RMIC_JAVA = $(OUTPUTDIR)/bin/amd64/java
+endif
+ifeq ($(PLATFORM)-$(LIBARCH), solaris-sparcv9)
+RMIC_JAVA = $(OUTPUTDIR)/bin/sparcv9/java
+endif
+
+RMIC = $(RMIC_JAVA) $(JAVA_TOOLS_FLAGS) -cp $(OUTPUTDIR)/classes sun.rmi.rmic.Main
+
 $(CLASSDESTDIR)/%_Stub.class: $(CLASSDESTDIR)/%.class
 	$(prep-target)
Index: /branches/vendor/oracle/openjdk6/current/jdk/make/common/shared/Compiler-gcc.gmk
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/make/common/shared/Compiler-gcc.gmk	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/make/common/shared/Compiler-gcc.gmk	(revision 404)
@@ -95,5 +95,5 @@
   endif
   # Option used to create a shared library
-  SHARED_LIBRARY_FLAG = -shared -mimpure-text
+  SHARED_LIBRARY_FLAG = -shared
   SUN_COMP_VER := $(shell $(CC) --verbose 2>&1 )
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/make/sun/Makefile
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/make/sun/Makefile	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/make/sun/Makefile	(revision 404)
@@ -65,5 +65,5 @@
 	  awt splashscreen $(XAWT_SUBDIR) $(MOTIF_SUBDIRS) \
           $(HEADLESS_SUBDIR) $(DGA_SUBDIR) \
-	  font jpeg cmm applet rmi beans $(JDBC_SUBDIR) \
+	  font jpeg cmm applet rmi $(JDBC_SUBDIR) \
 	  jawt text nio launcher management $(ORG_SUBDIR) \
           native2ascii serialver tools jconsole
Index: anches/vendor/oracle/openjdk6/current/jdk/make/sun/beans/Makefile
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/make/sun/beans/Makefile	(revision 403)
+++ 	(revision )
@@ -1,43 +1,0 @@
-#
-# Copyright (c) 1997, 2005, 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.
-#
-
-#
-# Makefile for building sun.beans.*
-#
-
-BUILDDIR = ../..
-PACKAGE = sun.beans
-PRODUCT = sun
-include $(BUILDDIR)/common/Defs.gmk
-
-#
-# Files
-#
-AUTO_FILES_JAVA_DIRS = sun/beans
-
-#
-# Rules
-#
-include $(BUILDDIR)/common/Classes.gmk
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/BooleanEditor.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/BooleanEditor.java	(revision 404)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/BooleanEditor.java	(revision 404)
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.beans.editors;
+
+/**
+ * Property editor for a java builtin "boolean" type.
+ */
+
+import java.beans.*;
+
+public class BooleanEditor extends PropertyEditorSupport {
+
+
+    public String getJavaInitializationString() {
+        Object value = getValue();
+        return (value != null)
+                ? value.toString()
+                : "null";
+    }
+
+    public String getAsText() {
+        Object value = getValue();
+        return (value instanceof Boolean)
+             ? getValidName((Boolean) value)
+             : "null";
+    }
+
+    public void setAsText(String text) throws java.lang.IllegalArgumentException {
+        if (text == null) {
+            setValue(null);
+        } else if (isValidName(true, text)) {
+            setValue(Boolean.TRUE);
+        } else if (isValidName(false, text)) {
+            setValue(Boolean.FALSE);
+        } else {
+            throw new java.lang.IllegalArgumentException(text);
+        }
+    }
+
+    public String[] getTags() {
+        return new String[] {getValidName(true), getValidName(false)};
+    }
+
+    // the following method should be localized (4890258)
+
+    private String getValidName(boolean value) {
+        return value ? "True" : "False";
+    }
+
+    private boolean isValidName(boolean value, String name) {
+        return getValidName(value).equalsIgnoreCase(name);
+    }
+}
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/ByteEditor.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/ByteEditor.java	(revision 404)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/ByteEditor.java	(revision 404)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.beans.editors;
+
+/**
+ * Property editor for a java builtin "byte" type.
+ *
+ */
+
+import java.beans.*;
+
+public class ByteEditor extends NumberEditor {
+
+    public String getJavaInitializationString() {
+        Object value = getValue();
+        return (value != null)
+                ? "((byte)" + value + ")"
+                : "null";
+    }
+
+    public void setAsText(String text) throws IllegalArgumentException {
+        setValue((text == null) ? null : Byte.decode(text));
+    }
+
+}
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/ColorEditor.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/ColorEditor.java	(revision 404)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/ColorEditor.java	(revision 404)
@@ -0,0 +1,212 @@
+/*
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.beans.editors;
+
+import java.awt.*;
+import java.beans.*;
+
+public class ColorEditor extends Panel implements PropertyEditor {
+    public ColorEditor() {
+        setLayout(null);
+
+        ourWidth = hPad;
+
+        // Create a sample color block bordered in black
+        Panel p = new Panel();
+        p.setLayout(null);
+        p.setBackground(Color.black);
+        sample = new Canvas();
+        p.add(sample);
+        sample.reshape(2, 2, sampleWidth, sampleHeight);
+        add(p);
+        p.reshape(ourWidth, 2, sampleWidth+4, sampleHeight+4);
+        ourWidth += sampleWidth + 4 + hPad;
+
+        text = new TextField("", 14);
+        add(text);
+        text.reshape(ourWidth,0,100,30);
+        ourWidth += 100 + hPad;
+
+        choser = new Choice();
+        int active = 0;
+        for (int i = 0; i < colorNames.length; i++) {
+            choser.addItem(colorNames[i]);
+        }
+        add(choser);
+        choser.reshape(ourWidth,0,100,30);
+        ourWidth += 100 + hPad;
+
+        resize(ourWidth,40);
+    }
+
+    public void setValue(Object o) {
+        Color c = (Color)o;
+        changeColor(c);
+    }
+
+    public Dimension preferredSize() {
+        return new Dimension(ourWidth, 40);
+    }
+
+    public boolean keyUp(Event e, int key) {
+        if (e.target == text) {
+            try {
+                setAsText(text.getText());
+            } catch (IllegalArgumentException ex) {
+                // Quietly ignore.
+            }
+        }
+        return (false);
+    }
+
+    public void setAsText(String s) throws java.lang.IllegalArgumentException {
+        if (s == null) {
+            changeColor(null);
+            return;
+        }
+        int c1 = s.indexOf(',');
+        int c2 = s.indexOf(',', c1+1);
+        if (c1 < 0 || c2 < 0) {
+            // Invalid string.
+            throw new IllegalArgumentException(s);
+        }
+        try {
+            int r = Integer.parseInt(s.substring(0,c1));
+            int g = Integer.parseInt(s.substring(c1+1, c2));
+            int b = Integer.parseInt(s.substring(c2+1));
+            Color c = new Color(r,g,b);
+            changeColor(c);
+        } catch (Exception ex) {
+            throw new IllegalArgumentException(s);
+        }
+
+    }
+
+    public boolean action(Event e, Object arg) {
+        if (e.target == choser) {
+            changeColor(colors[choser.getSelectedIndex()]);
+        }
+        return false;
+    }
+
+    public String getJavaInitializationString() {
+        return (this.color != null)
+                ? "new java.awt.Color(" + this.color.getRGB() + ",true)"
+                : "null";
+    }
+
+
+    private void changeColor(Color c) {
+
+        if (c == null) {
+            this.color = null;
+            this.text.setText("");
+            return;
+        }
+
+        color = c;
+
+        text.setText("" + c.getRed() + "," + c.getGreen() + "," + c.getBlue());
+
+        int active = 0;
+        for (int i = 0; i < colorNames.length; i++) {
+            if (color.equals(colors[i])) {
+                active = i;
+            }
+        }
+        choser.select(active);
+
+        sample.setBackground(color);
+        sample.repaint();
+
+        support.firePropertyChange("", null, null);
+    }
+
+    public Object getValue() {
+        return color;
+    }
+
+    public boolean isPaintable() {
+        return true;
+    }
+
+    public void paintValue(java.awt.Graphics gfx, java.awt.Rectangle box) {
+        Color oldColor = gfx.getColor();
+        gfx.setColor(Color.black);
+        gfx.drawRect(box.x, box.y, box.width-3, box.height-3);
+        gfx.setColor(color);
+        gfx.fillRect(box.x+1, box.y+1, box.width-4, box.height-4);
+        gfx.setColor(oldColor);
+    }
+
+    public String getAsText() {
+        return (this.color != null)
+                ? this.color.getRed() + "," + this.color.getGreen() + "," + this.color.getBlue()
+                : "null";
+    }
+
+    public String[] getTags() {
+        return null;
+    }
+
+    public java.awt.Component getCustomEditor() {
+        return this;
+    }
+
+    public boolean supportsCustomEditor() {
+        return true;
+    }
+
+    public void addPropertyChangeListener(PropertyChangeListener l) {
+        support.addPropertyChangeListener(l);
+    }
+
+    public void removePropertyChangeListener(PropertyChangeListener l) {
+        support.removePropertyChangeListener(l);
+    }
+
+
+    private String colorNames[] = { " ", "white", "lightGray", "gray", "darkGray",
+                        "black", "red", "pink", "orange",
+                        "yellow", "green", "magenta", "cyan",
+                        "blue"};
+    private Color colors[] = { null, Color.white, Color.lightGray, Color.gray, Color.darkGray,
+                        Color.black, Color.red, Color.pink, Color.orange,
+                        Color.yellow, Color.green, Color.magenta, Color.cyan,
+                        Color.blue};
+
+    private Canvas sample;
+    private int sampleHeight = 20;
+    private int sampleWidth = 40;
+    private int hPad = 5;
+    private int ourWidth;
+
+    private Color color;
+    private TextField text;
+    private Choice choser;
+
+    private PropertyChangeSupport support = new PropertyChangeSupport(this);
+}
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/DoubleEditor.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/DoubleEditor.java	(revision 404)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/DoubleEditor.java	(revision 404)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.beans.editors;
+
+/**
+ * Property editor for a java builtin "double" type.
+ *
+ */
+
+import java.beans.*;
+
+public class DoubleEditor extends NumberEditor {
+
+    public void setAsText(String text) throws IllegalArgumentException {
+        setValue((text == null) ? null : Double.valueOf(text));
+    }
+
+}
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/EnumEditor.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/EnumEditor.java	(revision 404)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/EnumEditor.java	(revision 404)
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.beans.editors;
+
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyEditor;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Property editor for java.lang.Enum subclasses.
+ *
+ * @see PropertyEditor
+ *
+ * @since 1.7
+ *
+ * @author Sergey A. Malenkov
+ */
+public final class EnumEditor implements PropertyEditor {
+    private final List<PropertyChangeListener> listeners = new ArrayList<PropertyChangeListener>();
+
+    private final Class type;
+    private final String[] tags;
+
+    private Object value;
+
+    public EnumEditor( Class type ) {
+        Object[] values = type.getEnumConstants();
+        if ( values == null ) {
+            throw new IllegalArgumentException( "Unsupported " + type );
+        }
+        this.type = type;
+        this.tags = new String[values.length];
+        for ( int i = 0; i < values.length; i++ ) {
+            this.tags[i] = ( ( Enum )values[i] ).name();
+        }
+    }
+
+    public Object getValue() {
+        return this.value;
+    }
+
+    public void setValue( Object value ) {
+        if ( ( value != null ) && !this.type.isInstance( value ) ) {
+            throw new IllegalArgumentException( "Unsupported value: " + value );
+        }
+        Object oldValue;
+        PropertyChangeListener[] listeners;
+        synchronized ( this.listeners ) {
+            oldValue = this.value;
+            this.value = value;
+
+            if ( ( value == null ) ? oldValue == null : value.equals( oldValue ) ) {
+                return; // do not fire event if value is not changed
+            }
+            int size = this.listeners.size();
+            if ( size == 0 ) {
+                return; // do not fire event if there are no any listener
+            }
+            listeners = this.listeners.toArray( new PropertyChangeListener[size] );
+        }
+        PropertyChangeEvent event = new PropertyChangeEvent( this, null, oldValue, value );
+        for ( PropertyChangeListener listener : listeners ) {
+            listener.propertyChange( event );
+        }
+    }
+
+    public String getAsText() {
+        return ( this.value != null )
+                ? ( ( Enum )this.value ).name()
+                : "null";
+    }
+
+    public void setAsText( String text ) {
+        setValue( ( text != null )
+                ? Enum.valueOf( this.type, text )
+                : null );
+    }
+
+    public String[] getTags() {
+        return this.tags.clone();
+    }
+
+    public String getJavaInitializationString() {
+        return ( this.value != null )
+                ? this.type.getName() + '.' + ( ( Enum )this.value ).name()
+                : "null";
+    }
+
+    public boolean isPaintable() {
+        return false;
+    }
+
+    public void paintValue( Graphics gfx, Rectangle box ) {
+    }
+
+    public boolean supportsCustomEditor() {
+        return false;
+    }
+
+    public Component getCustomEditor() {
+        return null;
+    }
+
+    public void addPropertyChangeListener( PropertyChangeListener listener ) {
+        synchronized ( this.listeners ) {
+            this.listeners.add( listener );
+        }
+    }
+
+    public void removePropertyChangeListener( PropertyChangeListener listener ) {
+        synchronized ( this.listeners ) {
+            this.listeners.remove( listener );
+        }
+    }
+}
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/FloatEditor.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/FloatEditor.java	(revision 404)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/FloatEditor.java	(revision 404)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.beans.editors;
+
+/**
+ * Property editor for a java builtin "float" type.
+ *
+ */
+
+import java.beans.*;
+
+public class FloatEditor extends NumberEditor {
+
+    public String getJavaInitializationString() {
+        Object value = getValue();
+        return (value != null)
+                ? value + "F"
+                : "null";
+    }
+
+    public void setAsText(String text) throws IllegalArgumentException {
+        setValue((text == null) ? null : Float.valueOf(text));
+    }
+
+}
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/FontEditor.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/FontEditor.java	(revision 404)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/FontEditor.java	(revision 404)
@@ -0,0 +1,218 @@
+/*
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.beans.editors;
+
+import java.awt.*;
+import java.beans.*;
+
+public class FontEditor extends Panel implements java.beans.PropertyEditor {
+
+    public FontEditor() {
+        setLayout(null);
+
+        toolkit = Toolkit.getDefaultToolkit();
+        fonts = toolkit.getFontList();
+
+        familyChoser = new Choice();
+        for (int i = 0; i < fonts.length; i++) {
+            familyChoser.addItem(fonts[i]);
+        }
+        add(familyChoser);
+        familyChoser.reshape(20, 5, 100, 30);
+
+        styleChoser = new Choice();
+        for (int i = 0; i < styleNames.length; i++) {
+            styleChoser.addItem(styleNames[i]);
+        }
+        add(styleChoser);
+        styleChoser.reshape(145, 5, 70, 30);
+
+        sizeChoser = new Choice();
+        for (int i = 0; i < pointSizes.length; i++) {
+            sizeChoser.addItem("" + pointSizes[i]);
+        }
+        add(sizeChoser);
+        sizeChoser.reshape(220, 5, 70, 30);
+
+        resize(300,40);
+    }
+
+
+    public Dimension preferredSize() {
+        return new Dimension(300, 40);
+    }
+
+    public void setValue(Object o) {
+        font = (Font) o;
+        if (this.font == null)
+            return;
+
+        changeFont(font);
+        // Update the current GUI choices.
+        for (int i = 0; i < fonts.length; i++) {
+            if (fonts[i].equals(font.getFamily())) {
+                familyChoser.select(i);
+                break;
+            }
+        }
+        for (int i = 0; i < styleNames.length; i++) {
+            if (font.getStyle() == styles[i]) {
+                styleChoser.select(i);
+                break;
+            }
+        }
+        for (int i = 0; i < pointSizes.length; i++) {
+            if (font.getSize() <= pointSizes[i]) {
+                sizeChoser.select(i);
+                break;
+            }
+        }
+    }
+
+    private void changeFont(Font f) {
+        font = f;
+        if (sample != null) {
+            remove(sample);
+        }
+        sample = new Label(sampleText);
+        sample.setFont(font);
+        add(sample);
+        Component p = getParent();
+        if (p != null) {
+            p.invalidate();
+            p.layout();
+        }
+        invalidate();
+        layout();
+        repaint();
+        support.firePropertyChange("", null, null);
+    }
+
+    public Object getValue() {
+        return (font);
+    }
+
+    public String getJavaInitializationString() {
+        if (this.font == null)
+            return "null";
+
+        return "new java.awt.Font(\"" + font.getName() + "\", " +
+                   font.getStyle() + ", " + font.getSize() + ")";
+    }
+
+    public boolean action(Event e, Object arg) {
+        String family = familyChoser.getSelectedItem();
+        int style = styles[styleChoser.getSelectedIndex()];
+        int size = pointSizes[sizeChoser.getSelectedIndex()];
+        try {
+            Font f = new Font(family, style, size);
+            changeFont(f);
+        } catch (Exception ex) {
+            System.err.println("Couldn't create font " + family + "-" +
+                        styleNames[style] + "-" + size);
+        }
+        return (false);
+    }
+
+
+    public boolean isPaintable() {
+        return true;
+    }
+
+    public void paintValue(java.awt.Graphics gfx, java.awt.Rectangle box) {
+        // Silent noop.
+        Font oldFont = gfx.getFont();
+        gfx.setFont(font);
+        FontMetrics fm = gfx.getFontMetrics();
+        int vpad = (box.height - fm.getAscent())/2;
+        gfx.drawString(sampleText, 0, box.height-vpad);
+        gfx.setFont(oldFont);
+    }
+
+    public String getAsText() {
+        if (this.font == null) {
+            return "null";
+        }
+        StringBuilder sb = new StringBuilder();
+        sb.append(this.font.getName());
+        sb.append(' ');
+
+        boolean b = this.font.isBold();
+        if (b) {
+            sb.append("BOLD");
+        }
+        boolean i = this.font.isItalic();
+        if (i) {
+            sb.append("ITALIC");
+        }
+        if (b || i) {
+            sb.append(' ');
+        }
+        sb.append(this.font.getSize());
+        return sb.toString();
+    }
+
+    public void setAsText(String text) throws IllegalArgumentException {
+        setValue((text == null) ? null : Font.decode(text));
+    }
+
+    public String[] getTags() {
+        return null;
+    }
+
+    public java.awt.Component getCustomEditor() {
+        return this;
+    }
+
+    public boolean supportsCustomEditor() {
+        return true;
+    }
+
+    public void addPropertyChangeListener(PropertyChangeListener l) {
+        support.addPropertyChangeListener(l);
+    }
+
+    public void removePropertyChangeListener(PropertyChangeListener l) {
+        support.removePropertyChangeListener(l);
+    }
+
+    private Font font;
+    private Toolkit toolkit;
+    private String sampleText = "Abcde...";
+
+    private Label sample;
+    private Choice familyChoser;
+    private Choice styleChoser;
+    private Choice sizeChoser;
+
+    private String fonts[];
+    private String[] styleNames = { "plain", "bold", "italic" };
+    private int[] styles = { Font.PLAIN, Font.BOLD, Font.ITALIC };
+    private int[] pointSizes = { 3, 5, 8, 10, 12, 14, 18, 24, 36, 48 };
+
+    private PropertyChangeSupport support = new PropertyChangeSupport(this);
+
+}
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/IntegerEditor.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/IntegerEditor.java	(revision 404)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/IntegerEditor.java	(revision 404)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.beans.editors;
+
+/**
+ * Property editor for a java builtin "int" type.
+ *
+ */
+
+import java.beans.*;
+
+public class IntegerEditor extends NumberEditor {
+
+
+    public void setAsText(String text) throws IllegalArgumentException {
+        setValue((text == null) ? null : Integer.decode(text));
+    }
+
+}
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/LongEditor.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/LongEditor.java	(revision 404)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/LongEditor.java	(revision 404)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.beans.editors;
+
+/**
+ * Property editor for a java builtin "long" type.
+ *
+ */
+
+import java.beans.*;
+
+public class LongEditor extends NumberEditor {
+
+    public String getJavaInitializationString() {
+        Object value = getValue();
+        return (value != null)
+                ? value + "L"
+                : "null";
+    }
+
+    public void setAsText(String text) throws IllegalArgumentException {
+        setValue((text == null) ? null : Long.decode(text));
+    }
+
+}
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/NumberEditor.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/NumberEditor.java	(revision 404)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/NumberEditor.java	(revision 404)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.beans.editors;
+
+/**
+ * Abstract Property editor for a java builtin number types.
+ *
+ */
+
+import java.beans.*;
+
+abstract public class NumberEditor extends PropertyEditorSupport {
+
+    public String getJavaInitializationString() {
+        Object value = getValue();
+        return (value != null)
+                ? value.toString()
+                : "null";
+    }
+
+}
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/ShortEditor.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/ShortEditor.java	(revision 404)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/ShortEditor.java	(revision 404)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package com.sun.beans.editors;
+
+/**
+ * Property editor for a java builtin "short" type.
+ *
+ */
+
+import java.beans.*;
+
+public class ShortEditor extends NumberEditor {
+
+    public String getJavaInitializationString() {
+        Object value = getValue();
+        return (value != null)
+                ? "((short)" + value + ")"
+                : "null";
+    }
+
+    public void setAsText(String text) throws IllegalArgumentException {
+        setValue((text == null) ? null : Short.decode(text));
+    }
+
+}
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/StringEditor.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/StringEditor.java	(revision 404)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/editors/StringEditor.java	(revision 404)
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package com.sun.beans.editors;
+
+import java.beans.*;
+
+public class StringEditor extends PropertyEditorSupport {
+
+    public String getJavaInitializationString() {
+        Object value = getValue();
+        if (value == null)
+            return "null";
+
+        String str = value.toString();
+        int length = str.length();
+        StringBuilder sb = new StringBuilder(length + 2);
+        sb.append('"');
+        for (int i = 0; i < length; i++) {
+            char ch = str.charAt(i);
+            switch (ch) {
+            case '\b': sb.append("\\b");  break;
+            case '\t': sb.append("\\t");  break;
+            case '\n': sb.append("\\n");  break;
+            case '\f': sb.append("\\f");  break;
+            case '\r': sb.append("\\r");  break;
+            case '\"': sb.append("\\\""); break;
+            case '\\': sb.append("\\\\"); break;
+            default:
+                if ((ch < ' ') || (ch > '~')) {
+                    sb.append("\\u");
+                    String hex = Integer.toHexString((int) ch);
+                    for (int len = hex.length(); len < 4; len++) {
+                        sb.append('0');
+                    }
+                    sb.append(hex);
+                } else {
+                    sb.append(ch);
+                }
+                break;
+            }
+        }
+        sb.append('"');
+        return sb.toString();
+    }
+
+    public void setAsText(String text) {
+        setValue(text);
+    }
+
+}
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/finder/ClassFinder.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/finder/ClassFinder.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/finder/ClassFinder.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -24,4 +24,6 @@
  */
 package com.sun.beans.finder;
+
+import static sun.reflect.misc.ReflectUtil.checkPackageAccess;
 
 /**
@@ -54,4 +56,5 @@
      */
     public static Class findClass( String name ) throws ClassNotFoundException {
+        checkPackageAccess(name);
         try {
             ClassLoader loader = Thread.currentThread().getContextClassLoader();
@@ -94,4 +97,5 @@
      */
     public static Class findClass( String name, ClassLoader loader ) throws ClassNotFoundException {
+        checkPackageAccess(name);
         if ( loader != null ) {
             try {
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/infos/ComponentBeanInfo.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/infos/ComponentBeanInfo.java	(revision 404)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/beans/infos/ComponentBeanInfo.java	(revision 404)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.beans.infos;
+
+import java.beans.*;
+
+/**
+ * BeanInfo descriptor for a standard AWT component.
+ */
+
+public class ComponentBeanInfo extends SimpleBeanInfo {
+    private static final Class beanClass = java.awt.Component.class;
+
+    public PropertyDescriptor[] getPropertyDescriptors() {
+        try {
+            PropertyDescriptor
+                      name = new PropertyDescriptor("name",       beanClass),
+                background = new PropertyDescriptor("background", beanClass),
+                foreground = new PropertyDescriptor("foreground", beanClass),
+                      font = new PropertyDescriptor("font",       beanClass),
+                   enabled = new PropertyDescriptor("enabled",    beanClass),
+                   visible = new PropertyDescriptor("visible",    beanClass),
+                 focusable = new PropertyDescriptor("focusable",  beanClass);
+
+            enabled.setExpert(true);
+            visible.setHidden(true);
+
+            background.setBound(true);
+            foreground.setBound(true);
+            font.setBound(true);
+            focusable.setBound(true);
+
+            PropertyDescriptor[] rv = {name, background, foreground, font, enabled, visible, focusable };
+            return rv;
+        } catch (IntrospectionException e) {
+            throw new Error(e.toString());
+        }
+    }
+}
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/java/util/jar/pack/Driver.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/java/util/jar/pack/Driver.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/java/util/jar/pack/Driver.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -355,6 +355,5 @@
 
 
-        File f = File.createTempFile(prefix, suffix, where);
-        return f;
+        return sun.misc.IOUtils.createTempFile(prefix, suffix, where);
     }
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/script/javascript/RhinoScriptEngine.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/script/javascript/RhinoScriptEngine.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/com/sun/script/javascript/RhinoScriptEngine.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -131,5 +131,9 @@
 
         if (System.getSecurityManager() != null) {
-            accCtxt = AccessController.getContext();
+            try {
+                AccessController.checkPermission(new AllPermission());
+            } catch (AccessControlException ace) {
+                accCtxt = AccessController.getContext();
+            }
         }
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/AWTEvent.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/AWTEvent.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/AWTEvent.java	(revision 404)
@@ -269,6 +269,18 @@
                 }
 
+                public void setPosted(AWTEvent ev) {
+                    ev.isPosted = true;
+                }
+
                 public AccessControlContext getAccessControlContext(AWTEvent ev) {
                     return ev.getAccessControlContext();
+                }
+
+                public byte[] getBData(AWTEvent ev) {
+                    return ev.bdata;
+                }
+
+                public void setBData(AWTEvent ev, byte[] bdata) {
+                    ev.bdata = bdata;
                 }
         });
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/CheckboxMenuItem.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/CheckboxMenuItem.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/CheckboxMenuItem.java	(revision 404)
@@ -32,4 +32,5 @@
 import java.io.IOException;
 import javax.accessibility.*;
+import sun.awt.AWTAccessor;
 
 
@@ -69,4 +70,11 @@
             initIDs();
         }
+        
+        AWTAccessor.setCheckboxMenuItemAccessor(
+            new AWTAccessor.CheckboxMenuItemAccessor() {
+                public boolean getState(CheckboxMenuItem cmi) {
+                    return cmi.state;
+                }
+            });
     }
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/Component.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/Component.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/Component.java	(revision 404)
@@ -799,8 +799,23 @@
     static {
         AWTAccessor.setComponentAccessor(new AWTAccessor.ComponentAccessor() {
+                public AppContext getAppContext(Component comp) {
+                    return comp.appContext;
+                }
+
+                public void setAppContext(Component comp, AppContext appContext) {
+                    comp.appContext = appContext;
+                }
+
                 public AccessControlContext getAccessControlContext(Component comp) {
                     return comp.getAccessControlContext();
                 }
 
+                public boolean requestFocusInWindow(Component comp, CausedFocusEvent.Cause cause) {
+                    return comp.requestFocusInWindow(cause);
+                }
+
+                public void requestFocus(Component comp, CausedFocusEvent.Cause cause) {
+                    comp.requestFocus(cause);
+                }
             });
     }
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/Cursor.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/Cursor.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/Cursor.java	(revision 404)
@@ -39,4 +39,5 @@
 
 import java.security.AccessController;
+import sun.awt.AWTAccessor;
 
 /**
@@ -194,4 +195,19 @@
             initIDs();
         }
+
+        AWTAccessor.setCursorAccessor(
+            new AWTAccessor.CursorAccessor() {
+                public long getPData(Cursor cursor) {
+                    return cursor.pData;
+                }
+
+                public void setPData(Cursor cursor, long pData) {
+                    cursor.pData = pData;
+                }
+
+                public int getType(Cursor cursor) {
+                    return cursor.type;
+                }
+            });
     }
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java	(revision 404)
@@ -41,4 +41,5 @@
 import sun.awt.AppContext;
 import sun.awt.SunToolkit;
+import sun.awt.AWTAccessor;
 import sun.awt.CausedFocusEvent;
 
@@ -76,4 +77,14 @@
         typeAheadMarkers = new LinkedList();
     private boolean consumeNextKeyTyped;
+
+    static {
+        AWTAccessor.setDefaultKeyboardFocusManagerAccessor(
+            new AWTAccessor.DefaultKeyboardFocusManagerAccessor() {
+                public void consumeNextKeyTyped(DefaultKeyboardFocusManager dkfm,
+                                                KeyEvent e) {
+                    dkfm.consumeNextKeyTyped(e);
+                }
+            });
+    }
 
     private static class TypeAheadMarker {
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/EventQueue.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/EventQueue.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/EventQueue.java	(revision 404)
@@ -43,7 +43,7 @@
 import sun.awt.PeerEvent;
 import sun.awt.SunToolkit;
+import sun.awt.AWTAccessor;
 
 import java.security.AccessControlContext;
-import java.security.ProtectionDomain;
 
 import sun.misc.SharedSecrets;
@@ -160,4 +160,24 @@
     private static final Logger eventLog = Logger.getLogger("java.awt.event.EventQueue");
 
+    static {
+        AWTAccessor.setEventQueueAccessor(
+            new AWTAccessor.EventQueueAccessor() {
+                public boolean noEvents(EventQueue eventQueue) {
+                    return eventQueue.noEvents();
+                }
+                public Thread getDispatchThread(EventQueue eventQueue) {
+                    return eventQueue.dispatchThread;
+                }
+                public EventQueue getNextQueue(EventQueue eventQueue) {
+                    return eventQueue.nextQueue;
+                }
+                public void removeSourceEvents(EventQueue eventQueue,
+                                               Object source,
+                                               boolean removeAllEvents) {
+                    eventQueue.removeSourceEvents(source, removeAllEvents);
+                }
+            });
+    }
+
     public EventQueue() {
         for (int i = 0; i < NUM_PRIORITIES; i++) {
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/Font.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/Font.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/Font.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -810,5 +810,5 @@
         boolean hasPerm = false;
         try {
-            f = File.createTempFile("+~JT", ".tmp", null);
+            f = sun.misc.IOUtils.createTempFile("+~JT", ".tmp", null);
             f.delete();
             f = null;
@@ -861,5 +861,5 @@
                 new PrivilegedExceptionAction<File>() {
                     public File run() throws IOException {
-                        return File.createTempFile("+~JF", ".tmp", null);
+                        return sun.misc.IOUtils.createTempFile("+~JF", ".tmp", null);
                     }
                 }
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/KeyboardFocusManager.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/KeyboardFocusManager.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/KeyboardFocusManager.java	(revision 404)
@@ -61,4 +61,5 @@
 import sun.awt.SunToolkit;
 import sun.awt.CausedFocusEvent;
+import sun.awt.AWTAccessor;
 
 /**
@@ -118,4 +119,22 @@
             initIDs();
         }
+        AWTAccessor.setKeyboardFocusManagerAccessor(
+            new AWTAccessor.KeyboardFocusManagerAccessor() {
+                public int shouldNativelyFocusHeavyweight(Component heavyweight,
+                                                   Component descendant,
+                                                   boolean temporary,
+                                                   boolean focusedWindowChangeAllowed,
+                                                   long time,
+                                                   CausedFocusEvent.Cause cause)
+                {
+                    return KeyboardFocusManager.shouldNativelyFocusHeavyweight(
+                        heavyweight, descendant, temporary, focusedWindowChangeAllowed, time, cause);
+                }
+
+                public void removeLastFocusRequest(Component heavyweight) {
+                    KeyboardFocusManager.removeLastFocusRequest(heavyweight);
+                }
+            }
+        );
     }
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/Menu.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/Menu.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/Menu.java	(revision 404)
@@ -32,4 +32,5 @@
 import java.awt.event.KeyEvent;
 import javax.accessibility.*;
+import sun.awt.AWTAccessor;
 
 /**
@@ -63,4 +64,10 @@
             initIDs();
         }
+        AWTAccessor.setMenuAccessor(
+            new AWTAccessor.MenuAccessor() {
+                public Vector getItems(Menu menu) {
+                    return menu.items;
+                }
+            });
     }
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/MenuBar.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/MenuBar.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/MenuBar.java	(revision 404)
@@ -29,4 +29,5 @@
 import java.util.Vector;
 import java.util.Enumeration;
+import sun.awt.AWTAccessor;
 import java.awt.peer.MenuBarPeer;
 import java.awt.event.KeyEvent;
@@ -75,4 +76,14 @@
             initIDs();
         }
+        AWTAccessor.setMenuBarAccessor(
+            new AWTAccessor.MenuBarAccessor() {
+                public Menu getHelpMenu(MenuBar menuBar) {
+                    return menuBar.helpMenu;
+                }
+
+                public Vector getMenus(MenuBar menuBar) {
+                    return menuBar.menus;
+                }
+            });
     }
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/MenuComponent.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/MenuComponent.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/MenuComponent.java	(revision 404)
@@ -30,5 +30,5 @@
 import java.io.ObjectInputStream;
 import sun.awt.AppContext;
-import sun.awt.SunToolkit;
+import sun.awt.AWTAccessor;
 import javax.accessibility.*;
 
@@ -56,4 +56,20 @@
             initIDs();
         }
+        AWTAccessor.setMenuComponentAccessor(
+            new AWTAccessor.MenuComponentAccessor() {
+                public AppContext getAppContext(MenuComponent menuComp) {
+                    return menuComp.appContext;
+                }
+                public void setAppContext(MenuComponent menuComp,
+                                          AppContext appContext) {
+                    menuComp.appContext = appContext;
+                }
+                public MenuContainer getParent(MenuComponent menuComp) {
+                    return menuComp.parent;
+                }
+                public Font getFont_NoClientCode(MenuComponent menuComp) {
+                    return menuComp.getFont_NoClientCode();
+                }
+            });
     }
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/MenuItem.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/MenuItem.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/MenuItem.java	(revision 404)
@@ -32,5 +32,5 @@
 import java.io.IOException;
 import javax.accessibility.*;
-
+import sun.awt.AWTAccessor;
 
 /**
@@ -77,4 +77,27 @@
             initIDs();
         }
+
+        AWTAccessor.setMenuItemAccessor(
+            new AWTAccessor.MenuItemAccessor() {
+                public boolean isEnabled(MenuItem item) {
+                    return item.enabled;
+                }
+
+                public String getLabel(MenuItem item) {
+                    return item.label;
+                }
+
+                public MenuShortcut getShortcut(MenuItem item) {
+                    return item.shortcut;
+                }
+
+                public String getActionCommandImpl(MenuItem item) {
+                    return item.getActionCommandImpl();
+                }
+
+                public boolean isItemEnabled(MenuItem item) {
+                    return item.isItemEnabled();
+                }
+            });
     }
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/PopupMenu.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/PopupMenu.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/PopupMenu.java	(revision 404)
@@ -29,4 +29,5 @@
 import javax.accessibility.*;
 
+import sun.awt.AWTAccessor;
 
 /**
@@ -48,4 +49,13 @@
 
     transient boolean isTrayIconPopup = false;
+
+    static {
+        AWTAccessor.setPopupMenuAccessor(
+            new AWTAccessor.PopupMenuAccessor() {
+                public boolean isTrayIconPopup(PopupMenu popupMenu) {
+                    return popupMenu.isTrayIconPopup;
+                }
+            });
+    }
 
     /*
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/ScrollPaneAdjustable.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/ScrollPaneAdjustable.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/ScrollPaneAdjustable.java	(revision 404)
@@ -25,4 +25,6 @@
 package java.awt;
 
+import sun.awt.AWTAccessor;
+
 import java.awt.event.AdjustmentEvent;
 import java.awt.event.AdjustmentListener;
@@ -157,4 +159,10 @@
             initIDs();
         }
+        AWTAccessor.setScrollPaneAdjustableAccessor(new AWTAccessor.ScrollPaneAdjustableAccessor() {
+            public void setTypedValue(final ScrollPaneAdjustable adj,
+                                      final int v, final int type) {
+                adj.setTypedValue(v, type);
+            }
+        });
     }
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/Window.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/Window.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/awt/Window.java	(revision 404)
@@ -51,4 +51,5 @@
 import java.util.concurrent.atomic.AtomicBoolean;
 import javax.accessibility.*;
+import sun.awt.AWTAccessor;
 import sun.awt.AppContext;
 import sun.awt.CausedFocusEvent;
@@ -319,4 +320,10 @@
             new GetPropertyAction("java.awt.Window.locationByPlatform"));
         locationByPlatformProp = (s != null && s.equals("true"));
+
+        AWTAccessor.setWindowAccessor(new AWTAccessor.WindowAccessor() {
+            public void setLWRequestStatus(Window changed, boolean status) {
+                changed.syncLWRequests = status;
+            }
+        });
     }
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/beans/Introspector.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/beans/Introspector.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/beans/Introspector.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -140,4 +140,5 @@
 
     private final static String DEFAULT_INFO_PATH = "sun.beans.infos";
+    private final static String DEFAULT_INFO_PATH_NEW = "com.sun.beans.infos";
 
     private static String[] searchPath = { DEFAULT_INFO_PATH };
@@ -461,10 +462,13 @@
 
         for (int i = 0; i < searchPath.length; i++) {
+            String path = searchPath[i];
+            if (DEFAULT_INFO_PATH.equals(path)) {
+                path = DEFAULT_INFO_PATH_NEW;
+            }
             // This optimization will only use the BeanInfo search path if is has changed
             // from the original or trying to get the ComponentBeanInfo.
-            if (!DEFAULT_INFO_PATH.equals(searchPath[i]) ||
-                DEFAULT_INFO_PATH.equals(searchPath[i]) && "ComponentBeanInfo".equals(name)) {
+            if (!DEFAULT_INFO_PATH_NEW.equals(path) || "ComponentBeanInfo".equals(name)) {
                 try {
-                    String fullName = searchPath[i] + "." + name;
+                    String fullName = path + "." + name;
                     java.beans.BeanInfo bi = (java.beans.BeanInfo)instantiate(beanClass, fullName);
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/beans/PropertyEditorManager.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/beans/PropertyEditorManager.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/beans/PropertyEditorManager.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -26,5 +26,5 @@
 package java.beans;
 
-import sun.beans.editors.*;
+import com.sun.beans.editors.*;
 
 /**
@@ -54,4 +54,7 @@
 
 public class PropertyEditorManager {
+
+    private static final String DEFAULT_SEARCH_PATH = "sun.beans.editors";
+    private static final String DEFAULT_SEARCH_PATH_NEW = "com.sun.beans.editors";
 
     /**
@@ -120,5 +123,5 @@
         }
         for (String path : searchPath) {
-            String name = path + '.' + editorName;
+            String name = (DEFAULT_SEARCH_PATH.equals(path) ? DEFAULT_SEARCH_PATH_NEW : path) + '.' + editorName;
             try {
                 return (PropertyEditor) Introspector.instantiate(targetType, name);
@@ -189,5 +192,5 @@
     }
 
-    private static String[] searchPath = { "sun.beans.editors" };
+    private static String[] searchPath = { DEFAULT_SEARCH_PATH };
     private static java.util.Hashtable registry;
 }
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/beans/XMLDecoder.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/beans/XMLDecoder.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/beans/XMLDecoder.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -32,4 +32,8 @@
 import java.lang.ref.Reference;
 import java.lang.ref.WeakReference;
+
+import java.security.AccessControlContext;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 
 import org.xml.sax.SAXException;
@@ -67,4 +71,5 @@
  */
 public class XMLDecoder {
+    private final AccessControlContext acc = AccessController.getContext();
     private InputStream in;
     private Object owner;
@@ -249,23 +254,31 @@
     private ObjectHandler getHandler() {
         if ( handler == null ) {
-            SAXParserFactory factory = SAXParserFactory.newInstance();
-            try {
-                SAXParser parser = factory.newSAXParser();
-                handler = new ObjectHandler( this, getClassLoader() );
-                parser.parse( in, handler );
+            if ((this.acc == null) && (null != System.getSecurityManager())) {
+                throw new SecurityException("AccessControlContext is not set");
             }
-            catch ( ParserConfigurationException e ) {
-                getExceptionListener().exceptionThrown( e );
-            }
-            catch ( SAXException se ) {
-                Exception e = se.getException();
-                if ( e == null ) {
-                    e = se;
+            handler = AccessController.doPrivileged(new PrivilegedAction<ObjectHandler>() {
+                public ObjectHandler run() {
+                    ObjectHandler handler = new ObjectHandler(XMLDecoder.this, getClassLoader());
+                    SAXParserFactory factory = SAXParserFactory.newInstance();
+                    try {
+                        SAXParser parser = factory.newSAXParser();
+                        parser.parse( in, handler );
+                    }
+                    catch ( ParserConfigurationException e ) {
+                        getExceptionListener().exceptionThrown( e );
+                    }
+                    catch ( SAXException se ) {
+                        Exception e = se.getException();
+                        if ( e == null ) {
+                            e = se;
+                        }
+                        getExceptionListener().exceptionThrown( e );
+                    }
+                    catch ( IOException ioe ) {
+                        getExceptionListener().exceptionThrown( ioe );
+                    }
+                    return handler;
                 }
-                getExceptionListener().exceptionThrown( e );
-            }
-            catch ( IOException ioe ) {
-                getExceptionListener().exceptionThrown( ioe );
-            }
+            }, this.acc);
         }
         return handler;
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/io/File.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/io/File.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/io/File.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1994, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -898,5 +898,5 @@
         SecurityManager security = System.getSecurityManager();
         if (security != null) security.checkWrite(path);
-        return fs.createFileExclusively(path);
+        return fs.createFileExclusively(path, false);
     }
 
@@ -1701,5 +1701,6 @@
     }
 
-    private static boolean checkAndCreate(String filename, SecurityManager sm)
+    private static boolean checkAndCreate(String filename, SecurityManager sm,
+                                          boolean restrictive)
         throws IOException
     {
@@ -1714,5 +1715,27 @@
             }
         }
-        return fs.createFileExclusively(filename);
+        return fs.createFileExclusively(filename, restrictive);
+    }
+    
+    // The resulting temporary file may have more restrictive access permission
+    // on some platforms, if restrictive is true.
+    private static File createTempFile0(String prefix, String suffix,
+                                        File directory, boolean restrictive)
+        throws IOException
+    {
+        if (prefix == null) throw new NullPointerException();
+        if (prefix.length() < 3)
+            throw new IllegalArgumentException("Prefix string too short");
+        String s = (suffix == null) ? ".tmp" : suffix;
+        if (directory == null) {
+            String tmpDir = LazyInitialization.temporaryDirectory();
+            directory = new File(tmpDir, fs.prefixLength(tmpDir));
+        }
+        SecurityManager sm = System.getSecurityManager();
+        File f;
+        do {
+            f = generateFile(prefix, s, directory);
+        } while (!checkAndCreate(f.getPath(), sm, restrictive));
+        return f;
     }
 
@@ -1790,18 +1813,5 @@
         throws IOException
     {
-        if (prefix == null) throw new NullPointerException();
-        if (prefix.length() < 3)
-            throw new IllegalArgumentException("Prefix string too short");
-        String s = (suffix == null) ? ".tmp" : suffix;
-        if (directory == null) {
-            String tmpDir = LazyInitialization.temporaryDirectory();
-            directory = new File(tmpDir, fs.prefixLength(tmpDir));
-        }
-        SecurityManager sm = System.getSecurityManager();
-        File f;
-        do {
-            f = generateFile(prefix, s, directory);
-        } while (!checkAndCreate(f.getPath(), sm));
-        return f;
+        return createTempFile0(prefix, suffix, directory, false);
     }
 
@@ -1838,5 +1848,5 @@
         throws IOException
     {
-        return createTempFile(prefix, suffix, null);
+        return createTempFile0(prefix, suffix, null, false);
     }
 
@@ -1960,5 +1970,14 @@
         );
     }
-
-
+    
+    // Set up JavaIOAccess in SharedSecrets
+    static {
+        sun.misc.SharedSecrets.setJavaIOFileAccess(new sun.misc.JavaIOFileAccess() {
+            public File createTempFile(String prefix, String suffix, File directory)
+                throws IOException
+            {
+                return createTempFile0(prefix, suffix, directory, true);
+            }
+        });
+    }
 }
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/io/FilePermission.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/io/FilePermission.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/io/FilePermission.java	(revision 404)
@@ -400,5 +400,5 @@
 
     public int hashCode() {
-        return this.cpath.hashCode();
+        return 0;
     }
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/io/FileSystem.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/io/FileSystem.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/io/FileSystem.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -158,6 +158,11 @@
      * file or directory with the given pathname already exists.  Throw an
      * IOException if an I/O error occurs.
-     */
-    public abstract boolean createFileExclusively(String pathname)
+     *
+     * <p>
+     * The resulting file may have more restrictive access permission
+     * on some platforms, if restrictive is true. 
+     */
+    public abstract boolean createFileExclusively(String pathname,
+                                                  boolean restrictive)
         throws IOException;
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/net/URL.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/net/URL.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/net/URL.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1995, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -29,4 +29,6 @@
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.Hashtable;
 import java.util.StringTokenizer;
@@ -1111,4 +1113,19 @@
     private static Object streamHandlerLock = new Object();
 
+    // special case the gopher protocol, disabled by default
+    private static final String GOPHER = "gopher";
+    private static final String ENABLE_GOPHER_PROP = "jdk.net.registerGopherProtocol";
+    private static final boolean enableGopher = AccessController.doPrivileged(
+        new PrivilegedAction<Boolean>() {
+            public Boolean run() {
+                String prop = System.getProperty(ENABLE_GOPHER_PROP);
+                return prop == null ? false :
+                   (prop.equalsIgnoreCase("false") ? false : true);
+             }
+        });
+
+    // package name of the JDK implementation protocol handlers
+    private static final String JDK_PACKAGE_PREFIX =  "sun.net.www.protocol";
+
     /**
      * Returns the Stream Handler.
@@ -1142,5 +1159,5 @@
                 // REMIND: decide whether to allow the "null" class prefix
                 // or not.
-                packagePrefixList += "sun.net.www.protocol";
+                packagePrefixList += JDK_PACKAGE_PREFIX;
 
                 StringTokenizer packagePrefixIter =
@@ -1152,4 +1169,13 @@
                     String packagePrefix =
                       packagePrefixIter.nextToken().trim();
+
+                    // do not try to instantiate the JDK gopher handler
+                    // unless the system property had been explicitly set
+                    if (protocol.equalsIgnoreCase(GOPHER) &&
+                        packagePrefix.equals(JDK_PACKAGE_PREFIX) &&
+                        !enableGopher) {
+                            continue;
+                    }
+
                     try {
                         String clsName = packagePrefix + "." + protocol +
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/security/AccessController.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/security/AccessController.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/security/AccessController.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -291,9 +291,9 @@
     public static <T> T doPrivilegedWithCombiner(PrivilegedAction<T> action) {
 
-        DomainCombiner dc = null;
         AccessControlContext acc = getStackAccessControlContext();
-        if (acc == null || (dc = acc.getAssignedCombiner()) == null) {
+        if (acc == null) {
             return AccessController.doPrivileged(action);
         }
+        DomainCombiner dc = acc.getAssignedCombiner();
         return AccessController.doPrivileged(action, preserveCombiner(dc));
     }
@@ -387,9 +387,9 @@
         (PrivilegedExceptionAction<T> action) throws PrivilegedActionException {
 
-        DomainCombiner dc = null;
         AccessControlContext acc = getStackAccessControlContext();
-        if (acc == null || (dc = acc.getAssignedCombiner()) == null) {
+        if (acc == null) {
             return AccessController.doPrivileged(action);
         }
+        DomainCombiner dc = acc.getAssignedCombiner();
         return AccessController.doPrivileged(action, preserveCombiner(dc));
     }
@@ -418,5 +418,10 @@
         // even if the caller is from the bootclasspath
         ProtectionDomain[] pds = new ProtectionDomain[] {callerPd};
-        return new AccessControlContext(combiner.combine(pds, null), combiner);
+        if (combiner == null) {
+            return new AccessControlContext(pds);
+        } else {
+            return new AccessControlContext(combiner.combine(pds, null),
+                                            combiner);
+        }
     }
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/util/ServiceLoader.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/util/ServiceLoader.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/util/ServiceLoader.java	(revision 404)
@@ -359,12 +359,19 @@
             String cn = nextName;
             nextName = null;
+            Class<?> c = null;
             try {
-                S p = service.cast(Class.forName(cn, true, loader)
-                                   .newInstance());
-                providers.put(cn, p);
-                return p;
+                c = Class.forName(cn, false, loader);
             } catch (ClassNotFoundException x) {
                 fail(service,
                      "Provider " + cn + " not found");
+            }
+            if (!service.isAssignableFrom(c)) {
+                fail(service,
+                     "Provider " + cn  + " not a subtype");
+            }
+            try {
+                S p = service.cast(c.newInstance());
+                providers.put(cn, p);
+                return p;
             } catch (Throwable x) {
                 fail(service,
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/util/UUID.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/util/UUID.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/util/UUID.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -123,7 +123,9 @@
     /*
      * The random number generator used by this class to create random
-     * based UUIDs.
-     */
-    private static volatile SecureRandom numberGenerator = null;
+     * based UUIDs. In a holder class to defer initialization until needed.
+     */
+    private static class Holder {
+        static final SecureRandom numberGenerator = new SecureRandom();
+    }
 
     // Constructors and Factories
@@ -170,8 +172,5 @@
      */
     public static UUID randomUUID() {
-        SecureRandom ng = numberGenerator;
-        if (ng == null) {
-            numberGenerator = ng = new SecureRandom();
-        }
+        SecureRandom ng = Holder.numberGenerator;
 
         byte[] randomBytes = new byte[16];
@@ -291,5 +290,6 @@
      * <p><ul>
      * <li>0    Reserved for NCS backward compatibility
-     * <li>2    The Leach-Salz variant (used by this class)
+     * <li>2 <a href="http://www.ietf.org/rfc/rfc4122.txt">IETF&nbsp;RFC&nbsp;4122</a>
+     * (Leach-Salz), used by this class
      * <li>6    Reserved, Microsoft Corporation backward compatibility
      * <li>7    Reserved for future definition
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/util/concurrent/Executors.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/util/concurrent/Executors.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/util/concurrent/Executors.java	(revision 404)
@@ -531,16 +531,15 @@
                     new PrivilegedExceptionAction<T>() {
                         public T run() throws Exception {
-                            ClassLoader savedcl = null;
                             Thread t = Thread.currentThread();
-                            try {
-                                ClassLoader cl = t.getContextClassLoader();
-                                if (ccl != cl) {
-                                    t.setContextClassLoader(ccl);
-                                    savedcl = cl;
+                            ClassLoader cl = t.getContextClassLoader();
+                            if (ccl == cl) {
+                                return task.call();
+                            } else {
+                                t.setContextClassLoader(ccl);
+                                try {
+                                    return task.call();
+                                } finally {
+                                    t.setContextClassLoader(cl);
                                 }
-                                return task.call();
-                            } finally {
-                                if (savedcl != null)
-                                    t.setContextClassLoader(savedcl);
                             }
                         }
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/util/logging/FileHandler.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/util/logging/FileHandler.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/util/logging/FileHandler.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -221,5 +221,5 @@
      */
     public FileHandler() throws IOException, SecurityException {
-        checkAccess();
+        checkPermission();
         configure();
         openFiles();
@@ -247,5 +247,5 @@
             throw new IllegalArgumentException();
         }
-        checkAccess();
+        checkPermission();
         configure();
         this.pattern = pattern;
@@ -279,5 +279,5 @@
             throw new IllegalArgumentException();
         }
-        checkAccess();
+        checkPermission();
         configure();
         this.pattern = pattern;
@@ -316,5 +316,5 @@
             throw new IllegalArgumentException();
         }
-        checkAccess();
+        checkPermission();
         configure();
         this.pattern = pattern;
@@ -355,5 +355,5 @@
             throw new IllegalArgumentException();
         }
-        checkAccess();
+        checkPermission();
         configure();
         this.pattern = pattern;
@@ -368,5 +368,5 @@
     private void openFiles() throws IOException {
         LogManager manager = LogManager.getLogManager();
-        manager.checkAccess();
+        manager.checkPermission();
         if (count < 1) {
            throw new IllegalArgumentException("file count = " + count);
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/util/logging/Handler.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/util/logging/Handler.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/util/logging/Handler.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -112,5 +112,5 @@
      */
     public void setFormatter(Formatter newFormatter) throws SecurityException {
-        checkAccess();
+        checkPermission();
         // Check for a null pointer:
         newFormatter.getClass();
@@ -141,5 +141,5 @@
     public void setEncoding(String encoding)
                         throws SecurityException, java.io.UnsupportedEncodingException {
-        checkAccess();
+        checkPermission();
         if (encoding != null) {
             try {
@@ -176,5 +176,5 @@
      */
     public void setFilter(Filter newFilter) throws SecurityException {
-        checkAccess();
+        checkPermission();
         filter = newFilter;
     }
@@ -200,5 +200,5 @@
      */
     public void setErrorManager(ErrorManager em) {
-        checkAccess();
+        checkPermission();
         if (em == null) {
            throw new NullPointerException();
@@ -214,5 +214,5 @@
      */
     public ErrorManager getErrorManager() {
-        checkAccess();
+        checkPermission();
         return errorManager;
     }
@@ -254,5 +254,5 @@
             throw new NullPointerException();
         }
-        checkAccess();
+        checkPermission();
         logLevel = newLevel;
     }
@@ -297,7 +297,7 @@
     // appropriate security privileges to update Handler
     // state and if not throw a SecurityException.
-    void checkAccess() throws SecurityException {
+    void checkPermission() throws SecurityException {
         if (sealed) {
-            manager.checkAccess();
+            manager.checkPermission();
         }
     }
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/util/logging/LogManager.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/util/logging/LogManager.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/util/logging/LogManager.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -304,5 +304,5 @@
             throw new NullPointerException();
         }
-        checkAccess();
+        checkPermission();
         changes.addPropertyChangeListener(l);
     }
@@ -323,5 +323,5 @@
      */
     public void removePropertyChangeListener(PropertyChangeListener l) throws SecurityException {
-        checkAccess();
+        checkPermission();
         changes.removePropertyChangeListener(l);
     }
@@ -741,5 +741,5 @@
      */
     public void readConfiguration() throws IOException, SecurityException {
-        checkAccess();
+        checkPermission();
 
         // if a configuration class is specified, load it and use it.
@@ -799,5 +799,5 @@
 
     public void reset() throws SecurityException {
-        checkAccess();
+        checkPermission();
         synchronized (this) {
             props = new Properties();
@@ -884,5 +884,5 @@
      */
     public void readConfiguration(InputStream ins) throws IOException, SecurityException {
-        checkAccess();
+        checkPermission();
         reset();
 
@@ -1046,5 +1046,11 @@
 
 
-    private Permission ourPermission = new LoggingPermission("control", null);
+    private final Permission controlPermission = new LoggingPermission("control", null);
+  
+    void checkPermission() {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm != null)
+            sm.checkPermission(controlPermission);
+    }
 
     /**
@@ -1059,9 +1065,5 @@
      */
     public void checkAccess() throws SecurityException {
-        SecurityManager sm = System.getSecurityManager();
-        if (sm == null) {
-            return;
-        }
-        sm.checkPermission(ourPermission);
+        checkPermission();
     }
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/util/logging/Logger.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/util/logging/Logger.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/util/logging/Logger.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -267,5 +267,5 @@
     }
 
-    private void checkAccess() throws SecurityException {
+    private void checkPermission() throws SecurityException {
         if (!anonymous) {
             if (manager == null) {
@@ -273,5 +273,5 @@
                 manager = LogManager.getLogManager();
             }
-            manager.checkAccess();
+            manager.checkPermission();
         }
     }
@@ -455,5 +455,5 @@
      */
     public synchronized void setFilter(Filter newFilter) throws SecurityException {
-        checkAccess();
+        checkPermission();
         filter = newFilter;
     }
@@ -1146,5 +1146,5 @@
      */
     public void setLevel(Level newLevel) throws SecurityException {
-        checkAccess();
+        checkPermission();
         synchronized (treeLock) {
             levelObject = newLevel;
@@ -1201,5 +1201,5 @@
         // Check for null handler
         handler.getClass();
-        checkAccess();
+        checkPermission();
         if (handlers == null) {
             handlers = new ArrayList<Handler>();
@@ -1218,5 +1218,5 @@
      */
     public synchronized void removeHandler(Handler handler) throws SecurityException {
-        checkAccess();
+        checkPermission();
         if (handler == null) {
             return;
@@ -1252,5 +1252,5 @@
      */
     public synchronized void setUseParentHandlers(boolean useParentHandlers) {
-        checkAccess();
+        checkPermission();
         this.useParentHandlers = useParentHandlers;
     }
@@ -1389,5 +1389,5 @@
             throw new NullPointerException();
         }
-        manager.checkAccess();
+        manager.checkPermission();
         doSetParent(parent);
     }
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/util/logging/MemoryHandler.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/util/logging/MemoryHandler.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/util/logging/MemoryHandler.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -239,5 +239,5 @@
         }
         LogManager manager = LogManager.getLogManager();
-        checkAccess();
+        checkPermission();
         pushLevel = newLevel;
     }
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/util/logging/StreamHandler.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/util/logging/StreamHandler.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/java/util/logging/StreamHandler.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -250,5 +250,5 @@
 
     private synchronized void flushAndClose() throws SecurityException {
-        checkAccess();
+        checkPermission();
         if (writer != null) {
             try {
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/javax/crypto/CipherSpi.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/javax/crypto/CipherSpi.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/javax/crypto/CipherSpi.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -743,5 +743,5 @@
             byte[] inArray = new byte[getTempArraySize(inLen)];
             int total = 0;
-            while (inLen > 0) {
+            do { 
                 int chunk = Math.min(inLen, inArray.length);
                 input.get(inArray, 0, chunk);
@@ -755,5 +755,5 @@
                 outOfs += n;
                 inLen -= chunk;
-            }
+            } while (inLen > 0); 
             output.position(outPos + total);
             return total;
@@ -772,5 +772,5 @@
             int total = 0;
             boolean resized = false;
-            while (inLen > 0) {
+            do {
                 int chunk = Math.min(inLen, outSize);
                 if ((a1 == false) && (resized == false)) {
@@ -802,5 +802,5 @@
                     outArray = new byte[newOut];
                 }
-            }
+            } while (inLen > 0); 
             input.position(inLimit);
             return total;
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/javax/imageio/stream/FileCacheImageInputStream.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/javax/imageio/stream/FileCacheImageInputStream.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/javax/imageio/stream/FileCacheImageInputStream.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -99,5 +99,5 @@
         this.stream = stream;
         this.cacheFile =
-            File.createTempFile("imageio", ".tmp", cacheDir);
+            sun.misc.IOUtils.createTempFile("imageio", ".tmp", cacheDir);
         this.cache = new RandomAccessFile(cacheFile, "rw");
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/javax/imageio/stream/FileCacheImageOutputStream.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/javax/imageio/stream/FileCacheImageOutputStream.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/javax/imageio/stream/FileCacheImageOutputStream.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -85,5 +85,5 @@
         this.stream = stream;
         this.cacheFile =
-            File.createTempFile("imageio", ".tmp", cacheDir);
+            sun.misc.IOUtils.createTempFile("imageio", ".tmp", cacheDir);
         this.cache = new RandomAccessFile(cacheFile, "rw");
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/javax/management/loading/MLet.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/javax/management/loading/MLet.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/javax/management/loading/MLet.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -1153,5 +1153,5 @@
                  File directory = new File(libraryDirectory);
                  directory.mkdirs();
-                 File file = File.createTempFile(libname + ".", null, directory);
+                 File file = sun.misc.IOUtils.createTempFile(libname + ".", null, directory);
                  file.deleteOnExit();
                  FileOutputStream fileOutput = new FileOutputStream(file);
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/javax/management/modelmbean/DescriptorSupport.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/javax/management/modelmbean/DescriptorSupport.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/javax/management/modelmbean/DescriptorSupport.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -1240,11 +1240,10 @@
         }
         final String className = s.substring(1, slash);
+        
         final Constructor<?> constr;
         try {
+            ReflectUtil.checkPackageAccess(className);
             final ClassLoader contextClassLoader =
                 Thread.currentThread().getContextClassLoader();
-            if (contextClassLoader == null) {
-                ReflectUtil.checkPackageAccess(className);
-            }
             final Class<?> c =
                 Class.forName(className, false, contextClassLoader);
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -40,9 +40,15 @@
 import java.rmi.UnmarshalException;
 import java.rmi.server.Unreferenced;
+
 import java.security.AccessControlContext;
 import java.security.AccessController;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Permissions;
 import java.security.PrivilegedAction;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
+import java.security.ProtectionDomain;
+
 import java.util.Arrays;
 import java.util.Collections;
@@ -61,4 +67,5 @@
 import javax.management.MBeanInfo;
 import javax.management.MBeanRegistrationException;
+import javax.management.MBeanPermission;
 import javax.management.MBeanServer;
 import javax.management.NotCompliantMBeanException;
@@ -145,4 +152,5 @@
 
         final ClassLoader dcl = defaultClassLoader;
+
         this.classLoaderWithRepository =
             AccessController.doPrivileged(
@@ -150,13 +158,36 @@
                     public ClassLoaderWithRepository run() {
                         return new ClassLoaderWithRepository(
-                                              getClassLoaderRepository(),
+                                              mbeanServer.getClassLoaderRepository(),
                                               dcl);
                     }
+                 },
+
+                 withPermissions( new MBeanPermission("*", "getClassLoaderRepository"),
+                                 new RuntimePermission("createClassLoader"))
+            );
+        this.defaultContextClassLoader =
+            AccessController.doPrivileged(
+                new PrivilegedAction<ClassLoader>() {
+                    @Override
+                    public ClassLoader run() {
+                        return new CombinedClassLoader(Thread.currentThread().getContextClassLoader(),
+                                dcl);
+                    }
                 });
-
-        serverCommunicatorAdmin = new
-          RMIServerCommunicatorAdmin(EnvHelp.getServerConnectionTimeout(env));
+        serverCommunicatorAdmin = new 
+            RMIServerCommunicatorAdmin(EnvHelp.getServerConnectionTimeout(env));
 
         this.env = env;
+    }
+
+    private static AccessControlContext withPermissions(Permission ... perms){
+        Permissions col = new Permissions();
+
+        for (Permission thePerm : perms ) {
+            col.add(thePerm);
+        }
+
+        final ProtectionDomain pd = new ProtectionDomain(null, col);
+        return new AccessControlContext( new ProtectionDomain[] { pd });
     }
 
@@ -507,5 +538,5 @@
                  +" unwrapping query with defaultClassLoader.");
 
-        queryValue = unwrap(query, defaultClassLoader, QueryExp.class);
+	queryValue = unwrap(query, defaultContextClassLoader, QueryExp.class);
 
         try {
@@ -541,5 +572,5 @@
                  +" unwrapping query with defaultClassLoader.");
 
-        queryValue = unwrap(query, defaultClassLoader, QueryExp.class);
+	queryValue = unwrap(query, defaultContextClassLoader, QueryExp.class);
 
         try {
@@ -1315,14 +1346,4 @@
     //------------------------------------------------------------------------
 
-    private ClassLoaderRepository getClassLoaderRepository() {
-        return
-            AccessController.doPrivileged(
-                new PrivilegedAction<ClassLoaderRepository>() {
-                    public ClassLoaderRepository run() {
-                        return mbeanServer.getClassLoaderRepository();
-                    }
-                });
-    }
-
     private ClassLoader getClassLoader(final ObjectName name)
         throws InstanceNotFoundException {
@@ -1334,5 +1355,7 @@
                             return mbeanServer.getClassLoader(name);
                         }
-                    });
+                    },
+                    withPermissions(new MBeanPermission("*", "getClassLoader"))
+            );
         } catch (PrivilegedActionException pe) {
             throw (InstanceNotFoundException) extractException(pe);
@@ -1349,5 +1372,7 @@
                             return mbeanServer.getClassLoaderFor(name);
                         }
-                    });
+                    },
+                    withPermissions(new MBeanPermission("*", "getClassLoaderFor"))
+            );
         } catch (PrivilegedActionException pe) {
             throw (InstanceNotFoundException) extractException(pe);
@@ -1576,5 +1601,6 @@
                 new PrivilegedExceptionAction<ClassLoader>() {
                     public ClassLoader run() throws Exception {
-                        return new OrderClassLoaders(cl1, cl2);
+                        return new CombinedClassLoader(Thread.currentThread().getContextClassLoader(),
+                                new OrderClassLoaders(cl1, cl2));
                     }
                 }
@@ -1668,4 +1694,6 @@
     private final ClassLoader defaultClassLoader;
 
+    private final ClassLoader defaultContextClassLoader;
+
     private final ClassLoaderWithRepository classLoaderWithRepository;
 
@@ -1752,3 +1780,42 @@
     private static final ClassLogger logger =
         new ClassLogger("javax.management.remote.rmi", "RMIConnectionImpl");
+    
+    private static final class CombinedClassLoader extends ClassLoader {
+        
+        private final static class ClassLoaderWrapper extends ClassLoader {
+            ClassLoaderWrapper(ClassLoader cl) {
+                super(cl);
+            }
+            
+            @Override
+            protected Class<?> loadClass(String name, boolean resolve) 
+                    throws ClassNotFoundException {
+                return super.loadClass(name, resolve);
+            }
+        };
+        
+        final ClassLoaderWrapper defaultCL;
+        
+        private CombinedClassLoader(ClassLoader parent, ClassLoader defaultCL) {
+            super(parent);
+            this.defaultCL = new ClassLoaderWrapper(defaultCL);
+        }
+        
+        @Override
+        protected Class<?> loadClass(String name, boolean resolve)
+        throws ClassNotFoundException {
+            try {
+                super.loadClass(name, resolve);
+            } catch(Exception e) {
+                for(Throwable t = e; t != null; t = t.getCause()) {
+                    if(t instanceof SecurityException) {
+                        throw t==e?(SecurityException)t:new SecurityException(t.getMessage(), e);
+                    }
+                }
+            }
+            final Class<?> cl = defaultCL.loadClass(name, resolve);
+            return cl;
+        }
+        
+    }
 }
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/javax/swing/ClientPropertyKey.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/javax/swing/ClientPropertyKey.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/javax/swing/ClientPropertyKey.java	(revision 404)
@@ -25,4 +25,6 @@
 
 package javax.swing;
+
+import sun.awt.AWTAccessor;
 
 /**
@@ -87,4 +89,13 @@
     private final boolean reportValueNotSerializable;
 
+    static {
+        AWTAccessor.setClientPropertyKeyAccessor(
+            new AWTAccessor.ClientPropertyKeyAccessor() {
+                public Object getJComponent_TRANSFER_HANDLER() {
+                    return JComponent_TRANSFER_HANDLER;
+                }
+            });
+    }
+
     /**
      * Constructs a key with the {@code reportValueNotSerializable} property
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/javax/swing/plaf/synth/SynthButtonUI.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/javax/swing/plaf/synth/SynthButtonUI.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/javax/swing/plaf/synth/SynthButtonUI.java	(revision 404)
@@ -136,6 +136,6 @@
             state = DISABLED;
         }
-        if (SynthLookAndFeel.selectedUI == this) {
-            return SynthLookAndFeel.selectedUIState | SynthConstants.ENABLED;
+        if (SynthLookAndFeel.getSelectedUI() == this) {
+            return SynthLookAndFeel.getSelectedUIState() | SynthConstants.ENABLED;
         }
         AbstractButton button = (AbstractButton) c;
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/javax/swing/plaf/synth/SynthLabelUI.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/javax/swing/plaf/synth/SynthLabelUI.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/javax/swing/plaf/synth/SynthLabelUI.java	(revision 404)
@@ -95,7 +95,7 @@
     private int getComponentState(JComponent c) {
         int state = SynthLookAndFeel.getComponentState(c);
-        if (SynthLookAndFeel.selectedUI == this &&
+        if (SynthLookAndFeel.getSelectedUI() == this &&
                         state == SynthConstants.ENABLED) {
-            state = SynthLookAndFeel.selectedUIState | SynthConstants.ENABLED;
+            state = SynthLookAndFeel.getSelectedUIState() | SynthConstants.ENABLED;
         }
         return state;
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java	(revision 404)
@@ -79,4 +79,14 @@
 
     /**
+     * AppContext key to get selectedUI.
+     */
+    private static final Object SELECTED_UI_KEY = new StringBuilder("selectedUI");
+
+    /**
+     * AppContext key to get selectedUIState.
+     */
+    private static final Object SELECTED_UI_STATE_KEY = new StringBuilder("selectedUIState");
+
+    /**
      * The last SynthStyleFactory that was asked for from AppContext
      * <code>lastContext</code>.
@@ -84,19 +94,7 @@
     private static SynthStyleFactory lastFactory;
     /**
-     * If this is true it indicates there is more than one AppContext active
-     * and that we need to make sure in getStyleCache the requesting
-     * AppContext matches that of <code>lastContext</code> before returning
-     * it.
-     */
-    private static boolean multipleApps;
-    /**
      * AppContext lastLAF came from.
      */
     private static AppContext lastContext;
-
-    // Refer to setSelectedUI
-    static ComponentUI selectedUI;
-    // Refer to setSelectedUI
-    static int selectedUIState;
 
     /**
@@ -112,4 +110,8 @@
 
     private Handler _handler;
+
+    static ComponentUI getSelectedUI() {
+        return (ComponentUI) AppContext.getAppContext().get(SELECTED_UI_KEY);
+    }
 
     /**
@@ -124,6 +126,6 @@
                               boolean focused, boolean enabled,
                               boolean rollover) {
-        selectedUI = uix;
-        selectedUIState = 0;
+        int selectedUIState = 0;
+
         if (selected) {
             selectedUIState = SynthConstants.SELECTED;
@@ -142,5 +144,7 @@
             if (enabled) {
                 selectedUIState |= SynthConstants.ENABLED;
-                selectedUIState = SynthConstants.FOCUSED;
+                if (focused) {
+                    selectedUIState |= SynthConstants.FOCUSED;
+                }
             }
             else {
@@ -148,4 +152,15 @@
             }
         }
+
+        AppContext context = AppContext.getAppContext();
+
+        context.put(SELECTED_UI_KEY, uix);
+        context.put(SELECTED_UI_STATE_KEY, Integer.valueOf(selectedUIState));
+    }
+
+    static int getSelectedUIState() {
+        Integer result = (Integer) AppContext.getAppContext().get(SELECTED_UI_STATE_KEY);
+
+        return result == null ? 0 : result.intValue();
     }
 
@@ -154,5 +169,5 @@
      */
     static void resetSelectedUI() {
-        selectedUI = null;
+        AppContext.getAppContext().remove(SELECTED_UI_KEY);
     }
 
@@ -169,8 +184,4 @@
         synchronized(SynthLookAndFeel.class) {
             AppContext context = AppContext.getAppContext();
-            if (!multipleApps && context != lastContext &&
-                                 lastContext != null) {
-                multipleApps = true;
-            }
             lastFactory = cache;
             lastContext = context;
@@ -186,7 +197,4 @@
     public static SynthStyleFactory getStyleFactory() {
         synchronized(SynthLookAndFeel.class) {
-            if (!multipleApps) {
-                return lastFactory;
-            }
             AppContext context = AppContext.getAppContext();
 
@@ -195,6 +203,5 @@
             }
             lastContext = context;
-            lastFactory = (SynthStyleFactory)AppContext.getAppContext().get
-                                           (STYLE_FACTORY_KEY);
+            lastFactory = (SynthStyleFactory) context.get(STYLE_FACTORY_KEY);
             return lastFactory;
         }
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/javax/swing/text/DefaultFormatter.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/javax/swing/text/DefaultFormatter.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/javax/swing/text/DefaultFormatter.java	(revision 404)
@@ -24,4 +24,6 @@
  */
 package javax.swing.text;
+
+import sun.reflect.misc.ConstructorUtil;
 
 import java.io.Serializable;
@@ -246,5 +248,5 @@
 
             try {
-                cons = vc.getConstructor(new Class[] { String.class });
+                cons = ConstructorUtil.getConstructor(vc, new Class[]{String.class});
 
             } catch (NoSuchMethodException nsme) {
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/awt/AWTAccessor.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/awt/AWTAccessor.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/awt/AWTAccessor.java	(revision 404)
@@ -27,13 +27,12 @@
 
 import java.awt.*;
-import java.awt.event.InputEvent;
-import java.awt.geom.Point2D;
-import java.awt.image.BufferedImage;
 
 import sun.misc.Unsafe;
-import java.awt.peer.ComponentPeer;
-
-import java.security.AccessController;
+
 import java.security.AccessControlContext;
+
+import java.util.Vector;
+
+import java.awt.event.KeyEvent;
 
 /**
@@ -56,12 +55,62 @@
     }
 
+    /**
+     * An interface of an accessor for java.awt.Window class.
+     */
+    public interface WindowAccessor {
+        /**
+         * Sets the synchronous status of focus requests on lightweight
+         * components in the specified window to the specified value.
+         */
+        void setLWRequestStatus(Window changed, boolean status);
+    }
+
     /*
      * An interface of accessor for the java.awt.Component class.
      */
     public interface ComponentAccessor {
+        /**
+         * Returns the appContext of the component.
+         */
+        AppContext getAppContext(Component comp);
+
+        /**
+         * Sets the appContext of the component.
+         */
+        void setAppContext(Component comp, AppContext appContext);
+
         /*
          * Returns the acc this component was constructed with.
          */
         AccessControlContext getAccessControlContext(Component comp);
+
+        /**
+         * Requests that this Component get the input focus, if this
+         * Component's top-level ancestor is already the focused Window
+         */
+        boolean requestFocusInWindow(Component comp, CausedFocusEvent.Cause cause);
+
+        /**
+         * Requests that this Component get the input focus, providing the cause
+         */
+        void requestFocus(Component comp, CausedFocusEvent.Cause cause);
+    }
+
+    /**
+     * An interface of accessor for the KeyboardFocusManager class.
+     */
+    public interface KeyboardFocusManagerAccessor {
+        /**
+         * Indicates whether the native implementation should
+         * proceed with a pending focus request for the heavyweight.
+         */
+        int shouldNativelyFocusHeavyweight(Component heavyweight,
+                                           Component descendant,
+                                           boolean temporary,
+                                           boolean focusedWindowChangeAllowed,
+                                           long time,
+                                           CausedFocusEvent.Cause cause);
+
+        void removeLastFocusRequest(Component heavyweight);
     }
 
@@ -70,4 +119,9 @@
      */
     public interface AWTEventAccessor {
+        /**
+         * Marks the event as posted.
+         */
+        void setPosted(AWTEvent ev);
+
         /**
          * Sets the flag on this AWTEvent indicating that it was
@@ -81,5 +135,4 @@
         boolean isSystemGenerated(AWTEvent ev);
 
-
         /*
          * Returns the acc this event was constructed with.
@@ -87,4 +140,188 @@
         AccessControlContext getAccessControlContext(AWTEvent ev);
 
+        /**
+         * Returns binary data associated with this event;
+         */
+        byte[] getBData(AWTEvent ev);
+
+       /**
+         * Associates binary data with this event;
+         */
+        void setBData(AWTEvent ev, byte[] bdata);
+}
+
+    /**
+     * An accessor for the MenuComponent class.
+     */
+    public interface MenuComponentAccessor {
+        /**
+         * Returns the appContext of the menu component.
+         */
+        AppContext getAppContext(MenuComponent menuComp);
+
+        /**
+         * Sets the appContext of the menu component.
+         */
+        void setAppContext(MenuComponent menuComp, AppContext appContext);
+
+        /**
+         * Returns the parent container for this menu component.
+         */
+        MenuContainer getParent(MenuComponent menuComp);
+
+        /**
+         * Gets the font used for this menu component.
+         */
+        Font getFont_NoClientCode(MenuComponent menuComp);
+    }
+
+    /** An accessor for the EventQueue class
+     */
+    public interface EventQueueAccessor {
+        /**
+         * Returns whether an event is pending on any of the separate Queues.
+         */
+        boolean noEvents(EventQueue eventQueue);
+
+        /**
+         * Returns dispatch thread for the given EventQueue which has private access
+         */
+        Thread getDispatchThread(EventQueue eventQueue);
+
+        /**
+         * Returns next queue for the given EventQueue which has private access
+         */
+        EventQueue getNextQueue(EventQueue eventQueue);
+
+        /**
+         * Removes any pending events for the specified source object.
+         */
+        void removeSourceEvents(EventQueue eventQueue, Object source,
+                                boolean removeAllEvents);
+    }
+
+    /**
+     * An accessor for the PopupMenu class
+     */
+    public interface PopupMenuAccessor {
+        /**
+         * Returns whether the popup menu is attached to a tray
+         */
+        boolean isTrayIconPopup(PopupMenu popupMenu);
+    }
+
+    /**
+     * An accessor for the ScrollPaneAdjustable class.
+     */
+    public interface ScrollPaneAdjustableAccessor {
+        /**
+         * Sets the value of this scrollbar to the specified value.
+         */
+        void setTypedValue(final ScrollPaneAdjustable adj, final int v,
+                           final int type);
+    }
+
+    /**
+     * An accessor for the CheckboxMenuItem class
+     */
+    public interface CheckboxMenuItemAccessor {
+        /**
+         * Returns whether menu item is checked
+         */
+        boolean getState(CheckboxMenuItem cmi);
+    }
+
+    /**
+     * An accessor for the Cursor class
+     */
+    public interface CursorAccessor {
+        /**
+         * Returns pData of the Cursor class
+         */
+        long getPData(Cursor cursor);
+
+        /**
+         * Sets pData to the Cursor class
+         */
+        void setPData(Cursor cursor, long pData);
+
+        /**
+         * Return type of the Cursor class
+         */
+        int getType(Cursor cursor);
+    }
+
+    /**
+     * An accessor for the MenuBar class
+     */
+    public interface MenuBarAccessor {
+        /**
+         * Returns help menu
+         */
+        Menu getHelpMenu(MenuBar menuBar);
+
+        /**
+         * Returns menus
+         */
+        Vector getMenus(MenuBar menuBar);
+    }
+
+    /**
+     * An accessor for the MenuItem class
+     */
+    public interface MenuItemAccessor {
+        /**
+         * Returns whether menu item is enabled
+         */
+        boolean isEnabled(MenuItem item);
+
+        /**
+         * Gets the command name of the action event that is fired
+         * by this menu item.
+         */
+        String getActionCommandImpl(MenuItem item);
+
+        /**
+         * Returns true if the item and all its ancestors are
+         * enabled, false otherwise
+         */
+        boolean isItemEnabled(MenuItem item);
+
+        /**
+         * Returns label
+         */
+        String getLabel(MenuItem item);
+
+        /**
+         * Returns shortcut
+         */
+        MenuShortcut getShortcut(MenuItem item);
+    }
+
+    /**
+     * An accessor for the Menu class
+     */
+    public interface MenuAccessor {
+        /**
+         * Returns vector of the items that are part of the Menu
+         */
+        Vector getItems(Menu menu);
+    }
+
+    /**
+     * An accessor for the ClientPropertyKey class
+     */
+    public interface ClientPropertyKeyAccessor {
+        /**
+         * Retrieves JComponent_TRANSFER_HANDLER enum object
+         */
+        Object getJComponent_TRANSFER_HANDLER();
+    }
+
+    /**
+     * An accessor for the DefaultKeyboardFocusManager class
+     */
+    public interface DefaultKeyboardFocusManagerAccessor {
+        void consumeNextKeyTyped(DefaultKeyboardFocusManager dkfm, KeyEvent e);
     }
 
@@ -93,6 +330,37 @@
      * corresponding AWT classes by using setters defined below.
      */
+    private static WindowAccessor windowAccessor;
     private static ComponentAccessor componentAccessor;
+    private static KeyboardFocusManagerAccessor kfmAccessor;
     private static AWTEventAccessor awtEventAccessor;
+    private static MenuComponentAccessor menuComponentAccessor;
+    private static EventQueueAccessor eventQueueAccessor;
+    private static PopupMenuAccessor popupMenuAccessor;
+    private static ScrollPaneAdjustableAccessor scrollPaneAdjustableAccessor;
+    private static CheckboxMenuItemAccessor checkboxMenuItemAccessor;
+    private static CursorAccessor cursorAccessor;
+    private static MenuBarAccessor menuBarAccessor;
+    private static MenuItemAccessor menuItemAccessor;
+    private static MenuAccessor menuAccessor;
+    private static ClientPropertyKeyAccessor clientPropertyKeyAccessor;
+    private static DefaultKeyboardFocusManagerAccessor defaultKeyboardFocusManagerAccessor;
+
+    /**
+     * Set an accessor object for the java.awt.Window class.
+     */
+    public static void setWindowAccessor(WindowAccessor wa) {
+        windowAccessor = wa;
+    }
+
+    /**
+     * Retrieve the accessor object for the java.awt.Window class.
+     */
+    public static WindowAccessor getWindowAccessor() {
+        if (windowAccessor == null) {
+            unsafe.ensureClassInitialized(Window.class);
+        }
+
+        return windowAccessor;
+    }
 
     /*
@@ -114,4 +382,21 @@
     }
 
+    /**
+     * Set an accessor object for the java.awt.KeyboardFocusManager class.
+     */
+    public static void setKeyboardFocusManagerAccessor(KeyboardFocusManagerAccessor kfma) {
+        kfmAccessor = kfma;
+    }
+
+    /**
+     * Retrieve the accessor object for the java.awt.KeyboardFocusManager class.
+     */
+    public static KeyboardFocusManagerAccessor getKeyboardFocusManagerAccessor() {
+        if (kfmAccessor == null) {
+            unsafe.ensureClassInitialized(KeyboardFocusManager.class);
+        }
+        return kfmAccessor;
+    }
+
     /*
      * Set an accessor object for the java.awt.AWTEvent class.
@@ -130,3 +415,193 @@
         return awtEventAccessor;
     }
+
+    /**
+     * Set an accessor object for the java.awt.MenuComponent class.
+     */
+    public static void setMenuComponentAccessor(MenuComponentAccessor mca) {
+        menuComponentAccessor = mca;
+    }
+
+    /**
+     * Retrieve the accessor object for the java.awt.MenuComponent class.
+     */
+    public static MenuComponentAccessor getMenuComponentAccessor() {
+        if (menuComponentAccessor == null) {
+            unsafe.ensureClassInitialized(MenuComponent.class);
+        }
+
+        return menuComponentAccessor;
+    }
+
+    /**
+     * Set an accessor object for the java.awt.EventQueue class.
+     */
+    public static void setEventQueueAccessor(EventQueueAccessor eqa) {
+        eventQueueAccessor = eqa;
+    }
+
+    /**
+     * Retrieve the accessor object for the java.awt.EventQueue class.
+     */
+    public static EventQueueAccessor getEventQueueAccessor() {
+        if (eventQueueAccessor == null) {
+            unsafe.ensureClassInitialized(EventQueue.class);
+        }
+        return eventQueueAccessor;
+    }
+
+    /**
+     * Set an accessor object for the java.awt.PopupMenu class.
+     */
+    public static void setPopupMenuAccessor(PopupMenuAccessor pma) {
+        popupMenuAccessor = pma;
+    }
+
+    /**
+     * Retrieve the accessor object for the java.awt.PopupMenu class.
+     */
+    public static PopupMenuAccessor getPopupMenuAccessor() {
+        if (popupMenuAccessor == null) {
+            unsafe.ensureClassInitialized(PopupMenu.class);
+        }
+        return popupMenuAccessor;
+    }
+
+    /**
+     * Set an accessor object for the java.awt.ScrollPaneAdjustable class.
+     */
+    public static void setScrollPaneAdjustableAccessor(ScrollPaneAdjustableAccessor adj) {
+        scrollPaneAdjustableAccessor = adj;
+    }
+
+    /**
+     * Retrieve the accessor object for the java.awt.ScrollPaneAdjustable
+     * class.
+     */
+    public static ScrollPaneAdjustableAccessor getScrollPaneAdjustableAccessor() {
+        if (scrollPaneAdjustableAccessor == null) {
+            unsafe.ensureClassInitialized(ScrollPaneAdjustable.class);
+        }
+        return scrollPaneAdjustableAccessor;
+    }
+
+    /**
+     * Set an accessor object for the java.awt.CheckboxMenuItem class.
+     */
+    public static void setCheckboxMenuItemAccessor(CheckboxMenuItemAccessor cmia) {
+        checkboxMenuItemAccessor = cmia;
+    }
+
+    /**
+     * Retrieve the accessor object for the java.awt.CheckboxMenuItem class.
+     */
+    public static CheckboxMenuItemAccessor getCheckboxMenuItemAccessor() {
+        if (checkboxMenuItemAccessor == null) {
+            unsafe.ensureClassInitialized(CheckboxMenuItemAccessor.class);
+        }
+        return checkboxMenuItemAccessor;
+    }
+
+    /**
+     * Set an accessor object for the java.awt.Cursor class.
+     */
+    public static void setCursorAccessor(CursorAccessor ca) {
+        cursorAccessor = ca;
+    }
+
+    /**
+     * Retrieve the accessor object for the java.awt.Cursor class.
+     */
+    public static CursorAccessor getCursorAccessor() {
+        if (cursorAccessor == null) {
+            unsafe.ensureClassInitialized(CursorAccessor.class);
+        }
+        return cursorAccessor;
+    }
+
+    /**
+     * Set an accessor object for the java.awt.MenuBar class.
+     */
+    public static void setMenuBarAccessor(MenuBarAccessor mba) {
+        menuBarAccessor = mba;
+    }
+
+    /**
+     * Retrieve the accessor object for the java.awt.MenuBar class.
+     */
+    public static MenuBarAccessor getMenuBarAccessor() {
+        if (menuBarAccessor == null) {
+            unsafe.ensureClassInitialized(MenuBarAccessor.class);
+        }
+        return menuBarAccessor;
+    }
+
+    /**
+     * Set an accessor object for the java.awt.MenuItem class.
+     */
+    public static void setMenuItemAccessor(MenuItemAccessor mia) {
+        menuItemAccessor = mia;
+    }
+
+    /**
+     * Retrieve the accessor object for the java.awt.MenuItem class.
+     */
+    public static MenuItemAccessor getMenuItemAccessor() {
+        if (menuItemAccessor == null) {
+            unsafe.ensureClassInitialized(MenuItemAccessor.class);
+        }
+        return menuItemAccessor;
+    }
+
+    /**
+     * Set an accessor object for the java.awt.Menu class.
+     */
+    public static void setMenuAccessor(MenuAccessor ma) {
+        menuAccessor = ma;
+    }
+
+    /**
+     * Retrieve the accessor object for the java.awt.Menu class.
+     */
+    public static MenuAccessor getMenuAccessor() {
+        if (menuAccessor == null) {
+            unsafe.ensureClassInitialized(MenuAccessor.class);
+        }
+        return menuAccessor;
+    }
+
+    /**
+     * Set an accessor object for the javax.swing.ClientPropertyKey class.
+     */
+    public static void setClientPropertyKeyAccessor(ClientPropertyKeyAccessor cpka) {
+        clientPropertyKeyAccessor = cpka;
+    }
+
+    /**
+     * Retrieve the accessor object for the javax.swing.ClientPropertyKey class.
+     */
+    public static ClientPropertyKeyAccessor getClientPropertyKeyAccessor() {
+        if (clientPropertyKeyAccessor == null) {
+            unsafe.ensureClassInitialized(ClientPropertyKeyAccessor.class);
+        }
+        return clientPropertyKeyAccessor;
+    }
+
+    /**
+     * Set an accessor object for the java.awt.DefaultKeyboardFocusManager class.
+     */
+    public static void setDefaultKeyboardFocusManagerAccessor(
+                            DefaultKeyboardFocusManagerAccessor dkfma) {
+        defaultKeyboardFocusManagerAccessor = dkfma;
+    }
+
+    /**
+     * Retrieve the accessor object for the java.awt.DefaultKeyboardFocusManager class.
+     */
+    public static DefaultKeyboardFocusManagerAccessor getDefaultKeyboardFocusManagerAccessor() {
+        if (defaultKeyboardFocusManagerAccessor == null) {
+            unsafe.ensureClassInitialized(DefaultKeyboardFocusManagerAccessor.class);
+        }
+        return defaultKeyboardFocusManagerAccessor;
+    }
 }
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java	(revision 404)
@@ -31,8 +31,4 @@
 import java.awt.peer.KeyboardFocusManagerPeer;
 
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-
 public class KeyboardFocusManagerPeerImpl implements KeyboardFocusManagerPeer {
     static native Window getNativeFocusedWindow();
@@ -57,17 +53,6 @@
     }
 
-    static Method m_removeLastFocusRequest = null;
     public static void removeLastFocusRequest(Component heavyweight) {
-        try {
-            if (m_removeLastFocusRequest == null) {
-                m_removeLastFocusRequest = SunToolkit.getMethod(KeyboardFocusManager.class, "removeLastFocusRequest",
-                                                              new Class[] {Component.class});
-            }
-            m_removeLastFocusRequest.invoke(null, new Object[]{heavyweight});
-        } catch (InvocationTargetException ite) {
-            ite.printStackTrace();
-        } catch (IllegalAccessException ex) {
-            ex.printStackTrace();
-        }
+        AWTAccessor.getKeyboardFocusManagerAccessor().removeLastFocusRequest(heavyweight);
     }
 }
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/awt/SunToolkit.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/awt/SunToolkit.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/awt/SunToolkit.java	(revision 404)
@@ -33,12 +33,8 @@
 import java.awt.event.WindowEvent;
 import java.awt.event.KeyEvent;
-import java.awt.im.spi.InputMethodDescriptor;
 import java.awt.image.*;
-import java.awt.geom.AffineTransform;
 import java.awt.TrayIcon;
 import java.awt.SystemTray;
-import java.io.*;
 import java.net.URL;
-import java.net.JarURLConnection;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
@@ -50,9 +46,7 @@
 import sun.font.FontDesignMetrics;
 import sun.awt.im.InputContext;
-import sun.awt.im.SimpleInputMethodWindow;
 import sun.awt.image.*;
 import sun.security.action.GetPropertyAction;
 import sun.security.action.GetBooleanAction;
-import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.lang.reflect.Constructor;
@@ -60,6 +54,4 @@
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
 
 public abstract class SunToolkit extends Toolkit
@@ -83,12 +75,5 @@
     public static final int GRAB_EVENT_MASK = 0x80000000;
 
-    private static Field syncLWRequestsField;
     private static Method  wakeupMethod;
-    private static Field componentKeyField;
-    private static Field menuComponentKeyField;
-    private static Field trayIconKeyField;
-    private static Field componentAppContextField;
-    private static Field menuComponentAppContextField;
-    private static Field isPostedField;
     /* The key to put()/get() the PostEventQueue into/from the AppContext.
      */
@@ -327,22 +312,4 @@
     }
 
-    public static Field getField(final Class klass, final String fieldName) {
-        return AccessController.doPrivileged(new PrivilegedAction<Field>() {
-            public Field run() {
-                try {
-                    Field field = klass.getDeclaredField(fieldName);
-                    assert (field != null);
-                    field.setAccessible(true);
-                    return field;
-                } catch (SecurityException e) {
-                    assert false;
-                } catch (NoSuchFieldException e) {
-                    assert false;
-                }
-                return null;
-            }//run
-        });
-    }
-
     static void wakeupEventQueue(EventQueue q, boolean isShutdown){
         if (wakeupMethod == null){
@@ -418,23 +385,13 @@
     private static boolean setAppContext(Object target, AppContext context)
     {
-        if (!(target instanceof Component) && !(target instanceof MenuComponent)) {
+        if (target instanceof Component) {
+            AWTAccessor.getComponentAccessor().
+                setAppContext((Component)target, context);
+        } else if (target instanceof MenuComponent) {
+            AWTAccessor.getMenuComponentAccessor().
+                setAppContext((MenuComponent)target, context);
+        } else {
             return false;
         }
-        try{
-            if (target instanceof Component){
-                if (componentAppContextField == null) {
-                    componentAppContextField = getField(Component.class, "appContext");
-                }
-                componentAppContextField.set(target, context);
-            } else if (target instanceof MenuComponent) {
-                if (menuComponentAppContextField == null) {
-                    menuComponentAppContextField = getField(MenuComponent.class, "appContext");
-                }
-                menuComponentAppContextField.set(target, context);
-            }
-        } catch( IllegalAccessException e){
-            assert false;
-        }
-
         return true;
     }
@@ -445,21 +402,13 @@
      */
     private static AppContext getAppContext(Object target) {
-        AppContext retObj = null;
-        try{
-            if (target instanceof Component){
-                if (componentAppContextField == null) {
-                    componentAppContextField = getField(Component.class, "appContext");
-                }
-                retObj = (AppContext) componentAppContextField.get(target);
-            } else if (target instanceof MenuComponent) {
-                if (menuComponentAppContextField == null) {
-                    menuComponentAppContextField = getField(MenuComponent.class, "appContext");
-                }
-                retObj = (AppContext) menuComponentAppContextField.get(target);
-            }
-        } catch( IllegalAccessException e){
-            assert false;
-        }
-        return retObj;
+        if (target instanceof Component) {
+            return AWTAccessor.getComponentAccessor().
+                       getAppContext((Component)target);
+        } else if (target instanceof MenuComponent) {
+            return AWTAccessor.getMenuComponentAccessor().
+                       getAppContext((MenuComponent)target);
+        } else {
+            return null;
+        }
     }
 
@@ -509,14 +458,5 @@
 
     public static void setLWRequestStatus(Window changed,boolean status){
-        if (syncLWRequestsField == null){
-            syncLWRequestsField = getField(Window.class, "syncLWRequests");
-        }
-        try{
-            if (syncLWRequestsField != null){
-                syncLWRequestsField.setBoolean(changed, status);
-            }
-        } catch( IllegalAccessException e){
-            assert false;
-        }
+        AWTAccessor.getWindowAccessor().setLWRequestStatus(changed, status);
     };
 
@@ -626,16 +566,7 @@
      */
     public static void postPriorityEvent(final AWTEvent e) {
-        if (isPostedField == null) {
-            isPostedField = getField(AWTEvent.class, "isPosted");
-        }
         PeerEvent pe = new PeerEvent(Toolkit.getDefaultToolkit(), new Runnable() {
                 public void run() {
-                    try {
-                        isPostedField.setBoolean(e, true);
-                    } catch (IllegalArgumentException e) {
-                        assert(false);
-                    } catch (IllegalAccessException e) {
-                        assert(false);
-                    }
+                    AWTAccessor.getAWTEventAccessor().setPosted(e);
                     ((Component)e.getSource()).dispatchEvent(e);
                 }
@@ -746,34 +677,4 @@
 
     /*
-     * Returns next queue for the given EventQueue which has private access
-     */
-    private static EventQueue getNextQueue(final Object o) {
-        EventQueue result = null;
-        try{
-            Field nextQueueField = getField(EventQueue.class,
-                                            "nextQueue");
-            result = (EventQueue)nextQueueField.get(o);
-        } catch( IllegalAccessException e){
-            assert false;
-        }
-        return result;
-    }
-
-    /*
-     * Returns dispatch thread for the given EventQueue which has private access
-     */
-    private static Thread getDispatchThread(final Object o) {
-        Thread result = null;
-        try{
-            Field dispatchThreadField = getField(EventQueue.class,
-                                                 "dispatchThread");
-            result = (Thread)dispatchThreadField.get(o);
-        } catch( IllegalAccessException e){
-            assert false;
-        }
-        return result;
-    }
-
-    /*
      * Returns true if the calling thread is the event dispatch thread
      * contained within AppContext which associated with the given target.
@@ -785,11 +686,12 @@
         EventQueue eq = (EventQueue)appContext.get(AppContext.EVENT_QUEUE_KEY);
 
-        EventQueue next = getNextQueue(eq);
+        EventQueue next = AWTAccessor.getEventQueueAccessor().getNextQueue(eq);
         while (next != null) {
             eq = next;
-            next = getNextQueue(eq);
-        }
-
-        return (Thread.currentThread() == getDispatchThread(eq));
+            next = AWTAccessor.getEventQueueAccessor().getNextQueue(eq);
+        }
+
+        return (Thread.currentThread() == AWTAccessor.getEventQueueAccessor()
+                                              .getDispatchThread(eq));
     }
 
@@ -1525,20 +1427,4 @@
     }
 
-    public static Method getMethod(final Class clz, final String methodName, final Class[] params) {
-        Method res = null;
-        try {
-            res = AccessController.doPrivileged(new PrivilegedExceptionAction<Method>() {
-                    public Method run() throws Exception {
-                        Method m = clz.getDeclaredMethod(methodName, params);
-                        m.setAccessible(true);
-                        return m;
-                    }
-                });
-        } catch (PrivilegedActionException ex) {
-            ex.printStackTrace();
-        }
-        return res;
-    }
-
     public static class OperationTimedOut extends RuntimeException {
         public OperationTimedOut(String msg) {
@@ -1683,19 +1569,7 @@
     private final Object waitLock = "Wait Lock";
 
-    static Method eqNoEvents;
-
     private boolean isEQEmpty() {
         EventQueue queue = getSystemEventQueueImpl();
-        synchronized(SunToolkit.class) {
-            if (eqNoEvents == null) {
-                eqNoEvents = getMethod(java.awt.EventQueue.class, "noEvents", null);
-            }
-        }
-        try {
-            return (Boolean)eqNoEvents.invoke(queue);
-        } catch (Exception e) {
-            e.printStackTrace();
-            return false;
-        }
+        return AWTAccessor.getEventQueueAccessor().noEvents(queue);
     }
 
@@ -1952,18 +1826,12 @@
      * however Swing could use it in the future.
      */
-    private static Method consumeNextKeyTypedMethod = null;
     public static synchronized void consumeNextKeyTyped(KeyEvent keyEvent) {
-        if (consumeNextKeyTypedMethod == null) {
-            consumeNextKeyTypedMethod = getMethod(DefaultKeyboardFocusManager.class,
-                                                  "consumeNextKeyTyped",
-                                                  new Class[] {KeyEvent.class});
-        }
         try {
-            consumeNextKeyTypedMethod.invoke(KeyboardFocusManager.getCurrentKeyboardFocusManager(),
-                                             keyEvent);
-        } catch (IllegalAccessException iae) {
-            iae.printStackTrace();
-        } catch (InvocationTargetException ite) {
-            ite.printStackTrace();
+            AWTAccessor.getDefaultKeyboardFocusManagerAccessor().consumeNextKeyTyped(
+                (DefaultKeyboardFocusManager)KeyboardFocusManager.
+                    getCurrentKeyboardFocusManager(),
+                keyEvent);
+        } catch (ClassCastException cce) {
+             cce.printStackTrace();
         }
     }
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/misc/IOUtils.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/misc/IOUtils.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/misc/IOUtils.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -31,4 +31,5 @@
 
 import java.io.EOFException;
+import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
@@ -78,3 +79,36 @@
         return output;
     }
+    
+    /*
+     * <p> Creates a new empty file in the specified directory, using the
+     * given prefix and suffix strings to generate its name. The resulting
+     * temporary file may have more restrictive access permission on some
+     * platforms.
+     *
+     * @param  prefix     The prefix string to be used in generating the file's
+     *                    name; must be at least three characters long
+     *
+     * @param  suffix     The suffix string to be used in generating the file's
+     *                    name; may be <code>null</code>, in which case the
+     *                    suffix <code>".tmp"</code> will be used
+     *
+     * @param  directory  The directory in which the file is to be created, or
+     *                    <code>null</code> if the default temporary-file
+     *                    directory is to be used
+     *
+     * @return  An abstract pathname denoting a newly-created empty file
+     *
+     * @see java.io.File#createTempFile(String,String,java.io.File)
+     */
+    public static File createTempFile(String prefix, String suffix, File directory)
+        throws IOException
+    {
+        return SharedSecrets.getJavaIOFileAccess().createTempFile(prefix, suffix, directory);
+    }
+
+    public static File createTempFile(String prefix, String suffix)
+        throws IOException
+    {
+        return SharedSecrets.getJavaIOFileAccess().createTempFile(prefix, suffix, null);
+    }
 }
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/misc/JavaIOFileAccess.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/misc/JavaIOFileAccess.java	(revision 404)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/misc/JavaIOFileAccess.java	(revision 404)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2012, 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.misc;
+
+import java.io.File;
+import java.io.IOException;
+
+public interface JavaIOFileAccess {
+    public File createTempFile(String prefix, String suffix, File directory)
+        throws IOException;
+}
+
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/misc/Service.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/misc/Service.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/misc/Service.java	(revision 404)
@@ -285,10 +285,18 @@
             String cn = nextName;
             nextName = null;
+            Class<?> c = null;
             try {
-                return Class.forName(cn, true, loader).newInstance();
+                c = Class.forName(cn, false, loader);
             } catch (ClassNotFoundException x) {
                 fail(service,
                      "Provider " + cn + " not found");
-            } catch (Exception x) {
+            }
+            if (!service.isAssignableFrom(c)) {
+                fail(service,
+                     "Provider " + cn  + " not a subtype");
+            }
+            try {
+                return service.cast(c.newInstance());
+	    } catch (Throwable x) {
                 fail(service,
                      "Provider " + cn + " could not be instantiated: " + x,
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/misc/SharedSecrets.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/misc/SharedSecrets.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/misc/SharedSecrets.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -54,4 +54,5 @@
     private static JavaSecurityAccess javaSecurityAccess;
     private static JavaAWTAccess javaAWTAccess;
+    private static JavaIOFileAccess javaIOFileAccess;
 
     public static JavaUtilJarAccess javaUtilJarAccess() {
@@ -150,3 +151,11 @@
         return javaAWTAccess;
     }
+    
+    public static void setJavaIOFileAccess(JavaIOFileAccess access) {
+        javaIOFileAccess = access;
+    }
+
+    public static JavaIOFileAccess getJavaIOFileAccess() {
+        return javaIOFileAccess;
+    }
 }
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/net/www/protocol/jar/URLJarFile.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/net/www/protocol/jar/URLJarFile.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/net/www/protocol/jar/URLJarFile.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -220,5 +220,5 @@
                             File tmpFile = null;
                             try {
-                                tmpFile = File.createTempFile("jar_cache", null);
+                                tmpFile = sun.misc.IOUtils.createTempFile("jar_cache", null);
                                 tmpFile.deleteOnExit();
                                 out  = new FileOutputStream(tmpFile);
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/print/PSPrinterJob.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/print/PSPrinterJob.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/print/PSPrinterJob.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -653,5 +653,5 @@
                      * removed when the VM exits.
                      */
-                    spoolFile = File.createTempFile("javaprint", ".ps", null);
+                    spoolFile = sun.misc.IOUtils.createTempFile("javaprint", ".ps", null);
                     spoolFile.deleteOnExit();
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/rmi/registry/RegistryImpl.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/rmi/registry/RegistryImpl.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/rmi/registry/RegistryImpl.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -406,5 +406,6 @@
         perms.add(new SocketPermission("*", "connect,accept"));
 
-        perms.add(new RuntimePermission("accessClassInPackage.sun.*"));
+        perms.add(new RuntimePermission("accessClassInPackage.sun.jvmstat.*"));
+        perms.add(new RuntimePermission("accessClassInPackage.sun.jvm.hotspot.*"));
 
         perms.add(new FilePermission("<<ALL FILES>>", "read"));
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/rmi/server/Activation.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/rmi/server/Activation.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/rmi/server/Activation.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -1917,5 +1917,5 @@
                         public Void run() throws IOException {
                             File file =
-                                File.createTempFile("rmid-err", null, null);
+                                sun.misc.IOUtils.createTempFile("rmid-err", null, null);
                             PrintStream errStream =
                                 new PrintStream(new FileOutputStream(file));
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/pkcs11/P11Cipher.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/pkcs11/P11Cipher.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/pkcs11/P11Cipher.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -651,5 +651,5 @@
     protected int engineGetKeySize(Key key) throws InvalidKeyException {
         int n = P11SecretKeyFactory.convertKey
-                                (token, key, keyAlgorithm).keyLength();
+                                (token, key, keyAlgorithm).length();
         return n;
     }
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/pkcs11/P11Key.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/pkcs11/P11Key.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/pkcs11/P11Key.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -47,4 +47,5 @@
 
 import sun.security.util.DerValue;
+import sun.security.util.Length;
 
 /**
@@ -62,5 +63,5 @@
  * @since   1.5
  */
-abstract class P11Key implements Key {
+abstract class P11Key implements Key, Length {
 
     private final static String PUBLIC = "public";
@@ -213,5 +214,9 @@
     }
 
-    int keyLength() {
+    /**
+     * Return bit length of the key.
+     */
+    @Override
+    public int length() { 
         return keyLength;
     }
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/pkcs11/P11RSACipher.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/pkcs11/P11RSACipher.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/pkcs11/P11RSACipher.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -202,5 +202,5 @@
             throw new InvalidKeyException("Unknown key type: " + p11Key);
         }
-        int n = (p11Key.keyLength() + 7) >> 3;
+        int n = (p11Key.length() + 7) >> 3;
         outputSize = n;
         buffer = new byte[n];
@@ -459,5 +459,5 @@
     // see JCE spec
     protected int engineGetKeySize(Key key) throws InvalidKeyException {
-        int n = P11KeyFactory.convertKey(token, key, algorithm).keyLength();
+        int n = P11KeyFactory.convertKey(token, key, algorithm).length();
         return n;
     }
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/pkcs11/P11Signature.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/pkcs11/P11Signature.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/pkcs11/P11Signature.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -275,5 +275,5 @@
                     signature = new byte[40];
                 } else {
-                    signature = new byte[(p11Key.keyLength() + 7) >> 3];
+                    signature = new byte[(p11Key.length() + 7) >> 3];
                 }
                 if (type == T_UPDATE) {
@@ -360,5 +360,5 @@
             int keyLen;
             if (publicKey instanceof P11Key) {
-                keyLen = ((P11Key) publicKey).keyLength();
+                keyLen = ((P11Key) publicKey).length();
             } else {
                 keyLen = ((RSAKey) publicKey).getModulus().bitLength();
@@ -621,5 +621,5 @@
     private byte[] pkcs1Pad(byte[] data) {
         try {
-            int len = (p11Key.keyLength() + 7) >> 3;
+            int len = (p11Key.length() + 7) >> 3;
             RSAPadding padding = RSAPadding.getInstance
                                         (RSAPadding.PAD_BLOCKTYPE_1, len);
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/provider/SecureRandom.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/provider/SecureRandom.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/provider/SecureRandom.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -56,10 +56,4 @@
 
     private static final long serialVersionUID = 3581829991155417889L;
-
-    /**
-     * This static object will be seeded by SeedGenerator, and used
-     * to seed future instances of SecureRandom
-     */
-    private static SecureRandom seeder;
 
     private static final int DIGEST_SIZE = 20;
@@ -174,4 +168,26 @@
 
     /**
+     * This static object will be seeded by SeedGenerator, and used
+     * to seed future instances of SHA1PRNG SecureRandoms.
+     *
+     * Bloch, Effective Java Second Edition: Item 71
+     */
+    private static class SeederHolder {
+
+        private static final SecureRandom seeder;
+
+        static {
+            /*
+             * Call to SeedGenerator.generateSeed() to add additional
+             * seed material (likely from the Native implementation).
+             */
+            seeder = new SecureRandom(SeedGenerator.getSystemEntropy());
+            byte [] b = new byte[DIGEST_SIZE];
+            SeedGenerator.generateSeed(b);
+            seeder.engineSetSeed(b);
+        }
+    }
+
+    /**
      * Generates a user-specified number of random bytes.
      *
@@ -184,11 +200,6 @@
 
         if (state == null) {
-            if (seeder == null) {
-                seeder = new SecureRandom(SeedGenerator.getSystemEntropy());
-                seeder.engineSetSeed(engineGenerateSeed(DIGEST_SIZE));
-            }
-
             byte[] seed = new byte[DIGEST_SIZE];
-            seeder.engineNextBytes(seed);
+            SeederHolder.seeder.engineNextBytes(seed);
             state = digest.digest(seed);
         }
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/ssl/AppOutputStream.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/ssl/AppOutputStream.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/ssl/AppOutputStream.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1996, 20111 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -89,8 +89,19 @@
         try {
             do {
+                boolean holdRecord = false;
                 int howmuch;
                 if (isFirstRecordOfThePayload && c.needToSplitPayload()) {
                     howmuch = (len == 0) ? 0 : Math.min(
                         0x01, r.availableDataBytes());
+                    /*
+                     * Nagle's algorithm (TCP_NODELAY) was coming into
+                     * play here when writing short (split) packets.
+                     * Signal to the OutputRecord code to internally
+                     * buffer this small packet until the next outbound
+                     * packet (of any type) is written.
+                     */
+                    if ((len != 1) && (howmuch == 1)) {
+                        holdRecord = true;
+                    } 
                 } else {
                     howmuch = Math.min(len, r.availableDataBytes());
@@ -106,5 +117,5 @@
                     len -= howmuch;
                 }
-                c.writeRecord(r);
+                c.writeRecord(r, holdRecord); 
                 c.checkWrite();
             } while (len > 0);
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/ssl/EngineOutputRecord.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/ssl/EngineOutputRecord.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/ssl/EngineOutputRecord.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -156,6 +156,7 @@
      * generated.
      */
-    void writeBuffer(OutputStream s, byte [] buf, int off, int len)
-            throws IOException {
+    @Override 
+    void writeBuffer(OutputStream s, byte [] buf, int off, int len, 
+            int debugOffset) throws IOException {
         /*
          * Copy data out of buffer, it's ready to go.
@@ -197,5 +198,6 @@
             addMAC(writeMAC);
             encrypt(writeCipher);
-            write((OutputStream)null);  // send down for processing
+            write((OutputStream)null, false,   // send down for processing 
+                (ByteArrayOutputStream)null);  
         }
         return;
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/ssl/HandshakeInStream.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/ssl/HandshakeInStream.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/ssl/HandshakeInStream.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -191,4 +191,5 @@
     byte[] getBytes8() throws IOException {
         int len = getInt8();
+        verifyLength(len);
         byte b[] = new byte[len];
 
@@ -199,4 +200,5 @@
     byte[] getBytes16() throws IOException {
         int len = getInt16();
+        verifyLength(len);
         byte b[] = new byte[len];
 
@@ -207,4 +209,5 @@
     byte[] getBytes24() throws IOException {
         int len = getInt24();
+        verifyLength(len);
         byte b[] = new byte[len];
 
@@ -213,3 +216,11 @@
     }
 
+    // Is a length greater than available bytes in the record?
+    private void verifyLength(int len) throws SSLException {
+        if (len > available()) {
+            throw new SSLException(
+                        "Not enough data to fill declared vector size");
+        }
+    }
+
 }
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/ssl/Handshaker.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/ssl/Handshaker.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/ssl/Handshaker.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -777,7 +777,7 @@
                 System.out.println("RSA master secret generation error:");
                 e.printStackTrace(System.out);
-                System.out.println("Generating new random premaster secret");
             }
-            preMasterSecret = RSAClientKeyExchange.generateDummySecret(protocolVersion);
+            preMasterSecret =
+                    RSAClientKeyExchange.generateDummySecret(protocolVersion);
             // recursive call with new premaster secret
             return calculateMasterSecret(preMasterSecret, null);
@@ -822,7 +822,7 @@
                 + protocolVersion + " or " + requestedVersion + ", decrypted: "
                 + premasterVersion);
-            System.out.println("Generating new random premaster secret");
-        }
-        preMasterSecret = RSAClientKeyExchange.generateDummySecret(protocolVersion);
+        }
+        preMasterSecret =
+                RSAClientKeyExchange.generateDummySecret(protocolVersion);
         // recursive call with new premaster secret
         return calculateMasterSecret(preMasterSecret, null);
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/ssl/OutputRecord.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/ssl/OutputRecord.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/ssl/OutputRecord.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -29,4 +29,5 @@
 import java.io.*;
 import java.nio.*;
+import java.util.Arrays;
 
 import javax.net.ssl.SSLException;
@@ -228,4 +229,22 @@
 
     /*
+     * Increases the capacity if necessary to ensure that it can hold
+     * at least the number of elements specified by the minimum
+     * capacity argument.
+     *
+     * Note that the increased capacity is only can be used for held
+     * record buffer. Please DO NOT update the availableDataBytes()
+     * according to the expended buffer capacity.
+     *
+     * @see availableDataBytes()
+     */
+    private void ensureCapacity(int minCapacity) {
+        // overflow-conscious code
+        if (minCapacity > buf.length) {
+            buf = Arrays.copyOf(buf, minCapacity);
+        }
+    }
+
+    /*
      * Return the type of SSL record that's buffered here.
      */
@@ -244,5 +263,6 @@
      * in a single low level write, for efficiency.
      */
-    void write(OutputStream s) throws IOException {
+    void write(OutputStream s, boolean holdRecord, 
+            ByteArrayOutputStream heldRecordBuffer) throws IOException {
         /*
          * Don't emit content-free records.  (Even change cipher spec
@@ -301,5 +321,46 @@
         firstMessage = false;
 
-        writeBuffer(s, buf, 0, count);
+        /* 
+         * The upper levels may want us to delay sending this packet so 
+         * multiple TLS Records can be sent in one (or more) TCP packets. 
+         * If so, add this packet to the heldRecordBuffer. 
+         * 
+         * NOTE:  all writes have been synchronized by upper levels. 
+         */ 
+        int debugOffset = 0; 
+        if (holdRecord) { 
+            /* 
+             * If holdRecord is true, we must have a heldRecordBuffer. 
+             * 
+             * Don't worry about the override of writeBuffer(), because 
+             * when holdRecord is true, the implementation in this class 
+             * will be used. 
+             */ 
+            writeBuffer(heldRecordBuffer, buf, 0, count, debugOffset); 
+        } else { 
+            // It's time to send, do we have buffered data? 
+            // May or may not have a heldRecordBuffer. 
+            if (heldRecordBuffer != null && heldRecordBuffer.size() > 0) { 
+                int heldLen = heldRecordBuffer.size(); 
+ 
+                // Ensure the capacity of this buffer. 
+                ensureCapacity(count + heldLen); 
+ 
+                // Slide everything in the buffer to the right. 
+                System.arraycopy(buf, 0, buf, heldLen, count); 
+ 
+                // Prepend the held record to the buffer. 
+                System.arraycopy( 
+                    heldRecordBuffer.toByteArray(), 0, buf, 0, heldLen); 
+                count += heldLen; 
+ 
+                // Clear the held buffer. 
+                heldRecordBuffer.reset(); 
+ 
+                // The held buffer has been dumped, set the debug dump offset. 
+                debugOffset = heldLen; 
+            } 
+            writeBuffer(s, buf, 0, count, debugOffset); 
+        }
         reset();
     }
@@ -310,13 +371,15 @@
      * action.
      */
-    void writeBuffer(OutputStream s, byte [] buf, int off, int len)
-            throws IOException {
+    void writeBuffer(OutputStream s, byte [] buf, int off, int len, 
+            int debugOffset) throws IOException {
         s.write(buf, off, len);
         s.flush();
 
+        // Output only the record from the specified debug offset.
         if (debug != null && Debug.isOn("packet")) {
             try {
                 HexDumpEncoder hd = new HexDumpEncoder();
-                ByteBuffer bb = ByteBuffer.wrap(buf, off, len);
+                ByteBuffer bb = ByteBuffer.wrap( 
+                        buf, off + debugOffset, len - debugOffset);
 
                 System.out.println("[Raw write]: length = " +
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/ssl/RSAClientKeyExchange.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/ssl/RSAClientKeyExchange.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/ssl/RSAClientKeyExchange.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -37,4 +37,5 @@
 
 import sun.security.internal.spec.TlsRsaPremasterSecretParameterSpec;
+import sun.security.util.KeyLength;
 
 /**
@@ -86,5 +87,6 @@
      * server's public key, and uses PKCS #1 block format 02.
      */
-    RSAClientKeyExchange(ProtocolVersion protocolVersion, ProtocolVersion maxVersion,
+    RSAClientKeyExchange(ProtocolVersion protocolVersion,
+            ProtocolVersion maxVersion,
             SecureRandom generator, PublicKey publicKey) throws IOException {
         if (publicKey.getAlgorithm().equals("RSA") == false) {
@@ -121,5 +123,6 @@
      * it with its private key.
      */
-    RSAClientKeyExchange(ProtocolVersion currentVersion, HandshakeInStream input,
+    RSAClientKeyExchange(ProtocolVersion currentVersion,
+            ProtocolVersion maxVersion, HandshakeInStream input,
             int messageSize, PrivateKey privateKey) throws IOException {
 
@@ -144,26 +147,117 @@
             preMaster = (SecretKey)cipher.unwrap(encrypted,
                                 "TlsRsaPremasterSecret", Cipher.SECRET_KEY);
+
+            // polish the premaster secret
+            preMaster = polishPreMasterSecretKey(
+                                currentVersion, maxVersion, preMaster, null);
         } catch (Exception e) {
-            /*
-             * Bogus decrypted ClientKeyExchange? If so, conjure a
-             * a random preMaster secret that will fail later during
-             * Finished message processing. This is a countermeasure against
-             * the "interactive RSA PKCS#1 encryption envelop attack" reported
-             * in June 1998. Preserving the executation path will
-             * mitigate timing attacks and force consistent error handling
-             * that will prevent an attacking client from differentiating
-             * different kinds of decrypted ClientKeyExchange bogosities.
-             */
-            if (debug != null && Debug.isOn("handshake")) {
-                System.out.println("Error decrypting premaster secret:");
-                e.printStackTrace(System.out);
-                System.out.println("Generating random secret");
+            // polish the premaster secret
+            preMaster = polishPreMasterSecretKey(
+                                currentVersion, maxVersion, preMaster, e);
+        }
+    }
+
+    /**
+     * To avoid vulnerabilities described by section 7.4.7.1, RFC 5246,
+     * treating incorrectly formatted message blocks and/or mismatched
+     * version numbers in a manner indistinguishable from correctly
+     * formatted RSA blocks.
+     *
+     * RFC 5246 describes the approach as :
+     *
+     *  1. Generate a string R of 46 random bytes
+     *
+     *  2. Decrypt the message to recover the plaintext M
+     *
+     *  3. If the PKCS#1 padding is not correct, or the length of message
+     *     M is not exactly 48 bytes:
+     *        pre_master_secret = ClientHello.client_version || R
+     *     else If ClientHello.client_version <= TLS 1.0, and version
+     *     number check is explicitly disabled:
+     *        pre_master_secret = M
+     *     else:
+     *        pre_master_secret = ClientHello.client_version || M[2..47]
+     *
+     * Note that although TLS 1.2 is not supported in this release, we still
+     * want to make use of the above approach to provide better protection.
+     */
+    private SecretKey polishPreMasterSecretKey(
+            ProtocolVersion currentVersion, ProtocolVersion clientHelloVersion,
+            SecretKey secretKey, Exception failoverException) {
+
+        if (failoverException == null && secretKey != null) {
+            // check the length
+            byte[] encoded = secretKey.getEncoded();
+            if (encoded == null) {      // unable to get the encoded key
+                if (debug != null && Debug.isOn("handshake")) {
+                    System.out.println(
+                        "unable to get the plaintext of the premaster secret");
+                }
+
+                int keySize = KeyLength.getKeySize(secretKey);
+                if (keySize > 0 && keySize != 384) {       // 384 = 48 * 8
+                    if (debug != null && Debug.isOn("handshake")) {
+                        System.out.println(
+                            "incorrect length of premaster secret: " +
+                            (keySize/8));
+                    }
+
+                    return generateDummySecret(currentVersion);
+                }
+
+                // The key size is exactly 48 bytes or not accessible.
+                //
+                // Conservatively, pass the checking to master secret
+                // calculation.
+                return secretKey;
+            } else if (encoded.length == 48) {
+                // check the version
+                if (clientHelloVersion.major == encoded[0] &&
+                    clientHelloVersion.minor == encoded[1]) {
+
+                    return secretKey;
+                } else if (clientHelloVersion.v <= ProtocolVersion.TLS10.v &&
+                           currentVersion.major == encoded[0] &&
+                           currentVersion.minor == encoded[1]) {
+                    /*
+                     * For compatibility, we maintain the behavior that the
+                     * version in pre_master_secret can be the negotiated
+                     * version for TLS v1.0 and SSL v3.0.
+                     */
+                    return secretKey;
+                }
+
+                if (debug != null && Debug.isOn("handshake")) {
+                    System.out.println("Mismatching Protocol Versions, " +
+                        "ClientHello.client_version is " + clientHelloVersion +
+                        ", while PreMasterSecret.client_version is " +
+                        ProtocolVersion.valueOf(encoded[0], encoded[1]));
+                }
+                return generateDummySecret(currentVersion);
+            } else {
+                if (debug != null && Debug.isOn("handshake")) {
+                    System.out.println(
+                        "incorrect length of premaster secret: " +
+                        encoded.length);
+                }
+                return generateDummySecret(currentVersion);
             }
-            preMaster = generateDummySecret(currentVersion);
-        }
+        }
+
+        if (debug != null && Debug.isOn("handshake") &&
+                        failoverException != null) {
+            System.out.println("Error decrypting premaster secret:");
+            failoverException.printStackTrace(System.out);
+        }
+
+        return generateDummySecret(currentVersion);
     }
 
     // generate a premaster secret with the specified version number
     static SecretKey generateDummySecret(ProtocolVersion version) {
+        if (debug != null && Debug.isOn("handshake")) {
+            System.out.println("Generating a random fake premaster secret");
+        }
+
         try {
             KeyGenerator kg =
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -364,4 +364,10 @@
     private boolean isFirstAppOutputRecord = true;
 
+    /*
+     * If AppOutputStream needs to delay writes of small packets, we
+     * will use this to store the data until we actually do the write.
+     */
+    private ByteArrayOutputStream heldRecordBuffer = null;
+
     //
     // CONSTRUCTORS AND INITIALIZATION CODE
@@ -629,4 +635,15 @@
 
     /*
+     * AppOutputStream calls may need to buffer multiple outbound
+     * application packets.
+     *
+     * All other writeRecord() calls will not buffer, so do not hold
+     * these records.
+     */
+    void writeRecord(OutputRecord r) throws IOException {
+        writeRecord(r, false);
+    }
+
+    /*
      * Record Output. Application data can't be sent until the first
      * handshake establishes a session.
@@ -635,5 +652,5 @@
      * TCP-level activity, notably handshaking, to occur.
      */
-    void writeRecord(OutputRecord r) throws IOException {
+    void writeRecord(OutputRecord r, boolean holdRecord) throws IOException {
         /*
          * The loop is in case of HANDSHAKE --> ERROR transitions, etc
@@ -706,5 +723,5 @@
                     if (writeLock.tryLock(getSoLinger(), TimeUnit.SECONDS)) {
                         try {
-                            writeRecordInternal(r);
+                            writeRecordInternal(r, holdRecord); 
                         } finally {
                             writeLock.unlock();
@@ -754,5 +771,5 @@
                 writeLock.lock();
                 try {
-                    writeRecordInternal(r);
+                    writeRecordInternal(r, holdRecord);
                 } finally {
                     writeLock.unlock();
@@ -762,9 +779,25 @@
     }
 
-    private void writeRecordInternal(OutputRecord r) throws IOException {
+    private void writeRecordInternal(OutputRecord r, 
+            boolean holdRecord) throws IOException { 
         // r.compress(c);
         r.addMAC(writeMAC);
         r.encrypt(writeCipher);
-        r.write(sockOutput);
+        if (holdRecord) { 
+            // If we were requested to delay the record due to possibility 
+            // of Nagle's being active when finally got to writing, and 
+            // it's actually not, we don't really need to delay it. 
+            if (getTcpNoDelay()) { 
+                holdRecord = false; 
+            } else { 
+                // We need to hold the record, so let's provide 
+                // a per-socket place to do it. 
+                if (heldRecordBuffer == null) { 
+                    // Likely only need 37 bytes. 
+                    heldRecordBuffer = new ByteArrayOutputStream(40); 
+                } 
+            } 
+        } 
+        r.write(sockOutput, holdRecord, heldRecordBuffer);
 
         // turn off the flag of the first application record
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -191,6 +191,7 @@
                      * certificates/keys.
                      */
-                    RSAClientKeyExchange pms = new RSAClientKeyExchange
-                        (protocolVersion, input, message_len, privateKey);
+                    RSAClientKeyExchange pms = new RSAClientKeyExchange(
+                            protocolVersion, clientRequestedVersion,
+                            input, message_len, privateKey);
                     preMasterSecret = this.clientKeyExchange(pms);
                     break;
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/util/KeyLength.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/util/KeyLength.java	(revision 404)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/util/KeyLength.java	(revision 404)
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2012, 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.security.util;
+
+import java.security.Key;
+import java.security.PrivilegedAction;
+import java.security.AccessController;
+import java.security.interfaces.ECKey;
+import java.security.interfaces.RSAKey;
+import java.security.interfaces.DSAKey;
+import javax.crypto.SecretKey;
+import javax.crypto.interfaces.DHKey;
+
+/**
+ * A utility class to get key length
+ */
+public final class KeyLength {
+
+    /**
+     * Returns the key size of the given key object in bits.
+     *
+     * @param key the key object, cannot be null
+     * @return the key size of the given key object in bits, or -1 if the
+     *       key size is not accessible
+     */
+    final public static int getKeySize(Key key) {
+        int size = -1;
+
+        if (key instanceof Length) {
+            try {
+                Length ruler = (Length)key;
+                size = ruler.length();
+            } catch (UnsupportedOperationException usoe) {
+                // ignore the exception
+            }
+
+            if (size >= 0) {
+                return size;
+            }
+        }
+
+        // try to parse the length from key specification
+        if (key instanceof SecretKey) {
+            SecretKey sk = (SecretKey)key;
+            String format = sk.getFormat();
+            if ("RAW".equals(format) && sk.getEncoded() != null) {
+                size = (sk.getEncoded().length * 8);
+            }   // Otherwise, it may be a unextractable key of PKCS#11, or
+                // a key we are not able to handle.
+        } else if (key instanceof RSAKey) {
+            RSAKey pubk = (RSAKey)key;
+            size = pubk.getModulus().bitLength();
+        } else if (key instanceof ECKey) {
+            ECKey pubk = (ECKey)key;
+            size = pubk.getParams().getOrder().bitLength();
+        } else if (key instanceof DSAKey) {
+            DSAKey pubk = (DSAKey)key;
+            size = pubk.getParams().getP().bitLength();
+        } else if (key instanceof DHKey) {
+            DHKey pubk = (DHKey)key;
+            size = pubk.getParams().getP().bitLength();
+        }   // Otherwise, it may be a unextractable key of PKCS#11, or
+            // a key we are not able to handle.
+
+        return size;
+    }
+}
+
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/util/Length.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/util/Length.java	(revision 404)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/util/Length.java	(revision 404)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2012, 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.security.util;
+
+/**
+ * The Length interface defines the length of an object
+ */
+public interface Length {
+
+    /**
+     * Gets the length of this object
+     * <p>
+     * Note that if a class of java.security.Key implements this interfaces,
+     * the length should be measured in bits.
+     *
+     * @return the length of this object
+     * @throws UnsupportedOperationException if the operation is not supported
+     */
+    public int length();
+}
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/x509/CRLExtensions.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/x509/CRLExtensions.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/x509/CRLExtensions.java	(revision 404)
@@ -33,6 +33,8 @@
 import java.security.cert.CertificateException;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Enumeration;
-import java.util.Hashtable;
+import java.util.Map;
+import java.util.TreeMap;
 
 import sun.security.util.*;
@@ -63,5 +65,6 @@
 public class CRLExtensions {
 
-    private Hashtable<String,Extension> map = new Hashtable<String,Extension>();
+    private Map<String,Extension> map = Collections.synchronizedMap(
+            new TreeMap<String,Extension>());
     private boolean unsupportedCritExt = false;
 
@@ -216,5 +219,5 @@
      */
     public Enumeration<Extension> getElements() {
-        return map.elements();
+        return Collections.enumeration(map.values());
     }
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/x509/CertificateExtensions.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/x509/CertificateExtensions.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/x509/CertificateExtensions.java	(revision 404)
@@ -58,5 +58,6 @@
     private static final Debug debug = Debug.getInstance("x509");
 
-    private Hashtable<String,Extension> map = new Hashtable<String,Extension>();
+    private Map<String,Extension> map = Collections.synchronizedMap(
+            new TreeMap<String,Extension>());
     private boolean unsupportedCritExt = false;
 
@@ -118,5 +119,5 @@
                 // ignore errors parsing non-critical extensions
                 if (unparseableExtensions == null) {
-                    unparseableExtensions = new HashMap<String,Extension>();
+                    unparseableExtensions = new TreeMap<String,Extension>();
                 }
                 unparseableExtensions.put(ext.getExtensionId().toString(),
@@ -219,4 +220,10 @@
     }
 
+    // Similar to get(String), but throw no exception, might return null.
+    // Used in X509CertImpl::getExtension(OID).
+    Extension getExtension(String name) {
+        return map.get(name);
+    }
+
     /**
      * Delete the attribute value.
@@ -237,5 +244,5 @@
      */
     public Enumeration<Extension> getElements() {
-        return map.elements();
+        return Collections.enumeration(map.values());
     }
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/x509/X509CRLEntryImpl.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/x509/X509CRLEntryImpl.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/x509/X509CRLEntryImpl.java	(revision 404)
@@ -32,9 +32,5 @@
 import java.security.cert.X509CRLEntry;
 import java.math.BigInteger;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.Set;
-import java.util.HashSet;
+import java.util.*;
 
 import javax.security.auth.x500.X500Principal;
@@ -73,5 +69,6 @@
  */
 
-public class X509CRLEntryImpl extends X509CRLEntry {
+public class X509CRLEntryImpl extends X509CRLEntry
+        implements Comparable<X509CRLEntryImpl> {
 
     private SerialNumber serialNumber = null;
@@ -194,7 +191,12 @@
      */
     public byte[] getEncoded() throws CRLException {
+        return getEncoded0().clone();
+    }
+
+    // Called internally to avoid clone
+    private byte[] getEncoded0() throws CRLException {
         if (revokedCert == null)
             this.encode(new DerOutputStream());
-        return revokedCert.clone();
+        return revokedCert;
     }
 
@@ -314,5 +316,5 @@
             return null;
         }
-        Set<String> extSet = new HashSet<String>();
+        Set<String> extSet = new TreeSet<String>();
         for (Extension ex : extensions.getAllExtensions()) {
             if (ex.isCritical()) {
@@ -335,5 +337,5 @@
             return null;
         }
-        Set<String> extSet = new HashSet<String>();
+        Set<String> extSet = new TreeSet<String>();
         for (Extension ex : extensions.getAllExtensions()) {
             if (!ex.isCritical()) {
@@ -462,3 +464,22 @@
             getExtension(PKIXExtensions.CertificateIssuer_Id);
     }
+    @Override
+    public int compareTo(X509CRLEntryImpl that) {
+        int compSerial = getSerialNumber().compareTo(that.getSerialNumber());
+        if (compSerial != 0) {
+            return compSerial;
+        }
+        try {
+            byte[] thisEncoded = this.getEncoded0();
+            byte[] thatEncoded = that.getEncoded0();
+            for (int i=0; i<thisEncoded.length && i<thatEncoded.length; i++) {
+                int a = thisEncoded[i] & 0xff;
+                int b = thatEncoded[i] & 0xff;
+                if (a != b) return a-b;
+            }
+            return thisEncoded.length -thatEncoded.length;
+        } catch (CRLException ce) {
+            return -1;
+        }
+    }
 }
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/x509/X509CRLImpl.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/x509/X509CRLImpl.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/x509/X509CRLImpl.java	(revision 404)
@@ -54,5 +54,5 @@
 /**
  * <p>
- * An implmentation for X509 CRL (Certificate Revocation List).
+ * An implementation for X509 CRL (Certificate Revocation List).
  * <p>
  * The X.509 v2 CRL format is described below in ASN.1:
@@ -105,5 +105,7 @@
     private Date             thisUpdate = null;
     private Date             nextUpdate = null;
-    private Map<X509IssuerSerial,X509CRLEntry> revokedCerts = new LinkedHashMap<X509IssuerSerial,X509CRLEntry>();
+    private Map<X509IssuerSerial,X509CRLEntry> revokedMap
+            = new TreeMap<X509IssuerSerial,X509CRLEntry>();
+    private List<X509CRLEntry> revokedList = new LinkedList<X509CRLEntry>();
     private CRLExtensions    extensions = null;
     private final static boolean isExplicit = true;
@@ -224,5 +226,6 @@
                 X509IssuerSerial issuerSerial = new X509IssuerSerial
                     (badCertIssuer, badCert.getSerialNumber());
-                this.revokedCerts.put(issuerSerial, badCert);
+                this.revokedMap.put(issuerSerial, badCert);
+                this.revokedList.add(badCert);
                 if (badCert.hasExtensions()) {
                     this.version = 1;
@@ -306,6 +309,6 @@
             }
 
-            if (!revokedCerts.isEmpty()) {
-                for (X509CRLEntry entry : revokedCerts.values()) {
+            if (!revokedList.isEmpty()) {
+                for (X509CRLEntry entry : revokedList) {
                     ((X509CRLEntryImpl)entry).encode(rCerts);
                 }
@@ -491,12 +494,12 @@
         if (nextUpdate != null)
             sb.append("Next Update: " + nextUpdate.toString() + "\n");
-        if (revokedCerts.isEmpty())
+        if (revokedList.isEmpty())
             sb.append("\nNO certificates have been revoked\n");
         else {
-            sb.append("\nRevoked Certificates: " + revokedCerts.size());
+            sb.append("\nRevoked Certificates: " + revokedList.size());
             int i = 1;
-            for (Iterator<X509CRLEntry> iter = revokedCerts.values().iterator();
-                                             iter.hasNext(); i++)
-                sb.append("\n[" + i + "] " + iter.next().toString());
+            for (X509CRLEntry entry: revokedList) {
+                sb.append("\n[" + i++ + "] " + entry.toString());
+            }
         }
         if (extensions != null) {
@@ -544,10 +547,10 @@
      */
     public boolean isRevoked(Certificate cert) {
-        if (revokedCerts.isEmpty() || (!(cert instanceof X509Certificate))) {
+        if (revokedMap.isEmpty() || (!(cert instanceof X509Certificate))) {
             return false;
         }
         X509Certificate xcert = (X509Certificate) cert;
         X509IssuerSerial issuerSerial = new X509IssuerSerial(xcert);
-        return revokedCerts.containsKey(issuerSerial);
+        return revokedMap.containsKey(issuerSerial);
     }
 
@@ -639,5 +642,5 @@
      */
     public X509CRLEntry getRevokedCertificate(BigInteger serialNumber) {
-        if (revokedCerts.isEmpty()) {
+        if (revokedMap.isEmpty()) {
             return null;
         }
@@ -645,5 +648,5 @@
         X509IssuerSerial issuerSerial = new X509IssuerSerial
             (getIssuerX500Principal(), serialNumber);
-        return revokedCerts.get(issuerSerial);
+        return revokedMap.get(issuerSerial);
     }
 
@@ -652,9 +655,9 @@
      */
     public X509CRLEntry getRevokedCertificate(X509Certificate cert) {
-        if (revokedCerts.isEmpty()) {
+        if (revokedMap.isEmpty()) {
             return null;
         }
         X509IssuerSerial issuerSerial = new X509IssuerSerial(cert);
-        return revokedCerts.get(issuerSerial);
+        return revokedMap.get(issuerSerial);
     }
 
@@ -668,8 +671,8 @@
      */
     public Set<X509CRLEntry> getRevokedCertificates() {
-        if (revokedCerts.isEmpty()) {
+        if (revokedList.isEmpty()) {
             return null;
         } else {
-            return new HashSet<X509CRLEntry>(revokedCerts.values());
+            return new TreeSet<X509CRLEntry>(revokedList);
         }
     }
@@ -897,5 +900,5 @@
             return null;
         }
-        Set<String> extSet = new HashSet<String>();
+        Set<String> extSet = new TreeSet<String>();
         for (Extension ex : extensions.getAllExtensions()) {
             if (ex.isCritical()) {
@@ -918,5 +921,5 @@
             return null;
         }
-        Set<String> extSet = new HashSet<String>();
+        Set<String> extSet = new TreeSet<String>();
         for (Extension ex : extensions.getAllExtensions()) {
             if (!ex.isCritical()) {
@@ -1095,5 +1098,6 @@
                 X509IssuerSerial issuerSerial = new X509IssuerSerial
                     (badCertIssuer, entry.getSerialNumber());
-                revokedCerts.put(issuerSerial, entry);
+                revokedMap.put(issuerSerial, entry);
+                revokedList.add(entry);
             }
         }
@@ -1193,5 +1197,6 @@
      * Immutable X.509 Certificate Issuer DN and serial number pair
      */
-    private final static class X509IssuerSerial {
+    private final static class X509IssuerSerial
+            implements Comparable<X509IssuerSerial> {
         final X500Principal issuer;
         final BigInteger serial;
@@ -1272,4 +1277,12 @@
             return hashcode;
         }
+
+        @Override
+        public int compareTo(X509IssuerSerial another) {
+            int cissuer = issuer.toString()
+                    .compareTo(another.issuer.toString());
+            if (cissuer != 0) return cissuer;
+            return this.serial.compareTo(another.serial);
+        }
     }
 }
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/x509/X509CertImpl.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/x509/X509CertImpl.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/security/x509/X509CertImpl.java	(revision 404)
@@ -1215,5 +1215,5 @@
                 return null;
             }
-            Set<String> extSet = new HashSet<String>();
+            Set<String> extSet = new TreeSet<String>();
             for (Extension ex : exts.getAllExtensions()) {
                 if (ex.isCritical()) {
@@ -1245,5 +1245,5 @@
                 return null;
             }
-            Set<String> extSet = new HashSet<String>();
+            Set<String> extSet = new TreeSet<String>();
             for (Extension ex : exts.getAllExtensions()) {
                 if (!ex.isCritical()) {
@@ -1279,8 +1279,12 @@
                 return null;
             } else {
-                for (Extension ex : extensions.getAllExtensions()) {
-                    if (ex.getExtensionId().equals(oid)) {
+                Extension ex = extensions.getExtension(oid.toString());
+                if (ex != null) {
+                    return ex;
+                }
+                for (Extension ex2: extensions.getAllExtensions()) {
+                    if (ex2.getExtensionId().equals((Object)oid)) {
                         //XXXX May want to consider cloning this
-                        return ex;
+                        return ex2;
                     }
                 }
@@ -1481,5 +1485,5 @@
             return Collections.<List<?>>emptySet();
         }
-        Set<List<?>> newNames = new HashSet<List<?>>();
+        List<List<?>> newNames = new ArrayList<List<?>>();
         for (GeneralName gname : names.names()) {
             GeneralNameInterface name = gname.getName();
@@ -1542,5 +1546,5 @@
         }
         if (mustClone) {
-            Set<List<?>> namesCopy = new HashSet<List<?>>();
+            List<List<?>> namesCopy = new ArrayList<List<?>>();
             for (List<?> nameEntry : altNames) {
                 Object nameObject = nameEntry.get(1);
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/tools/jar/Main.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/tools/jar/Main.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/tools/jar/Main.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -128,5 +128,5 @@
     /**
      * Creates a new empty temporary file in the same directory as the
-     * specified file.  A variant of File.createTempFile.
+     * specified file.  A variant of sun.misc.IOUtils.createTempFile.
      */
     private static File createTempFileInSameDirectoryAs(File file)
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/tools/native2ascii/Main.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/tools/native2ascii/Main.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/classes/sun/tools/native2ascii/Main.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -238,7 +238,5 @@
                 tempDir = new File(System.getProperty("user.dir"));
 
-            tempFile = File.createTempFile("_N2A",
-                                           ".TMP",
-                                            tempDir);
+            tempFile = File.createTempFile("_N2A", ".TMP", tempDir);
             tempFile.deleteOnExit();
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/demo/jvmti/compiledMethodLoad/sample.makefile.txt
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/demo/jvmti/compiledMethodLoad/sample.makefile.txt	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/demo/jvmti/compiledMethodLoad/sample.makefile.txt	(revision 404)
@@ -91,5 +91,5 @@
     # Library name and options needed to build it
     LIBRARY=lib$(LIBNAME).so
-    LDFLAGS=-Wl,-soname=$(LIBRARY) -static-libgcc -mimpure-text
+    LDFLAGS=-Wl,-soname=$(LIBRARY) -static-libgcc
     # Libraries we are dependent on
     LIBRARIES=-lc
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/demo/jvmti/gctest/sample.makefile.txt
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/demo/jvmti/gctest/sample.makefile.txt	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/demo/jvmti/gctest/sample.makefile.txt	(revision 404)
@@ -91,5 +91,5 @@
     # Library name and options needed to build it
     LIBRARY=lib$(LIBNAME).so
-    LDFLAGS=-Wl,-soname=$(LIBRARY) -static-libgcc -mimpure-text
+    LDFLAGS=-Wl,-soname=$(LIBRARY) -static-libgcc
     # Libraries we are dependent on
     LIBRARIES=-lc
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/demo/jvmti/heapTracker/sample.makefile.txt
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/demo/jvmti/heapTracker/sample.makefile.txt	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/demo/jvmti/heapTracker/sample.makefile.txt	(revision 404)
@@ -95,5 +95,5 @@
     # Library name and options needed to build it
     LIBRARY=lib$(LIBNAME).so
-    LDFLAGS=-Wl,-soname=$(LIBRARY) -static-libgcc -mimpure-text
+    LDFLAGS=-Wl,-soname=$(LIBRARY) -static-libgcc
     # Libraries we are dependent on
     LIBRARIES=-L $(JDK)/jre/lib/$(LIBARCH) -ljava_crw_demo -lc
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/demo/jvmti/heapViewer/sample.makefile.txt
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/demo/jvmti/heapViewer/sample.makefile.txt	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/demo/jvmti/heapViewer/sample.makefile.txt	(revision 404)
@@ -91,5 +91,5 @@
     # Library name and options needed to build it
     LIBRARY=lib$(LIBNAME).so
-    LDFLAGS=-Wl,-soname=$(LIBRARY) -static-libgcc -mimpure-text
+    LDFLAGS=-Wl,-soname=$(LIBRARY) -static-libgcc
     # Libraries we are dependent on
     LIBRARIES=-lc
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/demo/jvmti/hprof/sample.makefile.txt
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/demo/jvmti/hprof/sample.makefile.txt	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/demo/jvmti/hprof/sample.makefile.txt	(revision 404)
@@ -131,5 +131,5 @@
     # Library name and options needed to build it
     LIBRARY=lib$(LIBNAME).so
-    LDFLAGS=-Wl,-soname=$(LIBRARY) -static-libgcc -mimpure-text
+    LDFLAGS=-Wl,-soname=$(LIBRARY) -static-libgcc
     # Libraries we are dependent on
     LIBRARIES= -lnsl -ldl -lc
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/demo/jvmti/index.html
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/demo/jvmti/index.html	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/demo/jvmti/index.html	(revision 404)
@@ -309,5 +309,5 @@
 gcc -O2 -fPIC -pthread -DLINUX -c <i>*.c</i>
 <br>
-gcc -z defs -static-libgcc -shared -mimpure-text -o <i>libXXX.so *.o</i> -lc
+gcc -z defs -static-libgcc -shared -o <i>libXXX.so *.o</i> -lc
 </code></ul>
 <br>
@@ -317,5 +317,5 @@
 gcc -O2 -fPIC -pthread -DLINUX -D_LP64=1 -c <i>*.c</i>
 <br>
-gcc -z defs -static-libgcc -shared -mimpure-text -o <i>libXXX.so *.o</i> -lc
+gcc -z defs -static-libgcc -shared -o <i>libXXX.so *.o</i> -lc
 </code></ul>
 <br>
@@ -340,5 +340,5 @@
 
 <li>
-Library: Use -static-libgcc -mimpure-text.
+Library: Use -static-libgcc.
 <br>
 When building the shared library (-shared option), this option
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/demo/jvmti/java_crw_demo/sample.makefile.txt
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/demo/jvmti/java_crw_demo/sample.makefile.txt	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/demo/jvmti/java_crw_demo/sample.makefile.txt	(revision 404)
@@ -91,5 +91,5 @@
     # Library name and options needed to build it
     LIBRARY=lib$(LIBNAME).so
-    LDFLAGS=-Wl,-soname=$(LIBRARY) -static-libgcc -mimpure-text
+    LDFLAGS=-Wl,-soname=$(LIBRARY) -static-libgcc
     # Libraries we are dependent on
     LIBRARIES=-lc
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/demo/jvmti/minst/sample.makefile.txt
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/demo/jvmti/minst/sample.makefile.txt	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/demo/jvmti/minst/sample.makefile.txt	(revision 404)
@@ -95,5 +95,5 @@
     # Library name and options needed to build it
     LIBRARY=lib$(LIBNAME).so
-    LDFLAGS=-Wl,-soname=$(LIBRARY) -static-libgcc -mimpure-text
+    LDFLAGS=-Wl,-soname=$(LIBRARY) -static-libgcc
     # Libraries we are dependent on
     LIBRARIES=-L $(JDK)/jre/lib/$(LIBARCH) -ljava_crw_demo -lc
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/demo/jvmti/mtrace/sample.makefile.txt
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/demo/jvmti/mtrace/sample.makefile.txt	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/demo/jvmti/mtrace/sample.makefile.txt	(revision 404)
@@ -95,5 +95,5 @@
     # Library name and options needed to build it
     LIBRARY=lib$(LIBNAME).so
-    LDFLAGS=-Wl,-soname=$(LIBRARY) -static-libgcc -mimpure-text
+    LDFLAGS=-Wl,-soname=$(LIBRARY) -static-libgcc
     # Libraries we are dependent on
     LIBRARIES=-L $(JDK)/jre/lib/$(LIBARCH) -ljava_crw_demo -lc
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/demo/jvmti/versionCheck/sample.makefile.txt
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/demo/jvmti/versionCheck/sample.makefile.txt	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/demo/jvmti/versionCheck/sample.makefile.txt	(revision 404)
@@ -91,5 +91,5 @@
     # Library name and options needed to build it
     LIBRARY=lib$(LIBNAME).so
-    LDFLAGS=-Wl,-soname=$(LIBRARY) -static-libgcc -mimpure-text
+    LDFLAGS=-Wl,-soname=$(LIBRARY) -static-libgcc
     # Libraries we are dependent on
     LIBRARIES=-lc
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/lib/security/java.security
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/lib/security/java.security	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/lib/security/java.security	(revision 404)
@@ -137,8 +137,8 @@
 # been granted.
 #
-# by default, no packages are restricted for definition, and none of
-# the class loaders supplied with the JDK call checkPackageDefinition.
-#
-#package.definition=
+# by default, none of the class loaders supplied with the JDK call
+# checkPackageDefinition.
+#
+package.definition=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.
 
 #
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/lib/security/java.security-solaris
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/lib/security/java.security-solaris	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/lib/security/java.security-solaris	(revision 404)
@@ -138,8 +138,8 @@
 # been granted.
 #
-# by default, no packages are restricted for definition, and none of
-# the class loaders supplied with the JDK call checkPackageDefinition.
-#
-#package.definition=
+# by default, none of the class loaders supplied with the JDK call
+# checkPackageDefinition.
+#
+package.definition=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.
 
 #
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/lib/security/java.security-windows
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/lib/security/java.security-windows	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/lib/security/java.security-windows	(revision 404)
@@ -138,8 +138,8 @@
 # been granted.
 #
-# by default, no packages are restricted for definition, and none of
-# the class loaders supplied with the JDK call checkPackageDefinition.
-#
-#package.definition=
+# by default, none of the class loaders supplied with the JDK call
+# checkPackageDefinition.
+#
+package.definition=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.
 
 #
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/native/java/net/net_util.c
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/native/java/net/net_util.c	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/native/java/net/net_util.c	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -69,4 +69,6 @@
     IPv6_available = IPv6_supported() & (!preferIPv4Stack);
     initLocalAddrTable ();
+    parseExclusiveBindProperty(env);
+
     return JNI_VERSION_1_2;
 }
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/native/java/net/net_util.h
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/native/java/net/net_util.h	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/native/java/net/net_util.h	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -121,4 +121,5 @@
 
 void initLocalAddrTable ();
+void parseExclusiveBindProperty(JNIEnv *env);
 
 void
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/native/sun/font/layout/LookupProcessor.cpp
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/native/sun/font/layout/LookupProcessor.cpp	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/native/sun/font/layout/LookupProcessor.cpp	(revision 404)
@@ -87,4 +87,8 @@
         if (selectMask != 0) {
             const LookupTable *lookupTable = lookupListTable->getLookupTable(lookup);
+
+            if (!lookupTable)
+                continue;
+
             le_uint16 lookupFlags = SWAPW(lookupTable->lookupFlags);
 
@@ -125,4 +129,7 @@
         le_uint16 lookupListIndex = SWAPW(featureTable->lookupListIndexArray[lookup]);
 
+        if (lookupListIndex >= lookupSelectCount)
+            continue;
+
         lookupSelectArray[lookupListIndex] |= featureMask;
         lookupOrderArray[store++] = lookupListIndex;
@@ -136,5 +143,5 @@
         LETag scriptTag, LETag languageTag, const FeatureMap *featureMap,
         le_int32 featureMapCount, le_bool orderFeatures)
-    : lookupListTable(NULL), featureListTable(NULL), lookupSelectArray(NULL),
+    : lookupListTable(NULL), featureListTable(NULL), lookupSelectArray(NULL), lookupSelectCount(0),
       lookupOrderArray(NULL), lookupOrderCount(0)
 {
@@ -175,4 +182,6 @@
         lookupSelectArray[i] = 0;
     }
+
+    lookupSelectCount = lookupListCount;
 
     le_int32 count, order = 0;
@@ -192,4 +201,8 @@
 
         featureTable = featureListTable->getFeatureTable(featureIndex, &featureTag);
+
+        if (!featureTable)
+            continue;
+
         featureReferences += SWAPW(featureTable->lookupCount);
     }
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/share/native/sun/font/layout/LookupProcessor.h
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/share/native/sun/font/layout/LookupProcessor.h	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/share/native/sun/font/layout/LookupProcessor.h	(revision 404)
@@ -78,4 +78,5 @@
 
     FeatureMask             *lookupSelectArray;
+    le_uint32               lookupSelectCount;
 
     le_uint16               *lookupOrderArray;
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/java/io/UnixFileSystem.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/java/io/UnixFileSystem.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/java/io/UnixFileSystem.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -254,5 +254,5 @@
     /* -- File operations -- */
 
-    public native boolean createFileExclusively(String path)
+    public native boolean createFileExclusively(String path, boolean restrictive)
         throws IOException;
     public boolean delete(File f) {
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XCheckboxMenuItemPeer.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XCheckboxMenuItemPeer.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XCheckboxMenuItemPeer.java	(revision 404)
@@ -30,22 +30,7 @@
 import java.awt.event.*;
 
-import java.lang.reflect.Field;
-import sun.awt.SunToolkit;
+import sun.awt.AWTAccessor;
 
 class XCheckboxMenuItemPeer extends XMenuItemPeer implements CheckboxMenuItemPeer {
-
-    /************************************************
-     *
-     * Data members
-     *
-     ************************************************/
-
-    /*
-     * CheckboxMenuItem's fields
-     */
-    private final static Field f_state;
-    static {
-        f_state = SunToolkit.getField(CheckboxMenuItem.class, "state");
-    }
 
     /************************************************
@@ -75,14 +60,6 @@
      ************************************************/
     boolean getTargetState() {
-        MenuItem target = getTarget();
-        if (target == null) {
-            return false;
-        }
-        try {
-            return f_state.getBoolean(target);
-        } catch (IllegalAccessException e) {
-            e.printStackTrace();
-        }
-        return false;
+        return AWTAccessor.getCheckboxMenuItemAccessor()
+                   .getState((CheckboxMenuItem)getTarget());
     }
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java	(revision 404)
@@ -32,7 +32,5 @@
 import java.awt.Container;
 import java.awt.Cursor;
-import java.awt.DefaultKeyboardFocusManager;
 import java.awt.Dimension;
-import java.awt.Event;
 import java.awt.Font;
 import java.awt.FontMetrics;
@@ -41,6 +39,4 @@
 import java.awt.Insets;
 import java.awt.KeyboardFocusManager;
-import java.awt.MenuBar;
-import java.awt.Point;
 import java.awt.Rectangle;
 import java.awt.SystemColor;
@@ -61,10 +57,7 @@
 import java.awt.image.ImageProducer;
 import java.awt.image.VolatileImage;
-import java.awt.peer.CanvasPeer;
 import java.awt.peer.ComponentPeer;
 import java.awt.peer.ContainerPeer;
 import java.awt.peer.LightweightPeer;
-import java.awt.peer.PanelPeer;
-import java.awt.peer.WindowPeer;
 import java.lang.reflect.*;
 import java.security.*;
@@ -398,17 +391,6 @@
     }
 
-    static Method requestFocusWithCause;
-
     static void callRequestFocus(Component target, CausedFocusEvent.Cause cause) {
-        if (requestFocusWithCause == null) {
-            requestFocusWithCause = SunToolkit.getMethod(Component.class, "requestFocus", new Class[] {CausedFocusEvent.Cause.class});
-        }
-        if (requestFocusWithCause != null) {
-            try {
-                requestFocusWithCause.invoke(target, new Object[] {cause});
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-        }
+        AWTAccessor.getComponentAccessor().requestFocus(target, cause);
     }
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XEmbedCanvasPeer.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XEmbedCanvasPeer.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XEmbedCanvasPeer.java	(revision 404)
@@ -30,12 +30,5 @@
 import java.awt.dnd.DropTargetListener;
 import java.awt.event.*;
-import java.awt.image.ColorModel;
-import java.awt.image.ImageObserver;
-import java.awt.image.ImageProducer;
-import java.awt.image.VolatileImage;
-import java.awt.peer.*;
 import sun.awt.*;
-import sun.awt.motif.X11FontMetrics;
-import java.lang.reflect.*;
 import java.util.logging.*;
 import java.util.*;
@@ -456,14 +449,6 @@
     }
 
-    static Field bdataField;
     static byte[] getBData(KeyEvent e) {
-        try {
-            if (bdataField == null) {
-                bdataField = SunToolkit.getField(java.awt.AWTEvent.class, "bdata");
-            }
-            return (byte[])bdataField.get(e);
-        } catch (IllegalAccessException ex) {
-            return null;
-        }
+        return AWTAccessor.getAWTEventAccessor().getBData(e);
     }
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XEmbeddingContainer.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XEmbeddingContainer.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XEmbeddingContainer.java	(revision 404)
@@ -29,6 +29,5 @@
 import java.util.HashMap;
 import java.awt.event.KeyEvent;
-import java.lang.reflect.*;
-import sun.awt.SunToolkit;
+import sun.awt.AWTAccessor;
 
 public class XEmbeddingContainer extends XEmbedHelper implements XEventDispatcher {
@@ -128,18 +127,6 @@
     }
 
-    static Field bdata;
-    byte[] getBData(KeyEvent e) {
-        try {
-            if (bdata == null) {
-                bdata = SunToolkit.getField(java.awt.AWTEvent.class, "bdata");
-            }
-            return (byte[])bdata.get(e);
-        } catch (IllegalAccessException ex) {
-            return null;
-        }
-    }
-
     void forwardKeyEvent(long child, KeyEvent e) {
-        byte[] bdata = getBData(e);
+        byte[] bdata = AWTAccessor.getAWTEventAccessor().getBData(e);
         long data = Native.toData(bdata);
         if (data == 0) {
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XGlobalCursorManager.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XGlobalCursorManager.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XGlobalCursorManager.java	(revision 404)
@@ -30,29 +30,10 @@
 import java.awt.peer.LightweightPeer;
 import java.lang.ref.WeakReference;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
 import sun.awt.ComponentAccessor;
 
 import sun.awt.GlobalCursorManager;
-import sun.awt.SunToolkit;
+import sun.awt.AWTAccessor;
 
 public final class XGlobalCursorManager extends GlobalCursorManager {
-
-    private static Field  field_pData;
-    private static Field  field_type;
-    private static Class  cursorClass;
-    private static Method method_setPData;
-    static {
-        cursorClass = java.awt.Cursor.class;
-        field_pData = SunToolkit.getField(cursorClass, "pData");
-        field_type  = SunToolkit.getField(cursorClass, "type");
-        method_setPData = SunToolkit.getMethod(cursorClass, "setPData", new Class[] {long.class});
-        if (field_pData == null || field_type == null || method_setPData == null) {
-            System.out.println("Unable to initialize XGlobalCursorManager: ");
-            Thread.dumpStack();
-
-        }
-    }
-
 
     // cached nativeContainer
@@ -217,6 +198,6 @@
         int type = 0;
         try {
-            pData = field_pData.getLong(c);
-            type = field_type.getInt(c);
+            pData = AWTAccessor.getCursorAccessor().getPData(c);
+            type = AWTAccessor.getCursorAccessor().getType(c);
         }
         catch (Exception e)
@@ -288,5 +269,5 @@
     static void setPData(Cursor c, long pData) {
         try {
-            method_setPData.invoke(c, pData);
+            AWTAccessor.getCursorAccessor().setPData(c, pData);
         }
         catch (Exception e)
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XKeyboardFocusManagerPeer.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XKeyboardFocusManagerPeer.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XKeyboardFocusManagerPeer.java	(revision 404)
@@ -33,12 +33,9 @@
 import java.awt.peer.KeyboardFocusManagerPeer;
 
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import sun.awt.CausedFocusEvent;
-import sun.awt.SunToolkit;
+import sun.awt.AWTAccessor;
 
 public class XKeyboardFocusManagerPeer implements KeyboardFocusManagerPeer {
@@ -131,45 +128,15 @@
     }
 
-    static Method shouldNativelyFocusHeavyweightMethod;
-
     static int shouldNativelyFocusHeavyweight(Component heavyweight,
          Component descendant, boolean temporary,
          boolean focusedWindowChangeAllowed, long time, CausedFocusEvent.Cause cause)
     {
-        if (shouldNativelyFocusHeavyweightMethod == null) {
-            Class[] arg_types =
-                new Class[] { Component.class,
-                              Component.class,
-                              Boolean.TYPE,
-                              Boolean.TYPE,
-                              Long.TYPE,
-                              CausedFocusEvent.Cause.class
-            };
-
-            shouldNativelyFocusHeavyweightMethod =
-                SunToolkit.getMethod(KeyboardFocusManager.class,
-                                   "shouldNativelyFocusHeavyweight",
-                                   arg_types);
-        }
-        Object[] args = new Object[] { heavyweight,
-                                       descendant,
-                                       Boolean.valueOf(temporary),
-                                       Boolean.valueOf(focusedWindowChangeAllowed),
-                                       Long.valueOf(time), cause};
-
-        int result = XComponentPeer.SNFH_FAILURE;
-        if (shouldNativelyFocusHeavyweightMethod != null) {
-            try {
-                result = ((Integer) shouldNativelyFocusHeavyweightMethod.invoke(null, args)).intValue();
-            }
-            catch (IllegalAccessException e) {
-                assert false;
-            }
-            catch (InvocationTargetException e) {
-                assert false;
-            }
-        }
-
-        return result;
+         return AWTAccessor.getKeyboardFocusManagerAccessor()
+                 .shouldNativelyFocusHeavyweight(heavyweight,
+                                                 descendant,
+                                                 temporary,
+                                                 focusedWindowChangeAllowed,
+                                                 time,
+                                                 cause);
     }
 }
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XMenuBarPeer.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XMenuBarPeer.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XMenuBarPeer.java	(revision 404)
@@ -29,8 +29,7 @@
 import java.awt.event.*;
 
-import java.lang.reflect.Field;
 import java.util.Vector;
 import java.util.logging.*;
-import sun.awt.SunToolkit;
+import sun.awt.AWTAccessor;
 
 public class XMenuBarPeer extends XBaseMenuWindow implements MenuBarPeer {
@@ -67,13 +66,4 @@
     private final static int BAR_ITEM_MARGIN_TOP = 2;
     private final static int BAR_ITEM_MARGIN_BOTTOM = 2;
-
-    //fields
-    private static Field f_helpMenu;
-    private static Field f_menus;
-
-    static {
-        f_helpMenu = SunToolkit.getField(MenuBar.class, "helpMenu");
-        f_menus = SunToolkit.getField(MenuBar.class, "menus");
-    }
 
     /************************************************
@@ -205,17 +195,10 @@
     void postInit(XCreateWindowParams params) {
         super.postInit(params);
-        Vector targetMenuVector = null;
-        Menu targetHelpMenu = null;
-        try {
-            // Get menus from the target.
-            targetMenuVector = (Vector)f_menus.get(menuBarTarget);
-            targetHelpMenu = (Menu)f_helpMenu.get(menuBarTarget);
-            reloadItems(targetMenuVector);
-        } catch (IllegalAccessException iae) {
-            iae.printStackTrace();
-        }
-        if (targetHelpMenu != null) {
-            addHelpMenu(targetHelpMenu);
-        }
+        // Get menus from the target.
+        Vector targetMenuVector = AWTAccessor.getMenuBarAccessor()
+                                      .getMenus(menuBarTarget);
+        Menu targetHelpMenu = AWTAccessor.getMenuBarAccessor()
+                                  .getHelpMenu(menuBarTarget);
+        reloadItems(targetMenuVector);
         xSetVisible(true);
         toFront();
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XMenuItemPeer.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XMenuItemPeer.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XMenuItemPeer.java	(revision 404)
@@ -29,10 +29,5 @@
 import java.awt.event.*;
 
-import java.util.logging.*;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.InvocationTargetException;
-import sun.awt.SunToolkit;
+import sun.awt.AWTAccessor;
 
 public class XMenuItemPeer implements MenuItemPeer {
@@ -84,22 +79,4 @@
     private final static int SEPARATOR_HEIGHT = 5;
 
-    /*
-     * MenuItem's fields & methods
-     */
-    private final static Field f_enabled;
-    private final static Field f_label;
-    private final static Field f_shortcut;
-    private final static Method m_getFont;
-    private final static Method m_isItemEnabled;
-    private final static Method m_getActionCommand;
-    static {
-        f_enabled = SunToolkit.getField(MenuItem.class, "enabled");
-        f_label = SunToolkit.getField(MenuItem.class, "label");
-        f_shortcut = SunToolkit.getField(MenuItem.class, "shortcut");
-
-        m_getFont = SunToolkit.getMethod(MenuComponent.class, "getFont_NoClientCode", null);
-        m_getActionCommand = SunToolkit.getMethod(MenuItem.class, "getActionCommandImpl", null);
-        m_isItemEnabled = SunToolkit.getMethod(MenuItem.class, "isItemEnabled", null);
-    }
     /************************************************
      *
@@ -219,12 +196,5 @@
             return XWindow.defaultFont;
         }
-        try {
-            return (Font)m_getFont.invoke(target, new Object[0]);
-        } catch (IllegalAccessException e) {
-            e.printStackTrace();
-        } catch (InvocationTargetException e) {
-            e.printStackTrace();
-        }
-        return XWindow.defaultFont;
+        return AWTAccessor.getMenuComponentAccessor().getFont_NoClientCode(target);
     }
 
@@ -233,11 +203,6 @@
             return "";
         }
-        try {
-            String label = (String)f_label.get(target);
-            return (label == null) ? "" : label;
-        } catch (IllegalAccessException e) {
-            e.printStackTrace();
-        }
-        return "";
+        String label = AWTAccessor.getMenuItemAccessor().getLabel(target);
+        return (label == null) ? "" : label;
     }
 
@@ -246,10 +211,5 @@
             return false;
         }
-        try {
-            return f_enabled.getBoolean(target);
-        } catch (IllegalAccessException e) {
-            e.printStackTrace();
-        }
-        return false;
+        return AWTAccessor.getMenuItemAccessor().isEnabled(target);
     }
 
@@ -263,12 +223,5 @@
             return false;
         }
-        try {
-            return ((Boolean)m_isItemEnabled.invoke(target, new Object[0])).booleanValue();
-        } catch (IllegalAccessException e) {
-            e.printStackTrace();
-        } catch (InvocationTargetException e) {
-            e.printStackTrace();
-        }
-        return false;
+        return AWTAccessor.getMenuItemAccessor().isItemEnabled(target);
     }
 
@@ -277,12 +230,5 @@
             return "";
         }
-        try {
-            return (String) m_getActionCommand.invoke(target,(Object[]) null);
-        } catch (IllegalAccessException e) {
-            e.printStackTrace();
-        } catch (InvocationTargetException e) {
-            e.printStackTrace();
-        }
-        return "";
+        return AWTAccessor.getMenuItemAccessor().getActionCommandImpl(target);
     }
 
@@ -291,10 +237,5 @@
             return null;
         }
-        try {
-            return (MenuShortcut)f_shortcut.get(target);
-        } catch (IllegalAccessException e) {
-            e.printStackTrace();
-        }
-        return null;
+        return AWTAccessor.getMenuItemAccessor().getShortcut(target);
     }
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XMenuPeer.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XMenuPeer.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XMenuPeer.java	(revision 404)
@@ -28,8 +28,7 @@
 import java.awt.peer.*;
 
-import java.lang.reflect.Field;
 import java.util.Vector;
 import java.util.logging.*;
-import sun.awt.SunToolkit;
+import sun.awt.AWTAccessor;
 
 public class XMenuPeer extends XMenuItemPeer implements MenuPeer {
@@ -46,14 +45,4 @@
      */
     XMenuWindow menuWindow;
-
-
-    /*
-     * Menu's fields & methods
-     */
-    private final static Field f_items;
-
-    static {
-        f_items = SunToolkit.getField(Menu.class, "items");
-    }
 
     /************************************************
@@ -154,10 +143,5 @@
      ************************************************/
     Vector getTargetItems() {
-        try {
-            return (Vector)f_items.get(getTarget());
-        } catch (IllegalAccessException iae) {
-            iae.printStackTrace();
-            return null;
-        }
+        return AWTAccessor.getMenuAccessor().getItems((Menu)getTarget());
     }
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XPopupMenuPeer.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XPopupMenuPeer.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XPopupMenuPeer.java	(revision 404)
@@ -29,12 +29,7 @@
 import java.awt.event.*;
 
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.InvocationTargetException;
-
 import java.util.Vector;
+import sun.awt.AWTAccessor;
 import java.util.logging.*;
-
-import sun.awt.SunToolkit;
 
 public class XPopupMenuPeer extends XMenuWindow implements PopupMenuPeer {
@@ -66,22 +61,4 @@
     private final static int CAPTION_MARGIN_TOP = 4;
     private final static int CAPTION_SEPARATOR_HEIGHT = 6;
-
-    /*
-     * Menu's fields & methods
-     */
-    //Fix for 6184485: Popup menu is not disabled on XToolkit even when calling setEnabled (false)
-    private final static Field f_enabled;
-    //Fix for 6267144: PIT: Popup menu label is not shown, XToolkit
-    private final static Field f_label;
-    private final static Method m_getFont;
-    private final static Field f_items;
-
-    static {
-        f_enabled = SunToolkit.getField(MenuItem.class, "enabled");
-        f_label = SunToolkit.getField(MenuItem.class, "label");
-        f_items = SunToolkit.getField(Menu.class, "items");
-        m_getFont = SunToolkit.getMethod(MenuComponent.class, "getFont_NoClientCode", null);
-    }
-
 
     /************************************************
@@ -190,25 +167,14 @@
             return XWindow.defaultFont;
         }
-        try {
-            return (Font)m_getFont.invoke(popupMenuTarget, new Object[0]);
-        } catch (IllegalAccessException e) {
-            e.printStackTrace();
-        } catch (InvocationTargetException e) {
-            e.printStackTrace();
-        }
-        return XWindow.defaultFont;
-    }
-
+        return AWTAccessor.getMenuComponentAccessor()
+                   .getFont_NoClientCode(popupMenuTarget);
+    }
+
+    //Fix for 6267144: PIT: Popup menu label is not shown, XToolkit
     String getTargetLabel() {
         if (target == null) {
             return "";
         }
-        try {
-            String label = (String)f_label.get(popupMenuTarget);
-            return (label == null) ? "" : label;
-        } catch (IllegalAccessException e) {
-            e.printStackTrace();
-        }
-        return "";
+        return AWTAccessor.getMenuItemAccessor().getLabel(popupMenuTarget);
     }
 
@@ -218,19 +184,12 @@
             return false;
         }
-        try {
-            return f_enabled.getBoolean(popupMenuTarget);
-        } catch (IllegalAccessException e) {
-            e.printStackTrace();
-        }
-        return false;
+        return AWTAccessor.getMenuItemAccessor().isEnabled(popupMenuTarget);
     }
 
     Vector getMenuTargetItems() {
-        try {
-            return (Vector)f_items.get(popupMenuTarget);
-        } catch (IllegalAccessException iae) {
-            iae.printStackTrace();
+        if (popupMenuTarget == null) {
             return null;
         }
+        return AWTAccessor.getMenuAccessor().getItems(popupMenuTarget);
     }
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XScrollPanePeer.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XScrollPanePeer.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XScrollPanePeer.java	(revision 404)
@@ -29,6 +29,6 @@
 import java.awt.event.*;
 import java.awt.peer.*;
-import java.lang.reflect.*;
-import sun.awt.SunToolkit;
+
+import sun.awt.AWTAccessor;
 
 class XScrollPanePeer extends XComponentPeer implements ScrollPanePeer, XScrollbarClient {
@@ -42,7 +42,5 @@
     public final static int     HORIZONTAL = 1 << 1;
 
-    private static Method m_setValue;
     static {
-        m_setValue = SunToolkit.getMethod(ScrollPaneAdjustable.class, "setTypedValue", new Class[] {Integer.TYPE, Integer.TYPE});
         SCROLLBAR = XToolkit.getUIDefaults().getInt("ScrollBar.defaultWidth");
     }
@@ -317,14 +315,6 @@
 
     void setAdjustableValue(ScrollPaneAdjustable adj, int value, int type) {
-        try {
-            m_setValue.invoke(adj, new Object[] {Integer.valueOf(value), Integer.valueOf(type)});
-        } catch (IllegalAccessException iae) {
-            adj.setValue(value);
-        } catch (IllegalArgumentException iae2) {
-            adj.setValue(value);
-        } catch (InvocationTargetException ite) {
-            adj.setValue(value);
-            ite.getCause().printStackTrace();
-        }
+        AWTAccessor.getScrollPaneAdjustableAccessor().setTypedValue(adj, value,
+                                                                    type);
     }
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XTextAreaPeer.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XTextAreaPeer.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XTextAreaPeer.java	(revision 404)
@@ -62,4 +62,5 @@
 import sun.awt.CausedFocusEvent;
 import sun.awt.ComponentAccessor;
+import sun.awt.AWTAccessor;
 
 
@@ -986,6 +987,8 @@
         public void setTransferHandler(TransferHandler newHandler) {
             TransferHandler oldHandler = (TransferHandler)
-                getClientProperty(XTextTransferHelper.getTransferHandlerKey());
-            putClientProperty(XTextTransferHelper.getTransferHandlerKey(),
+                getClientProperty(AWTAccessor.getClientPropertyKeyAccessor()
+                                      .getJComponent_TRANSFER_HANDLER());
+            putClientProperty(AWTAccessor.getClientPropertyKeyAccessor()
+                                  .getJComponent_TRANSFER_HANDLER(),
                               newHandler);
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XTextFieldPeer.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XTextFieldPeer.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XTextFieldPeer.java	(revision 404)
@@ -56,4 +56,5 @@
 import sun.awt.CausedFocusEvent;
 import sun.awt.ComponentAccessor;
+import sun.awt.AWTAccessor;
 
 public class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
@@ -715,6 +716,8 @@
         public void setTransferHandler(TransferHandler newHandler) {
             TransferHandler oldHandler = (TransferHandler)
-                getClientProperty(XTextTransferHelper.getTransferHandlerKey());
-            putClientProperty(XTextTransferHelper.getTransferHandlerKey(),
+                getClientProperty(AWTAccessor.getClientPropertyKeyAccessor()
+                                      .getJComponent_TRANSFER_HANDLER());
+            putClientProperty(AWTAccessor.getClientPropertyKeyAccessor()
+                                  .getJComponent_TRANSFER_HANDLER(),
                               newHandler);
 
Index: anches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XTextTransferHelper.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XTextTransferHelper.java	(revision 403)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2003, 2007, 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.X11;
-
-import java.lang.reflect.Field;
-import sun.awt.SunToolkit;
-
-class XTextTransferHelper {
-    private static Object transferHandlerKey = null;
-    static Object getTransferHandlerKey() {
-        if (transferHandlerKey == null) {
-            try {
-                Class clazz = Class.forName("javax.swing.ClientPropertyKey");
-                Field field = SunToolkit.getField(clazz, "JComponent_TRANSFER_HANDLER");
-                transferHandlerKey = field.get(null);
-            } catch (IllegalAccessException ex) {
-                return null;
-            } catch (ClassNotFoundException cnfe) {
-                cnfe.printStackTrace();
-            }
-        }
-        return transferHandlerKey;
-    }
-}
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java	(revision 404)
@@ -50,5 +50,5 @@
 import sun.print.PrintJob2D;
 import sun.security.action.GetBooleanAction;
-import java.lang.reflect.*;
+import sun.security.action.GetPropertyAction;
 
 public class XToolkit extends UNIXToolkit implements Runnable, XConstants {
@@ -103,5 +103,4 @@
     static long awt_defaultFg; // Pixel
     private static XMouseInfoPeer xPeer;
-    private static Method m_removeSourceEvents;
 
     static {
@@ -121,7 +120,7 @@
             setBackingStoreType();
         }
-        m_removeSourceEvents = SunToolkit.getMethod(EventQueue.class, "removeSourceEvents", new Class[] {Object.class, Boolean.TYPE}) ;
-
-        noisyAwtHandler = AccessController.doPrivileged(new GetBooleanAction("sun.awt.noisyerrorhandler"));
+
+        noisyAwtHandler = AccessController.doPrivileged(
+                new GetBooleanAction("sun.awt.noisyerrorhandler"));
     }
 
@@ -204,5 +203,6 @@
     static void initSecurityWarning() {
         // Enable warning only for internal builds
-        String runtime = getSystemProperty("java.runtime.version");
+        String runtime = AccessController.doPrivileged(
+                new GetPropertyAction("java.runtime.version"));
         securityWarningEnabled = (runtime != null && runtime.contains("internal"));
     }
@@ -1125,12 +1125,4 @@
             awtUnlock();
         }
-    }
-
-    static String getSystemProperty(final String name) {
-        return (String)AccessController.doPrivileged(new PrivilegedAction() {
-                public Object run() {
-                    return System.getProperty(name);
-                }
-            });
     }
 
@@ -1895,14 +1887,5 @@
 
     static void removeSourceEvents(EventQueue queue, Object source, boolean removeAllEvents) {
-        try {
-            m_removeSourceEvents.invoke(queue, source, removeAllEvents);
-        }
-        catch (IllegalAccessException e)
-        {
-            e.printStackTrace();
-        }
-        catch (InvocationTargetException e) {
-            e.printStackTrace();
-        }
+        AWTAccessor.getEventQueueAccessor().removeSourceEvents(queue, source, removeAllEvents);
     }
 
@@ -1938,6 +1921,6 @@
 
     private static void setBackingStoreType() {
-        String prop = (String)AccessController.doPrivileged(
-                new sun.security.action.GetPropertyAction("sun.awt.backingStore"));
+        String prop = AccessController.doPrivileged(
+                new GetPropertyAction("sun.awt.backingStore"));
 
         if (prop == null) {
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XWindow.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XWindow.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XWindow.java	(revision 404)
@@ -34,5 +34,4 @@
 
 import java.lang.reflect.Field;
-import java.lang.reflect.Method;
 
 import java.util.logging.Level;
@@ -109,5 +108,4 @@
     private native static void initIDs();
 
-    private static Field isPostedField;
     static {
         initIDs();
@@ -362,18 +360,8 @@
     }
 
-    static Method m_sendMessage;
     static void sendEvent(final AWTEvent e) {
-        if (isPostedField == null) {
-            isPostedField = SunToolkit.getField(AWTEvent.class, "isPosted");
-        }
         PeerEvent pe = new PeerEvent(Toolkit.getDefaultToolkit(), new Runnable() {
                 public void run() {
-                    try {
-                        isPostedField.setBoolean(e, true);
-                    } catch (IllegalArgumentException e) {
-                        assert(false);
-                    } catch (IllegalAccessException e) {
-                        assert(false);
-                    }
+                    AWTAccessor.getAWTEventAccessor().setPosted(e);
                     ((Component)e.getSource()).dispatchEvent(e);
                 }
@@ -1251,14 +1239,6 @@
 
 
-    static Field bdata;
     static void setBData(KeyEvent e, byte[] data) {
-        try {
-            if (bdata == null) {
-                bdata = SunToolkit.getField(java.awt.AWTEvent.class, "bdata");
-            }
-            bdata.set(e, data);
-        } catch (IllegalAccessException ex) {
-            assert false;
-        }
+        AWTAccessor.getAWTEventAccessor().setBData(e, data);
     }
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XlibWrapper.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XlibWrapper.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/X11/XlibWrapper.java	(revision 404)
@@ -27,5 +27,5 @@
 
 import java.security.AccessController;
-import java.security.PrivilegedAction;
+import sun.security.action.GetPropertyAction;
 import sun.misc.*;
 
@@ -563,10 +563,5 @@
 
     static {
-        String dataModelProp = (String)AccessController.doPrivileged(
-            new PrivilegedAction() {
-                    public Object run() {
-                        return System.getProperty("sun.arch.data.model");
-                    }
-                });
+        String dataModelProp = AccessController.doPrivileged(new GetPropertyAction("sun.arch.data.model"));
         try {
             dataModel = Integer.parseInt(dataModelProp);
@@ -611,5 +606,5 @@
 
     private static boolean getBuildInternal() {
-        String javaVersion = XToolkit.getSystemProperty("java.version");
+        String javaVersion = AccessController.doPrivileged(new GetPropertyAction("java.version"));
         return javaVersion != null && javaVersion.contains("internal");
     }
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/motif/MComponentPeer.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/motif/MComponentPeer.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/awt/motif/MComponentPeer.java	(revision 404)
@@ -401,14 +401,5 @@
 
     static void callRequestFocusInWindow(Component target, CausedFocusEvent.Cause cause) {
-        if (requestFocusWithCause == null) {
-            requestFocusWithCause = SunToolkit.getMethod(Component.class, "requestFocusInWindow", new Class[] {CausedFocusEvent.Cause.class});
-        }
-        if (requestFocusWithCause != null) {
-            try {
-                requestFocusWithCause.invoke(target, new Object[] {cause});
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-        }
+        AWTAccessor.getComponentAccessor().requestFocusInWindow(target, cause);
     }
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/print/UnixPrintJob.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/print/UnixPrintJob.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/print/UnixPrintJob.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -938,5 +938,5 @@
                      * removed when the VM exits.
                      */
-                    spoolFile = File.createTempFile("javaprint", ".ps", null);
+                    spoolFile = sun.misc.IOUtils.createTempFile("javaprint", ".ps", null);
                     spoolFile.deleteOnExit();
                 }
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -713,5 +713,5 @@
                         Process proc;
                         BufferedReader bufferedReader = null;
-                        File f = File.createTempFile("prn","xc");
+                        File f = sun.misc.IOUtils.createTempFile("prn","xc");
                         cmd[2] = cmd[2]+">"+f.getAbsolutePath();
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/native/java/io/UnixFileSystem_md.c
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/native/java/io/UnixFileSystem_md.c	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/native/java/io/UnixFileSystem_md.c	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -311,5 +311,6 @@
 JNIEXPORT jboolean JNICALL
 Java_java_io_UnixFileSystem_createFileExclusively(JNIEnv *env, jclass cls,
-                                                  jstring pathname)
+                                                  jstring pathname,
+                                                  jboolean restrictive)
 {
     jboolean rv = JNI_FALSE;
@@ -320,5 +321,6 @@
             fd = JVM_EEXIST;    /* The root directory always exists */
         } else {
-            fd = JVM_Open(path, JVM_O_RDWR | JVM_O_CREAT | JVM_O_EXCL, 0666);
+            jint mode = (restrictive == JNI_TRUE) ? 0600 : 0666;
+            fd = JVM_Open(path, JVM_O_RDWR | JVM_O_CREAT | JVM_O_EXCL, mode);
         }
         if (fd < 0) {
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/native/java/net/net_util_md.c
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/native/java/net/net_util_md.c	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/solaris/native/java/net/net_util_md.c	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -65,5 +65,5 @@
 
 /*
- * EXCLBIND socket options only on Solaris 8 & 9.
+ * EXCLBIND socket options only on Solaris
  */
 #if defined(__solaris__) && !defined(TCP_EXCLBIND)
@@ -78,4 +78,5 @@
 static int tcp_max_buf;
 static int udp_max_buf;
+static int useExclBind = 0;
 
 /*
@@ -646,4 +647,24 @@
 
 #endif
+
+void parseExclusiveBindProperty(JNIEnv *env) {
+#ifdef __solaris__
+    jstring s, flagSet;
+    jclass iCls;
+    jmethodID mid;
+
+    s = (*env)->NewStringUTF(env, "sun.net.useExclusiveBind");
+    CHECK_NULL(s);
+    iCls = (*env)->FindClass(env, "java/lang/System");
+    CHECK_NULL(iCls);
+    mid = (*env)->GetStaticMethodID(env, iCls, "getProperty",
+                "(Ljava/lang/String;)Ljava/lang/String;");
+    CHECK_NULL(mid);
+    flagSet = (*env)->CallStaticObjectMethod(env, iCls, mid, s);
+    if (flagSet != NULL) {
+        useExclBind = 1;
+    }
+#endif
+}
 
 /* In the case of an IPv4 Inetaddress this method will return an
@@ -1223,6 +1244,6 @@
  * caught.
  *
- * On Solaris 8/9 with IPv6 enabled we must use an exclusive
- * bind to guaranteed a unique port number across the IPv4 and
+ * On Solaris with IPv6 enabled we must use an exclusive
+ * bind to guarantee a unique port number across the IPv4 and
  * IPv6 port spaces.
  *
@@ -1254,8 +1275,8 @@
 #if defined(__solaris__) && defined(AF_INET6)
     /*
-     * Solaris 8/9 have seperate IPv4 and IPv6 port spaces so we
+     * Solaris has separate IPv4 and IPv6 port spaces so we
      * use an exclusive bind when SO_REUSEADDR is not used to
      * give the illusion of a unified port space.
-     * This also avoid problems with IPv6 sockets connecting
+     * This also avoids problems with IPv6 sockets connecting
      * to IPv4 mapped addresses whereby the socket conversion
      * results in a late bind that fails because the
@@ -1266,9 +1287,10 @@
 
         len = sizeof(arg);
-        if (getsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&arg,
-                       &len) == 0) {
-            if (arg == 0) {
+        if (useExclBind || getsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
+                       (char *)&arg, &len) == 0) {
+            if (useExclBind || arg == 0) {
                 /*
-                 * SO_REUSEADDR is disabled so enable TCP_EXCLBIND or
+                 * SO_REUSEADDR is disabled or sun.net.useExclusiveBind
+                 * property is true so enable TCP_EXCLBIND or
                  * UDP_EXCLBIND
                  */
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/windows/classes/java/io/Win32FileSystem.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/windows/classes/java/io/Win32FileSystem.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/windows/classes/java/io/Win32FileSystem.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -511,5 +511,5 @@
     /* -- File operations -- */
 
-    public native boolean createFileExclusively(String path)
+    public native boolean createFileExclusively(String path, boolean restrictive)
         throws IOException;
     public boolean delete(File f) {
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/windows/classes/java/io/WinNTFileSystem.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/windows/classes/java/io/WinNTFileSystem.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/windows/classes/java/io/WinNTFileSystem.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -62,5 +62,5 @@
     /* -- File operations -- */
 
-    public native boolean createFileExclusively(String path)
+    public native boolean createFileExclusively(String path, boolean restrictive)
                                                throws IOException;
     protected native boolean delete0(File f);
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/windows/classes/sun/awt/windows/WPopupMenuPeer.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/windows/classes/sun/awt/windows/WPopupMenuPeer.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/windows/classes/sun/awt/windows/WPopupMenuPeer.java	(revision 404)
@@ -27,7 +27,6 @@
 import java.awt.*;
 import java.awt.peer.*;
-import java.lang.reflect.Field;
 
-import sun.awt.SunToolkit;
+import sun.awt.AWTAccessor;
 
 public class WPopupMenuPeer extends WMenuPeer implements PopupMenuPeer {
@@ -35,11 +34,4 @@
     // because this method should return null for the TrayIcon
     // popup regardless of that whether it has parent or not.
-    private static Field f_parent;
-    private static Field f_isTrayIconPopup;
-
-    static {
-        f_parent = SunToolkit.getField(MenuComponent.class, "parent");
-        f_isTrayIconPopup = SunToolkit.getField(PopupMenu.class, "isTrayIconPopup");
-    }
 
     public WPopupMenuPeer(PopupMenu target) {
@@ -47,14 +39,9 @@
         MenuContainer parent = null;
         boolean isTrayIconPopup = false;
-        try {
-            isTrayIconPopup = ((Boolean)f_isTrayIconPopup.get(target)).booleanValue();
-            if (isTrayIconPopup) {
-                parent = (MenuContainer)f_parent.get(target);
-            } else {
-                parent = target.getParent();
-            }
-        } catch (IllegalAccessException iae) {
-            iae.printStackTrace();
-            return;
+        isTrayIconPopup = AWTAccessor.getPopupMenuAccessor().isTrayIconPopup(target);
+        if (isTrayIconPopup) {
+            parent = AWTAccessor.getMenuComponentAccessor().getParent(target);
+        } else {
+            parent = target.getParent();
         }
 
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/windows/native/java/io/Win32FileSystem_md.c
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/windows/native/java/io/Win32FileSystem_md.c	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/windows/native/java/io/Win32FileSystem_md.c	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -263,5 +263,6 @@
 JNIEXPORT jboolean JNICALL
 Java_java_io_Win32FileSystem_createFileExclusively(JNIEnv *env, jclass cls,
-                                                   jstring pathname)
+                                                   jstring pathname,
+                                                   jboolean restrictive)
 {
     jboolean rv = JNI_FALSE;
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/windows/native/java/io/WinNTFileSystem_md.c
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/windows/native/java/io/WinNTFileSystem_md.c	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/windows/native/java/io/WinNTFileSystem_md.c	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -350,5 +350,6 @@
 JNIEXPORT jboolean JNICALL
 Java_java_io_WinNTFileSystem_createFileExclusively(JNIEnv *env, jclass cls,
-                                                   jstring path)
+                                                   jstring path,
+                                                   jboolean restrictive)
 {
     HANDLE h = NULL;
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/windows/native/java/net/net_util_md.c
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/windows/native/java/net/net_util_md.c	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/windows/native/java/net/net_util_md.c	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -132,4 +132,5 @@
 
 void initLocalAddrTable () {}
+void parseExclusiveBindProperty (JNIEnv *env) {}
 
 /*
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/windows/native/sun/windows/awt_Dialog.cpp
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/windows/native/sun/windows/awt_Dialog.cpp	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/windows/native/sun/windows/awt_Dialog.cpp	(revision 404)
@@ -429,6 +429,10 @@
     JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 
-    jlongArray windows = (jlongArray)(env->CallStaticObjectMethod(AwtWindow::wwindowPeerCls,
-                                                                  AwtWindow::getActiveWindowsMID));
+    jclass wwindowPeerCls = env->FindClass("sun/awt/windows/WWindowPeer");
+    jmethodID getActiveWindowsMID = env->GetStaticMethodID(wwindowPeerCls,
+                                                           "getActiveWindowHandles", "()[J");
+    DASSERT(getActiveWindowsMID != NULL);
+    jlongArray windows = (jlongArray)(env->CallStaticObjectMethod(wwindowPeerCls,
+                                                                  getActiveWindowsMID));
     if (windows == NULL) {
         return;
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/windows/native/sun/windows/awt_Window.cpp
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/windows/native/sun/windows/awt_Window.cpp	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/windows/native/sun/windows/awt_Window.cpp	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -122,7 +122,4 @@
 jfieldID AwtWindow::locationByPlatformID;
 jfieldID AwtWindow::autoRequestFocusID;
-
-jclass AwtWindow::wwindowPeerCls;
-jmethodID AwtWindow::getActiveWindowsMID;
 
 jfieldID AwtWindow::sysXID;
@@ -2162,9 +2159,4 @@
     AwtWindow::sysHID = env->GetFieldID(cls, "sysH", "I");
 
-    AwtWindow::wwindowPeerCls = cls;
-    AwtWindow::getActiveWindowsMID =
-        env->GetStaticMethodID(cls, "getActiveWindowHandles", "()[J");
-    DASSERT(AwtWindow::getActiveWindowsMID != NULL);
-
     CATCH_BAD_ALLOC;
 }
Index: /branches/vendor/oracle/openjdk6/current/jdk/src/windows/native/sun/windows/awt_Window.h
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/src/windows/native/sun/windows/awt_Window.h	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/src/windows/native/sun/windows/awt_Window.h	(revision 404)
@@ -57,9 +57,4 @@
     static jfieldID screenID; /* screen number passed over from WindowPeer */
     static jfieldID autoRequestFocusID;
-
-    /* WWindowPeer class */
-    static jclass wwindowPeerCls;
-    /* long[] getActiveWindowHandles() method in WWindowPeer */
-    static jmethodID getActiveWindowsMID;
 
     // The coordinates at the peer.
Index: /branches/vendor/oracle/openjdk6/current/jdk/test/java/awt/Dialog/CrashXCheckJni/CrashXCheckJni.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/test/java/awt/Dialog/CrashXCheckJni/CrashXCheckJni.java	(revision 404)
+++ /branches/vendor/oracle/openjdk6/current/jdk/test/java/awt/Dialog/CrashXCheckJni/CrashXCheckJni.java	(revision 404)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2008, 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+  @test
+  @bug 6610244
+  @library ../../regtesthelpers
+  @build Util Sysout AbstractTest
+  @summary modal dialog closes with fatal error if -Xcheck:jni is set
+  @author Andrei Dmitriev : area=awt.dialog
+  @run main/othervm -Xcheck:jni CrashXCheckJni
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.Timer;
+import java.util.TimerTask;
+import test.java.awt.regtesthelpers.Util;
+import test.java.awt.regtesthelpers.AbstractTest;
+import test.java.awt.regtesthelpers.Sysout;
+
+public class CrashXCheckJni {
+
+    public static void main(String []s)
+    {
+        final Dialog fd = new Dialog(new Frame(), true);
+        Timer t = new Timer();
+        t.schedule(new TimerTask() {
+
+            public void run() {
+                System.out.println("RUNNING TASK");
+                fd.setVisible(false);
+                fd.dispose();
+                System.out.println("FINISHING TASK");
+            }
+        }, 3000L);
+
+        fd.setVisible(true);
+        t.cancel();
+        Util.waitForIdle(null);
+
+        AbstractTest.pass();
+    }
+}
Index: /branches/vendor/oracle/openjdk6/current/jdk/test/java/net/Socket/setReuseAddress/Basic.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/test/java/net/Socket/setReuseAddress/Basic.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/test/java/net/Socket/setReuseAddress/Basic.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -24,7 +24,9 @@
 /*
  * @test
- * @bug 4476378
+ * @bug 4476378 7123896
  * @summary Check the specific behaviour of the setReuseAddress(boolean)
  * method.
+ * @run main Basic
+ * @run main/othervm -Dsun.net.useExclusiveBind Basic
  */
 import java.net.*;
@@ -171,5 +173,10 @@
             passed();
         } catch (BindException e) {
-            failed();
+            if (System.getProperty("sun.net.useExclusiveBind") != null) {
+                // exclusive bind enabled - expected result
+                passed();
+            } else {
+                failed();
+            }
         }
         s2.close();
Index: /branches/vendor/oracle/openjdk6/current/jdk/test/java/net/Socket/setReuseAddress/Restart.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/test/java/net/Socket/setReuseAddress/Restart.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/test/java/net/Socket/setReuseAddress/Restart.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -24,7 +24,9 @@
 /*
  * @test
- * @bug 4476378
- * @summary Check that SO_REUSEADDR allows a server to restart
+ * @bug 4476378 7123896
+ * @summary Check that SO_REUSEADDR allows a server to restart 
  *          after a crash.
+ * @run main Restart
+ * @run main/othervm -Dsun.net.useExclusiveBind Restart
  */
 import java.net.*;
@@ -40,26 +42,33 @@
 
     public static void main(String args[]) throws Exception {
+        ServerSocket ss = new ServerSocket(0);
+        Socket s1 = null, s2 = null;
+        try {
+            int port = ss.getLocalPort();
 
-        InetSocketAddress isa = new InetSocketAddress(0);
-        ServerSocket ss = new ServerSocket();
-        ss.bind(isa);
+            s1 = new Socket(InetAddress.getLocalHost(), port);
+            s2 = ss.accept();
 
-        int port = ss.getLocalPort();
+            // close server socket and the accepted connection
+            ss.close();
+            s2.close();
 
-        Socket s1 = new Socket(InetAddress.getLocalHost(), port);
-        Socket s2 = ss.accept();
+            ss = new ServerSocket();
+            ss.bind( new InetSocketAddress(port) );
+            ss.close();
 
-        // close server socket and the accepted connection
-        ss.close();
-        s2.close();
-
-        boolean failed = false;
-
-        ss = new ServerSocket();
-        ss.bind( new InetSocketAddress(port) );
-        ss.close();
-
-        // close the client socket
-        s1.close();
+            // close the client socket
+            s1.close();
+        } catch (BindException be) {
+            if (System.getProperty("sun.net.useExclusiveBind") != null) {
+                // exclusive bind, expected exception
+            } else {
+                throw be;
+            }
+        } finally {
+            if (ss != null) ss.close();
+            if (s1 != null) s1.close();
+            if (s2 != null) s2.close();
+        }
     }
 }
Index: /branches/vendor/oracle/openjdk6/current/jdk/test/java/util/UUID/UUIDTest.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/test/java/util/UUID/UUIDTest.java	(revision 403)
+++ /branches/vendor/oracle/openjdk6/current/jdk/test/java/util/UUID/UUIDTest.java	(revision 404)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -61,4 +61,8 @@
         for (int i=0; i<100; i++) {
             UUID u1 = UUID.randomUUID();
+            if(4 != u1.version())
+                throw new Exception("bad version");
+            if(2 != u1.variant())
+                throw new Exception("bad variant");
             if (list.contains(u1))
                 throw new Exception("random UUID collision very unlikely");
@@ -73,8 +77,12 @@
         for (int i=0; i<100; i++) {
             byteSource.nextBytes(someBytes);
-            UUID test = UUID.nameUUIDFromBytes(someBytes);
-            if (list.contains(test))
+            UUID u1 = UUID.nameUUIDFromBytes(someBytes);
+            if(3 != u1.version())
+                throw new Exception("bad version");
+            if(2 != u1.variant())
+                throw new Exception("bad variant");
+            if (list.contains(u1))
                 throw new Exception("byte UUID collision very unlikely");
-            list.add(test);
+            list.add(u1);
         }
     }
Index: /branches/vendor/oracle/openjdk6/current/jdk/test/javax/crypto/CipherSpi/DirectBBRemaining.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/test/javax/crypto/CipherSpi/DirectBBRemaining.java	(revision 404)
+++ /branches/vendor/oracle/openjdk6/current/jdk/test/javax/crypto/CipherSpi/DirectBBRemaining.java	(revision 404)
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2012, 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 7142509
+ * @summary Cipher.doFinal(ByteBuffer,ByteBuffer) fails to
+ * process when in.remaining() == 0
+ */
+
+import java.nio.ByteBuffer;
+import java.security.SecureRandom;
+import java.util.Arrays;
+import java.util.Random;
+
+import javax.crypto.Cipher;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.SecretKeySpec;
+
+/*
+ * Simple test case to show that Cipher.doFinal(ByteBuffer, ByteBuffer) fails to
+ * process the data internally buffered inBB the cipher when input.remaining()
+ * == 0 and at least one buffer is a direct buffer.
+ */
+public class DirectBBRemaining {
+
+    private static Random random = new SecureRandom();
+    private static int testSizes = 40;
+    private static int outputFrequency = 5;
+
+    public static void main(String args[]) throws Exception {
+    boolean failedOnce = false;
+    Exception failedReason = null;
+
+    byte[] keyBytes = new byte[8];
+    random.nextBytes(keyBytes);
+    SecretKey key = new SecretKeySpec(keyBytes, "DES");
+
+    Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding", "SunJCE");
+    cipher.init(Cipher.ENCRYPT_MODE, key);
+
+    /*
+     * Iterate through various sizes to make sure that the code does empty
+     * blocks, single partial blocks, 1 full block, full + partial blocks,
+     * multiple full blocks, etc. 5 blocks (using DES) is probably overkill
+     * but will feel more confident the fix isn't breaking anything.
+     */
+    System.out.println("Output test results for every "
+            + outputFrequency + " tests...");
+
+    for (int size = 0; size <= testSizes; size++) {
+        boolean output = (size % outputFrequency) == 0;
+        if (output) {
+            System.out.print("\nTesting buffer size: " + size + ":");
+        }
+
+        int outSize = cipher.getOutputSize(size);
+
+        try {
+            encrypt(cipher, size,
+                    ByteBuffer.allocate(size),
+                    ByteBuffer.allocate(outSize),
+                    ByteBuffer.allocateDirect(size),
+                    ByteBuffer.allocateDirect(outSize),
+                    output);
+        } catch (Exception e) {
+            System.out.print("\n Failed with size " + size);
+            failedOnce = true;
+            failedReason = e;
+
+            // If we got an exception, let's be safe for future
+            // testing and reset the cipher to a known good state.
+            cipher.init(Cipher.ENCRYPT_MODE, key);
+        }
+    }
+    if (failedOnce) {
+        throw failedReason;
+    }
+    System.out.println("\nTest Passed...");
+ }
+
+ private enum TestVariant {
+
+    HEAP_HEAP, HEAP_DIRECT, DIRECT_HEAP, DIRECT_DIRECT
+ };
+
+ private static void encrypt(Cipher cipher, int size,
+         ByteBuffer heapIn, ByteBuffer heapOut,
+         ByteBuffer directIn, ByteBuffer directOut,
+         boolean output) throws Exception {
+
+    ByteBuffer inBB = null;
+    ByteBuffer outBB = null;
+
+    // Set up data and encrypt to known/expected values.
+    byte[] testdata = new byte[size];
+    random.nextBytes(testdata);
+    byte[] expected = cipher.doFinal(testdata);
+
+    for (TestVariant tv : TestVariant.values()) {
+        if (output) {
+            System.out.print(" " + tv);
+        }
+
+        switch (tv) {
+        case HEAP_HEAP:
+            inBB = heapIn;
+            outBB = heapOut;
+            break;
+        case HEAP_DIRECT:
+            inBB = heapIn;
+            outBB = directOut;
+            break;
+        case DIRECT_HEAP:
+            inBB = directIn;
+            outBB = heapOut;
+            break;
+        case DIRECT_DIRECT:
+            inBB = directIn;
+            outBB = directOut;
+            break;
+        }
+
+        inBB.clear();
+        outBB.clear();
+
+        inBB.put(testdata);
+        inBB.flip();
+
+        // Process all data in one shot, but don't call doFinal() yet.
+        // May store up to n-1 bytes (w/block size n) internally.
+        cipher.update(inBB, outBB);
+        if (inBB.hasRemaining()) {
+            throw new Exception("buffer not empty");
+        }
+
+         // finish encryption and process all data buffered
+         cipher.doFinal(inBB, outBB);
+         outBB.flip();
+
+         // validate output size
+         if (outBB.remaining() != expected.length) {
+             throw new Exception(
+                     "incomplete encryption output, expected "
+                     + expected.length + " bytes but was only "
+                     + outBB.remaining() + " bytes");
+         }
+
+         // validate output data
+         byte[] encrypted = new byte[outBB.remaining()];
+         outBB.get(encrypted);
+         if (!Arrays.equals(expected, encrypted)) {
+             throw new Exception("bad encryption output");
+         }
+
+         if (!Arrays.equals(cipher.doFinal(), cipher.doFinal())) {
+             throw new Exception("Internal buffers still held data!");
+         }
+    }
+ }
+} 
+
Index: /branches/vendor/oracle/openjdk6/current/jdk/test/javax/swing/plaf/synth/7143614/bug7143614.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/test/javax/swing/plaf/synth/7143614/bug7143614.java	(revision 404)
+++ /branches/vendor/oracle/openjdk6/current/jdk/test/javax/swing/plaf/synth/7143614/bug7143614.java	(revision 404)
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2012, 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 7143614
+ * @summary Issues with Synth Look&Feel
+ * @author Pavel Porvatov
+ */
+
+import sun.awt.SunToolkit;
+
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.basic.BasicButtonUI;
+import javax.swing.plaf.synth.SynthConstants;
+import javax.swing.plaf.synth.SynthLookAndFeel;
+import java.lang.reflect.Method;
+
+public class bug7143614 {
+    private static Method setSelectedUIMethod;
+
+    private static ComponentUI componentUI = new BasicButtonUI();
+
+    public static void main(String[] args) throws Exception {
+        setSelectedUIMethod = SynthLookAndFeel.class.getDeclaredMethod("setSelectedUI", ComponentUI.class,
+                boolean.class, boolean.class, boolean.class, boolean.class);
+        setSelectedUIMethod.setAccessible(true);
+
+        setSelectedUIMethod.invoke(null, componentUI, true, true, true, true);
+
+        validate();
+
+        Thread thread = new ThreadInAnotherAppContext();
+
+        thread.start();
+        thread.join();
+
+        validate();
+
+        System.out.println("Test bug7143614 passed.");
+    }
+
+    private static void validate() throws Exception {
+        Method getSelectedUIMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUI");
+
+        getSelectedUIMethod.setAccessible(true);
+
+        Method getSelectedUIStateMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUIState");
+
+        getSelectedUIStateMethod.setAccessible(true);
+
+        if (getSelectedUIMethod.invoke(null) != componentUI) {
+            throw new RuntimeException("getSelectedUI returns invalid value");
+        }
+        if (((Integer) getSelectedUIStateMethod.invoke(null)).intValue() !=
+                (SynthConstants.SELECTED | SynthConstants.FOCUSED)) {
+            throw new RuntimeException("getSelectedUIState returns invalid value");
+        }
+
+    }
+
+    private static class ThreadInAnotherAppContext extends Thread {
+        public ThreadInAnotherAppContext() {
+            super(new ThreadGroup("7143614"), "ThreadInAnotherAppContext");
+        }
+
+        public void run() {
+            SunToolkit.createNewAppContext();
+
+            try {
+                setSelectedUIMethod.invoke(null, null, false, false, false, false);
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+        }
+    }
+}
Index: /branches/vendor/oracle/openjdk6/current/jdk/test/sun/security/x509/X509CRLImpl/OrderAndDup.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/test/sun/security/x509/X509CRLImpl/OrderAndDup.java	(revision 404)
+++ /branches/vendor/oracle/openjdk6/current/jdk/test/sun/security/x509/X509CRLImpl/OrderAndDup.java	(revision 404)
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2012, 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 7143872
+ * @summary Improve certificate extension processing
+ */
+import java.io.*;
+import java.math.BigInteger;
+import java.security.KeyPairGenerator;
+import java.security.cert.CertificateFactory;
+import java.security.cert.X509CRLEntry;
+import java.util.Date;
+import sun.security.util.DerInputStream;
+import sun.security.util.DerValue;
+import sun.security.x509.*;
+
+public class OrderAndDup {
+    public static void main(String[] args) throws Exception {
+
+        // Generate 20 serial numbers with dup and a special order
+        int count = 20;
+        BigInteger[] serials = new BigInteger[count];
+        for (int i=0; i<count; i++) {
+            serials[i] = BigInteger.valueOf(i*7%10);
+        }
+
+        // Generates a CRL
+        X509CRLEntry[] badCerts = new X509CRLEntry[count];
+        for (int i=0; i<count; i++) {
+            badCerts[i] = new X509CRLEntryImpl(serials[i],
+                    new Date(System.currentTimeMillis()+i*1000));
+        }
+        X500Name owner = new X500Name("CN=CA");
+        X509CRLImpl crl = new X509CRLImpl(owner, new Date(), new Date(), badCerts);
+        KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA");
+        crl.sign(kpg.genKeyPair().getPrivate(), "SHA1withRSA");
+        byte[] data = crl.getEncodedInternal();
+
+        // Check the encoding
+        checkData(crl, data, serials);
+
+        // Load a CRL from raw data
+        CertificateFactory cf = CertificateFactory.getInstance("X.509");
+        X509CRLImpl crl2 = (X509CRLImpl)cf.generateCRL(new ByteArrayInputStream(data));
+
+        // Check the encoding again
+        data = crl2.getEncodedInternal();
+        checkData(crl2, data, serials);
+    }
+
+    // Check the raw data's ASN.1 structure to see if the revoked certs
+    // have the same number and correct order as inserted
+    static void checkData(X509CRLImpl c, byte[] data, BigInteger[] expected)
+            throws Exception {
+        if (c.getRevokedCertificates().size() != expected.length) {
+            throw new Exception("Wrong count in CRL object, now " +
+                    c.getRevokedCertificates().size());
+        }
+        DerValue d1 = new DerValue(data);
+        // revokedCertificates at 5th place of TBSCertList
+        DerValue[] d2 = new DerInputStream(
+                d1.data.getSequence(0)[4].toByteArray())
+                .getSequence(0);
+        if (d2.length != expected.length) {
+            throw new Exception("Wrong count in raw data, now " + d2.length);
+        }
+        for (int i=0; i<d2.length; i++) {
+            // Serial is first in revokedCertificates entry
+            BigInteger bi = d2[i].data.getBigInteger();
+            if (!bi.equals(expected[i])) {
+                throw new Exception("Entry at #" + i + " is " + bi
+                        + ", should be " + expected[i]);
+            }
+        }
+    }
+}
+
Index: /branches/vendor/oracle/openjdk6/current/jdk/test/sun/tools/native2ascii/Permission.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/test/sun/tools/native2ascii/Permission.java	(revision 404)
+++ /branches/vendor/oracle/openjdk6/current/jdk/test/sun/tools/native2ascii/Permission.java	(revision 404)
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2012, 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 7177216 7199153
+ * @summary resulting file of native2ascii should have normal permission
+ */
+
+import java.io.*;
+import sun.tools.native2ascii.Main;
+
+public class Permission {
+
+    private static void cleanup(String... fnames) throws Throwable {
+        for (String fname : fnames) {
+            File f = new File(fname);
+            if (f.exists())
+                f.delete();
+        }
+    }
+
+    private static String permission(String fname) throws Throwable {
+        Process p = Runtime.getRuntime().exec("ls -l " + fname);
+        InputStream is = null;
+        String ret = null;
+        if (p != null && (is = p.getInputStream()) != null) {
+            p.waitFor();
+            BufferedReader br = new BufferedReader(new InputStreamReader(is, "ISO-8859-1"));
+            try {
+                ret = br.readLine();
+                if (ret != null)
+                    ret = ret.split(" ")[0];
+            } finally {
+                br.close();
+            }
+        }
+        return ret;
+    }
+
+    public static void realMain(String[] args) throws Throwable {
+        if (!System.getProperty("os.name").startsWith("Windows")) {
+            String src = "native2ascii_permtest_src";
+            String dst = "native2ascii_permtest_dst";
+
+            cleanup(src, dst);
+            try {
+                FileOutputStream fos = new FileOutputStream(src);
+                try {
+                    fos.write('a'); fos.write('b'); fos.write('c');
+                } finally {
+                    fos.close();
+                }
+                String[] n2aArgs = new String[] {"-encoding", "utf8", src, dst};
+                if (!new Main().convert(n2aArgs)) {
+                    fail("n2a failed.");
+                }
+                equal(permission(src), permission(dst));
+                String[] a2nArgs = new String[] {"-reverse", "-encoding", "utf8", dst, src};
+                if (!new Main().convert(a2nArgs)) {
+                    fail("a2n failed.");
+                }
+                equal(permission(src), permission(dst));
+            } finally {
+                cleanup(src, dst);
+            }
+        }
+    }
+
+    //--------------------- Infrastructure ---------------------------
+    static volatile int passed = 0, failed = 0;
+    static void pass() {passed++;}
+    static void fail() {failed++; Thread.dumpStack();}
+    static void fail(String msg) {System.out.println(msg); fail();}
+    static void unexpected(Throwable t) {failed++; t.printStackTrace();}
+    static void check(boolean cond) {if (cond) pass(); else fail();}
+    static void equal(Object x, Object y) {
+        if (x == null ? y == null : x.equals(y)) pass();
+        else fail(x + " not equal to " + y);}
+    public static void main(String[] args) throws Throwable {
+        try {realMain(args);} catch (Throwable t) {unexpected(t);}
+        System.out.println("\nPassed = " + passed + " failed = " + failed);
+        if (failed > 0) throw new AssertionError("Some tests failed");}
+}
Index: /branches/vendor/oracle/openjdk6/current/jdk/test/tools/jar/UpdateJar.java
===================================================================
--- /branches/vendor/oracle/openjdk6/current/jdk/test/tools/jar/UpdateJar.java	(revision 404)
+++ /branches/vendor/oracle/openjdk6/current/jdk/test/tools/jar/UpdateJar.java	(revision 404)
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2012, 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 7175845 7199153
+ * @summary jar -uf should not change file permission
+ */
+
+import java.io.*;
+import sun.tools.jar.Main;
+
+public class UpdateJar {
+
+    private static void cleanup(File f) throws Throwable {
+        if (f.exists())
+            f.delete();
+    }
+
+    private static String permission(String fname) throws Throwable {
+        Process p = Runtime.getRuntime().exec("ls -l " + fname);
+        InputStream is = null;
+        String ret = null;
+        if (p != null && (is = p.getInputStream()) != null) {
+            p.waitFor();
+            BufferedReader br = new BufferedReader(new InputStreamReader(is, "ISO-8859-1"));
+            try {
+                ret = br.readLine();
+                if (ret != null)
+                    ret = ret.split(" ")[0];
+            } finally {
+                br.close();
+            }
+        }
+        return ret;
+    }
+
+    public static void realMain(String[] args) throws Throwable {
+        if (!System.getProperty("os.name").startsWith("Windows")) {
+            String jarName = "testUpdateJar.jar";
+            String e0Name = "testUpdateJar_entry0.txt";
+            String e1Name = "testUpdateJar_entry1.txt";
+
+            File jar = new File(jarName);
+            File e0 = new File(e0Name);
+            File e1 = new File(e1Name);
+            try {
+                cleanup(jar);
+                cleanup(e0);
+                cleanup(e1);
+
+                FileOutputStream fos = new FileOutputStream(e0Name);
+                fos.write(0);
+                fos.close();
+
+                fos = new FileOutputStream(e1Name);
+                fos.write(0);
+                fos.close();
+
+                String[] jarArgs = new String[] {"cfM0", jarName, e0Name};
+                if (!new Main(System.out, System.err, "jar").run(jarArgs)) {
+                    fail("Could not create jar file.");
+                }
+                String pm = permission(jarName);
+                jarArgs = new String[] {"uf", jarName, e1Name};
+                if (!new Main(System.out, System.err, "jar").run(jarArgs)) {
+                    fail("Could not create jar file.");
+                }
+                equal(pm, permission(jarName));
+
+            } finally {
+                cleanup(jar);
+                cleanup(e0);
+                cleanup(e1);
+
+            }
+        }
+    }
+
+    //--------------------- Infrastructure ---------------------------
+    static volatile int passed = 0, failed = 0;
+    static void pass() {passed++;}
+    static void fail() {failed++; Thread.dumpStack();}
+    static void fail(String msg) {System.out.println(msg); fail();}
+    static void unexpected(Throwable t) {failed++; t.printStackTrace();}
+    static void check(boolean cond) {if (cond) pass(); else fail();}
+    static void equal(Object x, Object y) {
+        if (x == null ? y == null : x.equals(y)) pass();
+        else fail(x + " not equal to " + y);}
+    public static void main(String[] args) throws Throwable {
+        try {realMain(args);} catch (Throwable t) {unexpected(t);}
+        System.out.println("\nPassed = " + passed + " failed = " + failed);
+        if (failed > 0) throw new AssertionError("Some tests failed");}
+}
