jdk/src/share/classes/java/net/URLPermission.java
changeset 22105 09df5383d1df
parent 21608 73c4bf75786c
--- a/jdk/src/share/classes/java/net/URLPermission.java	Sun Jan 05 21:02:57 2014 -0800
+++ b/jdk/src/share/classes/java/net/URLPermission.java	Mon Jan 06 11:00:12 2014 +0000
@@ -47,7 +47,7 @@
  * class.
  * <i>authority</i> is specified as:
  * <pre>
- *     authority = hostrange [ : portrange ]
+ *     authority = [ userinfo @ ] hostrange [ : portrange ]
  *     portrange = portnumber | -portnumber | portnumber-[portnumber] | *
  *     hostrange = ([*.] dnsname) | IPv4address | IPv6address
  * </pre>
@@ -65,6 +65,9 @@
  * (default 443). No default is assumed for other schemes. A wildcard may be specified
  * which means all ports.
  * <p>
+ * <i>userinfo</i> is optional. A userinfo component if present, is ignored when
+ * creating a URLPermission, and has no effect on any other methods defined by this class.
+ * <p>
  * The <i>path</i> component comprises a sequence of path segments,
  * separated by '/' characters. <i>path</i> may also be empty. The path is specified
  * in a similar way to the path in {@link java.io.FilePermission}. There are
@@ -473,7 +476,12 @@
         HostPortrange p;
 
         Authority(String scheme, String authority) {
-            p = new HostPortrange(scheme, authority);
+            int at = authority.indexOf('@');
+            if (at == -1) {
+                    p = new HostPortrange(scheme, authority);
+            } else {
+                    p = new HostPortrange(scheme, authority.substring(at+1));
+            }
         }
 
         boolean implies(Authority other) {