--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/aix/native/libjli/java_md_aix.c Thu Sep 22 18:31:42 2016 +0000
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2016 SAP SE. 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.
+ */
+#include <stdio.h>
+#include <sys/ldr.h>
+
+#include "java_md_aix.h"
+
+static unsigned char dladdr_buffer[0x4000];
+
+static int fill_dll_info(void) {
+ return loadquery(L_GETINFO, dladdr_buffer, sizeof(dladdr_buffer));
+}
+
+static int dladdr_dont_reload(void *addr, Dl_info *info) {
+ const struct ld_info *p = (struct ld_info *)dladdr_buffer;
+ memset((void *)info, 0, sizeof(Dl_info));
+ for (;;) {
+ if (addr >= p->ldinfo_textorg &&
+ addr < (((char*)p->ldinfo_textorg) + p->ldinfo_textsize))
+ {
+ info->dli_fname = p->ldinfo_filename;
+ return 1;
+ }
+ if (!p->ldinfo_next) {
+ break;
+ }
+ p = (struct ld_info *)(((char *)p) + p->ldinfo_next);
+ }
+ return 0;
+}
+
+int dladdr(void *addr, Dl_info *info) {
+ static int loaded = 0;
+ int rc = 0;
+ void *addr0;
+ if (!addr) {
+ return rc;
+ }
+ if (!loaded) {
+ if (fill_dll_info() == -1)
+ return rc;
+ loaded = 1;
+ }
+
+ // first try with addr on cached data
+ rc = dladdr_dont_reload(addr, info);
+
+ // addr could be an AIX function descriptor, so try dereferenced version
+ if (rc == 0) {
+ addr0 = *((void **)addr);
+ rc = dladdr_dont_reload(addr0, info);
+ }
+
+ // if we had no success until now, maybe loadquery info is outdated.
+ // refresh and retry
+ if (rc == 0) {
+ if (fill_dll_info() == -1)
+ return rc;
+ rc = dladdr_dont_reload(addr, info);
+ if (rc == 0) {
+ rc = dladdr_dont_reload(addr0, info);
+ }
+ }
+ return rc;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/aix/native/libjli/java_md_aix.h Thu Sep 22 18:31:42 2016 +0000
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2016 SAP SE. 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.
+ */
+
+#ifndef JAVA_MD_AIX_H
+#define JAVA_MD_AIX_H
+
+/*
+ * Very limited AIX port of dladdr() for libjli.so.
+ *
+ * We try to mimick dladdr(3) on Linux (see http://linux.die.net/man/3/dladdr)
+ * dladdr(3) is not POSIX but a GNU extension, and is not available on AIX.
+ *
+ * We only support Dl_info.dli_fname here as this is the only thing that is
+ * used of it by libjli.so. A more comprehensive port of dladdr can be found
+ * in the hotspot implementation which is not available at this place, though.
+ */
+
+typedef struct {
+ const char *dli_fname; /* file path of loaded library */
+ void *dli_fbase; /* unsupported */
+ const char *dli_sname; /* unsupported */
+ void *dli_saddr; /* unsupported */
+} Dl_info;
+
+int dladdr(void *addr, Dl_info *info);
+
+#endif /* JAVA_MD_AIX_H */
--- a/jdk/src/java.base/share/classes/java/lang/StackStreamFactory.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/StackStreamFactory.java Thu Sep 22 18:31:42 2016 +0000
@@ -71,6 +71,7 @@
// These flags must match the values maintained in the VM
@Native private static final int DEFAULT_MODE = 0x0;
@Native private static final int FILL_CLASS_REFS_ONLY = 0x2;
+ @Native private static final int GET_CALLER_CLASS = 0x4;
@Native private static final int SHOW_HIDDEN_FRAMES = 0x20; // LambdaForms are hidden by the VM
@Native private static final int FILL_LIVE_STACK_FRAMES = 0x100;
/*
@@ -614,9 +615,7 @@
private Class<?> caller;
CallerClassFinder(StackWalker walker) {
- super(walker, FILL_CLASS_REFS_ONLY);
- assert (mode & FILL_CLASS_REFS_ONLY) == FILL_CLASS_REFS_ONLY
- : "mode should contain FILL_CLASS_REFS_ONLY";
+ super(walker, FILL_CLASS_REFS_ONLY|GET_CALLER_CLASS);
}
final class ClassBuffer extends FrameBuffer<Class<?>> {
--- a/jdk/src/java.base/share/classes/java/lang/module/ModuleInfo.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/module/ModuleInfo.java Thu Sep 22 18:31:42 2016 +0000
@@ -664,7 +664,7 @@
try {
bb.get(b, off, len);
} catch (BufferUnderflowException e) {
- throw new EOFException();
+ throw new EOFException(e.getMessage());
}
}
@@ -681,7 +681,7 @@
int ch = bb.get();
return (ch != 0);
} catch (BufferUnderflowException e) {
- throw new EOFException();
+ throw new EOFException(e.getMessage());
}
}
@@ -690,7 +690,7 @@
try {
return bb.get();
} catch (BufferUnderflowException e) {
- throw new EOFException();
+ throw new EOFException(e.getMessage());
}
}
@@ -699,7 +699,7 @@
try {
return ((int) bb.get()) & 0xff;
} catch (BufferUnderflowException e) {
- throw new EOFException();
+ throw new EOFException(e.getMessage());
}
}
@@ -708,7 +708,7 @@
try {
return bb.getShort();
} catch (BufferUnderflowException e) {
- throw new EOFException();
+ throw new EOFException(e.getMessage());
}
}
@@ -717,7 +717,7 @@
try {
return ((int) bb.getShort()) & 0xffff;
} catch (BufferUnderflowException e) {
- throw new EOFException();
+ throw new EOFException(e.getMessage());
}
}
@@ -726,7 +726,7 @@
try {
return bb.getChar();
} catch (BufferUnderflowException e) {
- throw new EOFException();
+ throw new EOFException(e.getMessage());
}
}
@@ -735,7 +735,7 @@
try {
return bb.getInt();
} catch (BufferUnderflowException e) {
- throw new EOFException();
+ throw new EOFException(e.getMessage());
}
}
@@ -744,7 +744,7 @@
try {
return bb.getLong();
} catch (BufferUnderflowException e) {
- throw new EOFException();
+ throw new EOFException(e.getMessage());
}
}
@@ -753,7 +753,7 @@
try {
return bb.getFloat();
} catch (BufferUnderflowException e) {
- throw new EOFException();
+ throw new EOFException(e.getMessage());
}
}
@@ -762,7 +762,7 @@
try {
return bb.getDouble();
} catch (BufferUnderflowException e) {
- throw new EOFException();
+ throw new EOFException(e.getMessage());
}
}
--- a/jdk/src/java.base/share/classes/java/lang/reflect/Proxy.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/Proxy.java Thu Sep 22 18:31:42 2016 +0000
@@ -597,10 +597,10 @@
private final Module module;
ProxyBuilder(ClassLoader loader, List<Class<?>> interfaces) {
if (!VM.isModuleSystemInited()) {
- throw new InternalError("Proxy is not supported until module system is fully initialzed");
+ throw new InternalError("Proxy is not supported until module system is fully initialized");
}
if (interfaces.size() > 65535) {
- throw new IllegalArgumentException("interface limit exceeded");
+ throw new IllegalArgumentException("interface limit exceeded: " + interfaces.size());
}
Set<Class<?>> refTypes = referencedTypes(loader, interfaces);
--- a/jdk/src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java Thu Sep 22 18:31:42 2016 +0000
@@ -186,7 +186,9 @@
if (result.getMajorVersion() != ImageHeader.MAJOR_VERSION ||
result.getMinorVersion() != ImageHeader.MINOR_VERSION) {
- throw new IOException("The image file \"" + name + "\" is not the correct version");
+ throw new IOException("The image file \"" + name + "\" is not " +
+ "the correct version. Major: " + result.getMajorVersion() +
+ ". Minor: " + result.getMinorVersion());
}
return result;
@@ -318,11 +320,11 @@
private ByteBuffer readBuffer(long offset, long size) {
if (offset < 0 || Integer.MAX_VALUE <= offset) {
- throw new IndexOutOfBoundsException("offset");
+ throw new IndexOutOfBoundsException("Bad offset: " + offset);
}
if (size < 0 || Integer.MAX_VALUE <= size) {
- throw new IndexOutOfBoundsException("size");
+ throw new IndexOutOfBoundsException("Bad size: " + size);
}
if (MAP_ALL) {
@@ -382,11 +384,13 @@
long uncompressedSize = loc.getUncompressedSize();
if (compressedSize < 0 || Integer.MAX_VALUE < compressedSize) {
- throw new IndexOutOfBoundsException("Compressed size");
+ throw new IndexOutOfBoundsException(
+ "Bad compressed size: " + compressedSize);
}
if (uncompressedSize < 0 || Integer.MAX_VALUE < uncompressedSize) {
- throw new IndexOutOfBoundsException("Uncompressed size");
+ throw new IndexOutOfBoundsException(
+ "Bad uncompressed size: " + uncompressedSize);
}
if (compressedSize == 0) {
--- a/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageHeader.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageHeader.java Thu Sep 22 18:31:42 2016 +0000
@@ -79,7 +79,8 @@
Objects.requireNonNull(buffer);
if (buffer.capacity() != HEADER_SLOTS) {
- throw new InternalError("jimage header not the correct size");
+ throw new InternalError(
+ "jimage header not the correct size: " + buffer.capacity());
}
int magic = buffer.get(0);
--- a/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageLocation.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageLocation.java Thu Sep 22 18:31:42 2016 +0000
@@ -81,7 +81,8 @@
}
if (kind < ATTRIBUTE_END || ATTRIBUTE_COUNT <= kind) {
- throw new InternalError("Invalid jimage attribute kind");
+ throw new InternalError(
+ "Invalid jimage attribute kind: " + kind);
}
int length = attributeLength(data);
@@ -91,7 +92,7 @@
value <<= 8;
if (!bytes.hasRemaining()) {
- throw new InternalError("\"Missing jimage attribute datad");
+ throw new InternalError("Missing jimage attribute data");
}
value |= bytes.get() & 0xFF;
@@ -134,7 +135,8 @@
long getAttribute(int kind) {
if (kind < ATTRIBUTE_END || ATTRIBUTE_COUNT <= kind) {
- throw new InternalError("Invalid jimage attribute kind");
+ throw new InternalError(
+ "Invalid jimage attribute kind: " + kind);
}
return attributes[kind];
@@ -142,7 +144,8 @@
String getAttributeString(int kind) {
if (kind < ATTRIBUTE_END || ATTRIBUTE_COUNT <= kind) {
- throw new InternalError("Invalid jimage attribute kind");
+ throw new InternalError(
+ "Invalid jimage attribute kind: " + kind);
}
return getStrings().get((int)attributes[kind]);
--- a/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageStream.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageStream.java Thu Sep 22 18:31:42 2016 +0000
@@ -82,7 +82,7 @@
public void ensure(int needs) {
if (needs < 0) {
- throw new IndexOutOfBoundsException("needs");
+ throw new IndexOutOfBoundsException("Bad value: " + needs);
}
if (needs > buffer.remaining()) {
@@ -106,7 +106,7 @@
public void skip(int n) {
if (n < 0) {
- throw new IndexOutOfBoundsException("n");
+ throw new IndexOutOfBoundsException("skip value = " + n);
}
buffer.position(buffer.position() + n);
--- a/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageStringsReader.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageStringsReader.java Thu Sep 22 18:31:42 2016 +0000
@@ -151,7 +151,7 @@
try {
charsFromMUTF8(chars, bytes, offset, count);
} catch (UTFDataFormatException ex) {
- throw new InternalError("Attempt to convert non modified UTF-8 byte sequence");
+ throw new InternalError("Attempt to convert non modified UTF-8 byte sequence", ex);
}
return new String(chars);
@@ -199,7 +199,8 @@
ch = buffer.get();
if ((ch & 0xC0) != 0x80) {
- throw new InternalError("Bad continuation in modified UTF-8 byte sequence");
+ throw new InternalError("Bad continuation in " +
+ "modified UTF-8 byte sequence: " + ch);
}
uch = ((uch & ~mask) << 6) | (ch & 0x3F);
@@ -208,7 +209,8 @@
}
if ((uch & 0xFFFF) != uch) {
- throw new InternalError("UTF-32 char in modified UTF-8 byte sequence");
+ throw new InternalError("UTF-32 char in modified UTF-8 " +
+ "byte sequence: " + uch);
}
chars[j++] = (char)uch;
--- a/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystem.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystem.java Thu Sep 22 18:31:42 2016 +0000
@@ -183,7 +183,7 @@
public PathMatcher getPathMatcher(String syntaxAndInput) {
int pos = syntaxAndInput.indexOf(':');
if (pos <= 0 || pos == syntaxAndInput.length()) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("pos is " + pos);
}
String syntax = syntaxAndInput.substring(0, pos);
String input = syntaxAndInput.substring(pos + 1);
@@ -285,7 +285,8 @@
for (OpenOption option : options) {
Objects.requireNonNull(option);
if (!(option instanceof StandardOpenOption)) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(
+ "option class: " + option.getClass());
}
}
if (options.contains(StandardOpenOption.WRITE) ||
--- a/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtPath.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtPath.java Thu Sep 22 18:31:42 2016 +0000
@@ -122,7 +122,8 @@
public final JrtPath getName(int index) {
initOffsets();
if (index < 0 || index >= offsets.length) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("index: " +
+ index + ", offsets length: " + offsets.length);
}
int begin = offsets[index];
int end;
@@ -139,7 +140,9 @@
initOffsets();
if (beginIndex < 0 || endIndex > offsets.length ||
beginIndex >= endIndex) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(
+ "beginIndex: " + beginIndex + ", endIndex: " + endIndex +
+ ", offsets length: " + offsets.length);
}
// starting/ending offsets
int begin = offsets[beginIndex];
@@ -211,7 +214,8 @@
return o;
}
if (jrtfs != o.jrtfs || isAbsolute() != o.isAbsolute()) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(
+ "Incorrect filesystem or path: " + other);
}
final String tp = this.path;
final String op = o.path;
@@ -366,7 +370,8 @@
private JrtPath checkPath(Path path) {
Objects.requireNonNull(path);
if (!(path instanceof JrtPath))
- throw new ProviderMismatchException();
+ throw new ProviderMismatchException("path class: " +
+ path.getClass());
return (JrtPath) path;
}
@@ -459,7 +464,7 @@
}
if (c == '\u0000') {
throw new InvalidPathException(path,
- "Path: nul character not allowed");
+ "Path: NUL character not allowed");
}
to.append(c);
prevC = c;
--- a/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java Thu Sep 22 18:31:42 2016 +0000
@@ -1603,11 +1603,50 @@
return weakCompareAndSwapShort(o, offset, c2s(expected), c2s(x));
}
+ /**
+ * The JVM converts integral values to boolean values using two
+ * different conventions, byte testing against zero and truncation
+ * to least-significant bit.
+ *
+ * <p>The JNI documents specify that, at least for returning
+ * values from native methods, a Java boolean value is converted
+ * to the value-set 0..1 by first truncating to a byte (0..255 or
+ * maybe -128..127) and then testing against zero. Thus, Java
+ * booleans in non-Java data structures are by convention
+ * represented as 8-bit containers containing either zero (for
+ * false) or any non-zero value (for true).
+ *
+ * <p>Java booleans in the heap are also stored in bytes, but are
+ * strongly normalized to the value-set 0..1 (i.e., they are
+ * truncated to the least-significant bit).
+ *
+ * <p>The main reason for having different conventions for
+ * conversion is performance: Truncation to the least-significant
+ * bit can be usually implemented with fewer (machine)
+ * instructions than byte testing against zero.
+ *
+ * <p>A number of Unsafe methods load boolean values from the heap
+ * as bytes. Unsafe converts those values according to the JNI
+ * rules (i.e, using the "testing against zero" convention). The
+ * method {@code byte2bool} implements that conversion.
+ *
+ * @param b the byte to be converted to boolean
+ * @return the result of the conversion
+ */
@ForceInline
private boolean byte2bool(byte b) {
- return b > 0;
- }
-
+ return b != 0;
+ }
+
+ /**
+ * Convert a boolean value to a byte. The return value is strongly
+ * normalized to the value-set 0..1 (i.e., the value is truncated
+ * to the least-significant bit). See {@link #byte2bool(byte)} for
+ * more details on conversion conventions.
+ *
+ * @param b the boolean to be converted to byte (and then normalized)
+ * @return the result of the conversion
+ */
@ForceInline
private byte bool2byte(boolean b) {
return b ? (byte)1 : (byte)0;
--- a/jdk/src/java.base/share/classes/jdk/internal/misc/VM.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/VM.java Thu Sep 22 18:31:42 2016 +0000
@@ -50,7 +50,7 @@
public static void initLevel(int value) {
synchronized (lock) {
if (value <= initLevel || value > SYSTEM_BOOTED)
- throw new InternalError();
+ throw new InternalError("Bad level: " + value);
initLevel = value;
lock.notifyAll();
}
--- a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java Thu Sep 22 18:31:42 2016 +0000
@@ -153,27 +153,24 @@
boolean addAllDefaultModules = false;
boolean addAllSystemModules = false;
boolean addAllApplicationModules = false;
- String propValue = getAndRemoveProperty("jdk.module.addmods");
- if (propValue != null) {
- for (String mod: propValue.split(",")) {
- switch (mod) {
- case ALL_DEFAULT:
- addAllDefaultModules = true;
- break;
- case ALL_SYSTEM:
- addAllSystemModules = true;
- break;
- case ALL_MODULE_PATH:
- addAllApplicationModules = true;
- break;
- default :
- roots.add(mod);
- }
+ for (String mod: getExtraAddModules()) {
+ switch (mod) {
+ case ALL_DEFAULT:
+ addAllDefaultModules = true;
+ break;
+ case ALL_SYSTEM:
+ addAllSystemModules = true;
+ break;
+ case ALL_MODULE_PATH:
+ addAllApplicationModules = true;
+ break;
+ default :
+ roots.add(mod);
}
}
// --limit-modules
- propValue = getAndRemoveProperty("jdk.module.limitmods");
+ String propValue = getAndRemoveProperty("jdk.module.limitmods");
if (propValue != null) {
Set<String> mods = new HashSet<>();
for (String mod: propValue.split(",")) {
@@ -392,6 +389,32 @@
}
}
+ /**
+ * Returns the set of module names specified via --add-modules options
+ * on the command line
+ */
+ private static Set<String> getExtraAddModules() {
+ String prefix = "jdk.module.addmods.";
+ int index = 0;
+
+ // the system property is removed after decoding
+ String value = getAndRemoveProperty(prefix + index);
+ if (value == null) {
+ return Collections.emptySet();
+ }
+
+ Set<String> modules = new HashSet<>();
+ while (value != null) {
+ for (String s : value.split(",")) {
+ if (s.length() > 0) modules.add(s);
+ }
+
+ index++;
+ value = getAndRemoveProperty(prefix + index);
+ }
+
+ return modules;
+ }
/**
* Process the --add-reads options to add any additional read edges that
@@ -514,7 +537,7 @@
// value is <module>(,<module>)*
if (map.containsKey(key))
- fail(key + " specified more than once");
+ fail(key + " specified more than once");
Set<String> values = new HashSet<>();
map.put(key, values);
--- a/jdk/src/java.base/share/classes/sun/security/provider/SeedGenerator.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/provider/SeedGenerator.java Thu Sep 22 18:31:42 2016 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -344,7 +344,8 @@
try {
BogusThread bt = new BogusThread();
Thread t = new Thread
- (seedGroup, bt, "SeedGenerator Thread", 0, false);
+ (seedGroup, bt, "SeedGenerator Thread", 0,
+ false);
t.start();
} catch (Exception e) {
throw new InternalError("internal error: " +
@@ -357,7 +358,8 @@
long startTime = System.nanoTime();
while (System.nanoTime() - startTime < 250000000) {
synchronized(this){};
- latch++;
+ // Mask the sign bit and keep latch non-negative
+ latch = (latch + 1) & 0x1FFFFFFF;
}
// Translate the value using the permutation, and xor
@@ -431,7 +433,7 @@
// data and using it to mix the trivial permutation.
// It should be evenly distributed. The specific values
// are not crucial to the security of this class.
- private static byte[] rndTab = {
+ private static final byte[] rndTab = {
56, 30, -107, -6, -86, 25, -83, 75, -12, -64,
5, -128, 78, 21, 16, 32, 70, -81, 37, -51,
-43, -46, -108, 87, 29, 17, -55, 22, -11, -111,
--- a/jdk/src/java.base/share/native/include/jvm.h Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/src/java.base/share/native/include/jvm.h Thu Sep 22 18:31:42 2016 +0000
@@ -179,6 +179,7 @@
*/
enum {
JVM_STACKWALK_FILL_CLASS_REFS_ONLY = 0x2,
+ JVM_STACKWALK_GET_CALLER_CLASS = 0x04,
JVM_STACKWALK_SHOW_HIDDEN_FRAMES = 0x20,
JVM_STACKWALK_FILL_LIVE_STACK_FRAMES = 0x100
};
--- a/jdk/src/java.base/unix/native/libjava/ProcessImpl_md.c Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/src/java.base/unix/native/libjava/ProcessImpl_md.c Thu Sep 22 18:31:42 2016 +0000
@@ -152,8 +152,8 @@
#ifdef __solaris__
/* These really are the Solaris defaults! */
return (geteuid() == 0 || getuid() == 0) ?
- "/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin:/usr/sbin" :
- "/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin:";
+ "/usr/xpg4/bin:/usr/bin:/opt/SUNWspro/bin:/usr/sbin" :
+ "/usr/xpg4/bin:/usr/bin:/opt/SUNWspro/bin:";
#else
return ":/bin:/usr/bin"; /* glibc */
#endif
--- a/jdk/src/java.base/unix/native/libjli/java_md.h Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/src/java.base/unix/native/libjli/java_md.h Thu Sep 22 18:31:42 2016 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -35,12 +35,12 @@
#include "manifest_info.h"
#include "jli_util.h"
-#define PATH_SEPARATOR ':'
-#define FILESEP "/"
-#define FILE_SEPARATOR '/'
+#define PATH_SEPARATOR ':'
+#define FILESEP "/"
+#define FILE_SEPARATOR '/'
#define IS_FILE_SEPARATOR(c) ((c) == '/')
#ifndef MAXNAMELEN
-#define MAXNAMELEN PATH_MAX
+#define MAXNAMELEN PATH_MAX
#endif
#ifdef _LP64
@@ -59,10 +59,13 @@
static jboolean GetJREPath(char *path, jint pathsize, const char * arch,
jboolean speculative);
+#if defined(_AIX)
+#include "java_md_aix.h"
+#endif
+
#ifdef MACOSX
#include "java_md_macosx.h"
#else /* !MACOSX */
#include "java_md_solinux.h"
#endif /* MACOSX */
-
#endif /* JAVA_MD_H */
--- a/jdk/src/java.desktop/share/classes/com/sun/beans/finder/ConstructorFinder.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/beans/finder/ConstructorFinder.java Thu Sep 22 18:31:42 2016 +0000
@@ -67,19 +67,22 @@
*/
public static Constructor<?> findConstructor(Class<?> type, Class<?>...args) throws NoSuchMethodException {
if (type.isPrimitive()) {
- throw new NoSuchMethodException("Primitive wrapper does not contain constructors");
+ throw new NoSuchMethodException("Primitive wrapper does not contain constructors: "
+ + type.getName());
}
if (type.isInterface()) {
- throw new NoSuchMethodException("Interface does not contain constructors");
+ throw new NoSuchMethodException("Interface does not contain constructors: "
+ + type.getName());
}
if (!FinderUtils.isExported(type)) {
- throw new NoSuchMethodException("Class is not accessible");
+ throw new NoSuchMethodException("Class is not accessible: " + type.getName());
}
if (Modifier.isAbstract(type.getModifiers())) {
- throw new NoSuchMethodException("Abstract class cannot be instantiated");
+ throw new NoSuchMethodException("Abstract class cannot be instantiated: "
+ + type.getName());
}
if (!Modifier.isPublic(type.getModifiers()) || !isPackageAccessible(type)) {
- throw new NoSuchMethodException("Class is not accessible");
+ throw new NoSuchMethodException("Class is not accessible: " + type.getName());
}
PrimitiveWrapperMap.replacePrimitivesWithWrappers(args);
Signature signature = new Signature(type, args);
--- a/jdk/src/java.desktop/share/classes/javax/imageio/ImageReader.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/ImageReader.java Thu Sep 22 18:31:42 2016 +0000
@@ -2461,16 +2461,16 @@
try {
bundle = ResourceBundle.getBundle(baseName, locale, this.getClass().getModule());
} catch (MissingResourceException mre) {
- throw new IllegalArgumentException("Bundle not found!");
+ throw new IllegalArgumentException("Bundle not found!", mre);
}
String warning = null;
try {
warning = bundle.getString(keyword);
} catch (ClassCastException cce) {
- throw new IllegalArgumentException("Resource is not a String!");
+ throw new IllegalArgumentException("Resource is not a String!", cce);
} catch (MissingResourceException mre) {
- throw new IllegalArgumentException("Resource is missing!");
+ throw new IllegalArgumentException("Resource is missing!", mre);
}
listener.warningOccurred(this, warning);
--- a/jdk/src/java.desktop/share/classes/javax/imageio/ImageWriter.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/ImageWriter.java Thu Sep 22 18:31:42 2016 +0000
@@ -1963,16 +1963,16 @@
try {
bundle = ResourceBundle.getBundle(baseName, locale, this.getClass().getModule());
} catch (MissingResourceException mre) {
- throw new IllegalArgumentException("Bundle not found!");
+ throw new IllegalArgumentException("Bundle not found!", mre);
}
String warning = null;
try {
warning = bundle.getString(keyword);
} catch (ClassCastException cce) {
- throw new IllegalArgumentException("Resource is not a String!");
+ throw new IllegalArgumentException("Resource is not a String!", cce);
} catch (MissingResourceException mre) {
- throw new IllegalArgumentException("Resource is missing!");
+ throw new IllegalArgumentException("Resource is missing!", mre);
}
listener.warningOccurred(this, imageIndex, warning);
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c Thu Sep 22 18:31:42 2016 +0000
@@ -442,7 +442,7 @@
#ifndef __linux__ /* SOLARIS */
if (xrenderLibHandle == NULL) {
- xrenderLibHandle = dlopen("/usr/sfw/lib/libXrender.so.1",
+ xrenderLibHandle = dlopen("/usr/lib/libXrender.so.1",
RTLD_LAZY | RTLD_GLOBAL);
}
#endif
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/Secmod.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/Secmod.java Thu Sep 22 18:31:42 2016 +0000
@@ -45,7 +45,7 @@
* <pre>
* Secmod secmod = Secmod.getInstance();
* if (secmod.isInitialized() == false) {
- * secmod.initialize("/home/myself/.mozilla", "/usr/sfw/lib/mozilla");
+ * secmod.initialize("/home/myself/.mozilla");
* }
*
* Provider p = secmod.getModule(ModuleType.KEYSTORE).getProvider();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/StackWalker/CallerSensitiveMethod/Main.java Thu Sep 22 18:31:42 2016 +0000
@@ -0,0 +1,35 @@
+/*
+ * 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 8157464
+ * @summary Basic test for StackWalker.getCallerClass()
+ * @library src
+ * @build java.base/java.util.CSM csm/*
+ * @run main/othervm csm/jdk.test.CallerSensitiveTest
+ * @run main/othervm csm/jdk.test.CallerSensitiveTest sm
+ */
+public class Main {
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/StackWalker/CallerSensitiveMethod/csm/jdk/test/CallerSensitiveTest.java Thu Sep 22 18:31:42 2016 +0000
@@ -0,0 +1,159 @@
+/*
+ * 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 jdk.test;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodHandles.Lookup;
+import java.lang.invoke.MethodType;
+import java.lang.reflect.Method;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.security.Policy;
+import java.security.ProtectionDomain;
+import java.util.CSM.Result;
+import java.util.function.Supplier;
+
+/**
+ * This test invokes StackWalker::getCallerClass via static reference,
+ * reflection, MethodHandle, lambda. Also verify that
+ * StackWalker::getCallerClass can't be called from @CallerSensitive method.
+ */
+public class CallerSensitiveTest {
+ private static final String NON_CSM_CALLER_METHOD = "getCallerClass";
+ private static final String CSM_CALLER_METHOD = "caller";
+
+ public static void main(String... args) throws Throwable {
+ boolean sm = false;
+ if (args.length > 0 && args[0].equals("sm")) {
+ sm = true;
+ PermissionCollection perms = new Permissions();
+ perms.add(new StackFramePermission("retainClassReference"));
+ Policy.setPolicy(new Policy() {
+ @Override
+ public boolean implies(ProtectionDomain domain, Permission p) {
+ return perms.implies(p);
+ }
+ });
+ System.setSecurityManager(new SecurityManager());
+ }
+
+ System.err.format("Test %s security manager.%n",
+ sm ? "with" : "without");
+
+ CallerSensitiveTest cstest = new CallerSensitiveTest();
+ // test static call to java.util.CSM::caller and CSM::getCallerClass
+ cstest.staticMethodCall();
+ // test java.lang.reflect.Method call
+ cstest.reflectMethodCall();
+ // test java.lang.invoke.MethodHandle
+ cstest.invokeMethodHandle(Lookup1.lookup);
+ cstest.invokeMethodHandle(Lookup2.lookup);
+ // test method ref
+ cstest.lambda();
+
+ LambdaTest.lambda();
+
+ if (failed > 0) {
+ throw new RuntimeException(failed + " test cases failed.");
+ }
+ }
+
+ void staticMethodCall() {
+ java.util.CSM.caller();
+
+ Result result = java.util.CSM.getCallerClass();
+ checkNonCSMCaller(CallerSensitiveTest.class, result);
+ }
+
+ void reflectMethodCall() throws Throwable {
+ Method method1 = java.util.CSM.class.getMethod(CSM_CALLER_METHOD);
+ method1.invoke(null);
+
+ Method method2 = java.util.CSM.class.getMethod(NON_CSM_CALLER_METHOD);
+ Result result = (Result) method2.invoke(null);
+ checkNonCSMCaller(CallerSensitiveTest.class, result);
+ }
+
+ void invokeMethodHandle(Lookup lookup) throws Throwable {
+ MethodHandle mh1 = lookup.findStatic(java.util.CSM.class, CSM_CALLER_METHOD,
+ MethodType.methodType(Class.class));
+ Class<?> c = (Class<?>)mh1.invokeExact();
+
+ MethodHandle mh2 = lookup.findStatic(java.util.CSM.class, NON_CSM_CALLER_METHOD,
+ MethodType.methodType(Result.class));
+ Result result = (Result)mh2.invokeExact();
+ checkNonCSMCaller(CallerSensitiveTest.class, result);
+ }
+
+ void lambda() {
+ Result result = LambdaTest.getCallerClass.get();
+ checkNonCSMCaller(CallerSensitiveTest.class, result);
+
+ LambdaTest.caller.get();
+ }
+
+ static int failed = 0;
+
+ static void checkNonCSMCaller(Class<?> expected, Result result) {
+ if (result.callers.size() != 1) {
+ throw new RuntimeException("Expected result.callers contain one element");
+ }
+ if (expected != result.callers.get(0)) {
+ System.err.format("ERROR: Expected %s but got %s%n", expected,
+ result.callers);
+ result.frames.stream()
+ .forEach(f -> System.err.println(" " + f));
+ failed++;
+ }
+ }
+
+ static class Lookup1 {
+ static Lookup lookup = MethodHandles.lookup();
+ }
+
+ static class Lookup2 {
+ static Lookup lookup = MethodHandles.lookup();
+ }
+
+ static class LambdaTest {
+ static Supplier<Class<?>> caller = java.util.CSM::caller;
+ static Supplier<Result> getCallerClass = java.util.CSM::getCallerClass;
+
+ static void caller() {
+ caller.get();
+ }
+ static Result getCallerClass() {
+ return getCallerClass.get();
+ }
+
+ static void lambda() {
+ Result result = LambdaTest.getCallerClass();
+ checkNonCSMCaller(LambdaTest.class, result);
+
+ LambdaTest.caller();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/StackWalker/CallerSensitiveMethod/csm/module-info.java Thu Sep 22 18:31:42 2016 +0000
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+module csm {
+ exports jdk.test;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/StackWalker/CallerSensitiveMethod/src/java.base/java/util/CSM.java Thu Sep 22 18:31:42 2016 +0000
@@ -0,0 +1,77 @@
+/*
+ * 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 java.util;
+
+import static java.lang.StackWalker.Option.*;
+import java.lang.StackWalker.StackFrame;
+import java.util.stream.Collectors;
+
+import jdk.internal.reflect.CallerSensitive;
+import jdk.internal.reflect.Reflection;
+
+public class CSM {
+ private static StackWalker walker =
+ StackWalker.getInstance(EnumSet.of(RETAIN_CLASS_REFERENCE,
+ SHOW_HIDDEN_FRAMES,
+ SHOW_REFLECT_FRAMES));
+
+ public static class Result {
+ public final List<Class<?>> callers;
+ public final List<StackWalker.StackFrame> frames;
+ Result(List<Class<?>> callers,
+ List<StackFrame> frames) {
+ this.callers = callers;
+ this.frames = frames;
+ }
+ }
+
+ /**
+ * Returns the caller of this caller-sensitive method returned by
+ * by Reflection::getCallerClass.
+ *
+ * StackWalker::getCallerClass is expected to throw UOE
+ */
+ @CallerSensitive
+ public static Class<?> caller() {
+ Class<?> c1 = Reflection.getCallerClass();
+
+ try {
+ Class<?> c2 = walker.getCallerClass();
+ throw new RuntimeException("Exception not thrown by StackWalker::getCallerClass");
+ } catch (UnsupportedOperationException e) {}
+ return c1;
+ }
+
+ /**
+ * Returns the caller of this non-caller-sensitive method.
+ */
+ public static Result getCallerClass() {
+ Class<?> caller = walker.getCallerClass();
+ return new Result(List.of(caller), dump());
+ }
+
+ static List<StackFrame> dump() {
+ return walker.walk(s -> s.collect(Collectors.toList()));
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/instrument/SimpleAgent.java Thu Sep 22 18:31:42 2016 +0000
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+import java.lang.instrument.Instrumentation;
+
+class SimpleAgent {
+
+ public static void premain(String args, Instrumentation inst) {
+ System.out.println("in premain");
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/instrument/TestAgentWithLimitMods.java Thu Sep 22 18:31:42 2016 +0000
@@ -0,0 +1,40 @@
+/*
+ * 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
+ * @summary Tests that the -javaagent option adds the java.instrument into
+ * the module graph
+ * @modules java.instrument
+ * @run shell MakeJAR3.sh SimpleAgent
+ * @run main/othervm -javaagent:SimpleAgent.jar -limitmods java.base TestAgentWithLimitMods
+ *
+ */
+public class TestAgentWithLimitMods {
+
+ public static void main(String[] args) {
+ System.out.println("Test passed");
+ }
+
+}
--- a/jdk/test/java/net/URLClassLoader/definePackage/SplitPackage.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/test/java/net/URLClassLoader/definePackage/SplitPackage.java Thu Sep 22 18:31:42 2016 +0000
@@ -27,6 +27,7 @@
* @summary Test two URLClassLoader define Package object of the same name
* @library /lib/testlibrary
* @build CompilerUtils
+ * @modules jdk.compiler
* @run testng SplitPackage
*/
--- a/jdk/test/java/net/URLPermission/nstest/LookupTest.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/test/java/net/URLPermission/nstest/LookupTest.java Thu Sep 22 18:31:42 2016 +0000
@@ -37,6 +37,7 @@
String url, boolean throwsSecException, boolean throwsIOException)
{
try {
+ ProxySelector.setDefault(null);
URL u = new URL(url);
System.err.println ("Connecting to " + u);
URLConnection urlc = u.openConnection();
@@ -71,7 +72,7 @@
System.out.print(port);
} else if (cmd.equals("-runtest")) {
port = Integer.parseInt(args[1]);
- String hostsFileName = System.getProperty("test.src", ".") + "/LookupTestHosts";
+ String hostsFileName = System.getProperty("user.dir", ".") + "/LookupTestHosts";
System.setProperty("jdk.net.hosts.file", hostsFileName);
addMappingToHostsFile("allowedAndFound.com", "127.0.0.1", hostsFileName, false);
addMappingToHostsFile("notAllowedButFound.com", "99.99.99.99", hostsFileName, true);
--- a/jdk/test/java/net/URLPermission/nstest/LookupTestHosts Thu Sep 22 16:41:14 2016 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-127.0.0.1 allowedAndFound.com
-99.99.99.99 notAllowedButFound.com
--- a/jdk/test/java/net/URLPermission/nstest/lookup.sh Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/test/java/net/URLPermission/nstest/lookup.sh Thu Sep 22 18:31:42 2016 +0000
@@ -48,6 +48,7 @@
grant {
permission java.net.URLPermission "http://allowedAndFound.com:${port}/-", "*:*";
permission java.net.URLPermission "http://allowedButNotfound.com:${port}/-", "*:*";
+ permission java.net.NetPermission "setProxySelector";
permission java.io.FilePermission "<<ALL FILES>>", "read,write,delete";
permission java.util.PropertyPermission "java.io.tmpdir", "read";
--- a/jdk/test/java/net/httpclient/HeadersTest1.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/test/java/net/httpclient/HeadersTest1.java Thu Sep 22 18:31:42 2016 +0000
@@ -23,9 +23,11 @@
* questions.
*/
-/**
+/*
* @test
* @bug 8153142
+ * @modules java.httpclient
+ * jdk.httpserver
* @run main/othervm HeadersTest1
* @summary HeadersTest1
*/
@@ -39,9 +41,11 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetSocketAddress;
-import java.net.PasswordAuthentication;
import java.net.URI;
-import java.net.http.*;
+import java.net.http.HttpClient;
+import java.net.http.HttpHeaders;
+import java.net.http.HttpResponse;
+import java.net.http.HttpRequest;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.List;
--- a/jdk/test/java/net/httpclient/ProxyAuthTest.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/test/java/net/httpclient/ProxyAuthTest.java Thu Sep 22 18:31:42 2016 +0000
@@ -26,6 +26,7 @@
* @test
* @bug 8163561
* @modules java.base/sun.net.www
+ * java.httpclient
* @summary Verify that Proxy-Authenticate header is correctly handled
*
* @run main/othervm ProxyAuthTest
--- a/jdk/test/java/net/httpclient/whitebox/Driver.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/test/java/net/httpclient/whitebox/Driver.java Thu Sep 22 18:31:42 2016 +0000
@@ -24,5 +24,6 @@
/*
* @test
* @bug 8151299
+ * @modules java.httpclient
* @run testng java.httpclient/java.net.http.SelectorTest
*/
--- a/jdk/test/jdk/internal/misc/Unsafe/TestBadHostClass.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/test/jdk/internal/misc/Unsafe/TestBadHostClass.java Thu Sep 22 18:31:42 2016 +0000
@@ -25,7 +25,6 @@
* @test
* @bug 8058575
* @summary Test that bad host classes cause exceptions to get thrown.
- * @library /test/lib
* @modules java.base/jdk.internal.misc
* java.base/jdk.internal.org.objectweb.asm
* @run main TestBadHostClass
@@ -35,7 +34,6 @@
import java.lang.*;
import java.lang.reflect.Field;
import jdk.internal.misc.Unsafe;
-import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.org.objectweb.asm.ClassWriter;
import static jdk.internal.org.objectweb.asm.Opcodes.*;
--- a/jdk/test/jprt.config Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/test/jprt.config Thu Sep 22 18:31:42 2016 +0000
@@ -82,15 +82,12 @@
fi
# Add basic solaris system paths
- path4sdk=/usr/ccs/bin:/usr/ccs/lib:/usr/bin:/bin:/usr/sfw/bin
+ path4sdk=/usr/bin:/usr/gnu/bin
# Find GNU make
- make=/usr/sfw/bin/gmake
+ make=/usr/bin/gmake
if [ ! -f ${make} ] ; then
- make=/opt/sfw/bin/gmake
- if [ ! -f ${make} ] ; then
- make=${slashjava}/devtools/${solaris_arch}/bin/gnumake
- fi
+ make=${slashjava}/devtools/${solaris_arch}/bin/gnumake
fi
fileMustExist "${make}" make
--- a/jdk/test/start-Xvfb.sh Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/test/start-Xvfb.sh Thu Sep 22 18:31:42 2016 +0000
@@ -59,9 +59,6 @@
/usr/bin/nohup /usr/bin/X11/Xvfb -fbdir ${currentDir} -pixdepths 8 16 24 32 ${DISPLAY} > ${currentDir}/nohup.$$ 2>&1 &
fi
WM="/usr/bin/X11/fvwm2"
-if [ ! -x ${WM} ] ; then
- WM="/opt/sfw/bin/fvwm2"
-fi
#
# Wait for Xvfb to initialize:
sleep 5
--- a/jdk/test/sun/security/smartcardio/README.txt Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/test/sun/security/smartcardio/README.txt Thu Sep 22 18:31:42 2016 +0000
@@ -1,17 +1,17 @@
Rough hints for setting up MUSCLE on Solaris:
-Make sure you have libusb, usually in /usr/sfw:
+Make sure you have libusb, usually in /usr/lib:
-ls -l /usr/sfw/lib/libusb.so
-lrwxrwxrwx 1 root other 11 Jan 12 16:02 /usr/sfw/lib/libusb.so -> libusb.so.1
+ls -l /usr/lib/libusb.so
+lrwxrwxrwx 1 root other 11 Jan 12 16:02 /usr/lib/libusb.so -> libusb.so.1
Get PCSC and CCID.
-rwx------ 1 user staff 529540 Jun 16 18:24 ccid-1.0.1.tar.gz
-rwx------ 1 user staff 842654 Jun 16 18:24 pcsc-lite-1.3.1.tar.gz
Unpack pcsc
-Run ./configure --enable-libusb=/usr/sfw (??)
+Run ./configure --enable-libusb (??)
gnumake
Make /usr/local writeable for user
gnumake install
--- a/jdk/test/sun/security/smartcardio/TestChannel.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/test/sun/security/smartcardio/TestChannel.java Thu Sep 22 18:31:42 2016 +0000
@@ -21,11 +21,12 @@
* questions.
*/
-/**
+/*
* @test
* @bug 6239117
* @summary test logical channels work
* @author Andreas Sterbenz
+ * @modules java.smartcardio/javax.smartcardio
* @run main/manual TestChannel
*/
--- a/jdk/test/sun/security/smartcardio/TestConnect.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/test/sun/security/smartcardio/TestConnect.java Thu Sep 22 18:31:42 2016 +0000
@@ -21,11 +21,12 @@
* questions.
*/
-/**
+/*
* @test
* @bug 6293769 6294527 6309280
* @summary test connect() works
* @author Andreas Sterbenz
+ * @modules java.smartcardio/javax.smartcardio
* @run main/manual TestConnect
*/
--- a/jdk/test/sun/security/smartcardio/TestConnectAgain.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/test/sun/security/smartcardio/TestConnectAgain.java Thu Sep 22 18:31:42 2016 +0000
@@ -21,11 +21,12 @@
* questions.
*/
-/**
+/*
* @test
* @bug 6239117
* @summary test connect works correctly if called multiple times/card removed
* @author Andreas Sterbenz
+ * @modules java.smartcardio/javax.smartcardio
* @run main/manual TestConnectAgain
*/
--- a/jdk/test/sun/security/smartcardio/TestControl.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/test/sun/security/smartcardio/TestControl.java Thu Sep 22 18:31:42 2016 +0000
@@ -21,11 +21,12 @@
* questions.
*/
-/**
+/*
* @test
* @bug 6239117 6470320
* @summary test if transmitControlCommand() works
* @author Andreas Sterbenz
+ * @modules java.smartcardio/javax.smartcardio
* @run main/manual TestControl
*/
--- a/jdk/test/sun/security/smartcardio/TestDefault.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/test/sun/security/smartcardio/TestDefault.java Thu Sep 22 18:31:42 2016 +0000
@@ -21,11 +21,12 @@
* questions.
*/
-/**
+/*
* @test
* @bug 6327047
* @summary verify that TerminalFactory.getDefault() works
* @author Andreas Sterbenz
+ * @modules java.smartcardio/javax.smartcardio
* @run main/manual TestDefault
*/
--- a/jdk/test/sun/security/smartcardio/TestDirect.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/test/sun/security/smartcardio/TestDirect.java Thu Sep 22 18:31:42 2016 +0000
@@ -21,10 +21,11 @@
* questions.
*/
-/**
+/*
* @test
* @bug 8046343
* @summary Make sure that direct protocol is available
+ * @modules java.smartcardio/javax.smartcardio
* @run main/manual TestDirect
*/
--- a/jdk/test/sun/security/smartcardio/TestExclusive.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/test/sun/security/smartcardio/TestExclusive.java Thu Sep 22 18:31:42 2016 +0000
@@ -21,11 +21,12 @@
* questions.
*/
-/**
+/*
* @test
* @bug 6239117
* @summary verify that beginExclusive()/endExclusive() works
* @author Andreas Sterbenz
+ * @modules java.smartcardio/javax.smartcardio
* @run main/manual TestExclusive
*/
--- a/jdk/test/sun/security/smartcardio/TestMultiplePresent.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/test/sun/security/smartcardio/TestMultiplePresent.java Thu Sep 22 18:31:42 2016 +0000
@@ -21,11 +21,12 @@
* questions.
*/
-/**
+/*
* @test
* @bug 6239117 6445367
* @summary test that CardTerminals.waitForCard() works
* @author Andreas Sterbenz
+ * @modules java.smartcardio/javax.smartcardio
* @run main/manual TestMultiplePresent
*/
--- a/jdk/test/sun/security/smartcardio/TestPresent.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/test/sun/security/smartcardio/TestPresent.java Thu Sep 22 18:31:42 2016 +0000
@@ -21,11 +21,12 @@
* questions.
*/
-/**
+/*
* @test
* @bug 6293769 6294527
* @summary test that the isCardPresent()/waitForX() APIs work correctly
* @author Andreas Sterbenz
+ * @modules java.smartcardio/javax.smartcardio
* @run main/manual TestPresent
*/
--- a/jdk/test/sun/security/smartcardio/TestTransmit.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/test/sun/security/smartcardio/TestTransmit.java Thu Sep 22 18:31:42 2016 +0000
@@ -21,11 +21,12 @@
* questions.
*/
-/**
+/*
* @test
* @bug 6293769 6294527
* @summary test transmit() works
* @author Andreas Sterbenz
+ * @modules java.smartcardio/javax.smartcardio
* @run main/manual TestTransmit
*/
--- a/jdk/test/sun/security/ssl/SocketCreation/SocketCreation.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/test/sun/security/ssl/SocketCreation/SocketCreation.java Thu Sep 22 18:31:42 2016 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -139,7 +139,7 @@
(SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
System.out.println("Server: Will call createServerSocket(int)");
- ServerSocket sslServerSocket = sslssf.createServerSocket(serverPort);
+ ServerSocket sslServerSocket = sslssf.createServerSocket(0);
serverPort = sslServerSocket.getLocalPort();
System.out.println("Server: Will accept on SSL server socket...");
@@ -157,7 +157,7 @@
(SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
System.out.println("Server: Will call createServerSocket(int, int)");
- ServerSocket sslServerSocket = sslssf.createServerSocket(serverPort,
+ ServerSocket sslServerSocket = sslssf.createServerSocket(0,
1);
serverPort = sslServerSocket.getLocalPort();
@@ -177,7 +177,7 @@
System.out.println("Server: Will call createServerSocket(int, " +
" int, InetAddress)");
- ServerSocket sslServerSocket = sslssf.createServerSocket(serverPort,
+ ServerSocket sslServerSocket = sslssf.createServerSocket(0,
1,
InetAddress.getByName("localhost"));
serverPort = sslServerSocket.getLocalPort();
@@ -203,14 +203,15 @@
if (sslServerSocket.isBound())
throw new Exception("Server socket is already bound!");
- System.out.println("Server: Will bind SSL server socket to port " +
- serverPort + "...");
-
- sslServerSocket.bind(new java.net.InetSocketAddress(serverPort));
+ sslServerSocket.bind(new java.net.InetSocketAddress(0));
if (!sslServerSocket.isBound())
throw new Exception("Server socket is not bound!");
+ serverPort = sslServerSocket.getLocalPort();
+ System.out.println("Server: Bound SSL server socket to port " +
+ serverPort + "...");
+
serverReady = true;
System.out.println("Server: Will accept on SSL server socket...");
@@ -224,11 +225,10 @@
SSLSocketFactory sslsf =
(SSLSocketFactory) SSLSocketFactory.getDefault();
- System.out.println("Server: Will create normal server socket bound"
- + " to port " + serverPort + "...");
-
- ServerSocket ss = new ServerSocket(serverPort);
+ ServerSocket ss = new ServerSocket(0);
serverPort = ss.getLocalPort();
+ System.out.println("Server: Created normal server socket bound"
+ + " to port " + serverPort + "...");
System.out.println("Server: Will accept on server socket...");
serverReady = true;
Socket s = ss.accept();
--- a/jdk/test/sun/security/tools/keytool/KeyToolTest.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/test/sun/security/tools/keytool/KeyToolTest.java Thu Sep 22 18:31:42 2016 +0000
@@ -1761,7 +1761,7 @@
//PKCS#11 tests
// 1. sccs edit cert8.db key3.db
- //Runtime.getRuntime().exec("/usr/ccs/bin/sccs edit cert8.db key3.db");
+ //Runtime.getRuntime().exec("/usr/bin/sccs edit cert8.db key3.db");
testOK("", p11Arg + ("-storepass test12 -genkey -alias genkey" +
" -dname cn=genkey -keysize 512 -keyalg rsa"));
testOK("", p11Arg + "-storepass test12 -list");
@@ -1781,7 +1781,7 @@
testOK("", p11Arg + "-storepass test12 -list");
assertTrue(out.indexOf("Your keystore contains 0 entries") != -1);
//(check for empty database listing)
- //Runtime.getRuntime().exec("/usr/ccs/bin/sccs unedit cert8.db key3.db");
+ //Runtime.getRuntime().exec("/usr/bin/sccs unedit cert8.db key3.db");
remove("genkey.cert");
remove("genkey.certreq");
// 12. sccs unedit cert8.db key3.db
--- a/jdk/test/tools/launcher/RunpathTest.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/test/tools/launcher/RunpathTest.java Thu Sep 22 18:31:42 2016 +0000
@@ -40,7 +40,7 @@
}
final String findElfReader() {
- String[] paths = {"/bin", "/sbin", "/usr/bin", "/usr/sbin", "/usr/ccs/bin"};
+ String[] paths = {"/usr/sbin", "/usr/bin"};
final String cmd = isSolaris ? "elfdump" : "readelf";
for (String x : paths) {
File p = new File(x);
--- a/jdk/test/tools/launcher/TooSmallStackSize.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/test/tools/launcher/TooSmallStackSize.java Thu Sep 22 18:31:42 2016 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -35,6 +35,11 @@
* stack size for the platform (as provided by the JVM error message when a very
* small stack is used), and then verify that the JVM can be launched with that stack
* size without a crash or any error messages.
+ *
+ * Note: The '-Xss<size>' and '-XX:ThreadStackSize=<k-bytes>' options
+ * both control Java thread stack size. This repo's version of the test
+ * exercises the '-Xss' option. The hotspot repo's version of the test
+ * exercises the '-XX:ThreadStackSize' VM option.
*/
public class TooSmallStackSize extends TestHelper {
@@ -59,7 +64,7 @@
static String getMinStackAllowed(TestResult tr) {
/*
* The JVM output will contain in one of the lines:
- * "The stack size specified is too small, Specify at least 100k"
+ * "The Java thread stack size specified is too small. Specify at least 100k"
* Although the actual size will vary. We need to extract this size
* string from the output and return it.
*/
@@ -73,6 +78,9 @@
}
}
+ System.out.println("Expect='" + matchStr + "'");
+ System.out.println("Actual:");
+ printTestOutput(tr);
System.out.println("FAILED: Could not get the stack size from the output");
throw new RuntimeException("test fails");
}
@@ -96,11 +104,15 @@
System.out.println("PASSED: got no error message with stack size of " + stackSize);
min_stack_allowed = stackSize;
} else {
- if (tr.contains("The stack size specified is too small")) {
+ String matchStr = "The Java thread stack size specified is too small";
+ if (tr.contains(matchStr)) {
System.out.println("PASSED: got expected error message with stack size of " + stackSize);
min_stack_allowed = getMinStackAllowed(tr);
} else {
// Likely a crash
+ System.out.println("Expect='" + matchStr + "'");
+ System.out.println("Actual:");
+ printTestOutput(tr);
System.out.println("FAILED: Did not get expected error message with stack size of " + stackSize);
throw new RuntimeException("test fails");
}
@@ -123,6 +135,8 @@
System.out.println("PASSED: VM launched with minimum allowed stack size of " + stackSize);
} else {
// Likely a crash
+ System.out.println("Test output:");
+ printTestOutput(tr);
System.out.println("FAILED: VM failed to launch with minimum allowed stack size of " + stackSize);
throw new RuntimeException("test fails");
}
--- a/jdk/test/tools/launcher/modules/addmods/AddModsTest.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/test/tools/launcher/modules/addmods/AddModsTest.java Thu Sep 22 18:31:42 2016 +0000
@@ -31,6 +31,7 @@
* @summary Basic test for java --add-modules
*/
+import java.io.File;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -224,6 +225,27 @@
/**
+ * Tests {@code --add-modules} be specified more than once.
+ */
+ public void testWithMultipleAddModules() throws Exception {
+
+ String modulepath = MODS1_DIR.toString() + File.pathSeparator +
+ MODS2_DIR.toString();
+ int exitValue
+ = executeTestJava("--module-path", modulepath,
+ "--add-modules", LOGGER_MODULE,
+ "--add-modules", TEST_MODULE,
+ "-m", TEST_MID,
+ "logger.Logger")
+ .outputTo(System.out)
+ .errorTo(System.out)
+ .getExitValue();
+
+ assertTrue(exitValue == 0);
+ }
+
+
+ /**
* Attempt to run with a bad module name specified to --add-modules
*/
public void testRunWithBadAddMods() throws Exception {
--- a/jdk/test/tools/pack200/Pack200Test.java Thu Sep 22 16:41:14 2016 +0000
+++ b/jdk/test/tools/pack200/Pack200Test.java Thu Sep 22 18:31:42 2016 +0000
@@ -24,6 +24,7 @@
/*
* @test
* @bug 6521334 6712743 8007902 8151901
+ * @requires (sun.arch.data.model == "64" & os.maxMemory >= 4g)
* @summary test general packer/unpacker functionality
* using native and java unpackers
* @compile -XDignore.symbol.file Utils.java Pack200Test.java