1.1 --- a/src/share/classes/java/nio/file/Path.java Sat Jun 04 17:32:21 2011 -0700
1.2 +++ b/src/share/classes/java/nio/file/Path.java Sat Jun 04 17:33:13 2011 -0700
1.3 @@ -460,15 +460,13 @@
1.4 /**
1.5 * Returns a URI to represent this path.
1.6 *
1.7 - * <p> This method constructs a hierarchical {@link URI} that is absolute
1.8 - * with a non-empty path component. Its {@link URI#getScheme() scheme} is
1.9 - * equal to the URI scheme that identifies the provider. The exact form of
1.10 - * the other URI components is highly provider dependent. In particular, it
1.11 - * is implementation dependent if its query, fragment, and authority
1.12 - * components are defined or undefined.
1.13 + * <p> This method constructs an absolute {@link URI} with a {@link
1.14 + * URI#getScheme() scheme} equal to the URI scheme that identifies the
1.15 + * provider. The exact form of the scheme specific part is highly provider
1.16 + * dependent.
1.17 *
1.18 - * <p> For the default provider the {@link URI#getPath() path} component
1.19 - * will represent the {@link #toAbsolutePath absolute} path; the query,
1.20 + * <p> In the case of the default provider, the URI is hierarchical with
1.21 + * a {@link URI#getPath() path} component that is absolute. The query and
1.22 * fragment components are undefined. Whether the authority component is
1.23 * defined or not is implementation dependent. There is no guarantee that
1.24 * the {@code URI} may be used to construct a {@link java.io.File java.io.File}.
1.25 @@ -497,7 +495,7 @@
1.26 * A format for compound URIs is not defined in this release; such a scheme
1.27 * may be added in a future release.
1.28 *
1.29 - * @return an absolute, hierarchical URI with a non-empty path component
1.30 + * @return the URI representing this path
1.31 *
1.32 * @throws java.io.IOError
1.33 * if an I/O error occurs obtaining the absolute path, or where a
2.1 --- a/test/java/security/Policy/GetPermissions/JarURL.java Sat Jun 04 17:32:21 2011 -0700
2.2 +++ b/test/java/security/Policy/GetPermissions/JarURL.java Sat Jun 04 17:33:13 2011 -0700
2.3 @@ -23,11 +23,13 @@
2.4
2.5 /*
2.6 * @test
2.7 - * @bug 7044443
2.8 + * @bug 7044443 7050329
2.9 + * @run main/othervm/policy=JarURL.policy JarURL
2.10 * @summary Permissions resolved incorrectly for jar protocol
2.11 */
2.12
2.13 import java.net.URL;
2.14 +import java.io.File;
2.15 import java.security.AllPermission;
2.16 import java.security.CodeSource;
2.17 import java.security.PermissionCollection;
2.18 @@ -35,11 +37,11 @@
2.19 import java.security.cert.Certificate;
2.20
2.21 public class JarURL {
2.22 +
2.23 public static void main(String[] args) throws Exception {
2.24 - URL codeSourceURL
2.25 - = new URL("jar:file:"
2.26 - + System.getProperty("java.ext.dirs").split(":")[0]
2.27 - + "/foo.jar!/");
2.28 + String userDir = System.getProperty("user.dir");
2.29 + String jarURL = "jar:file:" + userDir + File.separator + "foo.jar!/";
2.30 + URL codeSourceURL = new URL(jarURL);
2.31 CodeSource cs = new CodeSource(codeSourceURL, new Certificate[0]);
2.32 PermissionCollection perms = Policy.getPolicy().getPermissions(cs);
2.33 if (!perms.implies(new AllPermission()))
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/test/java/security/Policy/GetPermissions/JarURL.policy Sat Jun 04 17:33:13 2011 -0700
3.3 @@ -0,0 +1,8 @@
3.4 +grant codeBase "file:${user.dir}/*" {
3.5 + permission java.security.AllPermission;
3.6 +};
3.7 +
3.8 +grant {
3.9 + permission java.util.PropertyPermission "user.dir", "read";
3.10 + permission java.security.SecurityPermission "getPolicy";
3.11 +};