|
45 | 45 | import java.util.Objects; |
46 | 46 |
|
47 | 47 | import sun.datatransfer.DataFlavorUtil; |
48 | | -import sun.reflect.misc.ReflectUtil; |
49 | 48 |
|
50 | 49 | /** |
51 | 50 | * A {@code DataFlavor} provides meta information about data. {@code DataFlavor} |
@@ -131,32 +130,22 @@ protected static final Class<?> tryToLoadClass(String className, |
131 | 130 | ClassLoader fallback) |
132 | 131 | throws ClassNotFoundException |
133 | 132 | { |
134 | | - ReflectUtil.checkPackageAccess(className); |
| 133 | + ClassLoader loader = ClassLoader.getSystemClassLoader(); |
135 | 134 | try { |
136 | | - @SuppressWarnings("removal") |
137 | | - SecurityManager sm = System.getSecurityManager(); |
138 | | - if (sm != null) { |
139 | | - sm.checkPermission(new RuntimePermission("getClassLoader")); |
140 | | - } |
141 | | - ClassLoader loader = ClassLoader.getSystemClassLoader(); |
142 | | - try { |
143 | | - // bootstrap class loader and system class loader if present |
144 | | - return Class.forName(className, true, loader); |
145 | | - } |
146 | | - catch (ClassNotFoundException exception) { |
147 | | - // thread context class loader if and only if present |
148 | | - loader = Thread.currentThread().getContextClassLoader(); |
149 | | - if (loader != null) { |
150 | | - try { |
151 | | - return Class.forName(className, true, loader); |
152 | | - } |
153 | | - catch (ClassNotFoundException e) { |
154 | | - // fallback to user's class loader |
155 | | - } |
| 135 | + // bootstrap class loader and system class loader if present |
| 136 | + return Class.forName(className, true, loader); |
| 137 | + } |
| 138 | + catch (ClassNotFoundException exception) { |
| 139 | + // thread context class loader if and only if present |
| 140 | + loader = Thread.currentThread().getContextClassLoader(); |
| 141 | + if (loader != null) { |
| 142 | + try { |
| 143 | + return Class.forName(className, true, loader); |
| 144 | + } |
| 145 | + catch (ClassNotFoundException e) { |
| 146 | + // fallback to user's class loader |
156 | 147 | } |
157 | 148 | } |
158 | | - } catch (SecurityException exception) { |
159 | | - // ignore secured class loaders |
160 | 149 | } |
161 | 150 | return Class.forName(className, true, fallback); |
162 | 151 | } |
|
0 commit comments