From da4038873622a19ec10130d617969892583073e1 Mon Sep 17 00:00:00 2001 From: Jaikiran Pai Date: Sat, 16 Nov 2024 01:23:29 +0000 Subject: [PATCH] 8344315: Clean up sun.net.www.protocol.jrt.JavaRuntimeURLConnection after JEP 486 integration Reviewed-by: dfuchs, alanb --- .../jrt/JavaRuntimeURLConnection.java | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/src/java.base/share/classes/sun/net/www/protocol/jrt/JavaRuntimeURLConnection.java b/src/java.base/share/classes/sun/net/www/protocol/jrt/JavaRuntimeURLConnection.java index b4cd98870ca..4e67c962a46 100644 --- a/src/java.base/share/classes/sun/net/www/protocol/jrt/JavaRuntimeURLConnection.java +++ b/src/java.base/share/classes/sun/net/www/protocol/jrt/JavaRuntimeURLConnection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, 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 @@ -30,15 +30,11 @@ import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; -import java.security.AccessController; -import java.security.Permission; -import java.security.PrivilegedAction; import jdk.internal.jimage.ImageLocation; import jdk.internal.jimage.ImageReader; import jdk.internal.jimage.ImageReaderFactory; -import jdk.internal.loader.URLClassPath; import jdk.internal.loader.Resource; import sun.net.www.ParseUtil; import sun.net.www.URLConnection; @@ -47,15 +43,10 @@ import sun.net.www.URLConnection; * URLConnection implementation that can be used to connect to resources * contained in the runtime image. */ -@SuppressWarnings("removal") public class JavaRuntimeURLConnection extends URLConnection { // ImageReader to access resources in jimage - private static final ImageReader reader; - static { - PrivilegedAction pa = ImageReaderFactory::getImageReader; - reader = AccessController.doPrivileged(pa); - } + private static final ImageReader reader = ImageReaderFactory.getImageReader(); // the module and resource name in the URL private final String module; @@ -92,7 +83,7 @@ public class JavaRuntimeURLConnection extends URLConnection { if (reader != null) { URL url = toJrtURL(module, name); ImageLocation location = reader.findLocation(module, name); - if (location != null && URLClassPath.checkURL(url) != null) { + if (location != null) { return new Resource() { @Override public String getName() { @@ -158,11 +149,6 @@ public class JavaRuntimeURLConnection extends URLConnection { return len > Integer.MAX_VALUE ? -1 : (int)len; } - @Override - public Permission getPermission() { - return new RuntimePermission("accessSystemModules"); - } - /** * Returns a jrt URL for the given module and resource name. */