src/share/jaxws_classes/com/sun/istack/internal/tools/SecureLoader.java

changeset 368
0989ad8c0860
parent 286
f50545b5e2f1
child 637
9c07ef4934dd
equal deleted inserted replaced
366:8c0b6bccfe47 368:0989ad8c0860
1 /* 1 /*
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this 7 * published by the Free Software Foundation. Oracle designates this
70 } 70 }
71 }); 71 });
72 } 72 }
73 } 73 }
74 74
75 static ClassLoader getParentClassLoader(final ClassLoader cl) {
76 if (System.getSecurityManager() == null) {
77 return cl.getParent();
78 } else {
79 return (ClassLoader) java.security.AccessController.doPrivileged(
80 new java.security.PrivilegedAction() {
81 public java.lang.Object run() {
82 return cl.getParent();
83 }
84 });
85 }
86 }
87
75 static void setContextClassLoader(final ClassLoader cl) { 88 static void setContextClassLoader(final ClassLoader cl) {
76 if (System.getSecurityManager() == null) { 89 if (System.getSecurityManager() == null) {
77 Thread.currentThread().setContextClassLoader(cl); 90 Thread.currentThread().setContextClassLoader(cl);
78 } else { 91 } else {
79 java.security.AccessController.doPrivileged( 92 java.security.AccessController.doPrivileged(

mercurial