jdk/src/java.base/share/classes/sun/net/www/protocol/jrt/JavaRuntimeURLConnection.java
changeset 44359 c6761862ca0b
parent 43712 5dfd0950317c
--- a/jdk/src/java.base/share/classes/sun/net/www/protocol/jrt/JavaRuntimeURLConnection.java	Thu Mar 16 16:34:36 2017 +0000
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/jrt/JavaRuntimeURLConnection.java	Wed Mar 22 16:26:27 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, 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
@@ -26,8 +26,6 @@
 package sun.net.www.protocol.jrt;
 
 import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FilePermission;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.MalformedURLException;
@@ -44,7 +42,6 @@
 import jdk.internal.loader.Resource;
 import sun.net.www.ParseUtil;
 import sun.net.www.URLConnection;
-import sun.security.action.GetPropertyAction;
 
 /**
  * URLConnection implementation that can be used to connect to resources
@@ -66,9 +63,6 @@
     // the Resource when connected
     private volatile Resource resource;
 
-    // the permission to access resources in the runtime image, created lazily
-    private static volatile Permission permission;
-
     JavaRuntimeURLConnection(URL url) throws IOException {
         super(url);
         String path = url.getPath();
@@ -164,14 +158,8 @@
     }
 
     @Override
-    public Permission getPermission() throws IOException {
-        Permission p = permission;
-        if (p == null) {
-            String home = GetPropertyAction.privilegedGetProperty("java.home");
-            p = new FilePermission(home + File.separator + "-", "read");
-            permission = p;
-        }
-        return p;
+    public Permission getPermission() {
+        return new RuntimePermission("accessSystemModules");
     }
 
     /**