< prev index next >
src/java.base/share/classes/java/net/SocketPermission.java
Print this page
@@ -61,11 +61,11 @@
* </pre>
* The host is expressed as a DNS name, as a numerical IP address,
* or as "localhost" (for the local machine).
* The wildcard "*" may be included once in a DNS name host
* specification. If it is included, it must be in the leftmost
- * position, as in "*.sun.com".
+ * position, as in "*.example.com".
* <p>
* The format of the IPv6reference should follow that specified in <a
* href="http://www.ietf.org/rfc/rfc2732.txt"><i>RFC 2732: Format
* for Literal IPv6 Addresses in URLs</i></a>:
* <pre>
@@ -113,15 +113,15 @@
* The actions string is converted to lowercase before processing.
* <p>As an example of the creation and meaning of SocketPermissions,
* note that if the following permission:
*
* <pre>
- * p1 = new SocketPermission("puffin.eng.sun.com:7777", "connect,accept");
+ * p1 = new SocketPermission("foo.example.com:7777", "connect,accept");
* </pre>
*
* is granted to some code, it allows that code to connect to port 7777 on
- * {@code puffin.eng.sun.com}, and to accept connections on that port.
+ * {@code foo.example.com}, and to accept connections on that port.
*
* <p>Similarly, if the following permission:
*
* <pre>
* p2 = new SocketPermission("localhost:1024-", "accept,connect,listen");
@@ -209,11 +209,11 @@
private transient String cname;
// all the IP addresses of the host
private transient InetAddress[] addresses;
- // true if the hostname is a wildcard (e.g. "*.sun.com")
+ // true if the hostname is a wildcard (e.g. "*.example.com")
private transient boolean wildcard;
// true if we were initialized with a single numeric IP address
private transient boolean init_with_ip;
@@ -272,13 +272,13 @@
* any combination of those. "resolve" is automatically added
* when any of the other three are specified.
* <p>
* Examples of SocketPermission instantiation are the following:
* <pre>
- * nr = new SocketPermission("www.catalog.com", "connect");
- * nr = new SocketPermission("www.sun.com:80", "connect");
- * nr = new SocketPermission("*.sun.com", "connect");
+ * nr = new SocketPermission("www.example.com", "connect");
+ * nr = new SocketPermission("www.example.com:80", "connect");
+ * nr = new SocketPermission("*.example.com", "connect");
* nr = new SocketPermission("*.edu", "resolve");
* nr = new SocketPermission("204.160.241.0", "connect");
* nr = new SocketPermission("localhost:1024-65535", "listen");
* nr = new SocketPermission("204.160.241.0:1024-65535", "connect");
* </pre>
@@ -398,11 +398,11 @@
// always OR in RESOLVE if we allow any of the others
this.mask = mask | RESOLVE;
// Parse the host name. A name has up to three components, the
// hostname, a port number, or two numbers representing a port
- // range. "www.sun.com:8080-9090" is a valid host name.
+ // range. "www.example.com:8080-9090" is a valid host name.
// With IPv6 an address can be 2010:836B:4179::836B:4179
// An IPv6 address needs to be enclose in []
// For ex: [2010:836B:4179::836B:4179]:8080-9090
// Refer to RFC 2732 for more information.
@@ -833,14 +833,14 @@
* Then {@code implies} checks each of the following, in order,
* and for each returns true if the stated condition is true:
* <ul>
* <li> If this object was initialized with a single IP address and one of <i>p</i>'s
* IP addresses is equal to this object's IP address.
- * <li>If this object is a wildcard domain (such as *.sun.com), and
+ * <li>If this object is a wildcard domain (such as *.example.com), and
* <i>p</i>'s canonical name (the name without any preceding *)
- * ends with this object's canonical host name. For example, *.sun.com
- * implies *.eng.sun.com.
+ * ends with this object's canonical host name. For example, *.example.com
+ * implies *.foo.example.com.
* <li>If this object was not initialized with a single IP address, and one of this
* object's IP addresses equals one of <i>p</i>'s IP addresses.
* <li>If this canonical name equals <i>p</i>'s canonical name.
* </ul>
*
@@ -876,11 +876,11 @@
* <li> Checks that "p"'s actions are a proper subset of the
* current object's actions.
* <li> Checks that "p"'s port range is included in this port range
* <li> If this object was initialized with an IP address, checks that
* one of "p"'s IP addresses is equal to this object's IP address.
- * <li> If either object is a wildcard domain (i.e., "*.sun.com"),
+ * <li> If either object is a wildcard domain (i.e., "*.example.com"),
* attempt to match based on the wildcard.
* <li> If this object was not initialized with an IP address, attempt
* to find a match based on the IP addresses in both objects.
* <li> Attempt to match on the canonical hostnames of both objects.
* </ul>
@@ -942,12 +942,12 @@
}
// check and see if we have any wildcards...
if (this.wildcard || that.wildcard) {
// if they are both wildcards, return true iff
- // that's cname ends with this cname (i.e., *.sun.com
- // implies *.eng.sun.com)
+ // that's cname ends with this cname (i.e., *.example.com
+ // implies *.foo.example.com)
if (this.wildcard && that.wildcard)
return (that.cname.endsWith(this.cname));
// a non-wildcard can't imply a wildcard
if (that.wildcard)
@@ -1055,11 +1055,11 @@
// short cut. This catches:
// "crypto" equal to "crypto", or
// "1.2.3.4" equal to "1.2.3.4.", or
// "*.edu" equal to "*.edu", but it
// does not catch "crypto" equal to
- // "crypto.eng.sun.com".
+ // "crypto.foo.example.com".
if (this.getName().equalsIgnoreCase(that.getName())) {
return true;
}
@@ -1311,11 +1311,11 @@
System.out.println("-----\n");
SocketPermissionCollection nps = new SocketPermissionCollection();
nps.add(this_);
nps.add(new SocketPermission("www-leland.stanford.edu","connect"));
- nps.add(new SocketPermission("www-sun.com","connect"));
+ nps.add(new SocketPermission("www-example.com","connect"));
System.out.println("nps.implies(that) = " + nps.implies(that_));
System.out.println("-----\n");
}
*/
}
< prev index next >