8035618: Four api/org_omg/CORBA TCK tests fail under plugin only

Reviewed-by: alanb, mchung, dfuchs, msheppar
This commit is contained in:
Sean Coffey 2014-04-02 18:21:23 +01:00
parent d0730dc007
commit 011792fa34

View File

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -97,8 +97,7 @@ import com.sun.corba.se.impl.logging.OMGSystemException ;
import com.sun.corba.se.impl.presentation.rmi.PresentationManagerImpl ; import com.sun.corba.se.impl.presentation.rmi.PresentationManagerImpl ;
import sun.awt.AppContext; import sun.misc.JavaAWTAccess;
import sun.corba.SharedSecrets;
public abstract class ORB extends com.sun.corba.se.org.omg.CORBA.ORB public abstract class ORB extends com.sun.corba.se.org.omg.CORBA.ORB
implements Broker, TypeCodeFactory implements Broker, TypeCodeFactory
@ -170,6 +169,13 @@ public abstract class ORB extends com.sun.corba.se.org.omg.CORBA.ORB
// representing LogDomain and ExceptionGroup. // representing LogDomain and ExceptionGroup.
private Map wrapperMap ; 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(); private static Map staticWrapperMap = new ConcurrentHashMap();
protected MonitoringManager monitoringManager; protected MonitoringManager monitoringManager;
@ -201,8 +207,9 @@ public abstract class ORB extends com.sun.corba.se.org.omg.CORBA.ORB
try { try {
// First try the configured class name, if any // First try the configured class name, if any
Class<?> cls = SharedSecrets.getJavaCorbaAccess().loadClass( className ) ; Class<?> cls =
sff = (PresentationManager.StubFactoryFactory)cls.newInstance() ; sun.corba.SharedSecrets.getJavaCorbaAccess().loadClass(className);
sff = (PresentationManager.StubFactoryFactory)cls.newInstance();
} catch (Exception exc) { } catch (Exception exc) {
// Use the default. Log the error as a warning. // Use the default. Log the error as a warning.
staticWrapper.errorInSettingDynamicStubFactoryFactory( staticWrapper.errorInSettingDynamicStubFactoryFactory(
@ -235,13 +242,24 @@ public abstract class ORB extends com.sun.corba.se.org.omg.CORBA.ORB
*/ */
public static PresentationManager getPresentationManager() public static PresentationManager getPresentationManager()
{ {
AppContext ac = AppContext.getAppContext(); SecurityManager sm = System.getSecurityManager();
PresentationManager pm = (PresentationManager) ac.get(PresentationManager.class); JavaAWTAccess javaAwtAccess = sun.misc.SharedSecrets.getJavaAWTAccess();
if (pm == null) { if (sm != null && javaAwtAccess != null) {
pm = setupPresentationManager(); final Object appletContext = javaAwtAccess.getAppletContext();
ac.put(PresentationManager.class, pm); 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 /** Get the appropriate StubFactoryFactory. This