src/share/classes/com/sun/corba/se/spi/orb/ORB.java

Print this page

        

@@ -97,12 +97,10 @@
 import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
 import com.sun.corba.se.impl.logging.OMGSystemException ;
 
 import com.sun.corba.se.impl.presentation.rmi.PresentationManagerImpl ;
 
-import sun.misc.JavaAWTAccess;
-
 public abstract class ORB extends com.sun.corba.se.org.omg.CORBA.ORB
     implements Broker, TypeCodeFactory
 {
     // As much as possible, this class should be stateless.  However,
     // there are a few reasons why it is not:

@@ -243,23 +241,17 @@
      * AppContext to hold it. Creates and records one if needed.
      */
     public static PresentationManager getPresentationManager()
     {
         SecurityManager sm = System.getSecurityManager();
-        JavaAWTAccess javaAwtAccess = sun.misc.SharedSecrets.getJavaAWTAccess();
-        if (sm != null && javaAwtAccess != null) {
-            Object appletContext;
             try {
-                Class<?> clazz = JavaAWTAccess.class;
-                Method method = clazz.getMethod("getAppletContext");
-                appletContext = method.invoke(javaAwtAccess);
-            } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
-                InternalError err = new InternalError();
-                err.initCause(e);
-                throw err;
-            }
-
+            Method method = sun.misc.SharedSecrets.class.getMethod("getJavaAWTAccess");
+            Object javaAwtAccess = method.invoke(sun.misc.SharedSecrets.class);
+            if (sm != null && javaAwtAccess != null) {
+                Class<?> javaAwtAccessClass = Class.forName("sun.misc.JavaAWTAccess");
+                method = javaAwtAccessClass.getMethod("getAppletContext");
+                Object appletContext = method.invoke(javaAwtAccess);
             if (appletContext != null) {
                 synchronized (pmContexts) {
                     PresentationManager pm = pmContexts.get(appletContext);
                     if (pm == null) {
                         pm = setupPresentationManager();

@@ -267,10 +259,16 @@
                     }
                     return pm;
                 }
             }
         }
+        } catch (ClassNotFoundException | IllegalAccessException |
+            InvocationTargetException | NoSuchMethodException e) {
+            InternalError err = new InternalError();
+            err.initCause(e);
+            throw err;
+        }
 
         // No security manager or AppletAppContext
         return Holder.defaultPresentationManager;
     }