--- a/jdk/src/java.base/share/classes/java/lang/Deprecated.java Tue Apr 12 21:05:15 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/Deprecated.java Wed Apr 13 00:00:39 2016 -0700
@@ -29,14 +29,44 @@
import static java.lang.annotation.ElementType.*;
/**
- * A program element annotated @Deprecated is one that programmers
- * are discouraged from using, typically because it is dangerous,
- * or because a better alternative exists. Compilers warn when a
- * deprecated program element is used or overridden in non-deprecated code.
+ * A program element annotated {@code @Deprecated} is one that programmers
+ * are discouraged from using. An element may be deprecated for any of several
+ * reasons, for example, its usage is likely to lead to errors; it may
+ * be changed incompatibly or removed in a future version; it has been
+ * superseded by a newer, usually preferable alternative; or it is obsolete.
+ *
+ * <p>Compilers issue warnings when a deprecated program element is used or
+ * overridden in non-deprecated code. Use of the {@code @Deprecated}
+ * annotation on a local variable declaration or on a parameter declaration
+ * or a package declaration has no effect on the warnings issued by a compiler.
+ *
+ * <p>This annotation type has a string-valued element {@code since}. The value
+ * of this element indicates the version in which the annotated program element
+ * was first deprecated.
*
- * <p>Use of the @Deprecated annotation on a local variable
- * declaration or on a parameter declaration or a package declaration
- * has no effect on the warnings issued by a compiler.
+ * <p>This annotation type has a boolean-valued element {@code forRemoval}.
+ * A value of {@code true} indicates intent to remove the annotated program
+ * element in a future version. A value of {@code false} indicates that use of
+ * the annotated program element is discouraged, but at the time the program
+ * element was annotated, there was no specific intent to remove it.
+ *
+ * @apiNote
+ * It is strongly recommended that the reason for deprecating a program element
+ * be explained in the documentation, using the {@code @deprecated}
+ * javadoc tag. The documentation should also suggest and link to a
+ * recommended replacement API, if applicable. A replacement API often
+ * has subtly different semantics, so such issues should be discussed as
+ * well.
+ *
+ * <p>It is recommended that a {@code since} value be provided with all newly
+ * annotated program elements. Note that {@code since} cannot be mandatory,
+ * as there are many existing annotations that lack this element value.
+ *
+ * <p>There is no defined order among annotation elements. As a matter of
+ * style, the {@code since} element should be placed first.
+ *
+ * <p>The {@code @Deprecated} annotation should always be present if
+ * the {@code @deprecated} javadoc tag is present, and vice-versa.
*
* @author Neal Gafter
* @since 1.5
@@ -46,4 +76,23 @@
@Retention(RetentionPolicy.RUNTIME)
@Target(value={CONSTRUCTOR, FIELD, LOCAL_VARIABLE, METHOD, PACKAGE, PARAMETER, TYPE})
public @interface Deprecated {
+ /**
+ * Returns the version in which the annotated element became deprecated.
+ * The version string is in the same format and namespace as the value of
+ * the {@code @since} javadoc tag. The default value is the empty
+ * string.
+ *
+ * @return the version string
+ * @since 9
+ */
+ String since() default "";
+
+ /**
+ * Indicates whether the annotated element is subject to removal in a
+ * future version. The default value is {@code false}.
+ *
+ * @return whether the element is subject to removal
+ * @since 9
+ */
+ boolean forRemoval() default false;
}
--- a/jdk/src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java Tue Apr 12 21:05:15 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java Wed Apr 13 00:00:39 2016 -0700
@@ -89,8 +89,7 @@
static {
final String key = "jdk.internal.lambda.dumpProxyClasses";
String path = AccessController.doPrivileged(
- new GetPropertyAction(key), null,
- new PropertyPermission(key , "read"));
+ new GetPropertyAction(key));
dumper = (null == path) ? null : ProxyClassesDumper.getInstance(path);
}
--- a/jdk/src/java.base/share/classes/java/net/URLClassLoader.java Tue Apr 12 21:05:15 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/net/URLClassLoader.java Wed Apr 13 00:00:39 2016 -0700
@@ -465,23 +465,21 @@
}
/**
- * Defines a new package by name in this ClassLoader. The attributes
- * contained in the specified Manifest will be used to obtain package
- * version and sealing information. For sealed packages, the additional
- * URL specifies the code source URL from which the package was loaded.
+ * Defines a new package by name in this {@code URLClassLoader}.
+ * The attributes contained in the specified {@code Manifest}
+ * will be used to obtain package version and sealing information.
+ * For sealed packages, the additional URL specifies the code source URL
+ * from which the package was loaded.
*
* @param name the package name
- * @param man the Manifest containing package version and sealing
+ * @param man the {@code Manifest} containing package version and sealing
* information
* @param url the code source url for the package, or null if none
- * @exception IllegalArgumentException if the package name duplicates
- * an existing package either in this class loader or one
- * of its ancestors
- * @return the newly defined Package object
+ * @throws IllegalArgumentException if the package name is
+ * already defined by this class loader
+ * @return the newly defined {@code Package} object
*/
- protected Package definePackage(String name, Manifest man, URL url)
- throws IllegalArgumentException
- {
+ protected Package definePackage(String name, Manifest man, URL url) {
String path = name.replace('.', '/').concat("/");
String specTitle = null, specVersion = null, specVendor = null;
String implTitle = null, implVersion = null, implVendor = null;
--- a/jdk/src/java.base/share/classes/java/util/jar/JarFile.java Tue Apr 12 21:05:15 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/util/jar/JarFile.java Wed Apr 13 00:00:39 2016 -0700
@@ -894,7 +894,8 @@
private static final byte[] CLASSPATH_LASTOCC;
private static final byte[] MULTIRELEASE_CHARS =
- {'M','U','L','T','I','-','R','E','L','E', 'A', 'S', 'E', ':', ' '};
+ {'M','U','L','T','I','-','R','E','L','E', 'A', 'S', 'E', ':',
+ ' ', 'T', 'R', 'U', 'E'};
// The bad character shift for "multi-release: "
private static final byte[] MULTIRELEASE_LASTOCC;
@@ -914,17 +915,17 @@
MULTIRELEASE_LASTOCC = new byte[64];
MULTIRELEASE_LASTOCC[(int)'M' - 32] = 1;
- MULTIRELEASE_LASTOCC[(int)'U' - 32] = 2;
- MULTIRELEASE_LASTOCC[(int)'T' - 32] = 4;
MULTIRELEASE_LASTOCC[(int)'I' - 32] = 5;
MULTIRELEASE_LASTOCC[(int)'-' - 32] = 6;
- MULTIRELEASE_LASTOCC[(int)'R' - 32] = 7;
MULTIRELEASE_LASTOCC[(int)'L' - 32] = 9;
MULTIRELEASE_LASTOCC[(int)'A' - 32] = 11;
MULTIRELEASE_LASTOCC[(int)'S' - 32] = 12;
- MULTIRELEASE_LASTOCC[(int)'E' - 32] = 13;
MULTIRELEASE_LASTOCC[(int)':' - 32] = 14;
MULTIRELEASE_LASTOCC[(int)' ' - 32] = 15;
+ MULTIRELEASE_LASTOCC[(int)'T' - 32] = 16;
+ MULTIRELEASE_LASTOCC[(int)'R' - 32] = 17;
+ MULTIRELEASE_LASTOCC[(int)'U' - 32] = 18;
+ MULTIRELEASE_LASTOCC[(int)'E' - 32] = 19;
}
private JarEntry getManEntry() {
@@ -966,7 +967,7 @@
* Since there are no repeated substring in our search strings,
* the good suffix shifts can be replaced with a comparison.
*/
- private boolean match(byte[] src, byte[] b, byte[] lastOcc) {
+ private int match(byte[] src, byte[] b, byte[] lastOcc) {
int len = src.length;
int last = b.length - len;
int i = 0;
@@ -990,9 +991,9 @@
continue next;
}
}
- return true;
+ return i;
}
- return false;
+ return -1;
}
/**
@@ -1011,11 +1012,35 @@
if (manEntry != null) {
byte[] b = getBytes(manEntry);
hasClassPathAttribute = match(CLASSPATH_CHARS, b,
- CLASSPATH_LASTOCC);
+ CLASSPATH_LASTOCC) != -1;
// is this a multi-release jar file
if (MULTI_RELEASE_ENABLED && version != BASE_VERSION) {
- isMultiRelease = match(MULTIRELEASE_CHARS, b,
- MULTIRELEASE_LASTOCC);
+ int i = match(MULTIRELEASE_CHARS, b, MULTIRELEASE_LASTOCC);
+ if (i != -1) {
+ i += MULTIRELEASE_CHARS.length;
+ if (i < b.length) {
+ byte c = b[i++];
+ // Check that the value is followed by a newline
+ // and does not have a continuation
+ if (c == '\n' &&
+ (i == b.length || b[i] != ' ')) {
+ isMultiRelease = true;
+ } else if (c == '\r') {
+ if (i == b.length) {
+ isMultiRelease = true;
+ } else {
+ c = b[i++];
+ if (c == '\n') {
+ if (i == b.length || b[i] != ' ') {
+ isMultiRelease = true;
+ }
+ } else if (c != ' ') {
+ isMultiRelease = true;
+ }
+ }
+ }
+ }
+ }
}
}
hasCheckedSpecialAttributes = true;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/URLClassLoader/definePackage/SplitPackage.java Wed Apr 13 00:00:39 2016 -0700
@@ -0,0 +1,102 @@
+/**
+ * Copyright (c) 2016, 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 8153665
+ * @summary Test two URLClassLoader define Package object of the same name
+ * @library /lib/testlibrary
+ * @build CompilerUtils
+ * @run testng SplitPackage
+ */
+
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.jar.Manifest;
+
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+public class SplitPackage {
+ private static final Path SRC_DIR = Paths.get(System.getProperty("test.src", "."));
+ private static final Path FOO_DIR = Paths.get("foo");
+ private static final Path BAR_DIR = Paths.get("bar");
+
+ @BeforeTest
+ private void setup() throws Exception {
+ Files.createDirectory(BAR_DIR);
+
+ Path pkgDir = Paths.get("p");
+ // compile classes in package p
+ assertTrue(CompilerUtils.compile(SRC_DIR.resolve(pkgDir), BAR_DIR));
+
+ // move p.Foo to a different directory
+ Path foo = pkgDir.resolve("Foo.class");
+ Files.createDirectories(FOO_DIR.resolve(pkgDir));
+ Files.move(BAR_DIR.resolve(foo), FOO_DIR.resolve(foo),
+ StandardCopyOption.REPLACE_EXISTING);
+ }
+
+ @Test
+ public void test() throws Exception {
+ URLClassLoader loader1 = new URLClassLoader(new URL[] {
+ FOO_DIR.toUri().toURL()
+ });
+ Loader loader2 = new Loader(new URL[] {
+ BAR_DIR.toUri().toURL()
+ }, loader1);
+
+ Class<?> foo = Class.forName("p.Foo", true, loader2);
+ Class<?> bar = Class.forName("p.Bar", true, loader2);
+ Class<?> baz = Class.forName("p.Baz", true, loader2);
+
+ Package pForFoo = loader1.getDefinedPackage("p");
+ Package pForBar = loader2.getDefinedPackage("p");
+
+ assertEquals(pForFoo.getName(), pForBar.getName());
+ assertTrue(pForFoo != pForBar);
+
+ try {
+ loader2.defineSplitPackage("p");
+ } catch (IllegalArgumentException e) {
+
+ }
+ }
+
+ static class Loader extends URLClassLoader {
+ Loader(URL[] urls, URLClassLoader parent) {
+ super(urls, parent);
+ }
+
+ public Package defineSplitPackage(String name) {
+ Manifest manifest = new Manifest();
+ return super.definePackage(name, manifest, null);
+ }
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/URLClassLoader/definePackage/p/Bar.java Wed Apr 13 00:00:39 2016 -0700
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2016, 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 p;
+
+public class Bar { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/URLClassLoader/definePackage/p/Baz.java Wed Apr 13 00:00:39 2016 -0700
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2016, 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 p;
+
+public class Baz { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/URLClassLoader/definePackage/p/Foo.java Wed Apr 13 00:00:39 2016 -0700
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2016, 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 p;
+
+public class Foo { }
--- a/jdk/test/java/nio/channels/AsyncCloseAndInterrupt.java Tue Apr 12 21:05:15 2016 -0700
+++ b/jdk/test/java/nio/channels/AsyncCloseAndInterrupt.java Wed Apr 13 00:00:39 2016 -0700
@@ -23,7 +23,7 @@
/* @test
* @bug 4460583 4470470 4840199 6419424 6710579 6596323 6824135 6395224 7142919
- * 8151582
+ * 8151582 8068693 8153209
* @run main/othervm AsyncCloseAndInterrupt
* @summary Comprehensive test of asynchronous closing and interruption
* @author Mark Reinhold
@@ -557,7 +557,11 @@
}
// Test
- static void test(ChannelFactory cf, Op op, int test)
+ static void test(ChannelFactory cf, Op op, int test) throws Exception {
+ test(cf, op, test, true);
+ }
+
+ static void test(ChannelFactory cf, Op op, int test, boolean extraSleep)
throws Exception
{
log.println();
@@ -571,6 +575,10 @@
sleep(50);
} while (!t.ready);
+ if (extraSleep) {
+ sleep(100);
+ }
+
switch (test) {
case TEST_INTR:
@@ -603,15 +611,18 @@
break;
}
- t.finishAndThrow(500);
+ t.finishAndThrow(10000);
}
-
static void test(ChannelFactory cf, Op op) throws Exception {
+ test(cf, op, true);
+ }
+
+ static void test(ChannelFactory cf, Op op, boolean extraSleep) throws Exception {
// Test INTR cases before PREINTER cases since sometimes
// interrupted threads can't load classes
- test(cf, op, TEST_INTR);
- test(cf, op, TEST_PREINTR);
+ test(cf, op, TEST_INTR, extraSleep);
+ test(cf, op, TEST_PREINTR, extraSleep);
// Bugs, see FileChannelImpl for details
if (op == TRANSFER_FROM) {
@@ -623,7 +634,7 @@
return;
}
- test(cf, op, TEST_CLOSE);
+ test(cf, op, TEST_CLOSE, extraSleep);
}
static void test(ChannelFactory cf)
@@ -720,8 +731,8 @@
Future<Integer> pumpFuture = pumpRefuser(pumperExecutor);
waitPump("\nWait for initial Pump");
- test(socketChannelFactory, CONNECT);
- test(socketChannelFactory, FINISH_CONNECT);
+ test(socketChannelFactory, CONNECT, false);
+ test(socketChannelFactory, FINISH_CONNECT, false);
pumpDone = true;
Integer newConn = pumpFuture.get(30, TimeUnit.SECONDS);
--- a/jdk/test/java/security/testlibrary/SimpleOCSPServer.java Tue Apr 12 21:05:15 2016 -0700
+++ b/jdk/test/java/security/testlibrary/SimpleOCSPServer.java Wed Apr 13 00:00:39 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, 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
@@ -86,6 +86,7 @@
private boolean logEnabled = false;
private ExecutorService threadPool;
private volatile boolean started = false;
+ private volatile boolean serverReady = false;
private volatile boolean receivedShutdown = false;
private long delayMsec = 0;
@@ -217,6 +218,9 @@
listenPort), 128);
log("Listening on " + servSocket.getLocalSocketAddress());
+ // Singal ready
+ serverReady = true;
+
// Update the listenPort with the new port number. If
// the server is restarted, it will bind to the same
// port rather than picking a new one.
@@ -242,11 +246,12 @@
threadPool.shutdown();
} catch (IOException ioe) {
err(ioe);
+ } finally {
+ // Reset state variables so the server can be restarted
+ receivedShutdown = false;
+ started = false;
+ serverReady = false;
}
-
- // Reset state variables so the server can be restarted
- receivedShutdown = false;
- started = false;
}
});
}
@@ -468,7 +473,7 @@
* server has not yet been bound to a port.
*/
public int getPort() {
- if (servSocket != null && started) {
+ if (serverReady) {
InetSocketAddress inetSock =
(InetSocketAddress)servSocket.getLocalSocketAddress();
return inetSock.getPort();
@@ -478,6 +483,15 @@
}
/**
+ * Use to check if OCSP server is ready to accept connection.
+ *
+ * @return true if server ready, false otherwise
+ */
+ public boolean isServerReady() {
+ return serverReady;
+ }
+
+ /**
* Set a delay between the reception of the request and production of
* the response.
*
--- a/jdk/test/java/util/Currency/CurrencyTest.java Tue Apr 12 21:05:15 2016 -0700
+++ b/jdk/test/java/util/Currency/CurrencyTest.java Wed Apr 13 00:00:39 2016 -0700
@@ -23,7 +23,7 @@
/*
* @test
* @bug 4290801 4692419 4693631 5101540 5104960 6296410 6336600 6371531
- * 6488442 7036905 8008577 8039317 8074350 8074351
+ * 6488442 7036905 8008577 8039317 8074350 8074351 8150324
* @summary Basic tests for Currency class.
* @modules jdk.localedata
*/
@@ -32,12 +32,12 @@
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
-import java.util.Calendar;
-import java.util.Date;
+import java.time.LocalDate;
+import java.time.LocalTime;
+import java.time.ZoneId;
+import java.time.ZonedDateTime;
import java.util.Currency;
-import java.util.GregorianCalendar;
import java.util.Locale;
-import java.util.TimeZone;
public class CurrencyTest {
@@ -137,7 +137,7 @@
/*
* check currency changes
- * In current implementation, there is no data of old currency and transition date at jdk/src/share/classes/java/util/CurrencyData.properties.
+ * In current implementation, there is no data of old currency and transition date at jdk/make/data/currency/CurrencyData.properties.
* So, all the switch data arrays are empty. In the future, if data of old currency and transition date are necessary for any country, the
* arrays here can be updated so that the program can check the currency switch.
*/
@@ -146,15 +146,16 @@
String[] switchOverNew = {};
String[] switchOverTZ = {};
int[] switchOverYear = {};
- int[] switchOverMonth = {};
+ int[] switchOverMonth = {}; // java.time APIs accept month starting from 1 i.e. 01 for January
int[] switchOverDay = {};
for (int i = 0; i < switchOverCtry.length; i++) {
- TimeZone.setDefault(TimeZone.getTimeZone(switchOverTZ[i]));
- Calendar date = new GregorianCalendar(switchOverYear[i], switchOverMonth[i], switchOverDay[i]);
- long switchOver = date.getTime().getTime();
- boolean switchedOver = System.currentTimeMillis() >= switchOver;
- checkCountryCurrency(switchOverCtry[i], switchedOver ? switchOverNew[i] : switchOverOld[i]);
+ ZoneId zoneId = ZoneId.of(switchOverTZ[i]);
+ ZonedDateTime zonedDateAndTime = ZonedDateTime.of(LocalDate.of(switchOverYear[i], switchOverMonth[i], switchOverDay[i]),
+ LocalTime.MIDNIGHT, zoneId);
+ ZonedDateTime currentZonedDateAndTime = ZonedDateTime.now(zoneId);
+ checkCountryCurrency(switchOverCtry[i], (currentZonedDateAndTime.isAfter(zonedDateAndTime) ||
+ currentZonedDateAndTime.isEqual(zonedDateAndTime)) ? switchOverNew[i] : switchOverOld[i]);
}
// check a country code which doesn't have a currency
--- a/jdk/test/java/util/jar/JarFile/MultiReleaseJarAPI.java Tue Apr 12 21:05:15 2016 -0700
+++ b/jdk/test/java/util/jar/JarFile/MultiReleaseJarAPI.java Wed Apr 13 00:00:39 2016 -0700
@@ -54,6 +54,7 @@
static final int MAJOR_VERSION = Version.current().major();
String userdir = System.getProperty("user.dir",".");
+ CreateMultiReleaseTestJars creator = new CreateMultiReleaseTestJars();
File unversioned = new File(userdir, "unversioned.jar");
File multirelease = new File(userdir, "multi-release.jar");
File signedmultirelease = new File(userdir, "signed-multi-release.jar");
@@ -62,7 +63,6 @@
@BeforeClass
public void initialize() throws Exception {
- CreateMultiReleaseTestJars creator = new CreateMultiReleaseTestJars();
creator.compileEntries();
creator.buildUnversionedJar();
creator.buildMultiReleaseJar();
@@ -82,6 +82,10 @@
Assert.assertFalse(jf.isMultiRelease());
}
+ try (JarFile jf = new JarFile(unversioned, true, ZipFile.OPEN_READ, Release.RUNTIME)) {
+ Assert.assertFalse(jf.isMultiRelease());
+ }
+
try (JarFile jf = new JarFile(multirelease)) {
Assert.assertFalse(jf.isMultiRelease());
}
@@ -89,6 +93,28 @@
try (JarFile jf = new JarFile(multirelease, true, ZipFile.OPEN_READ, Release.RUNTIME)) {
Assert.assertTrue(jf.isMultiRelease());
}
+
+ testCustomMultiReleaseValue("true", true);
+ testCustomMultiReleaseValue("true\r\nOther: value", true);
+ testCustomMultiReleaseValue("true\nOther: value", true);
+ testCustomMultiReleaseValue("true\rOther: value", true);
+
+ testCustomMultiReleaseValue("false", false);
+ testCustomMultiReleaseValue(" true", false);
+ testCustomMultiReleaseValue("true ", false);
+ testCustomMultiReleaseValue("true\n ", false);
+ testCustomMultiReleaseValue("true\r ", false);
+ testCustomMultiReleaseValue("true\n true", false);
+ testCustomMultiReleaseValue("true\r\n true", false);
+ }
+
+ private void testCustomMultiReleaseValue(String value, boolean expected) throws Exception {
+ creator.buildCustomMultiReleaseJar("custom-mr.jar", value);
+ File custom = new File(userdir, "custom-mr.jar");
+ try (JarFile jf = new JarFile(custom, true, ZipFile.OPEN_READ, Release.RUNTIME)) {
+ Assert.assertEquals(jf.isMultiRelease(), expected);
+ }
+ Files.delete(custom.toPath());
}
@Test
--- a/jdk/test/javax/net/ssl/Stapling/HttpsUrlConnClient.java Tue Apr 12 21:05:15 2016 -0700
+++ b/jdk/test/javax/net/ssl/Stapling/HttpsUrlConnClient.java Wed Apr 13 00:00:39 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, 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
@@ -26,7 +26,7 @@
/*
* @test
- * @bug 8046321
+ * @bug 8046321 8153829
* @summary OCSP Stapling for TLS
* @library ../../../../java/security/testlibrary
* @build CertificateBuilder SimpleOCSPServer
@@ -298,12 +298,13 @@
*/
void doClientSide(ClientParameters cliParams) throws Exception {
- /*
- * Wait for server to get started.
- */
- while (!serverReady) {
+ // Wait 5 seconds for server ready
+ for (int i = 0; (i < 100 && !serverReady); i++) {
Thread.sleep(50);
}
+ if (!serverReady) {
+ throw new RuntimeException("Server not ready yet");
+ }
// Selectively enable or disable the feature
System.setProperty("jdk.tls.client.enableStatusRequestExtension",
@@ -532,7 +533,15 @@
rootOcsp.enableLog(debug);
rootOcsp.setNextUpdateInterval(3600);
rootOcsp.start();
- Thread.sleep(1000); // Give the server a second to start up
+
+ // Wait 5 seconds for server ready
+ for (int i = 0; (i < 100 && !rootOcsp.isServerReady()); i++) {
+ Thread.sleep(50);
+ }
+ if (!rootOcsp.isServerReady()) {
+ throw new RuntimeException("Server not ready yet");
+ }
+
rootOcspPort = rootOcsp.getPort();
String rootRespURI = "http://localhost:" + rootOcspPort;
log("Root OCSP Responder URI is " + rootRespURI);
@@ -577,7 +586,15 @@
intOcsp.enableLog(debug);
intOcsp.setNextUpdateInterval(3600);
intOcsp.start();
- Thread.sleep(1000);
+
+ // Wait 5 seconds for server ready
+ for (int i = 0; (i < 100 && !intOcsp.isServerReady()); i++) {
+ Thread.sleep(50);
+ }
+ if (!intOcsp.isServerReady()) {
+ throw new RuntimeException("Server not ready yet");
+ }
+
intOcspPort = intOcsp.getPort();
String intCaRespURI = "http://localhost:" + intOcspPort;
log("Intermediate CA OCSP Responder URI is " + intCaRespURI);
--- a/jdk/test/javax/net/ssl/Stapling/SSLEngineWithStapling.java Tue Apr 12 21:05:15 2016 -0700
+++ b/jdk/test/javax/net/ssl/Stapling/SSLEngineWithStapling.java Wed Apr 13 00:00:39 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, 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
@@ -26,7 +26,7 @@
/*
* @test
- * @bug 8046321
+ * @bug 8046321 8153829
* @summary OCSP Stapling for TLS
* @library ../../../../java/security/testlibrary
* @build CertificateBuilder SimpleOCSPServer
@@ -487,7 +487,15 @@
rootOcsp.enableLog(logging);
rootOcsp.setNextUpdateInterval(3600);
rootOcsp.start();
- Thread.sleep(1000); // Give the server a second to start up
+
+ // Wait 5 seconds for server ready
+ for (int i = 0; (i < 100 && !rootOcsp.isServerReady()); i++) {
+ Thread.sleep(50);
+ }
+ if (!rootOcsp.isServerReady()) {
+ throw new RuntimeException("Server not ready yet");
+ }
+
rootOcspPort = rootOcsp.getPort();
String rootRespURI = "http://localhost:" + rootOcspPort;
log("Root OCSP Responder URI is " + rootRespURI);
@@ -532,7 +540,15 @@
intOcsp.enableLog(logging);
intOcsp.setNextUpdateInterval(3600);
intOcsp.start();
- Thread.sleep(1000);
+
+ // Wait 5 seconds for server ready
+ for (int i = 0; (i < 100 && !intOcsp.isServerReady()); i++) {
+ Thread.sleep(50);
+ }
+ if (!intOcsp.isServerReady()) {
+ throw new RuntimeException("Server not ready yet");
+ }
+
intOcspPort = intOcsp.getPort();
String intCaRespURI = "http://localhost:" + intOcspPort;
log("Intermediate CA OCSP Responder URI is " + intCaRespURI);
--- a/jdk/test/javax/net/ssl/Stapling/SSLSocketWithStapling.java Tue Apr 12 21:05:15 2016 -0700
+++ b/jdk/test/javax/net/ssl/Stapling/SSLSocketWithStapling.java Wed Apr 13 00:00:39 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, 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
@@ -26,7 +26,7 @@
/*
* @test
- * @bug 8046321
+ * @bug 8046321 8153829
* @summary OCSP Stapling for TLS
* @library ../../../../java/security/testlibrary
* @build CertificateBuilder SimpleOCSPServer
@@ -318,6 +318,14 @@
// Start the OCSP responders up again
intOcsp.start();
rootOcsp.start();
+
+ // Wait 5 seconds for server ready
+ for (int i = 0; (i < 100 && (!intOcsp.isServerReady() || !rootOcsp.isServerReady())); i++) {
+ Thread.sleep(50);
+ }
+ if (!intOcsp.isServerReady() || !rootOcsp.isServerReady()) {
+ throw new RuntimeException("Server not ready yet");
+ }
}
/**
@@ -367,6 +375,14 @@
// Start the OCSP responders up again
intOcsp.start();
rootOcsp.start();
+
+ // Wait 5 seconds for server ready
+ for (int i = 0; (i < 100 && (!intOcsp.isServerReady() || !rootOcsp.isServerReady())); i++) {
+ Thread.sleep(50);
+ }
+ if (!intOcsp.isServerReady() || !rootOcsp.isServerReady()) {
+ throw new RuntimeException("Server not ready yet");
+ }
}
/**
@@ -394,7 +410,14 @@
rootOcsp.setDelay(3000);
rootOcsp.start();
intOcsp.start();
- Thread.sleep(1000);
+
+ // Wait 5 seconds for server ready
+ for (int i = 0; (i < 100 && (!intOcsp.isServerReady() || !rootOcsp.isServerReady())); i++) {
+ Thread.sleep(50);
+ }
+ if (!intOcsp.isServerReady() || !rootOcsp.isServerReady()) {
+ throw new RuntimeException("Server not ready yet");
+ }
System.out.println("========================================");
System.out.println("Stapling enbled in client. Server does");
@@ -442,6 +465,14 @@
rootOcsp.setDelay(0);
rootOcsp.start();
intOcsp.start();
+
+ // Wait 5 seconds for server ready
+ for (int i = 0; (i < 100 && (!intOcsp.isServerReady() || !rootOcsp.isServerReady())); i++) {
+ Thread.sleep(50);
+ }
+ if (!intOcsp.isServerReady() || !rootOcsp.isServerReady()) {
+ throw new RuntimeException("Server not ready yet");
+ }
}
/*
@@ -509,12 +540,13 @@
*/
void doClientSide(ClientParameters cliParams) throws Exception {
- /*
- * Wait for server to get started.
- */
- while (!serverReady) {
+ // Wait 5 seconds for server ready
+ for (int i = 0; (i < 100 && !serverReady); i++) {
Thread.sleep(50);
}
+ if (!serverReady) {
+ throw new RuntimeException("Server not ready yet");
+ }
// Selectively enable or disable the feature
System.setProperty("jdk.tls.client.enableStatusRequestExtension",
@@ -732,7 +764,15 @@
rootOcsp.enableLog(debug);
rootOcsp.setNextUpdateInterval(3600);
rootOcsp.start();
- Thread.sleep(1000); // Give the server a second to start up
+
+ // Wait 5 seconds for server ready
+ for (int i = 0; (i < 100 && !rootOcsp.isServerReady()); i++) {
+ Thread.sleep(50);
+ }
+ if (!rootOcsp.isServerReady()) {
+ throw new RuntimeException("Server not ready yet");
+ }
+
rootOcspPort = rootOcsp.getPort();
String rootRespURI = "http://localhost:" + rootOcspPort;
log("Root OCSP Responder URI is " + rootRespURI);
@@ -777,7 +817,15 @@
intOcsp.enableLog(debug);
intOcsp.setNextUpdateInterval(3600);
intOcsp.start();
- Thread.sleep(1000);
+
+ // Wait 5 seconds for server ready
+ for (int i = 0; (i < 100 && !intOcsp.isServerReady()); i++) {
+ Thread.sleep(50);
+ }
+ if (!intOcsp.isServerReady()) {
+ throw new RuntimeException("Server not ready yet");
+ }
+
intOcspPort = intOcsp.getPort();
String intCaRespURI = "http://localhost:" + intOcspPort;
log("Intermediate CA OCSP Responder URI is " + intCaRespURI);
--- a/jdk/test/javax/net/ssl/Stapling/StapleEnableProps.java Tue Apr 12 21:05:15 2016 -0700
+++ b/jdk/test/javax/net/ssl/Stapling/StapleEnableProps.java Wed Apr 13 00:00:39 2016 -0700
@@ -26,7 +26,7 @@
/*
* @test
- * @bug 8145854
+ * @bug 8145854 8153829
* @summary SSLContextImpl.statusResponseManager should be generated if required
* @library ../../../../java/security/testlibrary
* @build CertificateBuilder SimpleOCSPServer
@@ -588,7 +588,15 @@
rootOcsp.enableLog(logging);
rootOcsp.setNextUpdateInterval(3600);
rootOcsp.start();
- Thread.sleep(1000); // Give the server a second to start up
+
+ // Wait 5 seconds for server ready
+ for (int i = 0; (i < 100 && !rootOcsp.isServerReady()); i++) {
+ Thread.sleep(50);
+ }
+ if (!rootOcsp.isServerReady()) {
+ throw new RuntimeException("Server not ready yet");
+ }
+
rootOcspPort = rootOcsp.getPort();
String rootRespURI = "http://localhost:" + rootOcspPort;
log("Root OCSP Responder URI is " + rootRespURI);
@@ -633,7 +641,15 @@
intOcsp.enableLog(logging);
intOcsp.setNextUpdateInterval(3600);
intOcsp.start();
- Thread.sleep(1000);
+
+ // Wait 5 seconds for server ready
+ for (int i = 0; (i < 100 && !intOcsp.isServerReady()); i++) {
+ Thread.sleep(50);
+ }
+ if (!intOcsp.isServerReady()) {
+ throw new RuntimeException("Server not ready yet");
+ }
+
intOcspPort = intOcsp.getPort();
String intCaRespURI = "http://localhost:" + intOcspPort;
log("Intermediate CA OCSP Responder URI is " + intCaRespURI);
--- a/jdk/test/lib/testlibrary/java/util/jar/CreateMultiReleaseTestJars.java Tue Apr 12 21:05:15 2016 -0700
+++ b/jdk/test/lib/testlibrary/java/util/jar/CreateMultiReleaseTestJars.java Wed Apr 13 00:00:39 2016 -0700
@@ -88,8 +88,12 @@
}
public void buildMultiReleaseJar() throws IOException {
- JarBuilder jb = new JarBuilder("multi-release.jar");
- jb.addAttribute("Multi-Release", "true");
+ buildCustomMultiReleaseJar("multi-release.jar", "true");
+ }
+
+ public void buildCustomMultiReleaseJar(String filename, String multiReleaseValue) throws IOException {
+ JarBuilder jb = new JarBuilder(filename);
+ jb.addAttribute("Multi-Release", multiReleaseValue);
jb.addEntry("README", readme8.getBytes());
jb.addEntry("version/Main.java", main.getBytes());
jb.addEntry("version/Main.class", rootClasses.get("version.Main"));
--- a/jdk/test/sun/security/ssl/StatusStapling/java.base/sun/security/ssl/StatusResponseManagerTests.java Tue Apr 12 21:05:15 2016 -0700
+++ b/jdk/test/sun/security/ssl/StatusStapling/java.base/sun/security/ssl/StatusResponseManagerTests.java Wed Apr 13 00:00:39 2016 -0700
@@ -300,7 +300,15 @@
rootOcsp.enableLog(ocspDebug);
rootOcsp.setNextUpdateInterval(3600);
rootOcsp.start();
- Thread.sleep(1000); // Give the server a second to start up
+
+ // Wait 5 seconds for server ready
+ for (int i = 0; (i < 100 && !rootOcsp.isServerReady()); i++) {
+ Thread.sleep(50);
+ }
+ if (!rootOcsp.isServerReady()) {
+ throw new RuntimeException("Server not ready yet");
+ }
+
rootOcspPort = rootOcsp.getPort();
String rootRespURI = "http://localhost:" + rootOcspPort;
log("Root OCSP Responder URI is " + rootRespURI);
@@ -345,7 +353,15 @@
intOcsp.enableLog(ocspDebug);
intOcsp.setNextUpdateInterval(3600);
intOcsp.start();
- Thread.sleep(1000);
+
+ // Wait 5 seconds for server ready
+ for (int i = 0; (i < 100 && !intOcsp.isServerReady()); i++) {
+ Thread.sleep(50);
+ }
+ if (!intOcsp.isServerReady()) {
+ throw new RuntimeException("Server not ready yet");
+ }
+
intOcspPort = intOcsp.getPort();
String intCaRespURI = "http://localhost:" + intOcspPort;
log("Intermediate CA OCSP Responder URI is " + intCaRespURI);
--- a/jdk/test/tools/pack200/BandIntegrity.java Tue Apr 12 21:05:15 2016 -0700
+++ b/jdk/test/tools/pack200/BandIntegrity.java Wed Apr 13 00:00:39 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, 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
@@ -26,6 +26,7 @@
* @summary test ensures the proper sequencing of bands, dump bands as well.
* @compile -XDignore.symbol.file Utils.java BandIntegrity.java
* @run main BandIntegrity
+ * @key intermittent
* @author ksrini
*/
import java.io.File;