changeset 575:2c5553d912c8

8035618: Four api/org_omg/CORBA TCK tests fail under plugin only Reviewed-by: alanb, mchung, dfuchs, msheppar
author coffeys
date Wed, 02 Apr 2014 18:21:23 +0100
parents c6a001011f0a
children 9ad9346fea43
files src/share/classes/com/sun/corba/se/spi/orb/ORB.java
diffstat 1 files changed, 29 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/corba/se/spi/orb/ORB.java	Tue Apr 01 17:28:35 2014 -0700
+++ b/src/share/classes/com/sun/corba/se/spi/orb/ORB.java	Wed Apr 02 18:21:23 2014 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -97,8 +97,7 @@
 
 import com.sun.corba.se.impl.presentation.rmi.PresentationManagerImpl ;
 
-import sun.awt.AppContext;
-import sun.corba.SharedSecrets;
+import sun.misc.JavaAWTAccess;
 
 public abstract class ORB extends com.sun.corba.se.org.omg.CORBA.ORB
     implements Broker, TypeCodeFactory
@@ -170,6 +169,13 @@
     // representing LogDomain and ExceptionGroup.
     private Map wrapperMap ;
 
+    static class Holder {
+        static final PresentationManager defaultPresentationManager =
+            setupPresentationManager();
+    }
+
+    private static final Map<Object, PresentationManager> pmContexts = new HashMap<>();
+
     private static Map staticWrapperMap = new ConcurrentHashMap();
 
     protected MonitoringManager monitoringManager;
@@ -201,8 +207,9 @@
 
                         try {
                             // First try the configured class name, if any
-                            Class<?> cls = SharedSecrets.getJavaCorbaAccess().loadClass( className ) ;
-                            sff = (PresentationManager.StubFactoryFactory)cls.newInstance() ;
+                            Class<?> cls =
+                                sun.corba.SharedSecrets.getJavaCorbaAccess().loadClass(className);
+                            sff = (PresentationManager.StubFactoryFactory)cls.newInstance();
                         } catch (Exception exc) {
                             // Use the default. Log the error as a warning.
                             staticWrapper.errorInSettingDynamicStubFactoryFactory(
@@ -235,13 +242,24 @@
      */
     public static PresentationManager getPresentationManager()
     {
-        AppContext ac = AppContext.getAppContext();
-        PresentationManager pm = (PresentationManager) ac.get(PresentationManager.class);
-        if (pm == null) {
-            pm = setupPresentationManager();
-            ac.put(PresentationManager.class, pm);
+        SecurityManager sm = System.getSecurityManager();
+        JavaAWTAccess javaAwtAccess = sun.misc.SharedSecrets.getJavaAWTAccess();
+        if (sm != null && javaAwtAccess != null) {
+            final Object appletContext = javaAwtAccess.getAppletContext();
+            if (appletContext != null) {
+                synchronized (pmContexts) {
+                    PresentationManager pm = pmContexts.get(appletContext);
+                    if (pm == null) {
+                        pm = setupPresentationManager();
+                        pmContexts.put(appletContext, pm);
+                    }
+                    return pm;
+                }
+            }
         }
-        return pm;
+
+        // No security manager or AppletAppContext
+        return Holder.defaultPresentationManager;
     }
 
     /** Get the appropriate StubFactoryFactory.  This