8213911: Use example.com in java.net and other examples

Reviewed-by: prappo, chegar, rriggs, mullan
This commit is contained in:
Joe Darcy 2018-11-27 11:28:47 -08:00
parent 197b669f83
commit 5d1cc7fc01
9 changed files with 39 additions and 39 deletions

View File

@ -60,7 +60,7 @@ class HostPortrange {
HostPortrange(String scheme, String str) { HostPortrange(String scheme, String str) {
// Parse the host name. A name has up to three components, the // Parse the host name. A name has up to three components, the
// hostname, a port number, or two numbers representing a port // 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 // With IPv6 an address can be 2010:836B:4179::836B:4179
// An IPv6 address needs to be enclose in [] // An IPv6 address needs to be enclose in []

View File

@ -1168,7 +1168,7 @@ class InetAddress implements java.io.Serializable {
* No name service is checked for the validity of the address. * No name service is checked for the validity of the address.
* *
* <p> The host name can either be a machine name, such as * <p> The host name can either be a machine name, such as
* "{@code java.sun.com}", or a textual representation of its IP * "{@code www.example.com}", or a textual representation of its IP
* address. * address.
* <p> No validity checking is done on the host name either. * <p> No validity checking is done on the host name either.
* *
@ -1213,7 +1213,7 @@ class InetAddress implements java.io.Serializable {
* Determines the IP address of a host, given the host's name. * Determines the IP address of a host, given the host's name.
* *
* <p> The host name can either be a machine name, such as * <p> The host name can either be a machine name, such as
* "{@code java.sun.com}", or a textual representation of its * "{@code www.example.com}", or a textual representation of its
* IP address. If a literal IP address is supplied, only the * IP address. If a literal IP address is supplied, only the
* validity of the address format is checked. * validity of the address format is checked.
* *
@ -1259,7 +1259,7 @@ class InetAddress implements java.io.Serializable {
* based on the configured name service on the system. * based on the configured name service on the system.
* *
* <p> The host name can either be a machine name, such as * <p> The host name can either be a machine name, such as
* "{@code java.sun.com}", or a textual representation of its IP * "{@code www.example.com}", or a textual representation of its IP
* address. If a literal IP address is supplied, only the * address. If a literal IP address is supplied, only the
* validity of the address format is checked. * validity of the address format is checked.
* *

View File

@ -63,7 +63,7 @@ import sun.security.util.Debug;
* or as "localhost" (for the local machine). * or as "localhost" (for the local machine).
* The wildcard "*" may be included once in a DNS name host * The wildcard "*" may be included once in a DNS name host
* specification. If it is included, it must be in the leftmost * specification. If it is included, it must be in the leftmost
* position, as in "*.sun.com". * position, as in "*.example.com".
* <p> * <p>
* The format of the IPv6reference should follow that specified in <a * The format of the IPv6reference should follow that specified in <a
* href="http://www.ietf.org/rfc/rfc2732.txt"><i>RFC&nbsp;2732: Format * href="http://www.ietf.org/rfc/rfc2732.txt"><i>RFC&nbsp;2732: Format
@ -115,11 +115,11 @@ import sun.security.util.Debug;
* note that if the following permission: * note that if the following permission:
* *
* <pre> * <pre>
* p1 = new SocketPermission("puffin.eng.sun.com:7777", "connect,accept"); * p1 = new SocketPermission("foo.example.com:7777", "connect,accept");
* </pre> * </pre>
* *
* is granted to some code, it allows that code to connect to port 7777 on * 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: * <p>Similarly, if the following permission:
* *
@ -211,7 +211,7 @@ public final class SocketPermission extends Permission
// all the IP addresses of the host // all the IP addresses of the host
private transient InetAddress[] addresses; 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; private transient boolean wildcard;
// true if we were initialized with a single numeric IP address // true if we were initialized with a single numeric IP address
@ -274,9 +274,9 @@ public final class SocketPermission extends Permission
* <p> * <p>
* Examples of SocketPermission instantiation are the following: * Examples of SocketPermission instantiation are the following:
* <pre> * <pre>
* nr = new SocketPermission("www.catalog.com", "connect"); * nr = new SocketPermission("www.example.com", "connect");
* nr = new SocketPermission("www.sun.com:80", "connect"); * nr = new SocketPermission("www.example.com:80", "connect");
* nr = new SocketPermission("*.sun.com", "connect"); * nr = new SocketPermission("*.example.com", "connect");
* nr = new SocketPermission("*.edu", "resolve"); * nr = new SocketPermission("*.edu", "resolve");
* nr = new SocketPermission("204.160.241.0", "connect"); * nr = new SocketPermission("204.160.241.0", "connect");
* nr = new SocketPermission("localhost:1024-65535", "listen"); * nr = new SocketPermission("localhost:1024-65535", "listen");
@ -400,7 +400,7 @@ public final class SocketPermission extends Permission
// Parse the host name. A name has up to three components, the // Parse the host name. A name has up to three components, the
// hostname, a port number, or two numbers representing a port // 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 // With IPv6 an address can be 2010:836B:4179::836B:4179
// An IPv6 address needs to be enclose in [] // An IPv6 address needs to be enclose in []
@ -835,10 +835,10 @@ public final class SocketPermission extends Permission
* <ul> * <ul>
* <li> If this object was initialized with a single IP address and one of <i>p</i>'s * <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. * 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 *) * <i>p</i>'s canonical name (the name without any preceding *)
* ends with this object's canonical host name. For example, *.sun.com * ends with this object's canonical host name. For example, *.example.com
* implies *.eng.sun.com. * implies *.foo.example.com.
* <li>If this object was not initialized with a single IP address, and one of this * <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. * 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. * <li>If this canonical name equals <i>p</i>'s canonical name.
@ -878,7 +878,7 @@ public final class SocketPermission extends Permission
* <li> Checks that "p"'s port range is included in this port range * <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 * <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. * 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. * attempt to match based on the wildcard.
* <li> If this object was not initialized with an IP address, attempt * <li> If this object was not initialized with an IP address, attempt
* to find a match based on the IP addresses in both objects. * to find a match based on the IP addresses in both objects.
@ -944,8 +944,8 @@ public final class SocketPermission extends Permission
// check and see if we have any wildcards... // check and see if we have any wildcards...
if (this.wildcard || that.wildcard) { if (this.wildcard || that.wildcard) {
// if they are both wildcards, return true iff // if they are both wildcards, return true iff
// that's cname ends with this cname (i.e., *.sun.com // that's cname ends with this cname (i.e., *.example.com
// implies *.eng.sun.com) // implies *.foo.example.com)
if (this.wildcard && that.wildcard) if (this.wildcard && that.wildcard)
return (that.cname.endsWith(this.cname)); return (that.cname.endsWith(this.cname));
@ -1057,7 +1057,7 @@ public final class SocketPermission extends Permission
// "1.2.3.4" equal to "1.2.3.4.", or // "1.2.3.4" equal to "1.2.3.4.", or
// "*.edu" equal to "*.edu", but it // "*.edu" equal to "*.edu", but it
// does not catch "crypto" equal to // does not catch "crypto" equal to
// "crypto.eng.sun.com". // "crypto.foo.example.com".
if (this.getName().equalsIgnoreCase(that.getName())) { if (this.getName().equalsIgnoreCase(that.getName())) {
return true; return true;
@ -1313,7 +1313,7 @@ public final class SocketPermission extends Permission
SocketPermissionCollection nps = new SocketPermissionCollection(); SocketPermissionCollection nps = new SocketPermissionCollection();
nps.add(this_); nps.add(this_);
nps.add(new SocketPermission("www-leland.stanford.edu","connect")); 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("nps.implies(that) = " + nps.implies(that_));
System.out.println("-----\n"); System.out.println("-----\n");
} }

View File

@ -83,7 +83,7 @@ import java.lang.NullPointerException; // for javadoc
* subject to further parsing. Some examples of opaque URIs are: * subject to further parsing. Some examples of opaque URIs are:
* *
* <blockquote><ul style="list-style-type:none"> * <blockquote><ul style="list-style-type:none">
* <li>{@code mailto:java-net@java.sun.com}</li> * <li>{@code mailto:java-net@www.example.com}</li>
* <li>{@code news:comp.lang.java}</li> * <li>{@code news:comp.lang.java}</li>
* <li>{@code urn:isbn:096139210x}</li> * <li>{@code urn:isbn:096139210x}</li>
* </ul></blockquote> * </ul></blockquote>
@ -399,7 +399,7 @@ import java.lang.NullPointerException; // for javadoc
* For any URI <i>u</i> that does not contain redundant syntax such as two * For any URI <i>u</i> that does not contain redundant syntax such as two
* slashes before an empty authority (as in {@code file:///tmp/}&nbsp;) or a * slashes before an empty authority (as in {@code file:///tmp/}&nbsp;) or a
* colon following a host name but no port (as in * colon following a host name but no port (as in
* {@code http://java.sun.com:}&nbsp;), and that does not encode characters * {@code http://www.example.com:}&nbsp;), and that does not encode characters
* except those that must be quoted, the following identities also hold: * except those that must be quoted, the following identities also hold:
* <pre> * <pre>
* new URI(<i>u</i>.getScheme(), * new URI(<i>u</i>.getScheme(),

View File

@ -95,7 +95,7 @@ import sun.security.action.GetPropertyAction;
* as a "ref" or a "reference". The fragment is indicated by the sharp * as a "ref" or a "reference". The fragment is indicated by the sharp
* sign character "#" followed by more characters. For example, * sign character "#" followed by more characters. For example,
* <blockquote><pre> * <blockquote><pre>
* http://java.sun.com/index.html#chapter1 * http://www.example.com/index.html#chapter1
* </pre></blockquote> * </pre></blockquote>
* <p> * <p>
* This fragment is not technically part of the URL. Rather, it * This fragment is not technically part of the URL. Rather, it
@ -109,7 +109,7 @@ import sun.security.action.GetPropertyAction;
* relative to another URL. Relative URLs are frequently used within * relative to another URL. Relative URLs are frequently used within
* HTML pages. For example, if the contents of the URL: * HTML pages. For example, if the contents of the URL:
* <blockquote><pre> * <blockquote><pre>
* http://java.sun.com/index.html * http://www.example.com/index.html
* </pre></blockquote> * </pre></blockquote>
* contained within it the relative URL: * contained within it the relative URL:
* <blockquote><pre> * <blockquote><pre>
@ -117,7 +117,7 @@ import sun.security.action.GetPropertyAction;
* </pre></blockquote> * </pre></blockquote>
* it would be a shorthand for: * it would be a shorthand for:
* <blockquote><pre> * <blockquote><pre>
* http://java.sun.com/FAQ.html * http://www.example.com/FAQ.html
* </pre></blockquote> * </pre></blockquote>
* <p> * <p>
* The relative URL need not specify all the components of a URL. If * The relative URL need not specify all the components of a URL. If

View File

@ -57,7 +57,7 @@ import java.security.Permission;
* RFC 2732</a>. Literal IPv6 addresses must however, be enclosed in '[]' characters. * RFC 2732</a>. Literal IPv6 addresses must however, be enclosed in '[]' characters.
* The <i>dnsname</i> specification can be preceded by "*." which means * The <i>dnsname</i> specification can be preceded by "*." which means
* the name will match any hostname whose right-most domain labels are the same as * the name will match any hostname whose right-most domain labels are the same as
* this name. For example, "*.oracle.com" matches "foo.bar.oracle.com" * this name. For example, "*.example.com" matches "foo.bar.example.com"
* <p> * <p>
* <i>portrange</i> is used to specify a port number, or a bounded or unbounded range of ports * <i>portrange</i> is used to specify a port number, or a bounded or unbounded range of ports
* that this permission applies to. If portrange is absent or invalid, then a default * that this permission applies to. If portrange is absent or invalid, then a default
@ -78,18 +78,18 @@ import java.security.Permission;
* <tr><th scope="col">Example url</th><th scope="col">Description</th></tr> * <tr><th scope="col">Example url</th><th scope="col">Description</th></tr>
* </thead> * </thead>
* <tbody style="text-align:left"> * <tbody style="text-align:left">
* <tr><th scope="row" style="white-space:nowrap;">http://www.oracle.com/a/b/c.html</th> * <tr><th scope="row" style="white-space:nowrap;">http://www.example.com/a/b/c.html</th>
* <td>A url which identifies a specific (single) resource</td> * <td>A url which identifies a specific (single) resource</td>
* </tr> * </tr>
* <tr><th scope="row">http://www.oracle.com/a/b/*</th> * <tr><th scope="row">http://www.example.com/a/b/*</th>
* <td>The '*' character refers to all resources in the same "directory" - in * <td>The '*' character refers to all resources in the same "directory" - in
* other words all resources with the same number of path components, and * other words all resources with the same number of path components, and
* which only differ in the final path component, represented by the '*'. * which only differ in the final path component, represented by the '*'.
* </td> * </td>
* </tr> * </tr>
* <tr><th scope="row">http://www.oracle.com/a/b/-</th> * <tr><th scope="row">http://www.example.com/a/b/-</th>
* <td>The '-' character refers to all resources recursively below the * <td>The '-' character refers to all resources recursively below the
* preceding path (e.g. http://www.oracle.com/a/b/c/d/e.html matches this * preceding path (e.g. http://www.example.com/a/b/c/d/e.html matches this
* example). * example).
* </td> * </td>
* </tr> * </tr>
@ -267,9 +267,9 @@ public final class URLPermission extends Permission {
* <li>if this's url scheme is not equal to p's url scheme return false</li> * <li>if this's url scheme is not equal to p's url scheme return false</li>
* <li>if the scheme specific part of this's url is '*' return true</li> * <li>if the scheme specific part of this's url is '*' return true</li>
* <li>if the set of hosts defined by p's url hostrange is not a subset of * <li>if the set of hosts defined by p's url hostrange is not a subset of
* this's url hostrange then return false. For example, "*.foo.oracle.com" * this's url hostrange then return false. For example, "*.foo.example.com"
* is a subset of "*.oracle.com". "foo.bar.oracle.com" is not * is a subset of "*.example.com". "foo.bar.example.com" is not
* a subset of "*.foo.oracle.com"</li> * a subset of "*.foo.example.com"</li>
* <li>if the portrange defined by p's url is not a subset of the * <li>if the portrange defined by p's url is not a subset of the
* portrange defined by this's url then return false. * portrange defined by this's url then return false.
* <li>if the path or paths specified by p's url are contained in the * <li>if the path or paths specified by p's url are contained in the

View File

@ -131,7 +131,7 @@
* InputStream. * InputStream.
* <p>Here is an example:</p> * <p>Here is an example:</p>
* <pre> * <pre>
* URI uri = new URI("http://java.sun.com/"); * URI uri = new URI("http://www.example.com/");
* URL url = uri.toURL(); * URL url = uri.toURL();
* InputStream in = url.openStream(); * InputStream in = url.openStream();
* </pre> * </pre>

View File

@ -3067,7 +3067,7 @@ public final class Files {
* it to a file: * it to a file:
* <pre> * <pre>
* Path path = ... * Path path = ...
* URI u = URI.create("http://java.sun.com/"); * URI u = URI.create("http://www.example.com/");
* try (InputStream in = u.toURL().openStream()) { * try (InputStream in = u.toURL().openStream()) {
* Files.copy(in, path); * Files.copy(in, path);
* } * }

View File

@ -309,13 +309,13 @@ public class CodeSource implements java.io.Serializable {
* <p> * <p>
* For example, the codesource objects with the following locations * For example, the codesource objects with the following locations
* and null certificates all imply * and null certificates all imply
* the codesource with the location "http://java.sun.com/classes/foo.jar" * the codesource with the location "http://www.example.com/classes/foo.jar"
* and null certificates: * and null certificates:
* <pre> * <pre>
* http: * http:
* http://*.sun.com/classes/* * http://*.example.com/classes/*
* http://java.sun.com/classes/- * http://www.example.com/classes/-
* http://java.sun.com/classes/foo.jar * http://www.example.com/classes/foo.jar
* </pre> * </pre>
* *
* Note that if this CodeSource has a null location and a null * Note that if this CodeSource has a null location and a null