changeset 4290:1e04b38b3824 jdk7-b145

Merge
author lana
date Sat, 04 Jun 2011 17:33:13 -0700
parents e81d259442ed (current diff) 1f39ca0b9598 (diff)
children 7a341c412ea9 dab3e66ebda7
files
diffstat 3 files changed, 22 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/nio/file/Path.java	Sat Jun 04 17:32:21 2011 -0700
+++ b/src/share/classes/java/nio/file/Path.java	Sat Jun 04 17:33:13 2011 -0700
@@ -460,15 +460,13 @@
     /**
      * Returns a URI to represent this path.
      *
-     * <p> This method constructs a hierarchical {@link URI} that is absolute
-     * with a non-empty path component. Its {@link URI#getScheme() scheme} is
-     * equal to the URI scheme that identifies the provider. The exact form of
-     * the other URI components is highly provider dependent. In particular, it
-     * is implementation dependent if its query, fragment, and authority
-     * components are defined or undefined.
+     * <p> This method constructs an absolute {@link URI} with a {@link
+     * URI#getScheme() scheme} equal to the URI scheme that identifies the
+     * provider. The exact form of the scheme specific part is highly provider
+     * dependent.
      *
-     * <p> For the default provider the {@link URI#getPath() path} component
-     * will represent the {@link #toAbsolutePath absolute} path; the query,
+     * <p> In the case of the default provider, the URI is hierarchical with
+     * a {@link URI#getPath() path} component that is absolute. The query and
      * fragment components are undefined. Whether the authority component is
      * defined or not is implementation dependent. There is no guarantee that
      * the {@code URI} may be used to construct a {@link java.io.File java.io.File}.
@@ -497,7 +495,7 @@
      * A format for compound URIs is not defined in this release; such a scheme
      * may be added in a future release.
      *
-     * @return  an absolute, hierarchical URI with a non-empty path component
+     * @return  the URI representing this path
      *
      * @throws  java.io.IOError
      *          if an I/O error occurs obtaining the absolute path, or where a
--- a/test/java/security/Policy/GetPermissions/JarURL.java	Sat Jun 04 17:32:21 2011 -0700
+++ b/test/java/security/Policy/GetPermissions/JarURL.java	Sat Jun 04 17:33:13 2011 -0700
@@ -23,11 +23,13 @@
 
 /*
  * @test
- * @bug 7044443
+ * @bug 7044443 7050329
+ * @run main/othervm/policy=JarURL.policy JarURL
  * @summary Permissions resolved incorrectly for jar protocol
  */
 
 import java.net.URL;
+import java.io.File;
 import java.security.AllPermission;
 import java.security.CodeSource;
 import java.security.PermissionCollection;
@@ -35,11 +37,11 @@
 import java.security.cert.Certificate;
 
 public class JarURL {
+
     public static void main(String[] args) throws Exception {
-        URL codeSourceURL
-            = new URL("jar:file:"
-                      + System.getProperty("java.ext.dirs").split(":")[0]
-                      + "/foo.jar!/");
+        String userDir = System.getProperty("user.dir");
+        String jarURL = "jar:file:" + userDir + File.separator + "foo.jar!/";
+        URL codeSourceURL = new URL(jarURL);
         CodeSource cs = new CodeSource(codeSourceURL, new Certificate[0]);
         PermissionCollection perms = Policy.getPolicy().getPermissions(cs);
         if (!perms.implies(new AllPermission()))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/security/Policy/GetPermissions/JarURL.policy	Sat Jun 04 17:33:13 2011 -0700
@@ -0,0 +1,8 @@
+grant codeBase "file:${user.dir}/*" {
+    permission java.security.AllPermission;
+};
+
+grant {
+    permission java.util.PropertyPermission "user.dir", "read";
+    permission java.security.SecurityPermission "getPolicy";
+};