- *
+ * |
* {@link FilteringMode#REJECT_EXTENDED_RANGES REJECT_EXTENDED_RANGES}
- *
+ * |
* Same as above. |
*
* Throws {@link IllegalArgumentException} because {@code "de-*-DE"} is
diff --git a/jdk/src/java.base/share/classes/java/util/regex/Pattern.java b/jdk/src/java.base/share/classes/java/util/regex/Pattern.java
index b79c850bebf..4390fb7ba1a 100644
--- a/jdk/src/java.base/share/classes/java/util/regex/Pattern.java
+++ b/jdk/src/java.base/share/classes/java/util/regex/Pattern.java
@@ -3887,9 +3887,13 @@ loop: for(int x=0, offset=0; xpermission name, what it allows, and associated risks
*
*
- * Permission Target Name |
- * What the Permission Allows |
- * Risks of Allowing this Permission |
+ * Permission Target Name |
+ * What the Permission Allows |
+ * Risks of Allowing this Permission |
*
*
*
*
*
- * setHostnameVerifier |
+ * setHostnameVerifier |
* The ability to set a callback which can decide whether to
* allow a mismatch between the host being connected to by
* an HttpsURLConnection and the common name field in
@@ -70,7 +70,7 @@ import java.security.*;
* |
*
*
- * getSSLSessionContext |
+ * getSSLSessionContext |
* The ability to get the SSLSessionContext of an SSLSession.
* |
* Malicious code may monitor sessions which have been established
@@ -79,7 +79,7 @@ import java.security.*;
* |
*
*
- * setDefaultSSLContext |
+ * setDefaultSSLContext |
* The ability to set the default SSL context
* |
* Malicious code can set a context that monitors the opening of
diff --git a/jdk/src/java.base/share/classes/sun/nio/cs/ISO_8859_1.java b/jdk/src/java.base/share/classes/sun/nio/cs/ISO_8859_1.java
index f1dadedaf53..672cd33a478 100644
--- a/jdk/src/java.base/share/classes/sun/nio/cs/ISO_8859_1.java
+++ b/jdk/src/java.base/share/classes/sun/nio/cs/ISO_8859_1.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,7 @@ class ISO_8859_1
{
public ISO_8859_1() {
- super("ISO-8859-1", StandardCharsets.aliases_ISO_8859_1);
+ super(StandardCharsets.ISO_8859_1, StandardCharsets.aliases_ISO_8859_1);
}
public String historicalName() {
diff --git a/jdk/src/java.base/share/classes/sun/nio/cs/StandardCharsets.java.template b/jdk/src/java.base/share/classes/sun/nio/cs/StandardCharsets.java.template
index 8969ef1a04b..be05e03ef33 100644
--- a/jdk/src/java.base/share/classes/sun/nio/cs/StandardCharsets.java.template
+++ b/jdk/src/java.base/share/classes/sun/nio/cs/StandardCharsets.java.template
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -51,6 +51,12 @@ public class StandardCharsets extends CharsetProvider {
private static final String packagePrefix = "sun.nio.cs";
+ public static final String US_ASCII = "US-ASCII";
+
+ public static final String ISO_8859_1 = "ISO-8859-1";
+
+ public static final String UTF_8 = "UTF-8";
+
public StandardCharsets() {
this.aliasMap = new Aliases();
this.classMap = new Classes();
@@ -103,13 +109,13 @@ public class StandardCharsets extends CharsetProvider {
// As all charset class names added to classMap are string literals we
// can check identity here as an optimization
- if (cln == "US_ASCII") {
+ if (cln == US_ASCII) {
return cache(csn, new US_ASCII());
}
- if (cln == "ISO_8859_1") {
+ if (cln == ISO_8859_1) {
return cache(csn, new ISO_8859_1());
}
- if (cln == "UTF_8") {
+ if (cln == UTF_8) {
return cache(csn, new UTF_8());
}
diff --git a/jdk/src/java.base/share/classes/sun/nio/cs/US_ASCII.java b/jdk/src/java.base/share/classes/sun/nio/cs/US_ASCII.java
index e85ce61ccd8..43b3650b4d9 100644
--- a/jdk/src/java.base/share/classes/sun/nio/cs/US_ASCII.java
+++ b/jdk/src/java.base/share/classes/sun/nio/cs/US_ASCII.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,7 @@ public class US_ASCII
{
public US_ASCII() {
- super("US-ASCII", StandardCharsets.aliases_US_ASCII);
+ super(StandardCharsets.US_ASCII, StandardCharsets.aliases_US_ASCII);
}
public String historicalName() {
diff --git a/jdk/src/java.base/share/classes/sun/nio/cs/UTF_8.java b/jdk/src/java.base/share/classes/sun/nio/cs/UTF_8.java
index 06a43400745..642e363edb8 100644
--- a/jdk/src/java.base/share/classes/sun/nio/cs/UTF_8.java
+++ b/jdk/src/java.base/share/classes/sun/nio/cs/UTF_8.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -57,7 +57,7 @@ import java.nio.charset.CodingErrorAction;
class UTF_8 extends Unicode
{
public UTF_8() {
- super("UTF-8", StandardCharsets.aliases_UTF_8);
+ super(StandardCharsets.UTF_8, StandardCharsets.aliases_UTF_8);
}
public String historicalName() {
diff --git a/jdk/src/java.base/share/classes/sun/security/provider/certpath/AlgorithmChecker.java b/jdk/src/java.base/share/classes/sun/security/provider/certpath/AlgorithmChecker.java
index f7bedb99ccb..8282d51c425 100644
--- a/jdk/src/java.base/share/classes/sun/security/provider/certpath/AlgorithmChecker.java
+++ b/jdk/src/java.base/share/classes/sun/security/provider/certpath/AlgorithmChecker.java
@@ -270,7 +270,7 @@ public final class AlgorithmChecker extends PKIXCertPathChecker {
AlgorithmParameters currSigAlgParams = algorithmId.getParameters();
PublicKey currPubKey = cert.getPublicKey();
- String currSigAlg = ((X509Certificate)cert).getSigAlgName();
+ String currSigAlg = x509Cert.getSigAlgName();
// Check the signature algorithm and parameters against constraints.
if (!constraints.permits(SIGNATURE_PRIMITIVE_SET, currSigAlg,
diff --git a/jdk/src/java.base/share/classes/sun/security/util/ECUtil.java b/jdk/src/java.base/share/classes/sun/security/util/ECUtil.java
index dc6b02be611..a58cfc82c00 100644
--- a/jdk/src/java.base/share/classes/sun/security/util/ECUtil.java
+++ b/jdk/src/java.base/share/classes/sun/security/util/ECUtil.java
@@ -130,7 +130,7 @@ public class ECUtil {
return (ECPrivateKey)keyFactory.generatePrivate(keySpec);
}
- private static AlgorithmParameters getECParameters(Provider p) {
+ public static AlgorithmParameters getECParameters(Provider p) {
try {
if (p != null) {
return AlgorithmParameters.getInstance("EC", p);
diff --git a/jdk/src/java.base/windows/native/libnio/ch/FileChannelImpl.c b/jdk/src/java.base/windows/native/libnio/ch/FileChannelImpl.c
index 2e0a6ca0fd9..ee3da8fdb8e 100644
--- a/jdk/src/java.base/windows/native/libnio/ch/FileChannelImpl.c
+++ b/jdk/src/java.base/windows/native/libnio/ch/FileChannelImpl.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -170,8 +170,8 @@ Java_sun_nio_ch_FileChannelImpl_close0(JNIEnv *env, jobject this, jobject fdo)
{
HANDLE h = (HANDLE)(handleval(env, fdo));
if (h != INVALID_HANDLE_VALUE) {
- jint result = CloseHandle(h);
- if (result < 0) {
+ BOOL result = CloseHandle(h);
+ if (result == 0) {
JNU_ThrowIOExceptionWithLastError(env, "Close failed");
}
}
diff --git a/jdk/src/java.base/windows/native/libnio/ch/FileDispatcherImpl.c b/jdk/src/java.base/windows/native/libnio/ch/FileDispatcherImpl.c
index 821ad9eeded..c518116a209 100644
--- a/jdk/src/java.base/windows/native/libnio/ch/FileDispatcherImpl.c
+++ b/jdk/src/java.base/windows/native/libnio/ch/FileDispatcherImpl.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -334,7 +334,7 @@ Java_sun_nio_ch_FileDispatcherImpl_truncate0(JNIEnv *env, jobject this,
FileEndOfFileInfo,
&eofInfo,
sizeof(eofInfo));
- if (result == FALSE) {
+ if (result == 0) {
JNU_ThrowIOExceptionWithLastError(env, "Truncation failed");
return IOS_THROWN;
}
@@ -411,7 +411,7 @@ Java_sun_nio_ch_FileDispatcherImpl_release0(JNIEnv *env, jobject this,
long highPos = (long)(pos >> 32);
DWORD lowNumBytes = (DWORD)size;
DWORD highNumBytes = (DWORD)(size >> 32);
- jint result = 0;
+ BOOL result = 0;
OVERLAPPED o;
o.hEvent = 0;
o.Offset = lowPos;
@@ -422,7 +422,7 @@ Java_sun_nio_ch_FileDispatcherImpl_release0(JNIEnv *env, jobject this,
if (error == ERROR_IO_PENDING) {
DWORD dwBytes;
result = GetOverlappedResult(h, &o, &dwBytes, TRUE);
- if (result == 0) {
+ if (result != 0) {
return;
}
error = GetLastError();
@@ -437,7 +437,7 @@ static void closeFile(JNIEnv *env, jlong fd) {
HANDLE h = (HANDLE)fd;
if (h != INVALID_HANDLE_VALUE) {
int result = CloseHandle(h);
- if (result < 0)
+ if (result == 0)
JNU_ThrowIOExceptionWithLastError(env, "Close failed");
}
}
diff --git a/jdk/src/java.base/windows/native/libnio/ch/WindowsAsynchronousFileChannelImpl.c b/jdk/src/java.base/windows/native/libnio/ch/WindowsAsynchronousFileChannelImpl.c
index c53aedf7a8a..e24ca6e52b2 100644
--- a/jdk/src/java.base/windows/native/libnio/ch/WindowsAsynchronousFileChannelImpl.c
+++ b/jdk/src/java.base/windows/native/libnio/ch/WindowsAsynchronousFileChannelImpl.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -126,5 +126,8 @@ Java_sun_nio_ch_WindowsAsynchronousFileChannelImpl_close0(JNIEnv* env, jclass th
jlong handle)
{
HANDLE h = (HANDLE)jlong_to_ptr(handle);
- CloseHandle(h);
+ BOOL result = CloseHandle(h);
+ if (result == 0) {
+ JNU_ThrowIOExceptionWithLastError(env, "Close failed");
+ }
}
diff --git a/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/package.html b/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/package.html
index e52d3c9ec99..12ee65c9b8e 100644
--- a/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/package.html
+++ b/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/package.html
@@ -177,13 +177,13 @@ abstract class provides.
Features in BaseRowSet
- Feature |
- Details |
+ Feature |
+ Details |
|
- Properties |
+ Properties |
Provides standard JavaBeans property manipulation
mechanisms to allow applications to get and set RowSet command and
property values. Refer to the documentation of the javax.sql.RowSet
@@ -191,7 +191,7 @@ interface (available in the JDBC 3.0 specification) for more details on
the standard RowSet properties. |
- Event notification |
+ Event notification |
Provides standard JavaBeans event notifications
to registered event listeners. Refer to the documentation of javax.sql.RowSetEvent
interface (available in the JDBC 3.0 specification) for
@@ -199,12 +199,12 @@ more details on how to register and handle standard RowSet events generated
by compliant implementations. |
- Setters for a RowSet object's command |
+ Setters for a RowSet object's command |
Provides a complete set of setter methods
for setting RowSet command parameters. |
- Streams |
+ Streams |
Provides fields for storing of stream instances
in addition to providing a set of constants for stream type designation. |
diff --git a/jdk/src/java.sql/share/classes/java/sql/Connection.java b/jdk/src/java.sql/share/classes/java/sql/Connection.java
index 446f63c0f36..f3a6da0caa5 100644
--- a/jdk/src/java.sql/share/classes/java/sql/Connection.java
+++ b/jdk/src/java.sql/share/classes/java/sql/Connection.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1523,7 +1523,7 @@ throws SQLException;
*
* @implSpec
* The default implementation is a no-op.
- *
+ *
* @apiNote
* This method is to be used by Connection pooling managers.
*
diff --git a/jdk/src/java.sql/share/classes/java/sql/DriverManager.java b/jdk/src/java.sql/share/classes/java/sql/DriverManager.java
index 6c4f68a58b8..2399b596d8f 100644
--- a/jdk/src/java.sql/share/classes/java/sql/DriverManager.java
+++ b/jdk/src/java.sql/share/classes/java/sql/DriverManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -63,7 +63,6 @@ import jdk.internal.reflect.Reflection;
* via the {@linkplain ServiceLoader#load service-provider loading} mechanism.
*
*
- *
* @implNote
* {@code DriverManager} initialization is done lazily and looks up service
* providers using the thread context class loader. The drivers loaded and
diff --git a/jdk/src/java.sql/share/classes/java/sql/SQLPermission.java b/jdk/src/java.sql/share/classes/java/sql/SQLPermission.java
index 9907b98cc0d..dbdfb50efa0 100644
--- a/jdk/src/java.sql/share/classes/java/sql/SQLPermission.java
+++ b/jdk/src/java.sql/share/classes/java/sql/SQLPermission.java
@@ -62,29 +62,29 @@ import java.security.*;
* permission target name, what the permission allows, and associated risks
*
*
- * Permission Target Name |
- * What the Permission Allows |
- * Risks of Allowing this Permission |
+ * Permission Target Name |
+ * What the Permission Allows |
+ * Risks of Allowing this Permission |
*
*
*
*
*
- * setLog |
+ * setLog |
* Setting of the logging stream |
* This is a dangerous permission to grant.
* The contents of the log may contain usernames and passwords,
* SQL statements, and SQL data. |
*
*
- * callAbort |
+ * callAbort |
* Allows the invocation of the {@code Connection} method
* {@code abort} |
* Permits an application to terminate a physical connection to a
* database. |
*
*
- * setSyncFactory |
+ * setSyncFactory |
* Allows the invocation of the {@code SyncFactory} methods
* {@code setJNDIContext} and {@code setLogger} |
* Permits an application to specify the JNDI context from which the
@@ -93,7 +93,7 @@ import java.security.*;
* |
*
*
- * setNetworkTimeout |
+ * setNetworkTimeout |
* Allows the invocation of the {@code Connection} method
* {@code setNetworkTimeout} |
* Permits an application to specify the maximum period a
@@ -101,7 +101,7 @@ import java.security.*;
* objects created from the Connection
* will wait for the database to reply to any one request. |
*
- * deregisterDriver |
+ * deregisterDriver |
* Allows the invocation of the {@code DriverManager}
* method {@code deregisterDriver} |
* Permits an application to remove a JDBC driver from the list of
diff --git a/jdk/src/java.sql/share/classes/java/sql/Statement.java b/jdk/src/java.sql/share/classes/java/sql/Statement.java
index 9e6e2d900b8..89828185508 100644
--- a/jdk/src/java.sql/share/classes/java/sql/Statement.java
+++ b/jdk/src/java.sql/share/classes/java/sql/Statement.java
@@ -1379,17 +1379,17 @@ public interface Statement extends Wrapper, AutoCloseable {
* single quote within the string will be replaced by two single quotes.
*
*
- *
+ *
* Examples of the conversion:
*
- * Value | Result |
+ * Value | Result |
*
*
- * Hello | 'Hello' |
- * G'Day | 'G''Day' |
- * 'G''Day' |
+ * Hello | 'Hello' |
+ * G'Day | 'G''Day' |
+ * 'G''Day' |
* '''G''''Day''' |
- * I'''M | 'I''''''M' |
+ * I'''M | 'I''''''M' |
*
*
*
@@ -1454,48 +1454,48 @@ public interface Statement extends Wrapper, AutoCloseable {
* Examples of the conversion:
*
*
- * identifier |
- * alwaysQuote |
- * Result |
+ * identifier |
+ * alwaysQuote |
+ * Result |
*
*
*
- * Hello |
+ * Hello |
* false |
* Hello |
*
*
- * Hello |
+ * Hello |
* true |
* "Hello" |
*
*
- * G'Day |
+ * G'Day |
* false |
* "G'Day" |
*
*
- * "Bruce Wayne" |
+ * "Bruce Wayne" |
* false |
* "Bruce Wayne" |
*
*
- * "Bruce Wayne" |
+ * "Bruce Wayne" |
* true |
* "Bruce Wayne" |
*
*
- * GoodDay$ |
+ * GoodDay$ |
* false |
* "GoodDay$" |
*
*
- * Hello"World |
+ * Hello"World |
* false |
* SQLException |
*
*
- * "Hello"World" |
+ * "Hello"World" |
* false |
* SQLException |
*
@@ -1554,33 +1554,33 @@ public interface Statement extends Wrapper, AutoCloseable {
* Examples of the conversion:
*
*
- * identifier |
- * Simple Identifier |
+ * identifier |
+ * Simple Identifier |
*
*
*
*
- * Hello |
+ * Hello |
* true |
*
*
- * G'Day |
+ * G'Day |
* false |
*
*
- * "Bruce Wayne" |
+ * "Bruce Wayne" |
* false |
*
*
- * GoodDay$ |
+ * GoodDay$ |
* false |
*
*
- * Hello"World |
+ * Hello"World |
* false |
*
*
- * "Hello"World" |
+ * "Hello"World" |
* false |
*
*
@@ -1613,17 +1613,17 @@ public interface Statement extends Wrapper, AutoCloseable {
* Examples of the conversion:
*
*
- * Value |
- * Result |
+ * Value |
+ * Result |
*
*
*
- * Hello | N'Hello' |
- * G'Day | N'G''Day' |
- * 'G''Day' |
+ * Hello | N'Hello' |
+ * G'Day | N'G''Day' |
+ * 'G''Day' |
* N'''G''''Day''' |
- * I'''M | N'I''''''M' |
- * N'Hello' | N'N''Hello''' |
+ * I'''M | N'I''''''M' |
+ * N'Hello' | N'N''Hello''' |
*
*
*
diff --git a/jdk/src/java.sql/share/classes/javax/sql/package.html b/jdk/src/java.sql/share/classes/javax/sql/package.html
index 75cb739d7cf..8ee4c44913b 100644
--- a/jdk/src/java.sql/share/classes/javax/sql/package.html
+++ b/jdk/src/java.sql/share/classes/javax/sql/package.html
@@ -280,7 +280,6 @@ generally, a writer will do the following:
The RowSet interface may be implemented in any number of
ways, and anyone may write an implementation. Developers are encouraged
to use their imaginations in coming up with new ways to use rowsets.
-
Package Specification
diff --git a/jdk/src/jdk.crypto.ec/share/classes/sun/security/ec/ECKeyPairGenerator.java b/jdk/src/jdk.crypto.ec/share/classes/sun/security/ec/ECKeyPairGenerator.java
index 2df53fb60ed..9ffeff9d7d2 100644
--- a/jdk/src/jdk.crypto.ec/share/classes/sun/security/ec/ECKeyPairGenerator.java
+++ b/jdk/src/jdk.crypto.ec/share/classes/sun/security/ec/ECKeyPairGenerator.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,12 +25,14 @@
package sun.security.ec;
+import java.io.IOException;
import java.math.BigInteger;
import java.security.*;
import java.security.spec.AlgorithmParameterSpec;
import java.security.spec.ECGenParameterSpec;
import java.security.spec.ECParameterSpec;
import java.security.spec.ECPoint;
+import java.security.spec.InvalidParameterSpecException;
import sun.security.ec.ECPrivateKeyImpl;
import sun.security.ec.ECPublicKeyImpl;
@@ -85,17 +87,19 @@ public final class ECKeyPairGenerator extends KeyPairGeneratorSpi {
public void initialize(AlgorithmParameterSpec params, SecureRandom random)
throws InvalidAlgorithmParameterException {
+ ECParameterSpec ecSpec = null;
+
if (params instanceof ECParameterSpec) {
- this.params = ECUtil.getECParameterSpec(null,
+ ecSpec = ECUtil.getECParameterSpec(null,
(ECParameterSpec)params);
- if (this.params == null) {
+ if (ecSpec == null) {
throw new InvalidAlgorithmParameterException(
"Unsupported curve: " + params);
}
} else if (params instanceof ECGenParameterSpec) {
String name = ((ECGenParameterSpec)params).getName();
- this.params = ECUtil.getECParameterSpec(null, name);
- if (this.params == null) {
+ ecSpec = ECUtil.getECParameterSpec(null, name);
+ if (ecSpec == null) {
throw new InvalidAlgorithmParameterException(
"Unknown curve name: " + name);
}
@@ -103,11 +107,36 @@ public final class ECKeyPairGenerator extends KeyPairGeneratorSpi {
throw new InvalidAlgorithmParameterException(
"ECParameterSpec or ECGenParameterSpec required for EC");
}
+
+ // Not all known curves are supported by the native implementation
+ ensureCurveIsSupported(ecSpec);
+ this.params = ecSpec;
+
this.keySize =
((ECParameterSpec)this.params).getCurve().getField().getFieldSize();
this.random = random;
}
+ private static void ensureCurveIsSupported(ECParameterSpec ecSpec)
+ throws InvalidAlgorithmParameterException {
+
+ AlgorithmParameters ecParams = ECUtil.getECParameters(null);
+ byte[] encodedParams;
+ try {
+ ecParams.init(ecSpec);
+ encodedParams = ecParams.getEncoded();
+ } catch (InvalidParameterSpecException ex) {
+ throw new InvalidAlgorithmParameterException(
+ "Unsupported curve: " + ecSpec.toString());
+ } catch (IOException ex) {
+ throw new RuntimeException(ex);
+ }
+ if (!isCurveSupported(encodedParams)) {
+ throw new InvalidAlgorithmParameterException(
+ "Unsupported curve: " + ecParams.toString());
+ }
+ }
+
// generate the keypair. See JCA doc
@Override
public KeyPair generateKeyPair() {
@@ -159,6 +188,17 @@ public final class ECKeyPairGenerator extends KeyPairGeneratorSpi {
this.keySize = keySize;
}
+ /**
+ * Checks whether the curve in the encoded parameters is supported by the
+ * native implementation.
+ *
+ * @param encodedParams encoded parameters in the same form accepted
+ * by generateECKeyPair
+ * @return true if and only if generateECKeyPair will succeed for
+ * the supplied parameters
+ */
+ private static native boolean isCurveSupported(byte[] encodedParams);
+
/*
* Generates the keypair and returns a 2-element array of encoding bytes.
* The first one is for the private key, the second for the public key.
diff --git a/jdk/src/jdk.crypto.ec/share/native/libsunec/ECC_JNI.cpp b/jdk/src/jdk.crypto.ec/share/native/libsunec/ECC_JNI.cpp
index 31c2d074897..8b72cc7e820 100644
--- a/jdk/src/jdk.crypto.ec/share/native/libsunec/ECC_JNI.cpp
+++ b/jdk/src/jdk.crypto.ec/share/native/libsunec/ECC_JNI.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -88,6 +88,50 @@ jbyteArray getEncodedBytes(JNIEnv *env, SECItem *hSECItem)
return jEncodedBytes;
}
+/*
+ * Class: sun_security_ec_ECKeyPairGenerator
+ * Method: isCurveSupported
+ * Signature: ([B)Z
+ */
+JNIEXPORT jboolean
+JNICALL Java_sun_security_ec_ECKeyPairGenerator_isCurveSupported
+ (JNIEnv *env, jclass clazz, jbyteArray encodedParams)
+{
+ SECKEYECParams params_item;
+ ECParams *ecparams = NULL;
+ jboolean result = JNI_FALSE;
+
+ // The curve is supported if we can get parameters for it
+ params_item.len = env->GetArrayLength(encodedParams);
+ params_item.data =
+ (unsigned char *) env->GetByteArrayElements(encodedParams, 0);
+ if (params_item.data == NULL) {
+ goto cleanup;
+ }
+
+ // Fill a new ECParams using the supplied OID
+ if (EC_DecodeParams(¶ms_item, &ecparams, 0) != SECSuccess) {
+ /* bad curve OID */
+ goto cleanup;
+ }
+
+ // If we make it to here, then the curve is supported
+ result = JNI_TRUE;
+
+cleanup:
+ {
+ if (params_item.data) {
+ env->ReleaseByteArrayElements(encodedParams,
+ (jbyte *) params_item.data, JNI_ABORT);
+ }
+ if (ecparams) {
+ FreeECParams(ecparams, true);
+ }
+ }
+
+ return result;
+}
+
/*
* Class: sun_security_ec_ECKeyPairGenerator
* Method: generateECKeyPair
diff --git a/jdk/src/jdk.management.agent/share/classes/sun/management/jdp/JdpController.java b/jdk/src/jdk.management.agent/share/classes/sun/management/jdp/JdpController.java
index f96227ce471..14c45fafe0c 100644
--- a/jdk/src/jdk.management.agent/share/classes/sun/management/jdp/JdpController.java
+++ b/jdk/src/jdk.management.agent/share/classes/sun/management/jdp/JdpController.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@ import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
+import java.lang.UnsupportedOperationException;
import sun.management.VMManagement;
/**
@@ -132,19 +133,11 @@ public final class JdpController {
}
// Get the process id of the current running Java process
- private static Integer getProcessId() {
+ private static Long getProcessId() {
try {
- // Get the current process id using a reflection hack
- RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
- Field jvm = runtime.getClass().getDeclaredField("jvm");
- jvm.setAccessible(true);
-
- VMManagement mgmt = (sun.management.VMManagement) jvm.get(runtime);
- Method pid_method = mgmt.getClass().getDeclaredMethod("getProcessId");
- pid_method.setAccessible(true);
- Integer pid = (Integer) pid_method.invoke(mgmt);
- return pid;
- } catch(Exception ex) {
+ // Get the current process id
+ return ProcessHandle.current().pid();
+ } catch(UnsupportedOperationException ex) {
return null;
}
}
@@ -206,7 +199,7 @@ public final class JdpController {
packet.setBroadcastInterval(Integer.toString(pause));
// Set process id
- Integer pid = getProcessId();
+ Long pid = getProcessId();
if (pid != null) {
packet.setProcessId(pid.toString());
}
diff --git a/jdk/src/jdk.sctp/share/classes/com/sun/nio/sctp/SctpChannel.java b/jdk/src/jdk.sctp/share/classes/com/sun/nio/sctp/SctpChannel.java
index 53647e0a10e..55e2afb79e9 100644
--- a/jdk/src/jdk.sctp/share/classes/com/sun/nio/sctp/SctpChannel.java
+++ b/jdk/src/jdk.sctp/share/classes/com/sun/nio/sctp/SctpChannel.java
@@ -59,65 +59,70 @@ import java.nio.channels.SelectionKey;
* {@link #setOption(SctpSocketOption,Object) setOption} method. An SCTP
* channel support the following options:
*
- * Socket options
+ *
+ * Socket options
+ *
*
- * Option Name |
- * Description |
+ * Option Name |
+ * Description |
*
+ *
+ *
*
- * {@link SctpStandardSocketOptions#SCTP_DISABLE_FRAGMENTS
- * SCTP_DISABLE_FRAGMENTS} |
+ * {@link SctpStandardSocketOptions#SCTP_DISABLE_FRAGMENTS
+ * SCTP_DISABLE_FRAGMENTS} |
* Enables or disables message fragmentation |
*
*
- * {@link SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE
- * SCTP_EXPLICIT_COMPLETE} |
+ * {@link SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE
+ * SCTP_EXPLICIT_COMPLETE} |
* Enables or disables explicit message completion |
*
*
- * {@link SctpStandardSocketOptions#SCTP_FRAGMENT_INTERLEAVE
- * SCTP_FRAGMENT_INTERLEAVE} |
+ * {@link SctpStandardSocketOptions#SCTP_FRAGMENT_INTERLEAVE
+ * SCTP_FRAGMENT_INTERLEAVE} |
* Controls how the presentation of messages occur for the message
* receiver |
*
*
- * {@link SctpStandardSocketOptions#SCTP_INIT_MAXSTREAMS
- * SCTP_INIT_MAXSTREAMS} |
+ * {@link SctpStandardSocketOptions#SCTP_INIT_MAXSTREAMS
+ * SCTP_INIT_MAXSTREAMS} |
* The maximum number of streams requested by the local endpoint during
* association initialization |
*
*
- * {@link SctpStandardSocketOptions#SCTP_NODELAY SCTP_NODELAY} |
+ * {@link SctpStandardSocketOptions#SCTP_NODELAY SCTP_NODELAY} |
* Enables or disable a Nagle-like algorithm |
*
*
- * {@link SctpStandardSocketOptions#SCTP_PRIMARY_ADDR
- * SCTP_PRIMARY_ADDR} |
+ * {@link SctpStandardSocketOptions#SCTP_PRIMARY_ADDR
+ * SCTP_PRIMARY_ADDR} |
* Requests that the local SCTP stack use the given peer address as the
* association primary |
*
*
- * {@link SctpStandardSocketOptions#SCTP_SET_PEER_PRIMARY_ADDR
- * SCTP_SET_PEER_PRIMARY_ADDR} |
+ * {@link SctpStandardSocketOptions#SCTP_SET_PEER_PRIMARY_ADDR
+ * SCTP_SET_PEER_PRIMARY_ADDR} |
* Requests that the peer mark the enclosed address as the association
* primary |
*
*
- * {@link SctpStandardSocketOptions#SO_SNDBUF
- * SO_SNDBUF} |
+ * {@link SctpStandardSocketOptions#SO_SNDBUF
+ * SO_SNDBUF} |
* The size of the socket send buffer |
*
*
- * {@link SctpStandardSocketOptions#SO_RCVBUF
- * SO_RCVBUF} |
+ * {@link SctpStandardSocketOptions#SO_RCVBUF
+ * SO_RCVBUF} |
* The size of the socket receive buffer |
*
*
- * {@link SctpStandardSocketOptions#SO_LINGER
- * SO_LINGER} |
+ * {@link SctpStandardSocketOptions#SO_LINGER
+ * SO_LINGER} |
* Linger on close if data is present (when configured in blocking mode
* only) |
*
+ *
*
*
* Additional (implementation specific) options may also be supported. The list
diff --git a/jdk/src/jdk.sctp/share/classes/com/sun/nio/sctp/SctpMultiChannel.java b/jdk/src/jdk.sctp/share/classes/com/sun/nio/sctp/SctpMultiChannel.java
index cb498c9017d..2300bbbe146 100644
--- a/jdk/src/jdk.sctp/share/classes/com/sun/nio/sctp/SctpMultiChannel.java
+++ b/jdk/src/jdk.sctp/share/classes/com/sun/nio/sctp/SctpMultiChannel.java
@@ -63,65 +63,70 @@ import java.nio.channels.SelectionKey;
* {@link #setOption(SctpSocketOption,Object,Association) setOption} method. An
* {@code SctpMultiChannel} supports the following options:
*
- * Socket options
+ *
+ * Socket options
+ *
*
- * Option Name |
- * Description |
+ * Option Name |
+ * Description |
*
+ *
+ *
*
- * {@link SctpStandardSocketOptions#SCTP_DISABLE_FRAGMENTS
- * SCTP_DISABLE_FRAGMENTS} |
+ * {@link SctpStandardSocketOptions#SCTP_DISABLE_FRAGMENTS
+ * SCTP_DISABLE_FRAGMENTS} |
* Enables or disables message fragmentation |
*
*
- * {@link SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE
- * SCTP_EXPLICIT_COMPLETE} |
+ * {@link SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE
+ * SCTP_EXPLICIT_COMPLETE} |
* Enables or disables explicit message completion |
*
*
- * {@link SctpStandardSocketOptions#SCTP_FRAGMENT_INTERLEAVE
- * SCTP_FRAGMENT_INTERLEAVE} |
+ * {@link SctpStandardSocketOptions#SCTP_FRAGMENT_INTERLEAVE
+ * SCTP_FRAGMENT_INTERLEAVE} |
* Controls how the presentation of messages occur for the message
* receiver |
*
*
- * {@link SctpStandardSocketOptions#SCTP_INIT_MAXSTREAMS
- * SCTP_INIT_MAXSTREAMS} |
+ * {@link SctpStandardSocketOptions#SCTP_INIT_MAXSTREAMS
+ * SCTP_INIT_MAXSTREAMS} |
* The maximum number of streams requested by the local endpoint during
* association initialization |
*
*
- * {@link SctpStandardSocketOptions#SCTP_NODELAY SCTP_NODELAY} |
+ * {@link SctpStandardSocketOptions#SCTP_NODELAY SCTP_NODELAY} |
* Enables or disable a Nagle-like algorithm |
*
*
- * {@link SctpStandardSocketOptions#SCTP_PRIMARY_ADDR
- * SCTP_PRIMARY_ADDR} |
+ * {@link SctpStandardSocketOptions#SCTP_PRIMARY_ADDR
+ * SCTP_PRIMARY_ADDR} |
* Requests that the local SCTP stack use the given peer address as the
* association primary |
*
*
- * {@link SctpStandardSocketOptions#SCTP_SET_PEER_PRIMARY_ADDR
- * SCTP_SET_PEER_PRIMARY_ADDR} |
+ * {@link SctpStandardSocketOptions#SCTP_SET_PEER_PRIMARY_ADDR
+ * SCTP_SET_PEER_PRIMARY_ADDR} |
* Requests that the peer mark the enclosed address as the association
* primary |
*
*
- * {@link SctpStandardSocketOptions#SO_SNDBUF
- * SO_SNDBUF} |
+ * {@link SctpStandardSocketOptions#SO_SNDBUF
+ * SO_SNDBUF} |
* The size of the socket send buffer |
*
*
- * {@link SctpStandardSocketOptions#SO_RCVBUF
- * SO_RCVBUF} |
+ * {@link SctpStandardSocketOptions#SO_RCVBUF
+ * SO_RCVBUF} |
* The size of the socket receive buffer |
*
*
- * {@link SctpStandardSocketOptions#SO_LINGER
- * SO_LINGER} |
+ * {@link SctpStandardSocketOptions#SO_LINGER
+ * SO_LINGER} |
* Linger on close if data is present (when configured in blocking mode
* only) |
*
+ *
*
*
* Additional (implementation specific) options may also be supported. The list
diff --git a/jdk/src/jdk.sctp/share/classes/com/sun/nio/sctp/SctpServerChannel.java b/jdk/src/jdk.sctp/share/classes/com/sun/nio/sctp/SctpServerChannel.java
index cf56fd16c9f..212e111a930 100644
--- a/jdk/src/jdk.sctp/share/classes/com/sun/nio/sctp/SctpServerChannel.java
+++ b/jdk/src/jdk.sctp/share/classes/com/sun/nio/sctp/SctpServerChannel.java
@@ -47,17 +47,22 @@ import java.nio.channels.spi.AbstractSelectableChannel;
* {@link #setOption(SctpSocketOption,Object) setOption} method. SCTP server socket
* channels support the following options:
*
- * Socket options
+ *
+ * Socket options
+ *
*
- * Option Name |
- * Description |
+ * Option Name |
+ * Description |
*
+ *
+ *
*
- * {@link SctpStandardSocketOptions#SCTP_INIT_MAXSTREAMS
- * SCTP_INIT_MAXSTREAMS} |
+ * {@link SctpStandardSocketOptions#SCTP_INIT_MAXSTREAMS
+ * SCTP_INIT_MAXSTREAMS} |
* The maximum number of streams requested by the local endpoint during
* association initialization |
*
+ *
*
*
* Additional (implementation specific) options may also be supported. The list
diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt
index e063fe759ea..71389e0fd1a 100644
--- a/jdk/test/ProblemList.txt
+++ b/jdk/test/ProblemList.txt
@@ -264,9 +264,6 @@ tools/jimage/JImageExtractTest.java 8170120 generic-
tools/jimage/JImageListTest.java 8170120 generic-all
tools/jimage/JImageVerifyTest.java 8170120 generic-all
-tools/schemagen/MultiReleaseJarTest.java 8174692 generic-all
-tools/wsgen/MultiReleaseJarTest.java 8174692 generic-all
-
############################################################################
# jdk_jdi
diff --git a/jdk/test/com/oracle/security/ucrypto/TestAES.java b/jdk/test/com/oracle/security/ucrypto/TestAES.java
index bf460d420a6..b6943f2a005 100644
--- a/jdk/test/com/oracle/security/ucrypto/TestAES.java
+++ b/jdk/test/com/oracle/security/ucrypto/TestAES.java
@@ -26,17 +26,22 @@
* @bug 7088989 8014374 8167512 8173708
* @summary Ensure the AES ciphers of OracleUcrypto provider works correctly
* @key randomness
+ * @library /test/lib
+ * @build jdk.test.lib.Platform
+ * jdk.test.lib.Utils
* @run main TestAES
- * @run main/othervm/java.security.policy==empty.policy TestAES
+ * @run main/othervm -Dpolicy=empty.policy TestAES
*/
-import java.io.*;
import java.security.*;
import java.security.spec.*;
import java.util.*;
import javax.crypto.*;
import javax.crypto.spec.*;
+import jdk.test.lib.Platform;
+import jdk.test.lib.Utils;
+
public class TestAES extends UcryptoTest {
private static final String[] PADDEDCIPHER_ALGOS = {
@@ -55,10 +60,29 @@ public class TestAES extends UcryptoTest {
private static final SecretKey CIPHER_KEY =
new SecretKeySpec(new byte[16], "AES");
+ private static final boolean IS_BAD_SOLARIS = isBadSolaris();
+
public static void main(String[] args) throws Exception {
+ // It has to determine Solaris version before enabling security manager.
+ // Because that needs some permissions, like java.io.FilePermission.
+ String policy = System.getProperty("policy");
+ if (policy != null) {
+ enableSecurityManager(policy);
+ }
+
main(new TestAES(), null);
}
+ // Enables security manager and uses the specified policy file to override
+ // the default one.
+ private static void enableSecurityManager(String policy) {
+ String policyURL = "file://" + System.getProperty("test.src", ".") + "/"
+ + policy;
+ System.out.println("policyURL: " + policyURL);
+ Security.setProperty("policy.url.1", policyURL);
+ System.setSecurityManager(new SecurityManager());
+ }
+
public void doTest(Provider prov) throws Exception {
// Provider for testing Interoperability
Provider sunJCEProv = Security.getProvider("SunJCE");
@@ -136,11 +160,18 @@ public class TestAES extends UcryptoTest {
boolean testPassed = true;
byte[] in = new byte[16];
(new SecureRandom()).nextBytes(in);
- int blockSize = 16;
- for (int j = 1; j < (in.length - 1); j++) {
- System.out.println("Input offset size: " + j);
- for (int i = 0; i < algos.length; i++) {
+ for (int i = 0; i < algos.length; i++) {
+ if (IS_BAD_SOLARIS
+ && algos[i].indexOf("CFB128") != -1
+ && p.getName().equals("OracleUcrypto")) {
+ System.out.println("Ignore cases on CFB128 due to a pre-S11.3 bug");
+ continue;
+ }
+
+ for (int j = 1; j < (in.length - 1); j++) {
+ System.out.println("Input offset size: " + j);
+
try {
// check ENC
Cipher c;
@@ -177,12 +208,6 @@ public class TestAES extends UcryptoTest {
k += c.doFinal(eout, firstPartLen+1, eout.length - firstPartLen - 1, dout, k);
if (!checkArrays(in, in.length, dout, k)) testPassed = false;
} catch(Exception ex) {
- if (ex instanceof BadPaddingException &&
- algos[i].indexOf("CFB128") != -1 &&
- p.getName().equals("OracleUcrypto")) {
- System.out.println("Ignore due to a pre-S11.3 bug: " + ex);
- continue;
- }
System.out.println("Unexpected Exception: " + algos[i]);
ex.printStackTrace();
testPassed = false;
@@ -261,7 +286,6 @@ public class TestAES extends UcryptoTest {
}
}
-
private static void testCipherGCM(SecretKey key,
Provider p) {
boolean testPassed = true;
@@ -349,4 +373,12 @@ public class TestAES extends UcryptoTest {
}
return equal;
}
+
+ // The cases on CFB128 mode have to be skipped on pre-S11.3.
+ private static boolean isBadSolaris() {
+ return Platform.isSolaris()
+ && Platform.getOsVersionMajor() <= 5
+ && Platform.getOsVersionMinor() <= 11
+ && Utils.distro().compareTo("11.3") < 0;
+ }
}
diff --git a/jdk/test/java/nio/charset/Charset/IllegalCharsetName.java b/jdk/test/java/nio/charset/Charset/IllegalCharsetName.java
index f21ffaa5a5a..dd7c68c9782 100644
--- a/jdk/test/java/nio/charset/Charset/IllegalCharsetName.java
+++ b/jdk/test/java/nio/charset/Charset/IllegalCharsetName.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,15 +22,12 @@
*/
/* @test
- * @bug 6330020
+ * @bug 6330020 8184665
* @summary Ensure Charset.forName/isSupport throws the correct exception
* if the charset names passed in are illegal.
*/
-import java.io.*;
-import java.nio.*;
import java.nio.charset.*;
-import java.util.*;
public class IllegalCharsetName {
public static void main(String[] args) throws Exception {
@@ -59,5 +56,18 @@ public class IllegalCharsetName {
} catch (IllegalCharsetNameException x) { //expected
}
}
+
+ // Standard charsets may bypass alias checking during startup, test that
+ // they're all well-behaved as a sanity test
+ checkAliases(StandardCharsets.ISO_8859_1);
+ checkAliases(StandardCharsets.US_ASCII);
+ checkAliases(StandardCharsets.UTF_8);
+ }
+
+ private static void checkAliases(Charset cs) {
+ for (String alias : cs.aliases()) {
+ Charset.forName(alias);
+ Charset.isSupported(alias);
+ }
}
}
diff --git a/jdk/test/java/util/regex/RegExTest.java b/jdk/test/java/util/regex/RegExTest.java
index b61ea07e577..4de8496f1f1 100644
--- a/jdk/test/java/util/regex/RegExTest.java
+++ b/jdk/test/java/util/regex/RegExTest.java
@@ -33,9 +33,8 @@
* 6350801 6676425 6878475 6919132 6931676 6948903 6990617 7014645 7039066
* 7067045 7014640 7189363 8007395 8013252 8013254 8012646 8023647 6559590
* 8027645 8035076 8039124 8035975 8074678 6854417 8143854 8147531 7071819
- * 8151481 4867170 7080302 6728861 6995635 6736245 4916384
- * 6328855 6192895 6345469 6988218 6693451 7006761 8140212 8143282 8158482
- * 8176029
+ * 8151481 4867170 7080302 6728861 6995635 6736245 4916384 6328855 6192895
+ * 6345469 6988218 6693451 7006761 8140212 8143282 8158482 8176029 8184706
*
* @library /test/lib
* @build jdk.test.lib.RandomFactory
@@ -470,7 +469,25 @@ public class RegExTest {
m.find();
if (!m.hitEnd())
failCount++;
- report("hitEnd from a Slice");
+
+ // 8184706: Matching u+0d at EOL against \R should hit-end
+ p = Pattern.compile("...\\R");
+ m = p.matcher("cat" + (char)0x0a);
+ m.find();
+ if (m.hitEnd())
+ failCount++;
+
+ m = p.matcher("cat" + (char)0x0d);
+ m.find();
+ if (!m.hitEnd())
+ failCount++;
+
+ m = p.matcher("cat" + (char)0x0d + (char)0x0a);
+ m.find();
+ if (m.hitEnd())
+ failCount++;
+
+ report("hitEnd");
}
// This is for bug 4997476
diff --git a/jdk/test/sun/management/jdp/JdpOnTestCase.java b/jdk/test/sun/management/jdp/JdpOnTestCase.java
index 107ca5a9397..80abcebc83e 100644
--- a/jdk/test/sun/management/jdp/JdpOnTestCase.java
+++ b/jdk/test/sun/management/jdp/JdpOnTestCase.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,7 @@
import java.net.SocketTimeoutException;
import java.util.Map;
+import static jdk.testlibrary.Asserts.assertNotEquals;
public class JdpOnTestCase extends JdpTestCase {
@@ -58,6 +59,7 @@ public class JdpOnTestCase extends JdpTestCase {
final String jdpName = payload.get("INSTANCE_NAME");
log.fine("Received correct JDP packet #" + String.valueOf(receivedJDPpackets) +
", jdp.name=" + jdpName);
+ assertNotEquals(null, payload.get("PROCESS_ID"), "Expected payload.get(\"PROCESS_ID\") to be not null.");
}
/**
diff --git a/jdk/test/sun/security/ec/InvalidCurve.java b/jdk/test/sun/security/ec/InvalidCurve.java
new file mode 100644
index 00000000000..9321c2617c8
--- /dev/null
+++ b/jdk/test/sun/security/ec/InvalidCurve.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8182999
+ * @summary Ensure that SunEC behaves correctly for unsupported curves.
+ * @run main InvalidCurve
+ */
+
+import java.security.*;
+import java.security.spec.*;
+import java.math.*;
+
+public class InvalidCurve {
+
+ public static void main(String[] args) {
+
+ KeyPairGenerator keyGen;
+ try {
+ keyGen = KeyPairGenerator.getInstance("EC", "SunEC");
+ ECGenParameterSpec brainpoolSpec =
+ new ECGenParameterSpec("brainpoolP256r1");
+ keyGen.initialize(brainpoolSpec);
+ } catch (InvalidAlgorithmParameterException ex) {
+ System.out.println(ex.getMessage());
+ // this is expected
+ return;
+ } catch (NoSuchAlgorithmException | NoSuchProviderException ex) {
+ throw new RuntimeException(ex);
+ }
+
+ keyGen.generateKeyPair();
+
+ // If we make it to here, then the test is not working correctly.
+ throw new RuntimeException("The expected exception was not thrown.");
+
+ }
+
+}
+
diff --git a/jdk/test/tools/schemagen/MultiReleaseJarTest.java b/jdk/test/tools/schemagen/MultiReleaseJarTest.java
index 26aa230680a..659d057d4e0 100644
--- a/jdk/test/tools/schemagen/MultiReleaseJarTest.java
+++ b/jdk/test/tools/schemagen/MultiReleaseJarTest.java
@@ -56,7 +56,7 @@ public class MultiReleaseJarTest {
@DataProvider(name = "jarFiles")
public Object[][] jarFiles() {
- return new Object[][]{{"MV_BOTH.jar", 9},
+ return new Object[][]{{"MV_BOTH.jar", Math.min(10, Runtime.version().major())},
{"MV_ONLY_9.jar", 9},
{"NON_MV.jar", 8}};
}
diff --git a/jdk/test/tools/wsgen/MultiReleaseJarTest.java b/jdk/test/tools/wsgen/MultiReleaseJarTest.java
index c6953416d9b..a0d3ec02900 100644
--- a/jdk/test/tools/wsgen/MultiReleaseJarTest.java
+++ b/jdk/test/tools/wsgen/MultiReleaseJarTest.java
@@ -56,7 +56,7 @@ public class MultiReleaseJarTest {
@DataProvider(name = "jarFiles")
public Object[][] jarFiles() {
- return new Object[][]{{"MV_BOTH.jar", 9},
+ return new Object[][]{{"MV_BOTH.jar", Math.min(10, Runtime.version().major())},
{"MV_ONLY_9.jar", 9},
{"NON_MV.jar", 8}};
}
diff --git a/langtools/.hgtags b/langtools/.hgtags
index 86a6ed128de..479d0f680ea 100644
--- a/langtools/.hgtags
+++ b/langtools/.hgtags
@@ -435,3 +435,4 @@ daa70bfed35ecf0575884c954dc95135e0f94b29 jdk-10+11
add6717b655efa3aa9350e917175f3965cfc0729 jdk-10+14
0d0ac75b0f6cbe218362e3fac4bb443496e7258f jdk-9+176
2f01728210c1405ef459e69d9c7247b5df6abb78 jdk-9+177
+2b9273266ea629ca686239c416a7ff8a592d822a jdk-10+15
diff --git a/langtools/make/gendata/Gendata-jdk.compiler.gmk b/langtools/make/gendata/Gendata-jdk.compiler.gmk
index d37c94e70a4..93574ce6851 100644
--- a/langtools/make/gendata/Gendata-jdk.compiler.gmk
+++ b/langtools/make/gendata/Gendata-jdk.compiler.gmk
@@ -60,7 +60,8 @@ endif
$(SUPPORT_OUTPUTDIR)/symbols/ct.sym-files/_the.symbols: \
$(COMPILE_CREATE_SYMBOLS) \
- $(wildcard $(LANGTOOLS_TOPDIR)/make/data/symbols/*)
+ $(wildcard $(LANGTOOLS_TOPDIR)/make/data/symbols/*) \
+ $(MODULE_INFOS)
$(RM) -r $(@D)
$(MKDIR) -p $(@D)
$(ECHO) Creating ct.sym classes
diff --git a/langtools/make/src/classes/build/tools/symbolgenerator/TransitiveDependencies.java b/langtools/make/src/classes/build/tools/symbolgenerator/TransitiveDependencies.java
index 9ebc019166f..4fa98b83edc 100644
--- a/langtools/make/src/classes/build/tools/symbolgenerator/TransitiveDependencies.java
+++ b/langtools/make/src/classes/build/tools/symbolgenerator/TransitiveDependencies.java
@@ -59,13 +59,14 @@ public class TransitiveDependencies {
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
List options = Arrays.asList("-source", "9",
"-target", "9",
+ "-proc:only",
"--system", "none",
"--module-source-path", args[0],
"--add-modules", Arrays.stream(args)
.skip(1)
.collect(Collectors.joining(",")));
List jlObjectList = Arrays.asList("java.lang.Object");
- JavacTaskImpl task = (JavacTaskImpl) compiler.getTask(null, null, d -> {}, options, jlObjectList, null);
+ JavacTaskImpl task = (JavacTaskImpl) compiler.getTask(null, null, null, options, jlObjectList, null);
task.enter();
Elements elements = task.getElements();
List todo = new LinkedList<>();
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java
index bd08d4a828f..7130cc1b8a0 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java
@@ -340,6 +340,8 @@ public class ClassFinder {
JavaFileObject classfile = c.classfile;
if (classfile != null) {
JavaFileObject previousClassFile = currentClassFile;
+ Symbol prevOwner = c.owner;
+ Name prevName = c.fullname;
try {
if (reader.filling) {
Assert.error("Filling " + classfile.toUri() + " during " + previousClassFile);
@@ -360,6 +362,21 @@ public class ClassFinder {
+ classfile.toUri());
}
}
+ } catch (BadClassFile cf) {
+ //the symbol may be partially initialized, purge it:
+ c.owner = prevOwner;
+ c.members_field.getSymbols(sym -> sym.kind == TYP).forEach(sym -> {
+ ClassSymbol csym = (ClassSymbol) sym;
+ csym.owner = sym.packge();
+ csym.owner.members().enter(sym);
+ csym.fullname = sym.flatName();
+ csym.name = Convert.shortName(sym.flatName());
+ csym.reset();
+ });
+ c.fullname = prevName;
+ c.name = Convert.shortName(prevName);
+ c.reset();
+ throw cf;
} finally {
currentClassFile = previousClassFile;
}
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java
index 9279a046329..c7f50b44ebb 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java
@@ -290,8 +290,7 @@ public class Check {
*/
public Type completionError(DiagnosticPosition pos, CompletionFailure ex) {
log.error(JCDiagnostic.DiagnosticFlag.NON_DEFERRABLE, pos, Errors.CantAccess(ex.sym, ex.getDetailValue()));
- if (ex instanceof ClassFinder.BadClassFile) throw new Abort();
- else return syms.errType;
+ return syms.errType;
}
/** Report an error that wrong type tag was found.
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java
index de5c502fad4..23d1927181f 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java
@@ -94,10 +94,8 @@ import com.sun.tools.javac.tree.JCTree.JCRequires;
import com.sun.tools.javac.tree.JCTree.JCUses;
import com.sun.tools.javac.tree.JCTree.Tag;
import com.sun.tools.javac.tree.TreeInfo;
-import com.sun.tools.javac.util.Abort;
import com.sun.tools.javac.util.Assert;
import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.JCDiagnostic;
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
import com.sun.tools.javac.util.List;
import com.sun.tools.javac.util.ListBuffer;
@@ -105,7 +103,6 @@ import com.sun.tools.javac.util.Log;
import com.sun.tools.javac.util.Name;
import com.sun.tools.javac.util.Names;
import com.sun.tools.javac.util.Options;
-import com.sun.tools.javac.util.Position;
import static com.sun.tools.javac.code.Flags.ABSTRACT;
import static com.sun.tools.javac.code.Flags.ENUM;
@@ -266,8 +263,7 @@ public class Modules extends JCTree.Visitor {
msym.complete();
}
} catch (CompletionFailure ex) {
- log.error(JCDiagnostic.DiagnosticFlag.NON_DEFERRABLE, Position.NOPOS, Errors.CantAccess(ex.sym, ex.getDetailValue()));
- if (ex instanceof ClassFinder.BadClassFile) throw new Abort();
+ chk.completionError(null, ex);
} finally {
depth--;
}
@@ -1220,10 +1216,6 @@ public class Modules extends JCTree.Visitor {
Predicate observablePred = sym ->
(observable == null) ? (moduleFinder.findModule(sym).kind != ERR) : observable.contains(sym);
Predicate systemModulePred = sym -> (sym.flags() & Flags.SYSTEM_MODULE) != 0;
- Predicate noIncubatorPred = sym -> {
- sym.complete();
- return !sym.resolutionFlags.contains(ModuleResolutionFlags.DO_NOT_RESOLVE_BY_DEFAULT);
- };
Set enabledRoot = new LinkedHashSet<>();
if (rootModules.contains(syms.unnamedModule)) {
@@ -1241,9 +1233,18 @@ public class Modules extends JCTree.Visitor {
jdkModulePred = sym -> true;
}
+ Predicate noIncubatorPred = sym -> {
+ sym.complete();
+ return !sym.resolutionFlags.contains(ModuleResolutionFlags.DO_NOT_RESOLVE_BY_DEFAULT);
+ };
+
for (ModuleSymbol sym : new HashSet<>(syms.getAllModules())) {
- if (systemModulePred.test(sym) && observablePred.test(sym) && jdkModulePred.test(sym) && noIncubatorPred.test(sym)) {
- enabledRoot.add(sym);
+ try {
+ if (systemModulePred.test(sym) && observablePred.test(sym) && jdkModulePred.test(sym) && noIncubatorPred.test(sym)) {
+ enabledRoot.add(sym);
+ }
+ } catch (CompletionFailure ex) {
+ chk.completionError(null, ex);
}
}
}
@@ -1341,32 +1342,36 @@ public class Modules extends JCTree.Visitor {
result.add(syms.java_base);
while (primaryTodo.nonEmpty() || secondaryTodo.nonEmpty()) {
- ModuleSymbol current;
- boolean isPrimaryTodo;
- if (primaryTodo.nonEmpty()) {
- current = primaryTodo.head;
- primaryTodo = primaryTodo.tail;
- isPrimaryTodo = true;
- } else {
- current = secondaryTodo.head;
- secondaryTodo = secondaryTodo.tail;
- isPrimaryTodo = false;
- }
- if (observable != null && !observable.contains(current))
- continue;
- if (!result.add(current) || current == syms.unnamedModule || ((current.flags_field & Flags.AUTOMATIC_MODULE) != 0))
- continue;
- current.complete();
- if (current.kind == ERR && (isPrimaryTodo || base.contains(current)) && warnedMissing.add(current)) {
- log.error(Errors.ModuleNotFound(current));
- }
- for (RequiresDirective rd : current.requires) {
- if (rd.module == syms.java_base) continue;
- if ((rd.isTransitive() && isPrimaryTodo) || rootModules.contains(current)) {
- primaryTodo = primaryTodo.prepend(rd.module);
+ try {
+ ModuleSymbol current;
+ boolean isPrimaryTodo;
+ if (primaryTodo.nonEmpty()) {
+ current = primaryTodo.head;
+ primaryTodo = primaryTodo.tail;
+ isPrimaryTodo = true;
} else {
- secondaryTodo = secondaryTodo.prepend(rd.module);
+ current = secondaryTodo.head;
+ secondaryTodo = secondaryTodo.tail;
+ isPrimaryTodo = false;
}
+ if (observable != null && !observable.contains(current))
+ continue;
+ if (!result.add(current) || current == syms.unnamedModule || ((current.flags_field & Flags.AUTOMATIC_MODULE) != 0))
+ continue;
+ current.complete();
+ if (current.kind == ERR && (isPrimaryTodo || base.contains(current)) && warnedMissing.add(current)) {
+ log.error(Errors.ModuleNotFound(current));
+ }
+ for (RequiresDirective rd : current.requires) {
+ if (rd.module == syms.java_base) continue;
+ if ((rd.isTransitive() && isPrimaryTodo) || rootModules.contains(current)) {
+ primaryTodo = primaryTodo.prepend(rd.module);
+ } else {
+ secondaryTodo = secondaryTodo.prepend(rd.module);
+ }
+ }
+ } catch (CompletionFailure ex) {
+ chk.completionError(null, ex);
}
}
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
index cd914f2c233..11bbe457f95 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
@@ -1425,7 +1425,7 @@ public class ClassReader {
ClassSymbol c = readClassSymbol(nextChar());
NameAndType nt = readNameAndType(nextChar());
- if (c.members_field == null)
+ if (c.members_field == null || c.kind != TYP)
throw badClassFile("bad.enclosing.class", self, c);
MethodSymbol m = findMethod(nt, c.members_field, self.flags());
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java
index 11698ad3260..ecb20480579 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java
@@ -400,8 +400,6 @@ public class JavaCompiler {
} catch (CompletionFailure ex) {
// inlined Check.completionError as it is not initialized yet
log.error(Errors.CantAccess(ex.sym, ex.getDetailValue()));
- if (ex instanceof ClassFinder.BadClassFile)
- throw new Abort();
}
source = Source.instance(context);
attr = Attr.instance(context);
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
index b5d644cd299..526880748d3 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
@@ -2243,8 +2243,20 @@ public class JavacParser implements Parser {
}
}
- JCNewArray na = toP(F.at(newpos).NewArray(elemtype, dims.toList(), null));
+ List elems = null;
+ int errpos = token.pos;
+
+ if (token.kind == LBRACE) {
+ elems = arrayInitializerElements(newpos, elemtype);
+ }
+
+ JCNewArray na = toP(F.at(newpos).NewArray(elemtype, dims.toList(), elems));
na.dimAnnotations = dimAnnotations.toList();
+
+ if (elems != null) {
+ return syntaxError(errpos, List.of(na), "illegal.array.creation.both.dimension.and.initialization");
+ }
+
return na;
}
}
@@ -2270,6 +2282,11 @@ public class JavacParser implements Parser {
/** ArrayInitializer = "{" [VariableInitializer {"," VariableInitializer}] [","] "}"
*/
JCExpression arrayInitializer(int newpos, JCExpression t) {
+ List elems = arrayInitializerElements(newpos, t);
+ return toP(F.at(newpos).NewArray(t, List.nil(), elems));
+ }
+
+ List arrayInitializerElements(int newpos, JCExpression t) {
accept(LBRACE);
ListBuffer elems = new ListBuffer<>();
if (token.kind == COMMA) {
@@ -2283,7 +2300,7 @@ public class JavacParser implements Parser {
}
}
accept(RBRACE);
- return toP(F.at(newpos).NewArray(t, List.nil(), elems.toList()));
+ return elems.toList();
}
/** VariableInitializer = ArrayInitializer | Expression
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties
index 83e2c98956c..0333cf7c1bb 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties
@@ -165,6 +165,9 @@ compiler.err.array.and.varargs=\
compiler.err.array.dimension.missing=\
array dimension missing
+compiler.err.illegal.array.creation.both.dimension.and.initialization=\
+ array creation with both dimension expression and initialization is illegal
+
# 0: type
compiler.err.array.req.but.found=\
array required, but {0} found
diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java
index e5665ccb7ad..f2c93a70827 100644
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java
@@ -455,7 +455,7 @@ public class AbstractIndexWriter extends HtmlDocletWriter {
* @throws DocFileIOException if there is a problem creating the search index file
*/
protected void createSearchIndexFile(DocPath searchIndexFile, DocPath searchIndexZip,
- DocPath searchIndexJS, List searchIndex, String varName) throws DocFileIOException {
+ DocPath searchIndexJS, Collection searchIndex, String varName) throws DocFileIOException {
if (!searchIndex.isEmpty()) {
StringBuilder searchVar = new StringBuilder("[");
boolean first = true;
diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java
index 3f73b6bdb71..f02bb2d990a 100644
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java
@@ -532,7 +532,7 @@ public abstract class AbstractMemberWriter {
tdDesc.addStyle(HtmlStyle.colLast);
writer.addSummaryLinkComment(this, member, firstSentenceTags, tdDesc);
tr.addContent(tdDesc);
- if (utils.isMethod(member) && !utils.isAnnotationType(member)) {
+ if (utils.isMethod(member) && !utils.isAnnotationType(member) && !utils.isProperty(name(member))) {
int methodType = utils.isStatic(member) ? MethodTypes.STATIC.tableTabs().value() :
MethodTypes.INSTANCE.tableTabs().value();
if (utils.isInterface(member.getEnclosingElement())) {
diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java
index 6090ff9d46d..6b214b9052e 100644
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java
@@ -224,7 +224,7 @@ public class HtmlConfiguration extends BaseConfiguration {
protected List packageSearchIndex = new ArrayList<>();
- protected List tagSearchIndex = new ArrayList<>();
+ protected SortedSet tagSearchIndex = new TreeSet<>(makeSearchTagComparator());
protected List typeSearchIndex = new ArrayList<>();
@@ -348,6 +348,16 @@ public class HtmlConfiguration extends BaseConfiguration {
return htmlTag.allowTag(this.htmlVersion);
}
+ public Comparator makeSearchTagComparator() {
+ return (SearchIndexItem sii1, SearchIndexItem sii2) -> {
+ int result = (sii1.getLabel()).compareTo(sii2.getLabel());
+ if (result == 0) {
+ result = (sii1.getHolder()).compareTo(sii2.getHolder());
+ }
+ return result;
+ };
+ }
+
/**
* Decide the page which will appear first in the right-hand frame. It will
* be "overview-summary.html" if "-overview" option is used or no
diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SplitIndexWriter.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SplitIndexWriter.java
index 0dd7528e9e7..9431789f8ec 100644
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SplitIndexWriter.java
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SplitIndexWriter.java
@@ -107,12 +107,16 @@ public class SplitIndexWriter extends AbstractIndexWriter {
Set keys = new TreeSet<>(indexbuilder.getIndexMap().keySet());
keys.addAll(configuration.tagSearchIndexKeys);
ListIterator li = new ArrayList<>(keys).listIterator();
+ int prev;
+ int next;
while (li.hasNext()) {
+ prev = (li.hasPrevious()) ? li.previousIndex() + 1 : -1;
Object ch = li.next();
+ next = (li.hasNext()) ? li.nextIndex() + 1 : -1;
DocPath filename = DocPaths.indexN(li.nextIndex());
SplitIndexWriter indexgen = new SplitIndexWriter(configuration,
path.resolve(filename),
- indexbuilder, keys, li.previousIndex(), li.nextIndex());
+ indexbuilder, keys, prev, next);
indexgen.generateIndexFile((Character) ch);
if (!li.hasNext()) {
indexgen.createSearchIndexFiles();
diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css
index d3e5dd41761..71744780421 100644
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css
@@ -434,21 +434,21 @@ Table styles
}
.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link,
.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link,
-.requiresSummary caption a:link, .packagesSummary caption a:link, providesSummary caption a:link,
+.requiresSummary caption a:link, .packagesSummary caption a:link, .providesSummary caption a:link,
.usesSummary caption a:link,
.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover,
.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover,
-.requiresSummary caption a:hover, .packagesSummary caption a:hover, providesSummary caption a:hover,
+.requiresSummary caption a:hover, .packagesSummary caption a:hover, .providesSummary caption a:hover,
.usesSummary caption a:hover,
.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active,
.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active,
-.requiresSummary caption a:active, .packagesSummary caption a:active, providesSummary caption a:active,
+.requiresSummary caption a:active, .packagesSummary caption a:active, .providesSummary caption a:active,
.usesSummary caption a:active,
.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited,
-.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited
-.requiresSummary caption a:visited, .packagesSummary caption a:visited, providesSummary caption a:visited,
+.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited,
+.requiresSummary caption a:visited, .packagesSummary caption a:visited, .providesSummary caption a:visited,
.usesSummary caption a:visited {
- color:#FFFFFF;
+ color:#1f389c;
}
.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span,
.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span,
diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java
index 309c4b9416b..26a5a7cdf3b 100644
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java
@@ -38,7 +38,9 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;
+import java.util.MissingResourceException;
import java.util.Objects;
+import java.util.ResourceBundle;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -177,6 +179,16 @@ public class Start extends ToolOption.Helper {
usage("main.Xusage", OptionKind.EXTENDED, "main.Xusage.foot");
}
+ @Override
+ void version() {
+ messager.notice("javadoc.version", messager.programName, version("release"));
+ }
+
+ @Override
+ void fullVersion() {
+ messager.notice("javadoc.fullversion", messager.programName, version("full"));
+ }
+
private void usage(String headerKey, OptionKind kind, String footerKey) {
messager.notice(headerKey);
showToolOptions(kind);
@@ -193,6 +205,24 @@ public class Start extends ToolOption.Helper {
messager.notice(footerKey);
}
+ private static final String versionRBName = "jdk.javadoc.internal.tool.resources.version";
+ private static ResourceBundle versionRB;
+
+ private static String version(String key) {
+ if (versionRB == null) {
+ try {
+ versionRB = ResourceBundle.getBundle(versionRBName);
+ } catch (MissingResourceException e) {
+ return Log.getLocalizedString("version.not.available");
+ }
+ }
+ try {
+ return versionRB.getString(key);
+ } catch (MissingResourceException e) {
+ return Log.getLocalizedString("version.not.available");
+ }
+ }
+
void showToolOptions(OptionKind kind) {
Comparator comp = new Comparator() {
final Collator collator = Collator.getInstance(Locale.US);
diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOption.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOption.java
index 46e5b09f514..a4eea274225 100644
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOption.java
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOption.java
@@ -359,6 +359,20 @@ public enum ToolOption {
public void process(Helper helper) {
throw new AssertionError("the -J flag should be caught by the launcher.");
}
+ },
+
+ VERSION("--version", STANDARD) {
+ @Override
+ public void process(Helper helper) throws OptionException {
+ throw new OptionException(OK, helper::version);
+ }
+ },
+
+ FULLVERSION("--full-version", HIDDEN) {
+ @Override
+ public void process(Helper helper) throws OptionException {
+ throw new OptionException(OK, helper::fullVersion);
+ }
};
public final String primaryName;
@@ -456,6 +470,9 @@ public enum ToolOption {
abstract void usage();
abstract void Xusage();
+ abstract void version();
+ abstract void fullVersion();
+
abstract String getLocalizedMessage(String msg, Object... args);
abstract OptionHelper getOptionHelper();
diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc.properties b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc.properties
index 77ed15239ce..49257574058 100644
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc.properties
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc.properties
@@ -200,6 +200,9 @@ main.opt.encoding.desc=\
main.opt.quiet.desc=\
Do not display status messages
+main.opt.version.desc=\
+ Print version information
+
main.opt.J.arg=\
main.opt.J.desc=\
@@ -306,3 +309,5 @@ javadoc.error.msg={0}: error - {1}
javadoc.warning.msg={0}: warning - {1}
javadoc.note.msg = {1}
javadoc.note.pos.msg= {0}: {1}
+javadoc.version={0} {1}
+javadoc.fullversion={0} full version "{1}"
diff --git a/langtools/test/jdk/javadoc/doclet/testIndexFiles/TestIndexFiles.java b/langtools/test/jdk/javadoc/doclet/testIndexFiles/TestIndexFiles.java
new file mode 100644
index 00000000000..4f76b76d61a
--- /dev/null
+++ b/langtools/test/jdk/javadoc/doclet/testIndexFiles/TestIndexFiles.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8170825
+ * @summary Perform tests on index files generated by javadoc.
+ * @author bpatel
+ * @library ../lib
+ * @modules jdk.javadoc/jdk.javadoc.internal.tool
+ * @build JavadocTester
+ * @run main TestIndexFiles
+ */
+
+public class TestIndexFiles extends JavadocTester {
+
+ public static void main(String... args) throws Exception {
+ TestIndexFiles tester = new TestIndexFiles();
+ tester.runTests();
+ }
+
+ @Test
+ void testIndexFiles() {
+ javadoc("-d", "out", "-splitindex", "-Xdoclint:none", "-sourcepath", testSrc,
+ "-use", "pkg");
+ checkExit(Exit.OK);
+ checkIndexFiles(true);
+ }
+
+ void checkIndexFiles(boolean found) {
+ checkOutput("index-files/index-1.html", found,
+ "Prev Letter\n"
+ + "Next Letter");
+ checkOutput("index-files/index-5.html", found,
+ "Prev Letter\n"
+ + "Next Letter");
+ checkOutput("index-files/index-1.html", !found,
+ "Prev Letter\n"
+ + "Next Letter");
+ checkOutput("index-files/index-5.html", !found,
+ "Prev Letter\n"
+ + "Next Letter");
+ }
+}
diff --git a/langtools/test/jdk/javadoc/doclet/testIndexFiles/pkg/ClassForIndexFilesTest.java b/langtools/test/jdk/javadoc/doclet/testIndexFiles/pkg/ClassForIndexFilesTest.java
new file mode 100644
index 00000000000..897fff71344
--- /dev/null
+++ b/langtools/test/jdk/javadoc/doclet/testIndexFiles/pkg/ClassForIndexFilesTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg;
+
+public class ClassForIndexFilesTest {
+
+ /**
+ * Test field.
+ */
+ public int field1;
+
+ /**
+ * Test method.
+ */
+ public void testMethod() {
+ }
+
+ /**
+ * Another test method.
+ */
+ public void anotherTestMethod() {
+ }
+
+}
diff --git a/langtools/test/jdk/javadoc/doclet/testIndexFiles/pkg/package-info.java b/langtools/test/jdk/javadoc/doclet/testIndexFiles/pkg/package-info.java
new file mode 100644
index 00000000000..065d7848e4d
--- /dev/null
+++ b/langtools/test/jdk/javadoc/doclet/testIndexFiles/pkg/package-info.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Test pkg used for testing index files.
+ */
+package pkg;
diff --git a/langtools/test/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java b/langtools/test/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java
index e37083f7c59..2a752877037 100644
--- a/langtools/test/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java
+++ b/langtools/test/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java
@@ -24,7 +24,7 @@
/*
* @test
* @bug 7112427 8012295 8025633 8026567 8061305 8081854 8150130 8162363
- * 8167967 8172528 8175200 8178830
+ * 8167967 8172528 8175200 8178830 8182257
* @summary Test of the JavaFX doclet features.
* @author jvalenta
* @library ../lib
@@ -137,7 +137,10 @@ public class TestJavaFX extends JavadocTester {
"Property Summary\n"
+ "\n"
+ "Properties ",
- "");
+ "\n"
+ + "C.BooleanProperty | \n",
+ " \n"
+ + "C.DoubleProperty | \n");
checkOutput("pkg1/C.html", false,
"A()",
@@ -147,7 +150,11 @@ public class TestJavaFX extends JavadocTester {
+ "Instance Methods"
+ " "
+ "Concrete Methods "
- + "");
+ + "",
+ " \n"
+ + "C.BooleanProperty | \n",
+ " \n"
+ + "C.DoubleProperty | \n");
checkOutput("index-all.html", true,
"Gets the value of the property paused. ",
diff --git a/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java b/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java
index 316d8b60d51..5e6d7dc5069 100644
--- a/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java
+++ b/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java
@@ -25,7 +25,7 @@
* @test
* @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363
* 8168766 8168688 8162674 8160196 8175799 8174974 8176778 8177562 8175218 8175823 8166306
- * 8178043
+ * 8178043 8181622
* @summary Test modules support in javadoc.
* @author bpatel
* @library ../lib
@@ -394,7 +394,7 @@ public class TestModules extends JavadocTester {
+ "\n"
+ "\n"
+ "\n"
- + "This is a test description for the moduleA module. Search "
+ + " This is a test description for the moduleA module with a Search "
+ "phrase search phrase. ");
checkOutput("moduleB-summary.html", found,
"\n"
@@ -454,7 +454,7 @@ public class TestModules extends JavadocTester {
+ " \n"
+ "\n"
+ "\n"
- + " This is a test description for the moduleA module. Search "
+ + " This is a test description for the moduleA module with a Search "
+ "phrase search phrase. ");
checkOutput("moduleB-summary.html", found,
" \n"
@@ -755,7 +755,8 @@ public class TestModules extends JavadocTester {
+ "transitive | \n"
+ "moduleA | \n"
+ "\n"
- + " This is a test description for the moduleA module. \n"
+ + "This is a test description for the moduleA module with a Search "
+ + "phrase search phrase. \n"
+ " | \n"
+ " \n"
+ "\n"
@@ -839,7 +840,8 @@ public class TestModules extends JavadocTester {
"\n"
+ "- moduleA - module moduleA
\n"
+ "- \n"
- + "
This is a test description for the moduleA module. \n"
+ + "This is a test description for the moduleA module with a Search "
+ + "phrase search phrase. \n"
+ " \n"
+ "- moduleB - module moduleB
\n"
+ "- \n"
@@ -854,13 +856,21 @@ public class TestModules extends JavadocTester {
+ "search_word - Search tag in moduleB\n"
+ "
-
\n"
+ " ");
+ checkOutput("index-all.html", false,
+ ""
+ + "search phrase - Search tag in moduleA\n"
+ + "with description\n"
+ + ""
+ + "search phrase - Search tag in moduleA\n"
+ + "with description");
}
void checkModuleModeCommon() {
checkOutput("overview-summary.html", true,
"moduleA | \n"
+ "\n"
- + " This is a test description for the moduleA module. \n"
+ + "This is a test description for the moduleA module with a Search "
+ + "phrase search phrase. \n"
+ " | ",
"moduleB | \n"
+ "\n"
@@ -868,7 +878,7 @@ public class TestModules extends JavadocTester {
+ " | ",
"moduletags | \n"
+ "\n"
- + "This is a test description for the moduleA module. \n"
+ + " \n"
@@ -896,7 +906,8 @@ public class TestModules extends JavadocTester {
" transitive static | \n"
+ " moduleA | \n"
+ " \n"
- + " This is a test description for the moduleA module. \n"
+ + "This is a test description for the moduleA module with a Search "
+ + "phrase search phrase. \n"
+ " | ",
" \n"
+ "Requires \n"
diff --git a/langtools/test/jdk/javadoc/doclet/testModules/moduleA/module-info.java b/langtools/test/jdk/javadoc/doclet/testModules/moduleA/module-info.java
index db081128374..9dad71bfaa4 100644
--- a/langtools/test/jdk/javadoc/doclet/testModules/moduleA/module-info.java
+++ b/langtools/test/jdk/javadoc/doclet/testModules/moduleA/module-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
*/
/**
- * This is a test description for the moduleA module. Search phrase {@index "search phrase" with description}.
+ * This is a test description for the moduleA module with a Search phrase {@index "search phrase" with description}.
*
* @deprecated This module is deprecated.
*/
diff --git a/langtools/test/jdk/javadoc/doclet/testModules/moduletags/module-info.java b/langtools/test/jdk/javadoc/doclet/testModules/moduletags/module-info.java
index 1b0d2b24083..8c9df22713e 100644
--- a/langtools/test/jdk/javadoc/doclet/testModules/moduletags/module-info.java
+++ b/langtools/test/jdk/javadoc/doclet/testModules/moduletags/module-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
*/
/**
- * This is a test description for the moduleA module.
+ * This is a test description for the moduletags module.
* Type Link: {@link testpkgmdltags.TestClassInModuleTags}.
* Member Link: {@link testpkgmdltags.TestClassInModuleTags#testMethod(String)}.
* Package Link: {@link testpkgmdltags}.
diff --git a/langtools/test/jdk/javadoc/doclet/testSearch/TestSearch.java b/langtools/test/jdk/javadoc/doclet/testSearch/TestSearch.java
index 94c4866197b..f7af913ec28 100644
--- a/langtools/test/jdk/javadoc/doclet/testSearch/TestSearch.java
+++ b/langtools/test/jdk/javadoc/doclet/testSearch/TestSearch.java
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8141492 8071982 8141636 8147890 8166175 8168965 8176794 8175218 8147881
+ * @bug 8141492 8071982 8141636 8147890 8166175 8168965 8176794 8175218 8147881 8181622
* @summary Test the search feature of javadoc.
* @author bpatel
* @library ../lib
@@ -65,6 +65,7 @@ public class TestSearch extends JavadocTester {
checkInvalidUsageIndexTag();
checkSearchOutput(true);
checkSingleIndex(true);
+ checkSingleIndexSearchTagDuplication();
checkJqueryAndImageFiles(true);
checkSearchJS();
checkFiles(true,
@@ -86,6 +87,7 @@ public class TestSearch extends JavadocTester {
checkDocLintErrors();
checkSearchOutput(true);
checkSingleIndex(true);
+ checkSingleIndexSearchTagDuplication();
checkJqueryAndImageFiles(true);
checkSearchJS();
checkFiles(true,
@@ -127,6 +129,7 @@ public class TestSearch extends JavadocTester {
checkExit(Exit.OK);
checkSearchOutput(true);
checkSingleIndex(true);
+ checkSingleIndexSearchTagDuplication();
checkJqueryAndImageFiles(true);
checkSearchJS();
checkFiles(true,
@@ -210,6 +213,7 @@ public class TestSearch extends JavadocTester {
checkInvalidUsageIndexTag();
checkSearchOutput(true);
checkSplitIndex();
+ checkSplitIndexSearchTagDuplication();
checkJqueryAndImageFiles(true);
checkSearchJS();
checkFiles(true,
@@ -498,4 +502,34 @@ public class TestSearch extends JavadocTester {
+ " }\n"
+ " });");
}
+
+ void checkSingleIndexSearchTagDuplication() {
+ // Test for search tags duplication in index file.
+ checkOutput("index-all.html", true,
+ ""
+ + "SearchTagDeprecatedMethod - Search tag in pkg2.TestError\n"
+ + "with description");
+ checkOutput("index-all.html", false,
+ ""
+ + "SearchTagDeprecatedMethod - Search tag in pkg2.TestError\n"
+ + "with description\n"
+ + ""
+ + "SearchTagDeprecatedMethod - Search tag in pkg2.TestError\n"
+ + "with description");
+ }
+
+ void checkSplitIndexSearchTagDuplication() {
+ // Test for search tags duplication in index file.
+ checkOutput("index-files/index-13.html", true,
+ ""
+ + "SearchTagDeprecatedMethod - Search tag in pkg2.TestError\n"
+ + "with description");
+ checkOutput("index-files/index-13.html", false,
+ ""
+ + "SearchTagDeprecatedMethod - Search tag in pkg2.TestError\n"
+ + "with description\n"
+ + ""
+ + "SearchTagDeprecatedMethod - Search tag in pkg2.TestError\n"
+ + "with description");
+ }
}
diff --git a/langtools/test/jdk/javadoc/doclet/testVersionOption/TestVersionOption.java b/langtools/test/jdk/javadoc/doclet/testVersionOption/TestVersionOption.java
new file mode 100644
index 00000000000..eb3a5d88cd3
--- /dev/null
+++ b/langtools/test/jdk/javadoc/doclet/testVersionOption/TestVersionOption.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8177048
+ * @summary javadoc should support --version and --full-version flags
+ * @library ../lib
+ * @modules jdk.javadoc/jdk.javadoc.internal.tool
+ * @build JavadocTester TestVersionOption
+ * @run main TestVersionOption
+ */
+
+public class TestVersionOption extends JavadocTester {
+
+ public static void main(String... args) throws Exception {
+ TestVersionOption tester = new TestVersionOption();
+ tester.runTests();
+ }
+
+ @Test
+ void testFullVersionOption() {
+ javadoc("--full-version");
+ checkExit(Exit.OK);
+
+ checkOutput(Output.OUT, true, "javadoc full version \"" + System.getProperty("java.runtime.version") + "\"");
+ }
+
+
+ @Test
+ void testVersionOption() {
+ javadoc("--version");
+ checkExit(Exit.OK);
+
+ checkOutput(Output.OUT, true, "javadoc " + System.getProperty("java.version"));
+ }
+
+}
diff --git a/langtools/test/tools/javac/ExtraneousEquals.java b/langtools/test/tools/javac/ExtraneousEquals.java
index 6eda1576837..6c740f5bdcb 100644
--- a/langtools/test/tools/javac/ExtraneousEquals.java
+++ b/langtools/test/tools/javac/ExtraneousEquals.java
@@ -1,6 +1,6 @@
/*
* @test /nodynamiccopyright/
- * @bug 5019614
+ * @bug 5019614 8057647
* @summary variance prototype syntax leftover
*
* @compile/fail/ref=ExtraneousEquals.out -XDrawDiagnostics ExtraneousEquals.java
diff --git a/langtools/test/tools/javac/ExtraneousEquals.out b/langtools/test/tools/javac/ExtraneousEquals.out
index c0f55bb2358..942bdb13918 100644
--- a/langtools/test/tools/javac/ExtraneousEquals.out
+++ b/langtools/test/tools/javac/ExtraneousEquals.out
@@ -1,6 +1,4 @@
ExtraneousEquals.java:10:23: compiler.err.illegal.start.of.expr
ExtraneousEquals.java:10:24: compiler.err.illegal.start.of.expr
-ExtraneousEquals.java:10:25: compiler.err.expected: ';'
-ExtraneousEquals.java:10:28: compiler.err.not.stmt
-ExtraneousEquals.java:10:29: compiler.err.expected: ';'
-5 errors
+ExtraneousEquals.java:10:26: compiler.err.illegal.array.creation.both.dimension.and.initialization
+3 errors
diff --git a/langtools/test/tools/javac/T8003967/DetectMutableStaticFields.java b/langtools/test/tools/javac/T8003967/DetectMutableStaticFields.java
index 4a4c25da9fa..ca5ad12586a 100644
--- a/langtools/test/tools/javac/T8003967/DetectMutableStaticFields.java
+++ b/langtools/test/tools/javac/T8003967/DetectMutableStaticFields.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -91,6 +91,7 @@ public class DetectMutableStaticFields {
static {
ignore("javax/tools/ToolProvider", "instance");
+ ignore("jdk/javadoc/internal/tool/Start", "versionRB");
ignore("com/sun/tools/javah/JavahTask", "versionRB");
ignore("com/sun/tools/classfile/Dependencies$DefaultFilter", "instance");
ignore("com/sun/tools/javap/JavapTask", "versionRB");
diff --git a/langtools/test/tools/javac/diags/examples/IllegalArrayCreation.java b/langtools/test/tools/javac/diags/examples/IllegalArrayCreation.java
new file mode 100644
index 00000000000..3de664b20ac
--- /dev/null
+++ b/langtools/test/tools/javac/diags/examples/IllegalArrayCreation.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.illegal.array.creation.both.dimension.and.initialization
+
+class IllegalArrayCreation {
+ int[] foo = new int[10] { 1, 2, 3 };
+}
diff --git a/langtools/test/tools/javac/modules/BrokenModulesTest.java b/langtools/test/tools/javac/modules/BrokenModulesTest.java
new file mode 100644
index 00000000000..929e0f13f10
--- /dev/null
+++ b/langtools/test/tools/javac/modules/BrokenModulesTest.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8182450
+ * @summary Test model behavior when a completing a broken module-info.
+ * @library /tools/lib
+ * @modules
+ * jdk.compiler/com.sun.tools.javac.api
+ * jdk.compiler/com.sun.tools.javac.code
+ * jdk.compiler/com.sun.tools.javac.main
+ * jdk.compiler/com.sun.tools.javac.processing
+ * @build toolbox.ToolBox toolbox.JavacTask toolbox.ModuleBuilder ModuleTestBase
+ * @run main BrokenModulesTest
+ */
+
+import java.nio.file.Path;
+import java.util.List;
+
+import javax.tools.JavaCompiler;
+import javax.tools.ToolProvider;
+
+import com.sun.tools.javac.api.JavacTaskImpl;
+
+public class BrokenModulesTest extends ModuleTestBase {
+
+ public static void main(String... args) throws Exception {
+ new BrokenModulesTest().runTests();
+ }
+
+ List jlObjectList = List.of("java.lang.Object");
+ JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+
+ @Test
+ public void testBrokenModuleInfoModuleSourcePath(Path base) throws Exception {
+ Path msp = base.resolve("msp");
+ Path ma = msp.resolve("ma");
+ tb.writeJavaFiles(ma,
+ "module ma { requires not.available; exports api1; }",
+ "package api1; public interface Api { }");
+ Path out = base.resolve("out");
+ tb.createDirectories(out);
+
+ List opts = List.of("--module-source-path", msp.toString(),
+ "--add-modules", "ma");
+ JavacTaskImpl task = (JavacTaskImpl) compiler.getTask(null, null, null, opts, jlObjectList, null);
+
+ task.enter();
+
+ task.getElements().getModuleElement("java.base");
+ }
+
+ @Test
+ public void testSystem(Path base) throws Exception {
+ Path jdkCompiler = base.resolve("jdk.compiler");
+ tb.writeJavaFiles(jdkCompiler,
+ "module jdk.compiler { requires not.available; }");
+ Path out = base.resolve("out");
+ tb.createDirectories(out);
+
+ List opts = List.of("--patch-module", "jdk.compiler=" + jdkCompiler.toString(),
+ "--add-modules", "jdk.compiler");
+ JavacTaskImpl task = (JavacTaskImpl) compiler.getTask(null, null, null, opts, jlObjectList, null);
+
+ task.enter();
+
+ task.getElements().getModuleElement("java.base");
+ }
+
+ @Test
+ public void testParseError(Path base) throws Exception {
+ Path msp = base.resolve("msp");
+ Path ma = msp.resolve("ma");
+ tb.writeJavaFiles(ma,
+ "broken module ma { }",
+ "package api1; public interface Api { }");
+ Path out = base.resolve("out");
+ tb.createDirectories(out);
+
+ List opts = List.of("--module-source-path", msp.toString(),
+ "--add-modules", "ma");
+ JavacTaskImpl task = (JavacTaskImpl) compiler.getTask(null, null, null, opts, jlObjectList, null);
+
+ task.analyze();
+
+ task.getElements().getModuleElement("java.base");
+ }
+
+}
diff --git a/langtools/test/tools/javac/modules/EdgeCases.java b/langtools/test/tools/javac/modules/EdgeCases.java
index 8fc240f6ae7..2ac94d59dcc 100644
--- a/langtools/test/tools/javac/modules/EdgeCases.java
+++ b/langtools/test/tools/javac/modules/EdgeCases.java
@@ -467,7 +467,8 @@ public class EdgeCases extends ModuleTestBase {
List expected = Arrays.asList(
"- compiler.err.cant.access: m1x.module-info, (compiler.misc.bad.class.file.header: module-info.class, (compiler.misc.module.name.mismatch: other, m1x))",
- "1 error");
+ "module-info.java:1:1: compiler.err.module.not.found: m1x",
+ "2 errors");
if (!expected.equals(log)) {
throw new AssertionError("Unexpected output: " + log);
diff --git a/langtools/test/tools/javac/processing/model/completionfailure/NoAbortForBadClassFile.java b/langtools/test/tools/javac/processing/model/completionfailure/NoAbortForBadClassFile.java
new file mode 100644
index 00000000000..49333765413
--- /dev/null
+++ b/langtools/test/tools/javac/processing/model/completionfailure/NoAbortForBadClassFile.java
@@ -0,0 +1,248 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8182450
+ * @summary Bad classfiles should not abort compilations
+ * @library /tools/lib
+ * @modules
+ * jdk.compiler/com.sun.tools.javac.api
+ * jdk.compiler/com.sun.tools.javac.code
+ * jdk.compiler/com.sun.tools.javac.comp
+ * jdk.compiler/com.sun.tools.javac.jvm
+ * jdk.compiler/com.sun.tools.javac.main
+ * jdk.compiler/com.sun.tools.javac.processing
+ * jdk.compiler/com.sun.tools.javac.util
+ * @build toolbox.ToolBox toolbox.JavacTask
+ * @run main NoAbortForBadClassFile
+ */
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import com.sun.tools.javac.api.JavacTaskImpl;
+import com.sun.tools.javac.api.JavacTool;
+import com.sun.tools.javac.code.Flags;
+import com.sun.tools.javac.code.Symbol.ClassSymbol;
+import com.sun.tools.javac.code.Symbol.CompletionFailure;
+import com.sun.tools.javac.code.Symtab;
+import com.sun.tools.javac.jvm.ClassReader;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Context.Factory;
+import com.sun.tools.javac.util.Names;
+import com.sun.tools.javac.util.Options;
+import toolbox.Task;
+import toolbox.Task.Expect;
+
+import toolbox.TestRunner;
+import toolbox.ToolBox;
+
+public class NoAbortForBadClassFile extends TestRunner {
+
+ private ToolBox tb = new ToolBox();
+
+ public NoAbortForBadClassFile() {
+ super(System.out);
+ }
+
+ public static void main(String... args) throws Exception {
+ new NoAbortForBadClassFile().runTests(m -> new Object[] { Paths.get(m.getName()) });
+ }
+
+ @Test
+ public void testBrokenClassFile(Path base) throws Exception {
+ Path classes = base.resolve("classes");
+ Path brokenClassFile = classes.resolve("test").resolve("Broken.class");
+
+ Files.createDirectories(brokenClassFile.getParent());
+ Files.newOutputStream(brokenClassFile).close();
+
+ Path src = base.resolve("src");
+ tb.writeJavaFiles(src,
+ "package test; public class Test { private void test() { Broken b; String.unknown(); } }");
+ Path out = base.resolve("out");
+ tb.createDirectories(out);
+
+ List log = new toolbox.JavacTask(tb)
+ .options("-classpath", classes.toString(),
+ "-XDrawDiagnostics")
+ .outdir(out)
+ .files(tb.findJavaFiles(src))
+ .run(Expect.FAIL)
+ .writeAll()
+ .getOutputLines(Task.OutputKind.DIRECT);
+
+ List expectedOut = Arrays.asList(
+ "Test.java:1:57: compiler.err.cant.access: test.Broken, (compiler.misc.bad.class.file.header: Broken.class, (compiler.misc.class.file.wrong.class: java.lang.AutoCloseable))",
+ "Test.java:1:73: compiler.err.cant.resolve.location.args: kindname.method, unknown, , , (compiler.misc.location: kindname.class, java.lang.String, null)",
+ "2 errors"
+ );
+
+ if (!expectedOut.equals(log))
+ throw new Exception("expected output not found: " + log);
+ }
+
+ @Test
+ public void testLoading(Path base) throws Exception {
+ Path src = base.resolve("src");
+ tb.writeJavaFiles(src,
+ "public class Test { static { new Object() {}; } public static class I { public static class II { } } }");
+ Path out = base.resolve("out");
+ tb.createDirectories(out);
+
+ new toolbox.JavacTask(tb)
+ .outdir(out)
+ .files(tb.findJavaFiles(src))
+ .run(Expect.SUCCESS)
+ .writeAll()
+ .getOutputLines(Task.OutputKind.DIRECT);
+
+ List files;
+ try (Stream dir = Files.list(out)) {
+ files = dir.collect(Collectors.toList());
+ }
+
+ List> result = new ArrayList<>();
+
+ permutations(files, Collections.emptyList(), result);
+
+ for (List order : result) {
+ for (Path missing : order) {
+ Path test = base.resolve("test");
+
+ if (Files.exists(test)) {
+ tb.cleanDirectory(test);
+ } else {
+ tb.createDirectories(test);
+ }
+
+ for (Path p : order) {
+ Files.copy(p, test.resolve(p.getFileName()));
+ }
+
+ List actual = complete(test, order, missing, true);
+
+ Files.delete(test.resolve(missing.getFileName()));
+
+ List expected = complete(test, order, missing, false);
+
+ if (!actual.equals(expected)) {
+ throw new AssertionError("Unexpected state, actual=\n" + actual + "\nexpected=\n" + expected + "\norder=" + order + "\nmissing=" + missing);
+ }
+ }
+ }
+ }
+
+ private static void permutations(List todo, List currentList, List> result) {
+ if (todo.isEmpty()) {
+ result.add(currentList);
+ return ;
+ }
+
+ for (Path p : todo) {
+ List nextTODO = new ArrayList<>(todo);
+
+ nextTODO.remove(p);
+
+ List nextList = new ArrayList<>(currentList);
+
+ nextList.add(p);
+
+ permutations(nextTODO, nextList, result);
+ }
+ }
+
+ private List complete(Path test, List order, Path missing, boolean badClassFile) {
+ Context context = new Context();
+ if (badClassFile) {
+ TestClassReader.preRegister(context);
+ }
+ JavacTool tool = JavacTool.create();
+ JavacTaskImpl task = (JavacTaskImpl) tool.getTask(null, null, null, List.of("-classpath", test.toString(), "-XDblockClass=" + flatName(missing)), null, null, context);
+ Symtab syms = Symtab.instance(context);
+ Names names = Names.instance(context);
+
+ task.getElements().getTypeElement("java.lang.Object");
+
+ if (!badClassFile) {
+ //to ensure the same paths taken in ClassFinder.completeEnclosing in case the file is missing:
+ syms.enterClass(syms.unnamedModule, names.fromString(flatName(missing)));
+ }
+
+ List result = new ArrayList<>();
+
+ for (Path toCheck : order) {
+ ClassSymbol sym = syms.enterClass(syms.unnamedModule, names.fromString(flatName(toCheck)));
+
+ try {
+ sym.complete();
+ } catch (CompletionFailure ignore) {
+ }
+
+ long flags = sym.flags_field;
+
+ flags &= ~(Flags.CLASS_SEEN | Flags.SOURCE_SEEN);
+
+ result.add("sym: " + sym.flatname + ", " + sym.owner.flatName() +
+ ", " + sym.type + ", " + sym.members_field + ", " + flags);
+ }
+
+ return result;
+ }
+
+ private String flatName(Path p) {
+ return p.getFileName().toString().replace(".class", "");
+ }
+
+ private static class TestClassReader extends ClassReader {
+ public static void preRegister(Context ctx) {
+ ctx.put(classReaderKey, (Factory) c -> new TestClassReader(ctx));
+ }
+
+ private final String block;
+
+ public TestClassReader(Context context) {
+ super(context);
+ block = Options.instance(context).get("blockClass");
+ }
+
+ @Override
+ public void readClassFile(ClassSymbol c) {
+ super.readClassFile(c);
+
+ if (c.flatname.contentEquals(block)) {
+ throw badClassFile("blocked");
+ }
+ }
+
+ }
+
+}
diff --git a/nashorn/.hgtags b/nashorn/.hgtags
index a36e2862e9c..4355af836a8 100644
--- a/nashorn/.hgtags
+++ b/nashorn/.hgtags
@@ -426,3 +426,4 @@ de571c0a93258599054f18184cbdeae42cd95265 jdk-10+12
fed3f329875710c74f3ec1a0c4714046a79af100 jdk-10+14
3c6fbdf6e785aaf18d35ce9c6684369952fd22ec jdk-9+176
aa7404e062b95f679018f25eaaf933dcf0cf3f2b jdk-9+177
+f8a0c4895b2abe64a8c55af6117ffda192e34d30 jdk-10+15
diff --git a/nashorn/samples/barchart_weather.js b/nashorn/samples/barchart_weather.js
index 9402682f176..daf19f6d0ff 100644
--- a/nashorn/samples/barchart_weather.js
+++ b/nashorn/samples/barchart_weather.js
@@ -60,7 +60,7 @@ function readTextFromURL(url) {
}
// change URL for your city here!
-var url = "http://api.openweathermap.org/data/2.5/forecast?q=chennai,india&units=metric&mode=json";
+var url = "http://api.openweathermap.org/data/2.5/forecast?q=chennai,india&units=metric&mode=json&appid=9b2982987c080ae88d81f081dcb129e8";
// download JSON document and parse
var json = readTextFromURL(url);
diff --git a/nashorn/samples/datepick.js b/nashorn/samples/datepick.js
index e89ae5f9da5..e81165c6523 100644
--- a/nashorn/samples/datepick.js
+++ b/nashorn/samples/datepick.js
@@ -37,6 +37,7 @@ if (! $OPTIONS._fx) {
}
load("fx:controls.js");
+var Scene = Java.type("javafx.scene.Scene");
function start(stage) {
var picker = new DatePicker();
diff --git a/nashorn/samples/jsonviewer.js b/nashorn/samples/jsonviewer.js
index c650ae98af2..6deeb166d1f 100644
--- a/nashorn/samples/jsonviewer.js
+++ b/nashorn/samples/jsonviewer.js
@@ -103,7 +103,7 @@ function treeItemForObject(obj, name) {
return item;
}
-var DEFAULT_URL = "http://api.openweathermap.org/data/2.5/forecast/daily?q=Chennai&mode=json&units=metric&cnt=7`";
+var DEFAULT_URL = "http://api.openweathermap.org/data/2.5/forecast?q=chennai,india&units=metric&mode=json&appid=9b2982987c080ae88d81f081dcb129e8";
var url = arguments.length == 0? DEFAULT_URL : arguments[0];
var obj = JSON.parse(readTextFromURL(url));
diff --git a/test/lib/jdk/test/lib/Utils.java b/test/lib/jdk/test/lib/Utils.java
index 6f83759666f..08a95a7d424 100644
--- a/test/lib/jdk/test/lib/Utils.java
+++ b/test/lib/jdk/test/lib/Utils.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -680,5 +680,26 @@ public final class Utils {
String.format("A mandatory property '%s' isn't set", propName));
return prop;
}
+
+ /*
+ * Run uname with specified arguments.
+ */
+ public static OutputAnalyzer uname(String... args) throws Throwable {
+ String[] cmds = new String[args.length + 1];
+ cmds[0] = "uname";
+ System.arraycopy(args, 0, cmds, 1, args.length);
+ return ProcessTools.executeCommand(cmds);
+ }
+
+ /*
+ * Returns the system distro.
+ */
+ public static String distro() {
+ try {
+ return uname("-v").asLines().get(0);
+ } catch (Throwable t) {
+ throw new RuntimeException("Failed to determine distro.", t);
+ }
+ }
}
| | |