|
31 | 31 | import java.net.URLConnection;
|
32 | 32 | import java.util.HashMap;
|
33 | 33 | import java.util.jar.JarFile;
|
34 |
| -import java.security.Permission; |
35 | 34 |
|
36 | 35 | import jdk.internal.util.OperatingSystem;
|
37 | 36 | import sun.net.util.URLUtil;
|
@@ -219,52 +218,12 @@ public void close(JarFile jarFile) {
|
219 | 218 |
|
220 | 219 | private JarFile getCachedJarFile(URL url) {
|
221 | 220 | assert Thread.holdsLock(instance);
|
222 |
| - JarFile result = fileCache.get(urlKey(url)); |
223 |
| - |
224 |
| - /* if the JAR file is cached, the permission will always be there */ |
225 |
| - if (result != null) { |
226 |
| - @SuppressWarnings("removal") |
227 |
| - SecurityManager sm = System.getSecurityManager(); |
228 |
| - if (sm != null) { |
229 |
| - Permission perm = getPermission(result); |
230 |
| - if (perm != null) { |
231 |
| - try { |
232 |
| - sm.checkPermission(perm); |
233 |
| - } catch (SecurityException se) { |
234 |
| - // fallback to checkRead/checkConnect for pre 1.2 |
235 |
| - // security managers |
236 |
| - if ((perm instanceof java.io.FilePermission) && |
237 |
| - perm.getActions().contains("read")) { |
238 |
| - sm.checkRead(perm.getName()); |
239 |
| - } else if ((perm instanceof |
240 |
| - java.net.SocketPermission) && |
241 |
| - perm.getActions().contains("connect")) { |
242 |
| - sm.checkConnect(url.getHost(), url.getPort()); |
243 |
| - } else { |
244 |
| - throw se; |
245 |
| - } |
246 |
| - } |
247 |
| - } |
248 |
| - } |
249 |
| - } |
250 |
| - return result; |
| 221 | + return fileCache.get(urlKey(url)); |
251 | 222 | }
|
252 | 223 |
|
253 | 224 | private String urlKey(URL url) {
|
254 | 225 | String urlstr = URLUtil.urlNoFragString(url);
|
255 | 226 | if ("runtime".equals(url.getRef())) urlstr += "#runtime";
|
256 | 227 | return urlstr;
|
257 | 228 | }
|
258 |
| - |
259 |
| - private Permission getPermission(JarFile jarFile) { |
260 |
| - try { |
261 |
| - URLConnection uc = getConnection(jarFile); |
262 |
| - if (uc != null) |
263 |
| - return uc.getPermission(); |
264 |
| - } catch (IOException ioe) { |
265 |
| - // gulp |
266 |
| - } |
267 |
| - |
268 |
| - return null; |
269 |
| - } |
270 | 229 | }
|
0 commit comments