Skip to content

Commit 5e27608

Browse files
author
Eirik Bjørsnøs
committed
8344188: Cleanup sun.net.www.protocol.jar.JarFileFactory after JEP 486 integration
Reviewed-by: jpai, dfuchs
1 parent ba39321 commit 5e27608

File tree

1 file changed

+1
-42
lines changed

1 file changed

+1
-42
lines changed

src/java.base/share/classes/sun/net/www/protocol/jar/JarFileFactory.java

+1-42
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import java.net.URLConnection;
3232
import java.util.HashMap;
3333
import java.util.jar.JarFile;
34-
import java.security.Permission;
3534

3635
import jdk.internal.util.OperatingSystem;
3736
import sun.net.util.URLUtil;
@@ -219,52 +218,12 @@ public void close(JarFile jarFile) {
219218

220219
private JarFile getCachedJarFile(URL url) {
221220
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));
251222
}
252223

253224
private String urlKey(URL url) {
254225
String urlstr = URLUtil.urlNoFragString(url);
255226
if ("runtime".equals(url.getRef())) urlstr += "#runtime";
256227
return urlstr;
257228
}
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-
}
270229
}

0 commit comments

Comments
 (0)