--- a/jdk/.hgtags Thu Jun 02 14:58:53 2016 -0700
+++ b/jdk/.hgtags Mon Jun 06 09:58:04 2016 -0700
@@ -363,3 +363,4 @@
e1eba5cfa5cc8c66d524396a05323dc93568730a jdk-9+118
bad3f8a33db271a6143ba6eac0c8bd5bbd942417 jdk-9+119
b9a518bf72516954e57ac2f6e3ef21e13008f1cd jdk-9+120
+ee29aaab5889555ea56e4c0ed690aabb7613529d jdk-9+121
--- a/jdk/make/lib/CoreLibraries.gmk Thu Jun 02 14:58:53 2016 -0700
+++ b/jdk/make/lib/CoreLibraries.gmk Mon Jun 06 09:58:04 2016 -0700
@@ -212,9 +212,6 @@
-I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
-I$(SUPPORT_OUTPUTDIR)/headers/java.base, \
CFLAGS_unix := $(BUILD_LIBZIP_MMAP) -UDEBUG, \
- DISABLED_WARNINGS_gcc := parentheses, \
- DISABLED_WARNINGS_clang := dangling-else, \
- DISABLED_WARNINGS_microsoft := 4267, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libzip/mapfile-vers, \
REORDER := $(BUILD_LIBZIP_REORDER), \
LDFLAGS := $(LDFLAGS_JDKLIB) \
--- a/jdk/src/java.base/share/classes/java/lang/StackFrameInfo.java Thu Jun 02 14:58:53 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/StackFrameInfo.java Mon Jun 06 09:58:04 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
@@ -29,8 +29,6 @@
import static java.lang.StackWalker.Option.*;
import java.lang.StackWalker.StackFrame;
-import java.util.Optional;
-import java.util.OptionalInt;
class StackFrameInfo implements StackFrame {
private final static JavaLangInvokeAccess JLIA =
@@ -82,19 +80,21 @@
@Override
public int getByteCodeIndex() {
+ // bci not available for native methods
+ if (isNativeMethod())
+ return -1;
+
return bci;
}
@Override
public String getFileName() {
- if (isNativeMethod())
- return null;
-
return toStackTraceElement().getFileName();
}
@Override
public int getLineNumber() {
+ // line number not available for native methods
if (isNativeMethod())
return -2;
--- a/jdk/src/java.base/share/classes/java/lang/StackStreamFactory.java Thu Jun 02 14:58:53 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/StackStreamFactory.java Mon Jun 06 09:58:04 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
@@ -680,7 +680,8 @@
// 1: caller-sensitive method
// 2: caller class
while (n < 2 && (caller = nextFrame()) != null) {
- if (isMethodHandleFrame(caller)) continue;
+ if (isMethodHandleFrame(caller)) { continue; }
+ if (isReflectionFrame(caller)) { continue; }
frames[n++] = caller;
}
if (frames[1] == null) {
--- a/jdk/src/java.base/share/classes/java/lang/StackWalker.java Thu Jun 02 14:58:53 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/StackWalker.java Mon Jun 06 09:58:04 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
@@ -468,23 +468,23 @@
* Gets the {@code Class} object of the caller invoking the method
* that calls this {@code getCallerClass} method.
*
- * <p> Reflection frames, {@link java.lang.invoke.MethodHandle} and
+ * <p> Reflection frames, {@link java.lang.invoke.MethodHandle}, and
* hidden frames are filtered regardless of the
* {@link Option#SHOW_REFLECT_FRAMES SHOW_REFLECT_FRAMES}
* and {@link Option#SHOW_HIDDEN_FRAMES SHOW_HIDDEN_FRAMES} options
- * this {@code StackWalker} has been configured.
+ * this {@code StackWalker} has been configured with.
*
* <p> This method throws {@code UnsupportedOperationException}
- * if this {@code StackWalker} is not configured with
- * {@link Option#RETAIN_CLASS_REFERENCE RETAIN_CLASS_REFERENCE} option,
+ * if this {@code StackWalker} is not configured with the
+ * {@link Option#RETAIN_CLASS_REFERENCE RETAIN_CLASS_REFERENCE} option.
* This method should be called when a caller frame is present. If
- * it is called from the last frame on the stack;
+ * it is called from the last frame on the stack,
* {@code IllegalStateException} will be thrown.
*
* @apiNote
* For example, {@code Util::getResourceBundle} loads a resource bundle
* on behalf of the caller. It calls this {@code getCallerClass} method
- * to find the method calling {@code Util::getResourceBundle} and use the caller's
+ * to find the method calling {@code Util::getResourceBundle} and uses the caller's
* class loader to load the resource bundle. The caller class in this example
* is the {@code MyTool} class.
*
@@ -519,7 +519,7 @@
* When the {@code getCallerClass} method is called from a method that
* is the last frame on the stack,
* for example, {@code static public void main} method launched by the
- * {@code java} launcher or a method invoked from a JNI attached thread.
+ * {@code java} launcher, or a method invoked from a JNI attached thread,
* {@code IllegalStateException} is thrown.
*
* @return {@code Class} object of the caller's caller invoking this method.
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java Thu Jun 02 14:58:53 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java Mon Jun 06 09:58:04 2016 -0700
@@ -3360,9 +3360,9 @@
* @param pos place in {@code newTypes} where the non-skipped target parameters must occur
* @return a possibly adapted method handle
* @throws NullPointerException if either argument is null
- * @throws IllegalArgumentException
- * if either index is out of range in its corresponding list, or
- * if the non-skipped target parameter types match the new types at {@code pos}
+ * @throws IllegalArgumentException if any element of {@code newTypes} is {@code void.class},
+ * or if either index is out of range in its corresponding list,
+ * or if the non-skipped target parameter types match the new types at {@code pos}
* @since 9
*/
public static
--- a/jdk/src/java.base/share/classes/java/util/regex/Pattern.java Thu Jun 02 14:58:53 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/util/regex/Pattern.java Mon Jun 06 09:58:04 2016 -0700
@@ -3194,6 +3194,7 @@
break;
case 'U':
flags &= ~(UNICODE_CHARACTER_CLASS | UNICODE_CASE);
+ break;
default:
return;
}
--- a/jdk/src/java.base/share/classes/java/util/spi/AbstractResourceBundleProvider.java Thu Jun 02 14:58:53 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/util/spi/AbstractResourceBundleProvider.java Mon Jun 06 09:58:04 2016 -0700
@@ -40,6 +40,36 @@
* {@code AbstractResourceBundleProvider} is an abstract class for helping
* implement the {@link ResourceBundleProvider} interface.
*
+ * <p>
+ * Resource bundles can be packaged in a named module separated from
+ * the <em>caller module</em> loading the resource bundle, i.e. the module
+ * calling {@link ResourceBundle#getBundle(String)}. For the caller module
+ * to load a resource bundle "{@code com.example.app.MyResources}"
+ * from another module and a service interface named
+ * "{@code com.example.app.MyResourcesProvider}",
+ * the <em>bundle provider module</em> can provide the implementation class
+ * as follows:
+ *
+ * <pre><code>
+ * import com.example.app.MyResourcesProvider;
+ * class MyResourcesProviderImpl extends AbstractResourceBundleProvider
+ * implements MyResourcesProvider
+ * {</code>
+ * {@code @Override
+ * public ResourceBundle getBundle(String baseName, Locale locale) {
+ * // this module only provides bundles in french
+ * if (locale.equals(Locale.FRENCH)) {
+ * return super.getBundle(baseName, locale);
+ * }
+ * return null;
+ * }
+ * }}</pre>
+ *
+ * @see <a href="../ResourceBundle.html#bundleprovider">
+ * Resource Bundles in Named Modules</a>
+ * @see <a href="../ResourceBundle.html#RBP_support">
+ * ResourceBundleProvider Service Providers</a>
+ *
* @since 9
*/
public abstract class AbstractResourceBundleProvider implements ResourceBundleProvider {
@@ -125,6 +155,7 @@
Module module = this.getClass().getModule();
String bundleName = toBundleName(baseName, locale);
ResourceBundle bundle = null;
+
for (String format : formats) {
try {
if (FORMAT_CLASS.equals(format)) {
--- a/jdk/src/java.base/share/classes/java/util/spi/ResourceBundleProvider.java Thu Jun 02 14:58:53 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/util/spi/ResourceBundleProvider.java Mon Jun 06 09:58:04 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
@@ -30,13 +30,21 @@
/**
* {@code ResourceBundleProvider} is a provider interface that is used for
- * loading resource bundles. Implementation classes of this interface are loaded
- * with {@link java.util.ServiceLoader ServiceLoader} during a call to the
+ * loading resource bundles for named modules. Implementation classes of
+ * this interface are loaded with {@link java.util.ServiceLoader ServiceLoader}
+ * during a call to the
* {@link ResourceBundle#getBundle(String, Locale, ClassLoader)
* ResourceBundle.getBundle} method. The provider service type is determined by
- * {@code basename+"Provider"}. For example, if the base name is
- * "com.example.app.MyResources", {@code com.example.app.MyResourcesProvider}
- * will be the provider service type.
+ * {@code basename+"Provider"}.
+ *
+ * <p>
+ * For example, if the base name is "com.example.app.MyResources",
+ * {@code com.example.app.MyResourcesProvider} will be the provider service type:
+ * <pre>{@code
+ * public interface MyResourcesProvider extends ResourceBundleProvider {
+ * }
+ * }</pre>
+ *
* <p>
* This providers's {@link #getBundle(String, Locale) getBundle} method is called
* through the resource bundle loading process instead of {@link
@@ -44,13 +52,17 @@
* ResourceBundle.Control.newBundle()}. Refer to {@link ResourceBundle} for
* details.
*
+ * @see <a href="../ResourceBundle.html#bundleprovider">
+ * Resource Bundles in Named Modules</a>
+ * @see <a href="../ResourceBundle.html#RBP_support">
+ * ResourceBundleProvider Service Providers</a>
* @since 9
*/
public interface ResourceBundleProvider {
/**
* Returns a {@code ResourceBundle} for the given bundle name and locale.
- * This method returns null if there is no {@code ResourceBundle} found
- * for the given parameters.
+ * This method returns {@code null} if there is no {@code ResourceBundle}
+ * found for the given parameters.
*
*
* @param baseName
--- a/jdk/src/java.base/share/native/libzip/zip_util.c Thu Jun 02 14:58:53 2016 -0700
+++ b/jdk/src/java.base/share/native/libzip/zip_util.c Mon Jun 06 09:58:04 2016 -0700
@@ -582,16 +582,17 @@
}
}
- if (cenlen > endpos)
+ if (cenlen > endpos) {
ZIP_FORMAT_ERROR("invalid END header (bad central directory size)");
+ }
cenpos = endpos - cenlen;
/* Get position of first local file (LOC) header, taking into
* account that there may be a stub prefixed to the zip file. */
zip->locpos = cenpos - cenoff;
- if (zip->locpos < 0)
+ if (zip->locpos < 0) {
ZIP_FORMAT_ERROR("invalid END header (bad central directory offset)");
-
+ }
#ifdef USE_MMAP
if (zip->usemmap) {
/* On Solaris & Linux prior to JDK 6, we used to mmap the whole jar file to
@@ -681,15 +682,18 @@
method = CENHOW(cp);
nlen = CENNAM(cp);
- if (!CENSIG_AT(cp))
+ if (!CENSIG_AT(cp)) {
ZIP_FORMAT_ERROR("invalid CEN header (bad signature)");
- if (CENFLG(cp) & 1)
+ }
+ if (CENFLG(cp) & 1) {
ZIP_FORMAT_ERROR("invalid CEN header (encrypted entry)");
- if (method != STORED && method != DEFLATED)
+ }
+ if (method != STORED && method != DEFLATED) {
ZIP_FORMAT_ERROR("invalid CEN header (bad compression method)");
- if (cp + CENHDR + nlen > cenend)
+ }
+ if (cp + CENHDR + nlen > cenend) {
ZIP_FORMAT_ERROR("invalid CEN header (bad header size)");
-
+ }
/* if the entry is metadata add it to our metadata names */
if (isMetaName((char *)cp+CENHDR, nlen))
if (addMetaName(zip, (char *)cp+CENHDR, nlen) != 0)
@@ -704,9 +708,9 @@
entries[i].next = table[hsh];
table[hsh] = i;
}
- if (cp != cenend)
+ if (cp != cenend) {
ZIP_FORMAT_ERROR("invalid CEN header (bad header size)");
-
+ }
zip->total = i;
goto Finally;
@@ -1115,7 +1119,7 @@
ZIP_GetEntry(jzfile *zip, char *name, jint ulen)
{
if (ulen == 0) {
- return ZIP_GetEntry2(zip, name, strlen(name), JNI_FALSE);
+ return ZIP_GetEntry2(zip, name, (jint)strlen(name), JNI_FALSE);
}
return ZIP_GetEntry2(zip, name, ulen, JNI_TRUE);
}
@@ -1441,7 +1445,7 @@
jzentry *entry = ZIP_GetEntry(zip, name, 0);
if (entry) {
*sizeP = (jint)entry->size;
- *nameLenP = strlen(entry->name);
+ *nameLenP = (jint)strlen(entry->name);
}
return entry;
}
--- a/jdk/src/java.httpclient/share/classes/java/net/http/Http2Connection.java Thu Jun 02 14:58:53 2016 -0700
+++ b/jdk/src/java.httpclient/share/classes/java/net/http/Http2Connection.java Mon Jun 06 09:58:04 2016 -0700
@@ -367,7 +367,7 @@
Log.logError(t);
closed = true;
client2.deleteConnection(this);
- Collection<Stream> c = streams.values();
+ List<Stream> c = new LinkedList<>(streams.values());
for (Stream s : c) {
s.cancelImpl(t);
}
--- a/jdk/src/java.httpclient/share/classes/java/net/http/Stream.java Thu Jun 02 14:58:53 2016 -0700
+++ b/jdk/src/java.httpclient/share/classes/java/net/http/Stream.java Mon Jun 06 09:58:04 2016 -0700
@@ -30,6 +30,7 @@
import java.net.URI;
import java.nio.ByteBuffer;
import java.util.LinkedList;
+import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
@@ -537,7 +538,7 @@
* getResponseAsync()
*/
- final List<CompletableFuture<HttpResponseImpl>> response_cfs = new LinkedList<>();
+ final List<CompletableFuture<HttpResponseImpl>> response_cfs = new ArrayList<>(5);
@Override
CompletableFuture<HttpResponseImpl> getResponseAsync(Void v) {
@@ -565,17 +566,16 @@
void completeResponse(HttpResponse r) {
HttpResponseImpl resp = (HttpResponseImpl)r;
synchronized (response_cfs) {
- for (CompletableFuture<HttpResponseImpl> cf : response_cfs) {
+ int cfs_len = response_cfs.size();
+ for (int i=0; i<cfs_len; i++) {
+ CompletableFuture<HttpResponseImpl> cf = response_cfs.get(i);
if (!cf.isDone()) {
cf.complete(resp);
response_cfs.remove(cf);
- //responseHeaders = new HttpHeadersImpl(); // for any following header blocks
return;
- } else
- System.err.println("Stream: " + this + " ALREADY DONE");
+ }
}
response_cfs.add(CompletableFuture.completedFuture(resp));
- //responseHeaders = new HttpHeadersImpl(); // for any following header blocks
}
}
--- a/jdk/test/java/lang/StackWalker/GetCallerClassTest.java Thu Jun 02 14:58:53 2016 -0700
+++ b/jdk/test/java/lang/StackWalker/GetCallerClassTest.java Mon Jun 06 09:58:04 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
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8140450
+ * @bug 8140450 8152893
* @summary Basic test for StackWalker.getCallerClass()
* @run main/othervm GetCallerClassTest
* @run main/othervm GetCallerClassTest sm
@@ -41,6 +41,7 @@
import java.security.Policy;
import java.security.ProtectionDomain;
import java.util.Arrays;
+import java.util.EnumSet;
import java.util.List;
public class GetCallerClassTest {
@@ -65,16 +66,20 @@
}
new GetCallerClassTest(StackWalker.getInstance(), true).test();
new GetCallerClassTest(StackWalker.getInstance(RETAIN_CLASS_REFERENCE), false).test();
+ new GetCallerClassTest(StackWalker.getInstance(EnumSet.of(RETAIN_CLASS_REFERENCE,
+ SHOW_HIDDEN_FRAMES)), false).test();
}
public void test() {
new TopLevelCaller().run();
+ new LambdaTest().run();
new Nested().createNestedCaller().run();
new InnerClassCaller().run();
new ReflectionTest().run();
List<Thread> threads = Arrays.asList(
new Thread(new TopLevelCaller()),
+ new Thread(new LambdaTest()),
new Thread(new Nested().createNestedCaller()),
new Thread(new InnerClassCaller()),
new Thread(new ReflectionTest())
@@ -149,7 +154,7 @@
public static void assertEquals(Class<?> c, Class<?> expected) {
if (expected != c) {
- throw new RuntimeException(c + " != " + expected);
+ throw new RuntimeException("Got " + c + ", but expected " + expected);
}
}
@@ -172,6 +177,28 @@
}
}
+ class LambdaTest implements Runnable {
+ public void run() {
+ Runnable lambdaRunnable = () -> {
+ try {
+ Class<?> c = walker.getCallerClass();
+
+ assertEquals(c, LambdaTest.class);
+ if (expectUOE) { // Should have thrown
+ throw new RuntimeException("Didn't get expected exception");
+ }
+ } catch (Throwable e) {
+ if (expectUOE && causeIsUOE(e)) {
+ return; /* expected */
+ }
+ System.err.println("Unexpected exception:");
+ throw new RuntimeException(e);
+ }
+ };
+ lambdaRunnable.run();
+ }
+ }
+
class Nested {
NestedClassCaller createNestedCaller() { return new NestedClassCaller(); }
class NestedClassCaller implements Runnable {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/StackWalker/NativeMethod.java Mon Jun 06 09:58:04 2016 -0700
@@ -0,0 +1,72 @@
+/*
+ * 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 8157892 8157977
+ * @summary Verify file name, line number and bci of native methods
+ * @run main NativeMethod
+ */
+
+import java.lang.StackWalker.Option;
+import java.lang.StackWalker.StackFrame;
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class NativeMethod {
+ public static void main(String... args) throws Exception {
+ new NativeMethod().test();
+ }
+
+ private final StackWalker walker;
+ NativeMethod() {
+ this.walker = StackWalker.getInstance(Option.SHOW_REFLECT_FRAMES);
+ }
+
+ void test() throws Exception {
+ // invoke via reflection that includes native methods
+ Method m = NativeMethod.class.getDeclaredMethod("walk");
+ m.invoke(this);
+ }
+
+ void walk() {
+ List<StackFrame> nativeFrames = walker.walk(s ->
+ s.filter(StackFrame::isNativeMethod)
+ .collect(Collectors.toList())
+ );
+
+ assertTrue(nativeFrames.size() > 0, "native frame not found");
+ for (StackFrame f : nativeFrames) {
+ assertTrue(f.getFileName() != null, "source file expected to be found");
+ assertTrue(f.getLineNumber() < 0, "line number expected to be unavailable");
+ assertTrue(f.getByteCodeIndex() < 0, "bci expected to be unavailable");
+ }
+
+ }
+
+ private static void assertTrue(boolean value, String msg) {
+ if (value != true)
+ throw new AssertionError(msg);
+ }
+}
--- a/jdk/test/java/lang/invoke/DropArgumentsTest.java Thu Jun 02 14:58:53 2016 -0700
+++ b/jdk/test/java/lang/invoke/DropArgumentsTest.java Mon Jun 06 09:58:04 2016 -0700
@@ -25,7 +25,7 @@
/* @test
* @summary unit tests for java.lang.invoke.MethodHandles
- * @run testng/othervm -ea -esa test.java.lang.invoke.DropArgumentsTest
+ * @run testng test.java.lang.invoke.DropArgumentsTest
*/
package test.java.lang.invoke;
@@ -87,4 +87,13 @@
public void dropArgumentsToMatchIAE(MethodHandle target, int pos, List<Class<?>> valueType, int skip) {
MethodHandles.dropArgumentsToMatch(target, pos, valueType , skip);
}
+
+ @Test
+ @ExpectedExceptions(IllegalArgumentException.class)
+ public void dropArgumentsToMatchTestWithVoid() throws Throwable {
+ MethodHandle cat = lookup().findVirtual(String.class, "concat",
+ MethodType.methodType(String.class, String.class));
+ MethodType bigTypewithVoid = cat.type().insertParameterTypes(0, void.class, String.class, int.class);
+ MethodHandle handle2 = MethodHandles.dropArgumentsToMatch(cat, 0, bigTypewithVoid.parameterList(), 1);
+ }
}
--- a/jdk/test/java/net/CookieHandler/CookieManagerTest.java Thu Jun 02 14:58:53 2016 -0700
+++ b/jdk/test/java/net/CookieHandler/CookieManagerTest.java Mon Jun 06 09:58:04 2016 -0700
@@ -25,6 +25,7 @@
* @test
* @summary Unit test for java.net.CookieManager
* @bug 6244040 7150552 7051862
+ * @modules jdk.httpserver
* @run main/othervm -ea CookieManagerTest
* @author Edward Wang
*/
@@ -32,12 +33,31 @@
import com.sun.net.httpserver.*;
import java.io.IOException;
import java.net.*;
+import static java.net.Proxy.NO_PROXY;
public class CookieManagerTest {
static CookieTransactionHandler httpTrans;
static HttpServer server;
+ static final String hostAddress = getAddr();
+
+ /** Returns an IP literal suitable for use by the test. */
+ static String getAddr() {
+ try {
+ InetAddress lh = InetAddress.getLocalHost();
+ System.out.println("Trying: " + lh);
+ if (lh.isReachable(5_000)) {
+ System.out.println("Using: " + lh);
+ return lh.getHostAddress();
+ }
+ } catch (IOException x) {
+ System.out.println("Debug: caught:" + x);
+ }
+ System.out.println("Using: \"127.0.0.1\"");
+ return "127.0.0.1";
+ }
+
public static void main(String[] args) throws Exception {
startHttpServer();
makeHttpCall();
@@ -78,8 +98,8 @@
public static void makeHttpCall() throws IOException {
try {
- System.out.println("http server listenining on: "
- + server.getAddress().getPort());
+ int port = server.getAddress().getPort();
+ System.out.println("http server listenining on: " + port);
// install CookieManager to use
CookieHandler.setDefault(new CookieManager());
@@ -92,11 +112,12 @@
((CookieManager)CookieHandler.getDefault())
.getCookieStore().removeAll();
URL url = new URL("http" ,
- InetAddress.getLocalHost().getHostAddress(),
+ hostAddress,
server.getAddress().getPort(),
CookieTransactionHandler.testCases[i][0]
.serverPath);
- HttpURLConnection uc = (HttpURLConnection)url.openConnection();
+ System.out.println("Requesting " + url);
+ HttpURLConnection uc = (HttpURLConnection)url.openConnection(NO_PROXY);
uc.getResponseCode();
uc.disconnect();
}
@@ -116,8 +137,6 @@
// to send http request
public static final int testCount = 6;
- private String localHostAddr = "127.0.0.1";
-
@Override
public void handle(HttpExchange exchange) throws IOException {
if (testDone < testCases[testcaseDone].length) {
@@ -188,10 +207,8 @@
testCases = new CookieTestCase[testCount][];
testPolicies = new CookiePolicy[testCount];
- try {
- localHostAddr = InetAddress.getLocalHost().getHostAddress();
- } catch (Exception ignored) {
- };
+ String localHostAddr = CookieManagerTest.hostAddress;
+
int count = 0;
// an http session with Netscape cookies exchanged
--- a/jdk/test/java/net/HttpURLConnection/UnmodifiableMaps.java Thu Jun 02 14:58:53 2016 -0700
+++ b/jdk/test/java/net/HttpURLConnection/UnmodifiableMaps.java Mon Jun 06 09:58:04 2016 -0700
@@ -24,11 +24,11 @@
/**
* @test
* @bug 7128648
+ * @modules jdk.httpserver
* @summary HttpURLConnection.getHeaderFields should return an unmodifiable Map
*/
import java.io.IOException;
-import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.URI;
import java.net.HttpURLConnection;
@@ -40,6 +40,7 @@
import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpServer;
import com.sun.net.httpserver.Headers;
+import static java.net.Proxy.NO_PROXY;
public class UnmodifiableMaps {
@@ -47,8 +48,7 @@
HttpServer server = startHttpServer();
try {
InetSocketAddress address = server.getAddress();
- URI uri = new URI("http://" + InetAddress.getLocalHost().getHostAddress()
- + ":" + address.getPort() + "/foo");
+ URI uri = new URI("http://localhost:" + address.getPort() + "/foo");
doClient(uri);
} finally {
server.stop(0);
@@ -56,7 +56,7 @@
}
void doClient(URI uri) throws Exception {
- HttpURLConnection uc = (HttpURLConnection) uri.toURL().openConnection();
+ HttpURLConnection uc = (HttpURLConnection) uri.toURL().openConnection(NO_PROXY);
// Test1: getRequestProperties is unmodifiable
System.out.println("Check getRequestProperties");
--- a/jdk/test/java/net/URLConnection/HandleContentTypeWithAttrs.java Thu Jun 02 14:58:53 2016 -0700
+++ b/jdk/test/java/net/URLConnection/HandleContentTypeWithAttrs.java Mon Jun 06 09:58:04 2016 -0700
@@ -32,6 +32,7 @@
import java.io.*;
import sun.net.www.content.text.*;
import sun.net.www.MessageHeader;
+import static java.net.Proxy.NO_PROXY;
public class HandleContentTypeWithAttrs {
@@ -39,13 +40,11 @@
public HandleContentTypeWithAttrs (int port) throws Exception {
- String localHostName = InetAddress.getLocalHost().getHostName();
-
// Request echo.html from myHttpServer.
// In the header of the response, we make
// the content type have some attributes.
- url = new URL("http://" + localHostName + ":" + port + "/echo.html");
- URLConnection urlConn = url.openConnection();
+ url = new URL("http://localhost:" + port + "/echo.html");
+ URLConnection urlConn = url.openConnection(NO_PROXY);
// the method getContent() calls the method
// getContentHandler(). With the fix, the method
--- a/jdk/test/java/rmi/transport/dgcDeadLock/DGCDeadLock.java Thu Jun 02 14:58:53 2016 -0700
+++ b/jdk/test/java/rmi/transport/dgcDeadLock/DGCDeadLock.java Mon Jun 06 09:58:04 2016 -0700
@@ -23,6 +23,7 @@
/* @test
* @bug 4118056
+ * @key intermittent
*
* @summary synopsis: Distributed Garbage Collection Deadlock
* @author Laird Dornin
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ResourceBundle/modules/appbasic/appbasic.sh Mon Jun 06 09:58:04 2016 -0700
@@ -0,0 +1,68 @@
+#
+# 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
+# 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 8044767
+# @summary Basic test for ResourceBundle with modules; named module "test"
+# contains resource bundles for root and en, and separate named modules
+# "eubundles" and "asiabundles" contain other resource bundles.
+
+set -e
+
+if [ -z "$TESTJAVA" ]; then
+ if [ $# -lt 1 ]; then exit 1; fi
+ TESTJAVA="$1"; shift
+ COMPILEJAVA="${TESTJAVA}"
+ TESTSRC="`pwd`"
+ TESTCLASSES="`pwd`"
+fi
+
+JAVAC="$COMPILEJAVA/bin/javac"
+JAVA="$TESTJAVA/bin/java"
+
+
+for I in eu asia
+do
+ B=${I}bundles
+ mkdir -p mods/$B
+ CLASSES="`find $TESTSRC/src/$B -name '*.java'`"
+ if [ "x$CLASSES" != x ]; then
+ $JAVAC -g -d mods -modulesourcepath $TESTSRC/src -cp mods/test $CLASSES
+ fi
+ PROPS="`(cd $TESTSRC/src/$B; find . -name '*.properties')`"
+ if [ "x$PROPS" != x ]; then
+ for P in $PROPS
+ do
+ D=`dirname $P`
+ mkdir -p mods/$B/$D
+ cp $TESTSRC/src/$B/$P mods/$B/$D/
+ done
+ fi
+done
+
+mkdir -p mods/test
+$JAVAC -g -d mods -modulesourcepath $TESTSRC/src `find $TESTSRC/src/test -name "*.java"`
+
+$JAVA -mp mods -m test/jdk.test.Main de fr ja zh-tw en de
+
+exit $?
--- a/jdk/test/java/util/ResourceBundle/modules/appbasic/src/asiabundles/jdk/test/resources/asia/MyResourcesAsia.java Thu Jun 02 14:58:53 2016 -0700
+++ b/jdk/test/java/util/ResourceBundle/modules/appbasic/src/asiabundles/jdk/test/resources/asia/MyResourcesAsia.java Mon Jun 06 09:58:04 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
@@ -23,23 +23,33 @@
package jdk.test.resources.asia;
-import java.io.IOException;
import java.util.Locale;
import java.util.ResourceBundle;
-import java.util.ResourceBundle.Control;
-import jdk.test.resources.MyControl;
+import java.util.Set;
+import java.util.spi.AbstractResourceBundleProvider;
+
import jdk.test.resources.MyResourcesProvider;
-public class MyResourcesAsia extends MyControl implements MyResourcesProvider {
+public class MyResourcesAsia extends AbstractResourceBundleProvider
+ implements MyResourcesProvider
+{
+ private static Set<Locale> asiaLocales
+ = Set.of(Locale.JAPANESE, Locale.CHINESE, Locale.TAIWAN);
+
+ @Override
+ public String toBundleName(String baseName, Locale locale) {
+ String bundleName = super.toBundleName(baseName, locale);
+ if (asiaLocales.contains(locale)) {
+ int index = bundleName.lastIndexOf('.');
+ return bundleName.substring(0, index + 1) + "asia" + bundleName.substring(index);
+ }
+ return bundleName;
+ }
+
@Override
public ResourceBundle getBundle(String baseName, Locale locale) {
- if (isAsiaLocale(locale)) {
- try {
- ClassLoader loader = MyResourcesAsia.class.getClassLoader();
- return newBundle(baseName, locale, "java.properties", loader, false);
- } catch (IllegalAccessException | InstantiationException | IOException e) {
- System.out.println(e);
- }
+ if (asiaLocales.contains(locale)) {
+ return super.getBundle(baseName, locale);
}
return null;
}
--- a/jdk/test/java/util/ResourceBundle/modules/appbasic/src/eubundles/jdk/test/resources/eu/MyResourcesEU.java Thu Jun 02 14:58:53 2016 -0700
+++ b/jdk/test/java/util/ResourceBundle/modules/appbasic/src/eubundles/jdk/test/resources/eu/MyResourcesEU.java Mon Jun 06 09:58:04 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
@@ -23,23 +23,36 @@
package jdk.test.resources.eu;
-import java.io.IOException;
import java.util.Locale;
import java.util.ResourceBundle;
-import java.util.ResourceBundle.Control;
-import jdk.test.resources.MyControl;
+import java.util.Set;
+import java.util.spi.AbstractResourceBundleProvider;
+
import jdk.test.resources.MyResourcesProvider;
-public class MyResourcesEU extends MyControl implements MyResourcesProvider {
+public class MyResourcesEU extends AbstractResourceBundleProvider
+ implements MyResourcesProvider
+{
+ private static final Set<Locale> euLocales = Set.of(Locale.GERMAN, Locale.FRENCH);
+
+ public MyResourcesEU() {
+ super("java.class");
+ }
+
+ @Override
+ public String toBundleName(String baseName, Locale locale) {
+ String bundleName = super.toBundleName(baseName, locale);
+ if (euLocales.contains(locale)) {
+ int index = bundleName.lastIndexOf('.');
+ return bundleName.substring(0, index + 1) + "eu" + bundleName.substring(index);
+ }
+ return bundleName;
+ }
+
@Override
public ResourceBundle getBundle(String baseName, Locale locale) {
- if (isEULocale(locale)) {
- try {
- ClassLoader loader = MyResourcesEU.class.getClassLoader();
- return newBundle(baseName, locale, "java.class", loader, false);
- } catch (IllegalAccessException | InstantiationException | IOException e) {
- System.out.println(e);
- }
+ if (euLocales.contains(locale)) {
+ return super.getBundle(baseName, locale);
}
return null;
}
--- a/jdk/test/java/util/ResourceBundle/modules/appbasic/src/test/jdk/test/resources/MyControl.java Thu Jun 02 14:58:53 2016 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2015, 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 jdk.test.resources;
-
-import java.util.*;
-
-public class MyControl extends ResourceBundle.Control {
- private static final Set<Locale> euLocales, asiaLocales;
-
- static {
- euLocales = new HashSet<>(Arrays.asList(Locale.GERMAN, Locale.FRENCH));
- asiaLocales = new HashSet<>(Arrays.asList(Locale.JAPANESE, Locale.CHINESE, Locale.TAIWAN));
- }
-
- @Override
- public String toBundleName(String baseName, Locale locale) {
- String bundleName = baseName;
- if (euLocales.contains(locale)) {
- bundleName = addRegion(baseName, "eu");
- } else if (asiaLocales.contains(locale)) {
- bundleName = addRegion(baseName, "asia");
- }
- return super.toBundleName(bundleName, locale);
- }
-
- private String addRegion(String baseName, String region) {
- int index = baseName.lastIndexOf('.');
- return baseName.substring(0, index + 1) + region + baseName.substring(index);
- }
-
- protected static boolean isEULocale(Locale locale) {
- return euLocales.contains(locale);
- }
-
- protected static boolean isAsiaLocale(Locale locale) {
- return asiaLocales.contains(locale);
- }
-}
--- a/jdk/test/java/util/ResourceBundle/modules/appbasic/src/test/jdk/test/resources/MyResourcesProviderImpl.java Thu Jun 02 14:58:53 2016 -0700
+++ b/jdk/test/java/util/ResourceBundle/modules/appbasic/src/test/jdk/test/resources/MyResourcesProviderImpl.java Mon Jun 06 09:58:04 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
@@ -23,19 +23,20 @@
package jdk.test.resources;
-import java.io.IOException;
import java.util.Locale;
import java.util.ResourceBundle;
+import java.util.spi.AbstractResourceBundleProvider;
-public class MyResourcesProviderImpl extends MyControl implements MyResourcesProvider {
+public class MyResourcesProviderImpl extends AbstractResourceBundleProvider
+ implements MyResourcesProvider
+{
+ public MyResourcesProviderImpl() {
+ super("java.class");
+ }
@Override
public ResourceBundle getBundle(String baseName, Locale locale) {
if (locale.equals(Locale.ENGLISH) || locale.equals(Locale.ROOT)) {
- try {
- ClassLoader loader = MyResourcesProviderImpl.class.getClassLoader();
- return newBundle(baseName, locale, "java.class", loader, false);
- } catch (IllegalAccessException | InstantiationException | IOException e) {
- }
+ return super.getBundle(baseName, locale);
}
return null;
}
--- a/jdk/test/java/util/regex/RegExTest.java Thu Jun 02 14:58:53 2016 -0700
+++ b/jdk/test/java/util/regex/RegExTest.java Mon Jun 06 09:58:04 2016 -0700
@@ -34,7 +34,7 @@
* 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
+ * 6328855 6192895 6345469 6988218 6693451 7006761 8140212 8143282 8158482
*
* @library /lib/testlibrary
* @build jdk.testlibrary.*
@@ -164,6 +164,7 @@
groupCurlyBackoffTest();
patternAsPredicate();
invalidFlags();
+ embeddedFlags();
grapheme();
expoBacktracking();
@@ -4675,6 +4676,24 @@
report("Invalid compile flags");
}
+ // This test is for 8158482
+ private static void embeddedFlags() throws Exception {
+ try {
+ Pattern.compile("(?i).(?-i).");
+ Pattern.compile("(?m).(?-m).");
+ Pattern.compile("(?s).(?-s).");
+ Pattern.compile("(?d).(?-d).");
+ Pattern.compile("(?u).(?-u).");
+ Pattern.compile("(?c).(?-c).");
+ Pattern.compile("(?x).(?-x).");
+ Pattern.compile("(?U).(?-U).");
+ Pattern.compile("(?imsducxU).(?-imsducxU).");
+ } catch (PatternSyntaxException x) {
+ failCount++;
+ }
+ report("Embedded flags");
+ }
+
private static void grapheme() throws Exception {
Files.lines(Paths.get(System.getProperty("test.src", "."),
"GraphemeBreakTest.txt"))