--- old/src/share/classes/com/sun/corba/se/spi/orb/ORB.java Wed Feb 26 16:38:44 2014 +++ new/src/share/classes/com/sun/corba/se/spi/orb/ORB.java Wed Feb 26 16:38:43 2014 @@ -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 @@ -170,6 +170,8 @@ // representing LogDomain and ExceptionGroup. private Map wrapperMap ; + private static PresentationManager defaultPresentationManager; + private static Map staticWrapperMap = new ConcurrentHashMap(); protected MonitoringManager monitoringManager; @@ -233,15 +235,26 @@ * Returns the Presentation Manager for the current thread group, using the ThreadGroup-specific * AppContext to hold it. Creates and records one if needed. */ - public static PresentationManager getPresentationManager() + public synchronized 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(); + if (sm != null && AppContext.getAppContexts().size() > 0) { + AppContext ac = AppContext.getAppContext(); + if (ac != null) { + PresentationManager pm = + (PresentationManager) ac.get(PresentationManager.class); + if (pm == null) { + pm = setupPresentationManager(); + ac.put(PresentationManager.class, pm); + } + return pm; + } } - return pm; + + // No security manager or AppContext + if (defaultPresentationManager == null) + defaultPresentationManager = setupPresentationManager(); + return defaultPresentationManager; } /** Get the appropriate StubFactoryFactory. This