Skip to content

Commit

Permalink
Merge latest openjdk level jdk-12+21
Browse files Browse the repository at this point in the history
  • Loading branch information
j9build committed Nov 28, 2018
2 parents ee2a512 + 86ef47d commit 6e8bbd1
Show file tree
Hide file tree
Showing 52 changed files with 1,648 additions and 215 deletions.
20 changes: 20 additions & 0 deletions src/java.base/share/classes/java/lang/String.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.util.Objects;
import java.util.Spliterator;
import java.util.StringJoiner;
import java.util.function.Function;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
Expand Down Expand Up @@ -2972,6 +2973,25 @@ public String align(int n) {
return indent(indent > n ? Integer.MIN_VALUE : indent, true);
}

/**
* This method allows the application of a function to {@code this}
* string. The function should expect a single String argument
* and produce an {@code R} result.
*
* @param f functional interface to a apply
*
* @param <R> class of the result
*
* @return the result of applying the function to this string
*
* @see java.util.function.Function
*
* @since 12
*/
public <R> R transform(Function<? super String, ? extends R> f) {
return f.apply(this);
}

/**
* This object (which is already a string!) is itself returned.
*
Expand Down
2 changes: 1 addition & 1 deletion src/java.base/share/classes/java/net/HostPortrange.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public int hashCode() {
HostPortrange(String scheme, String str) {
// 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 []
Expand Down
6 changes: 3 additions & 3 deletions src/java.base/share/classes/java/net/InetAddress.java
Original file line number Diff line number Diff line change
Expand Up @@ -1168,7 +1168,7 @@ private static NameService createNameService() {
* No name service is checked for the validity of the address.
*
* <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.
* <p> No validity checking is done on the host name either.
*
Expand Down Expand Up @@ -1213,7 +1213,7 @@ public static InetAddress getByAddress(String host, byte[] addr)
* Determines the IP address of a host, given the host's name.
*
* <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
* validity of the address format is checked.
*
Expand Down Expand Up @@ -1259,7 +1259,7 @@ private static InetAddress getByName(String host, InetAddress reqAddr)
* based on the configured name service on the system.
*
* <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
* validity of the address format is checked.
*
Expand Down
32 changes: 16 additions & 16 deletions src/java.base/share/classes/java/net/SocketPermission.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
* 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&nbsp;2732: Format
Expand Down Expand Up @@ -115,11 +115,11 @@
* 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:
*
Expand Down Expand Up @@ -211,7 +211,7 @@ public final class SocketPermission extends Permission
// 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
Expand Down Expand Up @@ -274,9 +274,9 @@ private static synchronized Debug getDebug() {
* <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");
Expand Down Expand Up @@ -400,7 +400,7 @@ private void init(String host, int mask) {

// 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 []
Expand Down Expand Up @@ -835,10 +835,10 @@ void getIP()
* <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.
Expand Down Expand Up @@ -878,7 +878,7 @@ public boolean implies(Permission p) {
* <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.
Expand Down Expand Up @@ -944,8 +944,8 @@ boolean impliesIgnoreMask(SocketPermission that) {
// 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));

Expand Down Expand Up @@ -1057,7 +1057,7 @@ public boolean equals(Object obj) {
// "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;
Expand Down Expand Up @@ -1313,7 +1313,7 @@ public static void main(String args[]) throws Exception {
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");
}
Expand Down
4 changes: 2 additions & 2 deletions src/java.base/share/classes/java/net/URI.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
* subject to further parsing. Some examples of opaque URIs are:
*
* <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 urn:isbn:096139210x}</li>
* </ul></blockquote>
Expand Down Expand Up @@ -399,7 +399,7 @@
* 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
* 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:
* <pre>
* new URI(<i>u</i>.getScheme(),
Expand Down
15 changes: 7 additions & 8 deletions src/java.base/share/classes/java/net/URL.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
* as a "ref" or a "reference". The fragment is indicated by the sharp
* sign character "#" followed by more characters. For example,
* <blockquote><pre>
* http://java.sun.com/index.html#chapter1
* http://www.example.com/index.html#chapter1
* </pre></blockquote>
* <p>
* This fragment is not technically part of the URL. Rather, it
Expand All @@ -109,15 +109,15 @@
* relative to another URL. Relative URLs are frequently used within
* HTML pages. For example, if the contents of the URL:
* <blockquote><pre>
* http://java.sun.com/index.html
* http://www.example.com/index.html
* </pre></blockquote>
* contained within it the relative URL:
* <blockquote><pre>
* FAQ.html
* </pre></blockquote>
* it would be a shorthand for:
* <blockquote><pre>
* http://java.sun.com/FAQ.html
* http://www.example.com/FAQ.html
* </pre></blockquote>
* <p>
* The relative URL need not specify all the components of a URL. If
Expand Down Expand Up @@ -1421,13 +1421,12 @@ static URLStreamHandler getURLStreamHandler(String protocol) {
// this thread created.
handler = handler2;
}
}

// Insert this handler into the hashtable
if (handler != null) {
handlers.put(protocol, handler);
// Insert this handler into the hashtable
if (handler != null) {
handlers.put(protocol, handler);
}
}

return handler;
}

Expand Down
16 changes: 8 additions & 8 deletions src/java.base/share/classes/java/net/URLPermission.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
* RFC 2732</a>. Literal IPv6 addresses must however, be enclosed in '[]' characters.
* 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
* this name. For example, "*.oracle.com" matches "foo.bar.oracle.com"
* this name. For example, "*.example.com" matches "foo.bar.example.com"
* <p>
* <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
Expand All @@ -78,18 +78,18 @@
* <tr><th scope="col">Example url</th><th scope="col">Description</th></tr>
* </thead>
* <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>
* </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
* other words all resources with the same number of path components, and
* which only differ in the final path component, represented by the '*'.
* </td>
* </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
* 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).
* </td>
* </tr>
Expand Down Expand Up @@ -267,9 +267,9 @@ public String getActions() {
* <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 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"
* is a subset of "*.oracle.com". "foo.bar.oracle.com" is not
* a subset of "*.foo.oracle.com"</li>
* this's url hostrange then return false. For example, "*.foo.example.com"
* is a subset of "*.example.com". "foo.bar.example.com" is not
* a subset of "*.foo.example.com"</li>
* <li>if the portrange defined by p's url is not a subset of the
* portrange defined by this's url then return false.
* <li>if the path or paths specified by p's url are contained in the
Expand Down
2 changes: 1 addition & 1 deletion src/java.base/share/classes/java/net/package-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
* InputStream.
* <p>Here is an example:</p>
* <pre>
* URI uri = new URI("http://java.sun.com/");
* URI uri = new URI("http://www.example.com/");
* URL url = uri.toURL();
* InputStream in = url.openStream();
* </pre>
Expand Down
2 changes: 1 addition & 1 deletion src/java.base/share/classes/java/nio/file/Files.java
Original file line number Diff line number Diff line change
Expand Up @@ -3067,7 +3067,7 @@ public static BufferedWriter newBufferedWriter(Path path, OpenOption... options)
* it to a file:
* <pre>
* Path path = ...
* URI u = URI.create("http://java.sun.com/");
* URI u = URI.create("http://www.example.com/");
* try (InputStream in = u.toURL().openStream()) {
* Files.copy(in, path);
* }
Expand Down
8 changes: 4 additions & 4 deletions src/java.base/share/classes/java/security/CodeSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -309,13 +309,13 @@ public final CodeSigner[] getCodeSigners() {
* <p>
* For example, the codesource objects with the following locations
* 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:
* <pre>
* http:
* http://*.sun.com/classes/*
* http://java.sun.com/classes/-
* http://java.sun.com/classes/foo.jar
* http://*.example.com/classes/*
* http://www.example.com/classes/-
* http://www.example.com/classes/foo.jar
* </pre>
*
* Note that if this CodeSource has a null location and a null
Expand Down
4 changes: 2 additions & 2 deletions src/java.base/share/classes/java/security/KeyStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -1813,8 +1813,8 @@ private static final KeyStore getInstance(File file, char[] password,
}
}

throw new KeyStoreException("Unrecognized keystore format: " +
keystore);
throw new KeyStoreException("This keystore does not support probing "
+ "and must be loaded with a specified type");
}

/**
Expand Down
10 changes: 5 additions & 5 deletions src/java.base/share/classes/sun/security/ssl/SSLCipher.java
Original file line number Diff line number Diff line change
Expand Up @@ -530,22 +530,22 @@ SSLWriteCipher createWriteCipher(Authenticator authenticator,
ProtocolVersion protocolVersion,
SecretKey key, IvParameterSpec iv,
SecureRandom random) throws GeneralSecurityException {
if (readCipherGenerators.length == 0) {
if (writeCipherGenerators.length == 0) {
return null;
}

WriteCipherGenerator rcg = null;
WriteCipherGenerator wcg = null;
for (Map.Entry<WriteCipherGenerator,
ProtocolVersion[]> me : writeCipherGenerators) {
for (ProtocolVersion pv : me.getValue()) {
if (protocolVersion == pv) {
rcg = me.getKey();
wcg = me.getKey();
}
}
}

if (rcg != null) {
return rcg.createCipher(this, authenticator,
if (wcg != null) {
return wcg.createCipher(this, authenticator,
protocolVersion, transformation, key, iv, random);
}
return null;
Expand Down
Loading

0 comments on commit 6e8bbd1

Please sign in to comment.