keyset = p.stringPropertyNames();
+ for (String key : keyset) {
+ String value = p.getProperty(key);
+ props.put(key, value);
+ }
+
+ props.store(out, null);
+ return out.toByteArray();
+ }
+
+ public static byte[] serializePropertiesToByteArray() throws IOException {
+ return serializePropertiesToByteArray(System.getProperties());
+ }
+
+ public static byte[] serializeAgentPropertiesToByteArray() throws IOException {
+ return serializePropertiesToByteArray(getAgentProperties());
+ }
+
+ /*
+ * Returns true if the given JAR file has the Class-Path attribute in the
+ * main section of the JAR manifest. Throws RuntimeException if the given
+ * path is not a JAR file or some other error occurs.
+ */
+ public static boolean isClassPathAttributePresent(String path) {
+ try {
+ Manifest man = (new JarFile(path)).getManifest();
+ if (man != null) {
+ if (man.getMainAttributes().getValue(Attributes.Name.CLASS_PATH) != null) {
+ return true;
+ }
+ }
+ return false;
+ } catch (IOException ioe) {
+ throw new RuntimeException(ioe.getMessage());
+ }
+ }
+
+ /*
+ * Return the temporary directory that the VM uses for the attach
+ * and perf data files.
+ *
+ * It is important that this directory is well-known and the
+ * same for all VM instances. It cannot be affected by configuration
+ * variables such as java.io.tmpdir.
+ */
+ public static native String getVMTemporaryDirectory();
+}
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/java.base/share/classes/module-info.java
--- a/jdk/src/java.base/share/classes/module-info.java Tue Apr 05 18:23:10 2016 +0300
+++ b/jdk/src/java.base/share/classes/module-info.java Tue Apr 05 09:17:15 2016 -0700
@@ -180,6 +180,11 @@
jdk.jvmstat;
exports jdk.internal.ref to
java.desktop;
+ exports jdk.internal.util.jar to
+ jdk.jartool;
+ exports jdk.internal.vm to
+ java.management,
+ jdk.jvmstat;
exports sun.net to
java.httpclient;
exports sun.net.dns to
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/java.base/share/classes/sun/misc/GC.java
--- a/jdk/src/java.base/share/classes/sun/misc/GC.java Tue Apr 05 18:23:10 2016 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,283 +0,0 @@
-/*
- * Copyright (c) 1998, 2008, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 sun.misc;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-
-/**
- * Support for garbage-collection latency requests.
- *
- * @author Mark Reinhold
- * @since 1.2
- */
-
-public class GC {
-
- private GC() { } /* To prevent instantiation */
-
-
- /* Latency-target value indicating that there's no active target
- */
- private static final long NO_TARGET = Long.MAX_VALUE;
-
- /* The current latency target, or NO_TARGET if there is no target
- */
- private static long latencyTarget = NO_TARGET;
-
- /* The daemon thread that implements the latency-target mechanism,
- * or null if there is presently no daemon thread
- */
- private static Thread daemon = null;
-
- /* The lock object for the latencyTarget and daemon fields. The daemon
- * thread, if it exists, waits on this lock for notification that the
- * latency target has changed.
- */
- private static class LatencyLock extends Object { };
- private static Object lock = new LatencyLock();
-
-
- /**
- * Returns the maximum object-inspection age, which is the number
- * of real-time milliseconds that have elapsed since the
- * least-recently-inspected heap object was last inspected by the garbage
- * collector.
- *
- * For simple stop-the-world collectors this value is just the time
- * since the most recent collection. For generational collectors it is the
- * time since the oldest generation was most recently collected. Other
- * collectors are free to return a pessimistic estimate of the elapsed
- * time, or simply the time since the last full collection was performed.
- *
- *
Note that in the presence of reference objects, a given object that
- * is no longer strongly reachable may have to be inspected multiple times
- * before it can be reclaimed.
- */
- public static native long maxObjectInspectionAge();
-
- private static class Daemon extends Thread {
-
- public void run() {
- for (;;) {
- long l;
- synchronized (lock) {
-
- l = latencyTarget;
- if (l == NO_TARGET) {
- /* No latency target, so exit */
- GC.daemon = null;
- return;
- }
-
- long d = maxObjectInspectionAge();
- if (d >= l) {
- /* Do a full collection. There is a remote possibility
- * that a full collection will occurr between the time
- * we sample the inspection age and the time the GC
- * actually starts, but this is sufficiently unlikely
- * that it doesn't seem worth the more expensive JVM
- * interface that would be required.
- */
- System.gc();
- d = 0;
- }
-
- /* Wait for the latency period to expire,
- * or for notification that the period has changed
- */
- try {
- lock.wait(l - d);
- } catch (InterruptedException x) {
- continue;
- }
- }
- }
- }
-
- private Daemon(ThreadGroup tg) {
- super(tg, null, "GC Daemon", 0L, false);
- }
-
- /* Create a new daemon thread in the root thread group */
- public static void create() {
- PrivilegedAction pa = new PrivilegedAction() {
- public Void run() {
- ThreadGroup tg = Thread.currentThread().getThreadGroup();
- for (ThreadGroup tgn = tg;
- tgn != null;
- tg = tgn, tgn = tg.getParent());
- Daemon d = new Daemon(tg);
- d.setDaemon(true);
- d.setPriority(Thread.MIN_PRIORITY + 1);
- d.start();
- GC.daemon = d;
- return null;
- }};
- AccessController.doPrivileged(pa);
- }
-
- }
-
-
- /* Sets the latency target to the given value.
- * Must be invoked while holding the lock.
- */
- private static void setLatencyTarget(long ms) {
- latencyTarget = ms;
- if (daemon == null) {
- /* Create a new daemon thread */
- Daemon.create();
- } else {
- /* Notify the existing daemon thread
- * that the lateency target has changed
- */
- lock.notify();
- }
- }
-
-
- /**
- * Represents an active garbage-collection latency request. Instances of
- * this class are created by the {@link #requestLatency}
- * method. Given a request, the only interesting operation is that of
- * cancellation.
- */
- public static class LatencyRequest
- implements Comparable {
-
- /* Instance counter, used to generate unique identifers */
- private static long counter = 0;
-
- /* Sorted set of active latency requests */
- private static SortedSet requests = null;
-
- /* Examine the request set and reset the latency target if necessary.
- * Must be invoked while holding the lock.
- */
- private static void adjustLatencyIfNeeded() {
- if ((requests == null) || requests.isEmpty()) {
- if (latencyTarget != NO_TARGET) {
- setLatencyTarget(NO_TARGET);
- }
- } else {
- LatencyRequest r = requests.first();
- if (r.latency != latencyTarget) {
- setLatencyTarget(r.latency);
- }
- }
- }
-
- /* The requested latency, or NO_TARGET
- * if this request has been cancelled
- */
- private long latency;
-
- /* Unique identifier for this request */
- private long id;
-
- private LatencyRequest(long ms) {
- if (ms <= 0) {
- throw new IllegalArgumentException("Non-positive latency: "
- + ms);
- }
- this.latency = ms;
- synchronized (lock) {
- this.id = ++counter;
- if (requests == null) {
- requests = new TreeSet();
- }
- requests.add(this);
- adjustLatencyIfNeeded();
- }
- }
-
- /**
- * Cancels this latency request.
- *
- * @throws IllegalStateException
- * If this request has already been cancelled
- */
- public void cancel() {
- synchronized (lock) {
- if (this.latency == NO_TARGET) {
- throw new IllegalStateException("Request already"
- + " cancelled");
- }
- if (!requests.remove(this)) {
- throw new InternalError("Latency request "
- + this + " not found");
- }
- if (requests.isEmpty()) requests = null;
- this.latency = NO_TARGET;
- adjustLatencyIfNeeded();
- }
- }
-
- public int compareTo(LatencyRequest r) {
- long d = this.latency - r.latency;
- if (d == 0) d = this.id - r.id;
- return (d < 0) ? -1 : ((d > 0) ? +1 : 0);
- }
-
- public String toString() {
- return (LatencyRequest.class.getName()
- + "[" + latency + "," + id + "]");
- }
-
- }
-
-
- /**
- * Makes a new request for a garbage-collection latency of the given
- * number of real-time milliseconds. A low-priority daemon thread makes a
- * best effort to ensure that the maximum object-inspection age never
- * exceeds the smallest of the currently active requests.
- *
- * @param latency
- * The requested latency
- *
- * @throws IllegalArgumentException
- * If the given latency
is non-positive
- */
- public static LatencyRequest requestLatency(long latency) {
- return new LatencyRequest(latency);
- }
-
-
- /**
- * Returns the current smallest garbage-collection latency request, or zero
- * if there are no active requests.
- */
- public static long currentLatencyTarget() {
- long t = latencyTarget;
- return (t == NO_TARGET) ? 0 : t;
- }
-
-}
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/java.base/share/classes/sun/misc/InvalidJarIndexException.java
--- a/jdk/src/java.base/share/classes/sun/misc/InvalidJarIndexException.java Tue Apr 05 18:23:10 2016 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 1999, 2011, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 sun.misc;
-
-import java.lang.LinkageError;
-
-/**
- * Thrown if the URLClassLoader finds the INDEX.LIST file of
- * a jar file contains incorrect information.
- *
- * @author Zhenghua Li
- * @since 1.3
- */
-
-public
-class InvalidJarIndexException extends RuntimeException {
-
- static final long serialVersionUID = -6159797516569680148L;
-
- /**
- * Constructs an InvalidJarIndexException
with no
- * detail message.
- */
- public InvalidJarIndexException() {
- super();
- }
-
- /**
- * Constructs an InvalidJarIndexException
with the
- * specified detail message.
- *
- * @param s the detail message.
- */
- public InvalidJarIndexException(String s) {
- super(s);
- }
-}
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/java.base/share/classes/sun/misc/JarIndex.java
--- a/jdk/src/java.base/share/classes/sun/misc/JarIndex.java Tue Apr 05 18:23:10 2016 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,333 +0,0 @@
-/*
- * Copyright (c) 1999, 2012, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 sun.misc;
-
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
-import java.util.zip.*;
-
-/**
- * This class is used to maintain mappings from packages, classes
- * and resources to their enclosing JAR files. Mappings are kept
- * at the package level except for class or resource files that
- * are located at the root directory. URLClassLoader uses the mapping
- * information to determine where to fetch an extension class or
- * resource from.
- *
- * @author Zhenghua Li
- * @since 1.3
- */
-
-public class JarIndex {
-
- /**
- * The hash map that maintains mappings from
- * package/classe/resource to jar file list(s)
- */
- private HashMap> indexMap;
-
- /**
- * The hash map that maintains mappings from
- * jar file to package/class/resource lists
- */
- private HashMap> jarMap;
-
- /*
- * An ordered list of jar file names.
- */
- private String[] jarFiles;
-
- /**
- * The index file name.
- */
- public static final String INDEX_NAME = "META-INF/INDEX.LIST";
-
- /**
- * true if, and only if, sun.misc.JarIndex.metaInfFilenames is set to true.
- * If true, the names of the files in META-INF, and its subdirectories, will
- * be added to the index. Otherwise, just the directory names are added.
- */
- private static final boolean metaInfFilenames =
- "true".equals(System.getProperty("sun.misc.JarIndex.metaInfFilenames"));
-
- /**
- * Constructs a new, empty jar index.
- */
- public JarIndex() {
- indexMap = new HashMap<>();
- jarMap = new HashMap<>();
- }
-
- /**
- * Constructs a new index from the specified input stream.
- *
- * @param is the input stream containing the index data
- */
- public JarIndex(InputStream is) throws IOException {
- this();
- read(is);
- }
-
- /**
- * Constructs a new index for the specified list of jar files.
- *
- * @param files the list of jar files to construct the index from.
- */
- public JarIndex(String[] files) throws IOException {
- this();
- this.jarFiles = files;
- parseJars(files);
- }
-
- /**
- * Returns the jar index, or null
if none.
- *
- * @param jar the JAR file to get the index from.
- * @exception IOException if an I/O error has occurred.
- */
- public static JarIndex getJarIndex(JarFile jar) throws IOException {
- JarIndex index = null;
- JarEntry e = jar.getJarEntry(INDEX_NAME);
- // if found, then load the index
- if (e != null) {
- index = new JarIndex(jar.getInputStream(e));
- }
- return index;
- }
-
- /**
- * Returns the jar files that are defined in this index.
- */
- public String[] getJarFiles() {
- return jarFiles;
- }
-
- /*
- * Add the key, value pair to the hashmap, the value will
- * be put in a linked list which is created if necessary.
- */
- private void addToList(String key, String value,
- HashMap> t) {
- LinkedList list = t.get(key);
- if (list == null) {
- list = new LinkedList<>();
- list.add(value);
- t.put(key, list);
- } else if (!list.contains(value)) {
- list.add(value);
- }
- }
-
- /**
- * Returns the list of jar files that are mapped to the file.
- *
- * @param fileName the key of the mapping
- */
- public LinkedList get(String fileName) {
- LinkedList jarFiles = null;
- if ((jarFiles = indexMap.get(fileName)) == null) {
- /* try the package name again */
- int pos;
- if((pos = fileName.lastIndexOf('/')) != -1) {
- jarFiles = indexMap.get(fileName.substring(0, pos));
- }
- }
- return jarFiles;
- }
-
- /**
- * Add the mapping from the specified file to the specified
- * jar file. If there were no mapping for the package of the
- * specified file before, a new linked list will be created,
- * the jar file is added to the list and a new mapping from
- * the package to the jar file list is added to the hashmap.
- * Otherwise, the jar file will be added to the end of the
- * existing list.
- *
- * @param fileName the file name
- * @param jarName the jar file that the file is mapped to
- *
- */
- public void add(String fileName, String jarName) {
- String packageName;
- int pos;
- if((pos = fileName.lastIndexOf('/')) != -1) {
- packageName = fileName.substring(0, pos);
- } else {
- packageName = fileName;
- }
-
- addMapping(packageName, jarName);
- }
-
- /**
- * Same as add(String,String) except that it doesn't strip off from the
- * last index of '/'. It just adds the jarItem (filename or package)
- * as it is received.
- */
- private void addMapping(String jarItem, String jarName) {
- // add the mapping to indexMap
- addToList(jarItem, jarName, indexMap);
-
- // add the mapping to jarMap
- addToList(jarName, jarItem, jarMap);
- }
-
- /**
- * Go through all the jar files and construct the
- * index table.
- */
- private void parseJars(String[] files) throws IOException {
- if (files == null) {
- return;
- }
-
- String currentJar = null;
-
- for (int i = 0; i < files.length; i++) {
- currentJar = files[i];
- ZipFile zrf = new ZipFile(currentJar.replace
- ('/', File.separatorChar));
-
- Enumeration extends ZipEntry> entries = zrf.entries();
- while(entries.hasMoreElements()) {
- ZipEntry entry = entries.nextElement();
- String fileName = entry.getName();
-
- // Skip the META-INF directory, the index, and manifest.
- // Any files in META-INF/ will be indexed explicitly
- if (fileName.equals("META-INF/") ||
- fileName.equals(INDEX_NAME) ||
- fileName.equals(JarFile.MANIFEST_NAME))
- continue;
-
- if (!metaInfFilenames || !fileName.startsWith("META-INF/")) {
- add(fileName, currentJar);
- } else if (!entry.isDirectory()) {
- // Add files under META-INF explicitly so that certain
- // services, like ServiceLoader, etc, can be located
- // with greater accuracy. Directories can be skipped
- // since each file will be added explicitly.
- addMapping(fileName, currentJar);
- }
- }
-
- zrf.close();
- }
- }
-
- /**
- * Writes the index to the specified OutputStream
- *
- * @param out the output stream
- * @exception IOException if an I/O error has occurred
- */
- public void write(OutputStream out) throws IOException {
- BufferedWriter bw = new BufferedWriter
- (new OutputStreamWriter(out, "UTF8"));
- bw.write("JarIndex-Version: 1.0\n\n");
-
- if (jarFiles != null) {
- for (int i = 0; i < jarFiles.length; i++) {
- /* print out the jar file name */
- String jar = jarFiles[i];
- bw.write(jar + "\n");
- LinkedList jarlist = jarMap.get(jar);
- if (jarlist != null) {
- Iterator listitr = jarlist.iterator();
- while(listitr.hasNext()) {
- bw.write(listitr.next() + "\n");
- }
- }
- bw.write("\n");
- }
- bw.flush();
- }
- }
-
-
- /**
- * Reads the index from the specified InputStream.
- *
- * @param is the input stream
- * @exception IOException if an I/O error has occurred
- */
- public void read(InputStream is) throws IOException {
- BufferedReader br = new BufferedReader
- (new InputStreamReader(is, "UTF8"));
- String line = null;
- String currentJar = null;
-
- /* an ordered list of jar file names */
- Vector jars = new Vector<>();
-
- /* read until we see a .jar line */
- while((line = br.readLine()) != null && !line.endsWith(".jar"));
-
- for(;line != null; line = br.readLine()) {
- if (line.length() == 0)
- continue;
-
- if (line.endsWith(".jar")) {
- currentJar = line;
- jars.add(currentJar);
- } else {
- String name = line;
- addMapping(name, currentJar);
- }
- }
-
- jarFiles = jars.toArray(new String[jars.size()]);
- }
-
- /**
- * Merges the current index into another index, taking into account
- * the relative path of the current index.
- *
- * @param toIndex The destination index which the current index will
- * merge into.
- * @param path The relative path of the this index to the destination
- * index.
- *
- */
- public void merge(JarIndex toIndex, String path) {
- Iterator>> itr = indexMap.entrySet().iterator();
- while(itr.hasNext()) {
- Map.Entry> e = itr.next();
- String packageName = e.getKey();
- LinkedList from_list = e.getValue();
- Iterator listItr = from_list.iterator();
- while(listItr.hasNext()) {
- String jarName = listItr.next();
- if (path != null) {
- jarName = path.concat(jarName);
- }
- toIndex.addMapping(packageName, jarName);
- }
- }
- }
-}
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/java.base/share/classes/sun/misc/VMSupport.java
--- a/jdk/src/java.base/share/classes/sun/misc/VMSupport.java Tue Apr 05 18:23:10 2016 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 2005, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 sun.misc;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.Properties;
-import java.util.Set;
-import java.util.jar.JarFile;
-import java.util.jar.Manifest;
-import java.util.jar.Attributes;
-
-/*
- * Support class used by JVMTI and VM attach mechanism.
- */
-public class VMSupport {
-
- private static Properties agentProps = null;
- /**
- * Returns the agent properties.
- */
- public static synchronized Properties getAgentProperties() {
- if (agentProps == null) {
- agentProps = new Properties();
- initAgentProperties(agentProps);
- }
- return agentProps;
- }
- private static native Properties initAgentProperties(Properties props);
-
- /**
- * Write the given properties list to a byte array and return it. Properties with
- * a key or value that is not a String is filtered out. The stream written to the byte
- * array is ISO 8859-1 encoded.
- */
- private static byte[] serializePropertiesToByteArray(Properties p) throws IOException {
- ByteArrayOutputStream out = new ByteArrayOutputStream(4096);
-
- Properties props = new Properties();
-
- // stringPropertyNames() returns a snapshot of the property keys
- Set keyset = p.stringPropertyNames();
- for (String key : keyset) {
- String value = p.getProperty(key);
- props.put(key, value);
- }
-
- props.store(out, null);
- return out.toByteArray();
- }
-
- public static byte[] serializePropertiesToByteArray() throws IOException {
- return serializePropertiesToByteArray(System.getProperties());
- }
-
- public static byte[] serializeAgentPropertiesToByteArray() throws IOException {
- return serializePropertiesToByteArray(getAgentProperties());
- }
-
- /*
- * Returns true if the given JAR file has the Class-Path attribute in the
- * main section of the JAR manifest. Throws RuntimeException if the given
- * path is not a JAR file or some other error occurs.
- */
- public static boolean isClassPathAttributePresent(String path) {
- try {
- Manifest man = (new JarFile(path)).getManifest();
- if (man != null) {
- if (man.getMainAttributes().getValue(Attributes.Name.CLASS_PATH) != null) {
- return true;
- }
- }
- return false;
- } catch (IOException ioe) {
- throw new RuntimeException(ioe.getMessage());
- }
- }
-
- /*
- * Return the temporary directory that the VM uses for the attach
- * and perf data files.
- *
- * It is important that this directory is well-known and the
- * same for all VM instances. It cannot be affected by configuration
- * variables such as java.io.tmpdir.
- */
- public static native String getVMTemporaryDirectory();
-}
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/java.base/share/classes/sun/misc/resources/Messages.java
--- a/jdk/src/java.base/share/classes/sun/misc/resources/Messages.java Tue Apr 05 18:23:10 2016 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2002, 2005, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 sun.misc.resources;
-
-/**
- * This class represents the {@code ResourceBundle}
- * for sun.misc.
- *
- * @author Michael Colburn
- */
-
-public class Messages extends java.util.ListResourceBundle {
-
- /**
- * Returns the contents of this {@code ResourceBundle}.
- *
- * @return the contents of this {@code ResourceBundle}.
- */
- public Object[][] getContents() {
- return contents;
- }
-
- private static final Object[][] contents = {
- { "optpkg.versionerror", "ERROR: Invalid version format used in {0} JAR file. Check the documentation for the supported version format." },
- { "optpkg.attributeerror", "ERROR: The required {0} JAR manifest attribute is not set in {1} JAR file." },
- { "optpkg.attributeserror", "ERROR: Some required JAR manifest attributes are not set in {0} JAR file." }
- };
-
-}
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/java.base/share/classes/sun/misc/resources/Messages_de.java
--- a/jdk/src/java.base/share/classes/sun/misc/resources/Messages_de.java Tue Apr 05 18:23:10 2016 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2002, 2013, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 sun.misc.resources;
-
-/**
- * This class represents the {@code ResourceBundle}
- * for sun.misc.
- *
- * @author Michael Colburn
- */
-
-public class Messages_de extends java.util.ListResourceBundle {
-
- /**
- * Returns the contents of this {@code ResourceBundle}.
- *
- * @return the contents of this {@code ResourceBundle}.
- */
- public Object[][] getContents() {
- return contents;
- }
-
- private static final Object[][] contents = {
- { "optpkg.versionerror", "ERROR: In JAR-Datei {0} wurde ein ung\u00FCltiges Versionsformat verwendet. Pr\u00FCfen Sie in der Dokumentation, welches Versionsformat unterst\u00FCtzt wird." },
- { "optpkg.attributeerror", "ERROR: In JAR-Datei {1} ist das erforderliche JAR-Manifestattribut {0} nicht festgelegt." },
- { "optpkg.attributeserror", "ERROR: In JAR-Datei {0} sind einige erforderliche JAR-Manifestattribute nicht festgelegt." }
- };
-
-}
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/java.base/share/classes/sun/misc/resources/Messages_es.java
--- a/jdk/src/java.base/share/classes/sun/misc/resources/Messages_es.java Tue Apr 05 18:23:10 2016 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2002, 2013, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 sun.misc.resources;
-
-/**
- * This class represents the {@code ResourceBundle}
- * for sun.misc.
- *
- * @author Michael Colburn
- */
-
-public class Messages_es extends java.util.ListResourceBundle {
-
- /**
- * Returns the contents of this {@code ResourceBundle}.
- *
- * @return the contents of this {@code ResourceBundle}.
- */
- public Object[][] getContents() {
- return contents;
- }
-
- private static final Object[][] contents = {
- { "optpkg.versionerror", "ERROR: el formato del archivo JAR {0} pertenece a una versi\u00F3n no v\u00E1lida. Busque en la documentaci\u00F3n el formato de una versi\u00F3n soportada." },
- { "optpkg.attributeerror", "ERROR: el atributo obligatorio JAR manifest {0} no est\u00E1 definido en el archivo JAR {1}." },
- { "optpkg.attributeserror", "ERROR: algunos atributos obligatorios JAR manifest no est\u00E1n definidos en el archivo JAR {0}." }
- };
-
-}
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/java.base/share/classes/sun/misc/resources/Messages_fr.java
--- a/jdk/src/java.base/share/classes/sun/misc/resources/Messages_fr.java Tue Apr 05 18:23:10 2016 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2002, 2013, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 sun.misc.resources;
-
-/**
- * This class represents the {@code ResourceBundle}
- * for sun.misc.
- *
- * @author Michael Colburn
- */
-
-public class Messages_fr extends java.util.ListResourceBundle {
-
- /**
- * Returns the contents of this {@code ResourceBundle}.
- *
- * @return the contents of this {@code ResourceBundle}.
- */
- public Object[][] getContents() {
- return contents;
- }
-
- private static final Object[][] contents = {
- { "optpkg.versionerror", "ERREUR\u00A0: le format de version utilis\u00E9 pour le fichier JAR {0} n''est pas valide. Pour conna\u00EEtre le format de version pris en charge, consultez la documentation." },
- { "optpkg.attributeerror", "ERREUR\u00A0: l''attribut manifest JAR {0} obligatoire n''est pas d\u00E9fini dans le fichier JAR {1}." },
- { "optpkg.attributeserror", "ERREUR\u00A0: certains attributs manifest JAR obligatoires ne sont pas d\u00E9finis dans le fichier JAR {0}." }
- };
-
-}
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/java.base/share/classes/sun/misc/resources/Messages_it.java
--- a/jdk/src/java.base/share/classes/sun/misc/resources/Messages_it.java Tue Apr 05 18:23:10 2016 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2002, 2013, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 sun.misc.resources;
-
-/**
- * This class represents the {@code ResourceBundle}
- * for sun.misc.
- *
- * @author Michael Colburn
- */
-
-public class Messages_it extends java.util.ListResourceBundle {
-
- /**
- * Returns the contents of this {@code ResourceBundle}.
- *
- * @return the contents of this {@code ResourceBundle}.
- */
- public Object[][] getContents() {
- return contents;
- }
-
- private static final Object[][] contents = {
- { "optpkg.versionerror", "ERRORE: Formato versione non valido nel file JAR {0}. Verificare nella documentazione il formato della versione supportato." },
- { "optpkg.attributeerror", "ERRORE: L''attributo manifest JAR {0} richiesto non \u00E8 impostato nel file JAR {1}." },
- { "optpkg.attributeserror", "ERRORE: Alcuni attributi manifesti JAR obbligatori non sono impostati nel file JAR {0}." }
- };
-
-}
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/java.base/share/classes/sun/misc/resources/Messages_ja.java
--- a/jdk/src/java.base/share/classes/sun/misc/resources/Messages_ja.java Tue Apr 05 18:23:10 2016 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2002, 2013, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 sun.misc.resources;
-
-/**
- * This class represents the {@code ResourceBundle}
- * for sun.misc.
- *
- * @author Michael Colburn
- */
-
-public class Messages_ja extends java.util.ListResourceBundle {
-
- /**
- * Returns the contents of this {@code ResourceBundle}.
- *
- * @return the contents of this {@code ResourceBundle}.
- */
- public Object[][] getContents() {
- return contents;
- }
-
- private static final Object[][] contents = {
- { "optpkg.versionerror", "\u30A8\u30E9\u30FC: JAR\u30D5\u30A1\u30A4\u30EB{0}\u3067\u7121\u52B9\u306A\u30D0\u30FC\u30B8\u30E7\u30F3\u5F62\u5F0F\u304C\u4F7F\u7528\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u308B\u30D0\u30FC\u30B8\u30E7\u30F3\u5F62\u5F0F\u306B\u3064\u3044\u3066\u306E\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002" },
- { "optpkg.attributeerror", "\u30A8\u30E9\u30FC: \u5FC5\u8981\u306AJAR\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u5C5E\u6027{0}\u304CJAR\u30D5\u30A1\u30A4\u30EB{1}\u306B\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002" },
- { "optpkg.attributeserror", "\u30A8\u30E9\u30FC: \u8907\u6570\u306E\u5FC5\u8981\u306AJAR\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u5C5E\u6027\u304CJAR\u30D5\u30A1\u30A4\u30EB{0}\u306B\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002" }
- };
-
-}
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/java.base/share/classes/sun/misc/resources/Messages_ko.java
--- a/jdk/src/java.base/share/classes/sun/misc/resources/Messages_ko.java Tue Apr 05 18:23:10 2016 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2002, 2013, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 sun.misc.resources;
-
-/**
- * This class represents the {@code ResourceBundle}
- * for sun.misc.
- *
- * @author Michael Colburn
- */
-
-public class Messages_ko extends java.util.ListResourceBundle {
-
- /**
- * Returns the contents of this {@code ResourceBundle}.
- *
- * @return the contents of this {@code ResourceBundle}.
- */
- public Object[][] getContents() {
- return contents;
- }
-
- private static final Object[][] contents = {
- { "optpkg.versionerror", "\uC624\uB958: {0} JAR \uD30C\uC77C\uC5D0 \uBD80\uC801\uD569\uD55C \uBC84\uC804 \uD615\uC2DD\uC774 \uC0AC\uC6A9\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uC124\uBA85\uC11C\uC5D0\uC11C \uC9C0\uC6D0\uB418\uB294 \uBC84\uC804 \uD615\uC2DD\uC744 \uD655\uC778\uD558\uC2ED\uC2DC\uC624." },
- { "optpkg.attributeerror", "\uC624\uB958: \uD544\uC694\uD55C {0} JAR manifest \uC18D\uC131\uC774 {1} JAR \uD30C\uC77C\uC5D0 \uC124\uC815\uB418\uC5B4 \uC788\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4." },
- { "optpkg.attributeserror", "\uC624\uB958: \uD544\uC694\uD55C \uC77C\uBD80 JAR manifest \uC18D\uC131\uC774 {0} JAR \uD30C\uC77C\uC5D0 \uC124\uC815\uB418\uC5B4 \uC788\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4." }
- };
-
-}
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/java.base/share/classes/sun/misc/resources/Messages_pt_BR.java
--- a/jdk/src/java.base/share/classes/sun/misc/resources/Messages_pt_BR.java Tue Apr 05 18:23:10 2016 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2002, 2013, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 sun.misc.resources;
-
-/**
- * This class represents the {@code ResourceBundle}
- * for sun.misc.
- *
- * @author Michael Colburn
- */
-
-public class Messages_pt_BR extends java.util.ListResourceBundle {
-
- /**
- * Returns the contents of this {@code ResourceBundle}.
- *
- * @return the contents of this {@code ResourceBundle}.
- */
- public Object[][] getContents() {
- return contents;
- }
-
- private static final Object[][] contents = {
- { "optpkg.versionerror", "ERRO: formato de vers\u00E3o inv\u00E1lido usado no arquivo JAR {0}. Verifique a documenta\u00E7\u00E3o para obter o formato de vers\u00E3o suportado." },
- { "optpkg.attributeerror", "ERRO: o atributo de manifesto JAR {0} necess\u00E1rio n\u00E3o est\u00E1 definido no arquivo JAR {1}." },
- { "optpkg.attributeserror", "ERRO: alguns atributos de manifesto JAR necess\u00E1rios n\u00E3o est\u00E3o definidos no arquivo JAR {0}." }
- };
-
-}
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/java.base/share/classes/sun/misc/resources/Messages_sv.java
--- a/jdk/src/java.base/share/classes/sun/misc/resources/Messages_sv.java Tue Apr 05 18:23:10 2016 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2002, 2013, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 sun.misc.resources;
-
-/**
- * This class represents the {@code ResourceBundle}
- * for sun.misc.
- *
- * @author Michael Colburn
- */
-
-public class Messages_sv extends java.util.ListResourceBundle {
-
- /**
- * Returns the contents of this {@code ResourceBundle}.
- *
- * @return the contents of this {@code ResourceBundle}.
- */
- public Object[][] getContents() {
- return contents;
- }
-
- private static final Object[][] contents = {
- { "optpkg.versionerror", "FEL: Ogiltigt versionsformat i {0} JAR-fil. Kontrollera i dokumentationen vilket versionsformat som st\u00F6ds." },
- { "optpkg.attributeerror", "FEL: Obligatoriskt JAR manifest-attribut {0} \u00E4r inte inst\u00E4llt i {1} JAR-filen." },
- { "optpkg.attributeserror", "FEL: Vissa obligatoriska JAR manifest-attribut \u00E4r inte inst\u00E4llda i {0} JAR-filen." }
- };
-
-}
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/java.base/share/classes/sun/misc/resources/Messages_zh_CN.java
--- a/jdk/src/java.base/share/classes/sun/misc/resources/Messages_zh_CN.java Tue Apr 05 18:23:10 2016 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2002, 2013, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 sun.misc.resources;
-
-/**
- * This class represents the {@code ResourceBundle}
- * for sun.misc.
- *
- * @author Michael Colburn
- */
-
-public class Messages_zh_CN extends java.util.ListResourceBundle {
-
- /**
- * Returns the contents of this {@code ResourceBundle}.
- *
- * @return the contents of this {@code ResourceBundle}.
- */
- public Object[][] getContents() {
- return contents;
- }
-
- private static final Object[][] contents = {
- { "optpkg.versionerror", "\u9519\u8BEF: {0} JAR \u6587\u4EF6\u4E2D\u4F7F\u7528\u7684\u7248\u672C\u683C\u5F0F\u65E0\u6548\u3002\u8BF7\u68C0\u67E5\u6587\u6863\u4EE5\u4E86\u89E3\u652F\u6301\u7684\u7248\u672C\u683C\u5F0F\u3002" },
- { "optpkg.attributeerror", "\u9519\u8BEF: \u5FC5\u8981\u7684{0} JAR \u6E05\u5355\u5C5E\u6027\u672A\u5728{1} JAR \u6587\u4EF6\u4E2D\u8BBE\u7F6E\u3002" },
- { "optpkg.attributeserror", "\u9519\u8BEF: \u67D0\u4E9B\u5FC5\u8981\u7684 JAR \u6E05\u5355\u5C5E\u6027\u672A\u5728{0} JAR \u6587\u4EF6\u4E2D\u8BBE\u7F6E\u3002" }
- };
-
-}
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/java.base/share/classes/sun/misc/resources/Messages_zh_TW.java
--- a/jdk/src/java.base/share/classes/sun/misc/resources/Messages_zh_TW.java Tue Apr 05 18:23:10 2016 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2002, 2013, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 sun.misc.resources;
-
-/**
- * This class represents the {@code ResourceBundle}
- * for sun.misc.
- *
- * @author Michael Colburn
- */
-
-public class Messages_zh_TW extends java.util.ListResourceBundle {
-
- /**
- * Returns the contents of this {@code ResourceBundle}.
- *
- * @return the contents of this {@code ResourceBundle}.
- */
- public Object[][] getContents() {
- return contents;
- }
-
- private static final Object[][] contents = {
- { "optpkg.versionerror", "\u932F\u8AA4: {0} JAR \u6A94\u4F7F\u7528\u4E86\u7121\u6548\u7684\u7248\u672C\u683C\u5F0F\u3002\u8ACB\u6AA2\u67E5\u6587\u4EF6\uFF0C\u4EE5\u7372\u5F97\u652F\u63F4\u7684\u7248\u672C\u683C\u5F0F\u3002" },
- { "optpkg.attributeerror", "\u932F\u8AA4: {1} JAR \u6A94\u4E2D\u672A\u8A2D\u5B9A\u5FC5\u8981\u7684 {0} JAR \u8CC7\u8A0A\u6E05\u55AE\u5C6C\u6027\u3002" },
- { "optpkg.attributeserror", "\u932F\u8AA4: {0} JAR \u6A94\u4E2D\u672A\u8A2D\u5B9A\u67D0\u4E9B\u5FC5\u8981\u7684 JAR \u8CC7\u8A0A\u6E05\u55AE\u5C6C\u6027\u3002" }
- };
-
-}
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/java.base/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java
--- a/jdk/src/java.base/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java Tue Apr 05 18:23:10 2016 +0300
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java Tue Apr 05 09:17:15 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 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
@@ -299,6 +299,13 @@
// Just keep throwing for now.
throw e;
} catch (FtpProtocolException fe) {
+ if (ftp != null) {
+ try {
+ ftp.close();
+ } catch (IOException ioe) {
+ fe.addSuppressed(ioe);
+ }
+ }
throw new IOException(fe);
}
try {
@@ -481,11 +488,34 @@
msgh.add("content-type", "text/plain");
msgh.add("access-type", "directory");
} catch (IOException ex) {
- throw new FileNotFoundException(fullpath);
+ FileNotFoundException fnfe = new FileNotFoundException(fullpath);
+ if (ftp != null) {
+ try {
+ ftp.close();
+ } catch (IOException ioe) {
+ fnfe.addSuppressed(ioe);
+ }
+ }
+ throw fnfe;
} catch (FtpProtocolException ex2) {
- throw new FileNotFoundException(fullpath);
+ FileNotFoundException fnfe = new FileNotFoundException(fullpath);
+ if (ftp != null) {
+ try {
+ ftp.close();
+ } catch (IOException ioe) {
+ fnfe.addSuppressed(ioe);
+ }
+ }
+ throw fnfe;
}
} catch (FtpProtocolException ftpe) {
+ if (ftp != null) {
+ try {
+ ftp.close();
+ } catch (IOException ioe) {
+ ftpe.addSuppressed(ioe);
+ }
+ }
throw new IOException(ftpe);
}
setProperties(msgh);
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/java.base/share/classes/sun/util/resources/LocaleData.java
--- a/jdk/src/java.base/share/classes/sun/util/resources/LocaleData.java Tue Apr 05 18:23:10 2016 +0300
+++ b/jdk/src/java.base/share/classes/sun/util/resources/LocaleData.java Tue Apr 05 09:17:15 2016 -0700
@@ -197,8 +197,6 @@
private static abstract class LocaleDataResourceBundleProvider
implements ResourceBundleProvider {
- abstract protected boolean isSupportedInModule(String baseName, Locale locale);
-
/**
* Changes baseName to its module dependent package name and
* calls the super class implementation. For example,
@@ -217,10 +215,6 @@
* resource bundles except for the java.time supplementary data.
*/
public static abstract class CommonResourceBundleProvider extends LocaleDataResourceBundleProvider {
- @Override
- protected boolean isSupportedInModule(String baseName, Locale locale) {
- return LocaleDataStrategy.INSTANCE.inJavaBaseModule(baseName, locale);
- }
}
/**
@@ -228,10 +222,6 @@
* resource bundles for java.time.
*/
public static abstract class SupplementaryResourceBundleProvider extends LocaleDataResourceBundleProvider {
- @Override
- protected boolean isSupportedInModule(String baseName, Locale locale) {
- return SupplementaryStrategy.INSTANCE.inJavaBaseModule(baseName, locale);
- }
}
// Bundles.Strategy implementations
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/java.base/share/native/libjava/GC.c
--- a/jdk/src/java.base/share/native/libjava/GC.c Tue Apr 05 18:23:10 2016 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 1998, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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
-#include
-#include "sun_misc_GC.h"
-
-
-JNIEXPORT jlong JNICALL
-Java_sun_misc_GC_maxObjectInspectionAge(JNIEnv *env, jclass cls)
-{
- return JVM_MaxObjectInspectionAge();
-}
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/java.base/share/native/libjava/VMSupport.c
--- a/jdk/src/java.base/share/native/libjava/VMSupport.c Tue Apr 05 18:23:10 2016 +0300
+++ b/jdk/src/java.base/share/native/libjava/VMSupport.c Tue Apr 05 09:17:15 2016 -0700
@@ -27,36 +27,17 @@
#include "jni_util.h"
#include "jlong.h"
#include "jvm.h"
-#include "jdk_util.h"
-#include "sun_misc_VMSupport.h"
-
-typedef jobject (JNICALL *INIT_AGENT_PROPERTIES_FN)(JNIEnv *, jobject);
-
-static INIT_AGENT_PROPERTIES_FN InitAgentProperties_fp = NULL;
+#include "jdk_internal_vm_VMSupport.h"
JNIEXPORT jobject JNICALL
-Java_sun_misc_VMSupport_initAgentProperties(JNIEnv *env, jclass cls, jobject props)
+Java_jdk_internal_vm_VMSupport_initAgentProperties(JNIEnv *env, jclass cls, jobject props)
{
- if (InitAgentProperties_fp == NULL) {
- if (!JDK_InitJvmHandle()) {
- JNU_ThrowInternalError(env,
- "Handle for JVM not found for symbol lookup");
- return NULL;
- }
- InitAgentProperties_fp = (INIT_AGENT_PROPERTIES_FN)
- JDK_FindJvmEntry("JVM_InitAgentProperties");
- if (InitAgentProperties_fp == NULL) {
- JNU_ThrowInternalError(env,
- "Mismatched VM version: JVM_InitAgentProperties not found");
- return NULL;
- }
- }
- return (*InitAgentProperties_fp)(env, props);
+ return JVM_InitAgentProperties(env, props);
}
JNIEXPORT jstring JNICALL
-Java_sun_misc_VMSupport_getVMTemporaryDirectory(JNIEnv *env, jclass cls)
+Java_jdk_internal_vm_VMSupport_getVMTemporaryDirectory(JNIEnv *env, jclass cls)
{
return JVM_GetTemporaryDirectory(env);
}
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/java.management/share/classes/sun/management/Agent.java
--- a/jdk/src/java.management/share/classes/sun/management/Agent.java Tue Apr 05 18:23:10 2016 +0300
+++ b/jdk/src/java.management/share/classes/sun/management/Agent.java Tue Apr 05 09:17:15 2016 -0700
@@ -52,7 +52,7 @@
import sun.management.jmxremote.ConnectorBootstrap;
import sun.management.jdp.JdpController;
import sun.management.jdp.JdpException;
-import sun.misc.VMSupport;
+import jdk.internal.vm.VMSupport;
/**
* This Agent is started by the VM when -Dcom.sun.management.snmp or
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/java.rmi/share/classes/sun/rmi/transport/DGCClient.java
--- a/jdk/src/java.rmi/share/classes/sun/rmi/transport/DGCClient.java Tue Apr 05 18:23:10 2016 +0300
+++ b/jdk/src/java.rmi/share/classes/sun/rmi/transport/DGCClient.java Tue Apr 05 09:17:15 2016 -0700
@@ -41,7 +41,6 @@
import java.rmi.dgc.Lease;
import java.rmi.dgc.VMID;
import java.rmi.server.ObjID;
-import sun.misc.GC;
import sun.rmi.runtime.NewThreadAction;
import sun.rmi.server.UnicastRef;
import sun.rmi.server.Util;
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/java.rmi/share/classes/sun/rmi/transport/GC.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.rmi/share/classes/sun/rmi/transport/GC.java Tue Apr 05 09:17:15 2016 -0700
@@ -0,0 +1,291 @@
+/*
+ * Copyright (c) 1998, 2008, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 sun.rmi.transport;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+
+/**
+ * Support for garbage-collection latency requests.
+ *
+ * @author Mark Reinhold
+ * @since 1.2
+ */
+
+class GC {
+
+ private GC() { } /* To prevent instantiation */
+
+
+ /* Latency-target value indicating that there's no active target
+ */
+ private static final long NO_TARGET = Long.MAX_VALUE;
+
+ /* The current latency target, or NO_TARGET if there is no target
+ */
+ private static long latencyTarget = NO_TARGET;
+
+ /* The daemon thread that implements the latency-target mechanism,
+ * or null if there is presently no daemon thread
+ */
+ private static Thread daemon = null;
+
+ /* The lock object for the latencyTarget and daemon fields. The daemon
+ * thread, if it exists, waits on this lock for notification that the
+ * latency target has changed.
+ */
+ private static class LatencyLock extends Object { };
+ private static Object lock = new LatencyLock();
+
+
+ /**
+ * Returns the maximum object-inspection age, which is the number
+ * of real-time milliseconds that have elapsed since the
+ * least-recently-inspected heap object was last inspected by the garbage
+ * collector.
+ *
+ * For simple stop-the-world collectors this value is just the time
+ * since the most recent collection. For generational collectors it is the
+ * time since the oldest generation was most recently collected. Other
+ * collectors are free to return a pessimistic estimate of the elapsed
+ * time, or simply the time since the last full collection was performed.
+ *
+ *
Note that in the presence of reference objects, a given object that
+ * is no longer strongly reachable may have to be inspected multiple times
+ * before it can be reclaimed.
+ */
+ public static native long maxObjectInspectionAge();
+
+ static {
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Void run() {
+ System.loadLibrary("rmi");
+ return null;
+ }});
+ }
+
+ private static class Daemon extends Thread {
+
+ public void run() {
+ for (;;) {
+ long l;
+ synchronized (lock) {
+
+ l = latencyTarget;
+ if (l == NO_TARGET) {
+ /* No latency target, so exit */
+ GC.daemon = null;
+ return;
+ }
+
+ long d = maxObjectInspectionAge();
+ if (d >= l) {
+ /* Do a full collection. There is a remote possibility
+ * that a full collection will occurr between the time
+ * we sample the inspection age and the time the GC
+ * actually starts, but this is sufficiently unlikely
+ * that it doesn't seem worth the more expensive JVM
+ * interface that would be required.
+ */
+ System.gc();
+ d = 0;
+ }
+
+ /* Wait for the latency period to expire,
+ * or for notification that the period has changed
+ */
+ try {
+ lock.wait(l - d);
+ } catch (InterruptedException x) {
+ continue;
+ }
+ }
+ }
+ }
+
+ private Daemon(ThreadGroup tg) {
+ super(tg, null, "GC Daemon", 0L, false);
+ }
+
+ /* Create a new daemon thread in the root thread group */
+ public static void create() {
+ PrivilegedAction pa = new PrivilegedAction() {
+ public Void run() {
+ ThreadGroup tg = Thread.currentThread().getThreadGroup();
+ for (ThreadGroup tgn = tg;
+ tgn != null;
+ tg = tgn, tgn = tg.getParent());
+ Daemon d = new Daemon(tg);
+ d.setDaemon(true);
+ d.setPriority(Thread.MIN_PRIORITY + 1);
+ d.start();
+ GC.daemon = d;
+ return null;
+ }};
+ AccessController.doPrivileged(pa);
+ }
+
+ }
+
+
+ /* Sets the latency target to the given value.
+ * Must be invoked while holding the lock.
+ */
+ private static void setLatencyTarget(long ms) {
+ latencyTarget = ms;
+ if (daemon == null) {
+ /* Create a new daemon thread */
+ Daemon.create();
+ } else {
+ /* Notify the existing daemon thread
+ * that the lateency target has changed
+ */
+ lock.notify();
+ }
+ }
+
+
+ /**
+ * Represents an active garbage-collection latency request. Instances of
+ * this class are created by the {@link #requestLatency}
+ * method. Given a request, the only interesting operation is that of
+ * cancellation.
+ */
+ public static class LatencyRequest
+ implements Comparable {
+
+ /* Instance counter, used to generate unique identifers */
+ private static long counter = 0;
+
+ /* Sorted set of active latency requests */
+ private static SortedSet requests = null;
+
+ /* Examine the request set and reset the latency target if necessary.
+ * Must be invoked while holding the lock.
+ */
+ private static void adjustLatencyIfNeeded() {
+ if ((requests == null) || requests.isEmpty()) {
+ if (latencyTarget != NO_TARGET) {
+ setLatencyTarget(NO_TARGET);
+ }
+ } else {
+ LatencyRequest r = requests.first();
+ if (r.latency != latencyTarget) {
+ setLatencyTarget(r.latency);
+ }
+ }
+ }
+
+ /* The requested latency, or NO_TARGET
+ * if this request has been cancelled
+ */
+ private long latency;
+
+ /* Unique identifier for this request */
+ private long id;
+
+ private LatencyRequest(long ms) {
+ if (ms <= 0) {
+ throw new IllegalArgumentException("Non-positive latency: "
+ + ms);
+ }
+ this.latency = ms;
+ synchronized (lock) {
+ this.id = ++counter;
+ if (requests == null) {
+ requests = new TreeSet();
+ }
+ requests.add(this);
+ adjustLatencyIfNeeded();
+ }
+ }
+
+ /**
+ * Cancels this latency request.
+ *
+ * @throws IllegalStateException
+ * If this request has already been cancelled
+ */
+ public void cancel() {
+ synchronized (lock) {
+ if (this.latency == NO_TARGET) {
+ throw new IllegalStateException("Request already"
+ + " cancelled");
+ }
+ if (!requests.remove(this)) {
+ throw new InternalError("Latency request "
+ + this + " not found");
+ }
+ if (requests.isEmpty()) requests = null;
+ this.latency = NO_TARGET;
+ adjustLatencyIfNeeded();
+ }
+ }
+
+ public int compareTo(LatencyRequest r) {
+ long d = this.latency - r.latency;
+ if (d == 0) d = this.id - r.id;
+ return (d < 0) ? -1 : ((d > 0) ? +1 : 0);
+ }
+
+ public String toString() {
+ return (LatencyRequest.class.getName()
+ + "[" + latency + "," + id + "]");
+ }
+
+ }
+
+
+ /**
+ * Makes a new request for a garbage-collection latency of the given
+ * number of real-time milliseconds. A low-priority daemon thread makes a
+ * best effort to ensure that the maximum object-inspection age never
+ * exceeds the smallest of the currently active requests.
+ *
+ * @param latency
+ * The requested latency
+ *
+ * @throws IllegalArgumentException
+ * If the given latency
is non-positive
+ */
+ public static LatencyRequest requestLatency(long latency) {
+ return new LatencyRequest(latency);
+ }
+
+
+ /**
+ * Returns the current smallest garbage-collection latency request, or zero
+ * if there are no active requests.
+ */
+ public static long currentLatencyTarget() {
+ long t = latencyTarget;
+ return (t == NO_TARGET) ? 0 : t;
+ }
+
+}
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/java.rmi/share/classes/sun/rmi/transport/ObjectTable.java
--- a/jdk/src/java.rmi/share/classes/sun/rmi/transport/ObjectTable.java Tue Apr 05 18:23:10 2016 +0300
+++ b/jdk/src/java.rmi/share/classes/sun/rmi/transport/ObjectTable.java Tue Apr 05 09:17:15 2016 -0700
@@ -34,7 +34,6 @@
import java.security.PrivilegedAction;
import java.util.HashMap;
import java.util.Map;
-import sun.misc.GC;
import sun.rmi.runtime.Log;
import sun.rmi.runtime.NewThreadAction;
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/java.rmi/share/native/librmi/GC.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.rmi/share/native/librmi/GC.c Tue Apr 05 09:17:15 2016 -0700
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 1998, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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
+#include
+#include "sun_rmi_transport_GC.h"
+
+
+JNIEXPORT jlong JNICALL
+Java_sun_rmi_transport_GC_maxObjectInspectionAge(JNIEnv *env, jclass cls)
+{
+ return JVM_MaxObjectInspectionAge();
+}
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/KeyStore.java
--- a/jdk/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/KeyStore.java Tue Apr 05 18:23:10 2016 +0300
+++ b/jdk/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/KeyStore.java Tue Apr 05 09:17:15 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -188,8 +188,10 @@
/*
* The keystore entries.
+ * Keys in the map are unique aliases (thus can differ from
+ * KeyEntry.getAlias())
*/
- private Collection entries = new ArrayList();
+ private Map entries = new HashMap<>();
/*
* The keystore name.
@@ -248,13 +250,10 @@
if (engineIsKeyEntry(alias) == false)
return null;
- for (KeyEntry entry : entries) {
- if (alias.equals(entry.getAlias())) {
- return entry.getPrivateKey();
- }
- }
-
- return null;
+ KeyEntry entry = entries.get(alias);
+ return (entry == null)
+ ? null
+ : entry.getPrivateKey();
}
/**
@@ -274,15 +273,13 @@
return null;
}
- for (KeyEntry entry : entries) {
- if (alias.equals(entry.getAlias())) {
- X509Certificate[] certChain = entry.getCertificateChain();
-
- return certChain.clone();
- }
- }
-
- return null;
+ KeyEntry entry = entries.get(alias);
+ X509Certificate[] certChain = (entry == null)
+ ? null
+ : entry.getCertificateChain();
+ return (certChain == null)
+ ? null
+ : certChain.clone();
}
/**
@@ -306,15 +303,13 @@
return null;
}
- for (KeyEntry entry : entries) {
- if (alias.equals(entry.getAlias()))
- {
- X509Certificate[] certChain = entry.getCertificateChain();
- return certChain.length == 0 ? null : certChain[0];
- }
- }
-
- return null;
+ KeyEntry entry = entries.get(alias);
+ X509Certificate[] certChain = (entry == null)
+ ? null
+ : entry.getCertificateChain();
+ return (certChain == null || certChain.length == 0)
+ ? null
+ : certChain[0];
}
/**
@@ -378,16 +373,7 @@
if (key instanceof RSAPrivateCrtKey) {
- KeyEntry entry = null;
- boolean found = false;
-
- for (KeyEntry e : entries) {
- if (alias.equals(e.getAlias())) {
- found = true;
- entry = e;
- break;
- }
- }
+ KeyEntry entry = entries.get(alias);
X509Certificate[] xchain;
if (chain != null) {
@@ -401,11 +387,11 @@
xchain = null;
}
- if (! found) {
+ if (entry == null) {
entry =
//TODO new KeyEntry(alias, key, (X509Certificate[]) chain);
new KeyEntry(alias, null, xchain);
- entries.add(entry);
+ storeWithUniqueAlias(alias, entry);
}
entry.setAlias(alias);
@@ -484,23 +470,14 @@
// TODO - build CryptoAPI chain?
X509Certificate[] chain =
new X509Certificate[]{ (X509Certificate) cert };
- KeyEntry entry = null;
- boolean found = false;
+ KeyEntry entry = entries.get(alias);
- for (KeyEntry e : entries) {
- if (alias.equals(e.getAlias())) {
- found = true;
- entry = e;
- break;
- }
+ if (entry == null) {
+ entry =
+ new KeyEntry(alias, null, chain);
+ storeWithUniqueAlias(alias, entry);
}
- if (! found) {
- entry =
- new KeyEntry(alias, null, chain);
- entries.add(entry);
-
- }
if (entry.getPrivateKey() == null) { // trusted-cert entry
entry.setAlias(alias);
@@ -532,32 +509,26 @@
throw new KeyStoreException("alias must not be null");
}
- for (KeyEntry entry : entries) {
- if (alias.equals(entry.getAlias())) {
+ KeyEntry entry = entries.remove(alias);
+ if (entry != null) {
+ // Get end-entity certificate and remove from system cert store
+ X509Certificate[] certChain = entry.getCertificateChain();
+ if (certChain != null) {
- // Get end-entity certificate and remove from system cert store
- X509Certificate[] certChain = entry.getCertificateChain();
- if (certChain != null) {
+ try {
- try {
-
- byte[] encoding = certChain[0].getEncoded();
- removeCertificate(getName(), alias, encoding,
+ byte[] encoding = certChain[0].getEncoded();
+ removeCertificate(getName(), entry.getAlias(), encoding,
encoding.length);
- } catch (CertificateException e) {
- throw new KeyStoreException("Cannot remove entry: " +
- e);
- }
+ } catch (CertificateException e) {
+ throw new KeyStoreException("Cannot remove entry: ", e);
}
- Key privateKey = entry.getPrivateKey();
- if (privateKey != null) {
- destroyKeyContainer(
- Key.getContainerName(privateKey.getHCryptProvider()));
- }
-
- entries.remove(entry);
- break;
+ }
+ Key privateKey = entry.getPrivateKey();
+ if (privateKey != null) {
+ destroyKeyContainer(
+ Key.getContainerName(privateKey.getHCryptProvider()));
}
}
}
@@ -568,8 +539,7 @@
* @return enumeration of the alias names
*/
public Enumeration engineAliases() {
-
- final Iterator iter = entries.iterator();
+ final Iterator iter = entries.keySet().iterator();
return new Enumeration()
{
@@ -580,8 +550,7 @@
public String nextElement()
{
- KeyEntry entry = iter.next();
- return entry.getAlias();
+ return iter.next();
}
};
}
@@ -594,15 +563,7 @@
* @return true if the alias exists, false otherwise
*/
public boolean engineContainsAlias(String alias) {
- for (Enumeration enumerator = engineAliases();
- enumerator.hasMoreElements();)
- {
- String a = enumerator.nextElement();
-
- if (a.equals(alias))
- return true;
- }
- return false;
+ return entries.containsKey(alias);
}
/**
@@ -627,13 +588,8 @@
return false;
}
- for (KeyEntry entry : entries) {
- if (alias.equals(entry.getAlias())) {
- return entry.getPrivateKey() != null;
- }
- }
-
- return false;
+ KeyEntry entry = entries.get(alias);
+ return entry != null && entry.getPrivateKey() != null;
}
/**
@@ -643,15 +599,14 @@
* @return true if the entry identified by the given alias is a
* trusted certificate entry, false otherwise.
*/
- public boolean engineIsCertificateEntry(String alias)
- {
- for (KeyEntry entry : entries) {
- if (alias.equals(entry.getAlias())) {
- return entry.getPrivateKey() == null;
- }
+ public boolean engineIsCertificateEntry(String alias) {
+
+ if (alias == null) {
+ return false;
}
- return false;
+ KeyEntry entry = entries.get(alias);
+ return entry != null && entry.getPrivateKey() == null;
}
/**
@@ -670,9 +625,10 @@
* @return the (alias) name of the first entry with matching certificate,
* or null if no such entry exists in this keystore.
*/
- public String engineGetCertificateAlias(Certificate cert)
- {
- for (KeyEntry entry : entries) {
+ public String engineGetCertificateAlias(Certificate cert) {
+
+ for (Map.Entry mapEntry : entries.entrySet()) {
+ KeyEntry entry = mapEntry.getValue();
if (entry.certChain != null && entry.certChain[0].equals(cert)) {
return entry.getAlias();
}
@@ -765,7 +721,7 @@
try {
// Load keys and/or certificate chains
- loadKeysOrCertificateChains(getName(), entries);
+ loadKeysOrCertificateChains(getName());
} catch (KeyStoreException e) {
throw new IOException(e);
@@ -773,12 +729,31 @@
}
/**
+ * Stores the given entry into the map, making sure
+ * the alias, used as the key is unique.
+ * If the same alias already exists, it tries to append
+ * a suffix (1), (2), etc to it until it finds a unique
+ * value.
+ */
+ private void storeWithUniqueAlias(String alias, KeyEntry entry) {
+ String uniqAlias = alias;
+ int uniqNum = 1;
+
+ while (true) {
+ if (entries.putIfAbsent(uniqAlias, entry) == null) {
+ break;
+ }
+ uniqAlias = alias + " (" + (uniqNum++) + ")";
+ }
+ }
+
+
+ /**
* Generates a certificate chain from the collection of
* certificates and stores the result into a key entry.
*/
private void generateCertificateChain(String alias,
- Collection extends Certificate> certCollection,
- Collection entries)
+ Collection extends Certificate> certCollection)
{
try
{
@@ -792,10 +767,8 @@
certChain[i] = (X509Certificate) iter.next();
}
- KeyEntry entry = new KeyEntry(alias, null, certChain);
-
- // Add cert chain
- entries.add(entry);
+ storeWithUniqueAlias(alias,
+ new KeyEntry(alias, null, certChain));
}
catch (Throwable e)
{
@@ -810,8 +783,7 @@
*/
private void generateRSAKeyAndCertificateChain(String alias,
long hCryptProv, long hCryptKey, int keyLength,
- Collection extends Certificate> certCollection,
- Collection entries)
+ Collection extends Certificate> certCollection)
{
try
{
@@ -825,11 +797,9 @@
certChain[i] = (X509Certificate) iter.next();
}
- KeyEntry entry = new KeyEntry(alias, new RSAPrivateKey(hCryptProv,
- hCryptKey, keyLength), certChain);
-
- // Add cert chain
- entries.add(entry);
+ storeWithUniqueAlias(alias, new KeyEntry(alias,
+ new RSAPrivateKey(hCryptProv, hCryptKey, keyLength),
+ certChain));
}
catch (Throwable e)
{
@@ -886,8 +856,8 @@
* @param name Name of keystore.
* @param entries Collection of key/certificate.
*/
- private native void loadKeysOrCertificateChains(String name,
- Collection entries) throws KeyStoreException;
+ private native void loadKeysOrCertificateChains(String name)
+ throws KeyStoreException;
/**
* Stores a DER-encoded certificate into the certificate store
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/jdk.crypto.mscapi/windows/native/libsunmscapi/security.cpp
--- a/jdk/src/jdk.crypto.mscapi/windows/native/libsunmscapi/security.cpp Tue Apr 05 18:23:10 2016 +0300
+++ b/jdk/src/jdk.crypto.mscapi/windows/native/libsunmscapi/security.cpp Tue Apr 05 09:17:15 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -272,7 +272,7 @@
* Signature: (Ljava/lang/String;Ljava/util/Collection;)V
*/
JNIEXPORT void JNICALL Java_sun_security_mscapi_KeyStore_loadKeysOrCertificateChains
- (JNIEnv *env, jobject obj, jstring jCertStoreName, jobject jCollections)
+ (JNIEnv *env, jobject obj, jstring jCertStoreName)
{
/**
* Certificate in cert store has enhanced key usage extension
@@ -331,7 +331,7 @@
// Determine method ID to generate certificate chain
jmethodID mGenCertChain = env->GetMethodID(clazzOfThis,
"generateCertificateChain",
- "(Ljava/lang/String;Ljava/util/Collection;Ljava/util/Collection;)V");
+ "(Ljava/lang/String;Ljava/util/Collection;)V");
if (mGenCertChain == NULL) {
__leave;
}
@@ -339,7 +339,7 @@
// Determine method ID to generate RSA certificate chain
jmethodID mGenRSAKeyAndCertChain = env->GetMethodID(clazzOfThis,
"generateRSAKeyAndCertificateChain",
- "(Ljava/lang/String;JJILjava/util/Collection;Ljava/util/Collection;)V");
+ "(Ljava/lang/String;JJILjava/util/Collection;)V");
if (mGenRSAKeyAndCertChain == NULL) {
__leave;
}
@@ -366,38 +366,37 @@
} else {
// Private key is available
- BOOL bGetUserKey = ::CryptGetUserKey(hCryptProv, dwKeySpec, &hUserKey);
+ BOOL bGetUserKey = ::CryptGetUserKey(hCryptProv, dwKeySpec, &hUserKey);
- // Skip certificate if cannot find private key
- if (bGetUserKey == FALSE)
- {
- if (bCallerFreeProv)
- ::CryptReleaseContext(hCryptProv, NULL);
+ // Skip certificate if cannot find private key
+ if (bGetUserKey == FALSE)
+ {
+ if (bCallerFreeProv)
+ ::CryptReleaseContext(hCryptProv, NULL);
- continue;
- }
+ continue;
+ }
- // Set cipher mode to ECB
- DWORD dwCipherMode = CRYPT_MODE_ECB;
- ::CryptSetKeyParam(hUserKey, KP_MODE, (BYTE*)&dwCipherMode, NULL);
+ // Set cipher mode to ECB
+ DWORD dwCipherMode = CRYPT_MODE_ECB;
+ ::CryptSetKeyParam(hUserKey, KP_MODE, (BYTE*)&dwCipherMode, NULL);
- // If the private key is present in smart card, we may not be able to
- // determine the key length by using the private key handle. However,
- // since public/private key pairs must have the same length, we could
- // determine the key length of the private key by using the public key
- // in the certificate.
- dwPublicKeyLength = ::CertGetPublicKeyLength(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
- &(pCertContext->pCertInfo->SubjectPublicKeyInfo));
+ // If the private key is present in smart card, we may not be able to
+ // determine the key length by using the private key handle. However,
+ // since public/private key pairs must have the same length, we could
+ // determine the key length of the private key by using the public key
+ // in the certificate.
+ dwPublicKeyLength = ::CertGetPublicKeyLength(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
+ &(pCertContext->pCertInfo->SubjectPublicKeyInfo));
-}
+ }
PCCERT_CHAIN_CONTEXT pCertChainContext = NULL;
// Build certificate chain by using system certificate store.
// Add cert chain into collection for any key usage.
//
- if (GetCertificateChain(OID_EKU_ANY, pCertContext,
- &pCertChainContext))
+ if (GetCertificateChain(OID_EKU_ANY, pCertContext, &pCertChainContext))
{
for (unsigned int i=0; i < pCertChainContext->cChain; i++)
@@ -456,26 +455,26 @@
// collection
env->CallVoidMethod(obj, mGenCertChain,
env->NewStringUTF(pszNameString),
- jArrayList, jCollections);
+ jArrayList);
}
else
{
- // Determine key type: RSA or DSA
- DWORD dwData = CALG_RSA_KEYX;
- DWORD dwSize = sizeof(DWORD);
- ::CryptGetKeyParam(hUserKey, KP_ALGID, (BYTE*)&dwData,
- &dwSize, NULL);
+ // Determine key type: RSA or DSA
+ DWORD dwData = CALG_RSA_KEYX;
+ DWORD dwSize = sizeof(DWORD);
+ ::CryptGetKeyParam(hUserKey, KP_ALGID, (BYTE*)&dwData,
+ &dwSize, NULL);
- if ((dwData & ALG_TYPE_RSA) == ALG_TYPE_RSA)
- {
- // Generate RSA certificate chain and store into cert
- // chain collection
- env->CallVoidMethod(obj, mGenRSAKeyAndCertChain,
- env->NewStringUTF(pszNameString),
- (jlong) hCryptProv, (jlong) hUserKey,
- dwPublicKeyLength, jArrayList, jCollections);
+ if ((dwData & ALG_TYPE_RSA) == ALG_TYPE_RSA)
+ {
+ // Generate RSA certificate chain and store into cert
+ // chain collection
+ env->CallVoidMethod(obj, mGenRSAKeyAndCertChain,
+ env->NewStringUTF(pszNameString),
+ (jlong) hCryptProv, (jlong) hUserKey,
+ dwPublicKeyLength, jArrayList);
+ }
}
-}
}
// Free cert chain
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/jdk.jartool/share/classes/sun/tools/jar/Main.java
--- a/jdk/src/jdk.jartool/share/classes/sun/tools/jar/Main.java Tue Apr 05 18:23:10 2016 +0300
+++ b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/Main.java Tue Apr 05 09:17:15 2016 -0700
@@ -51,8 +51,8 @@
import jdk.internal.module.Hasher;
import jdk.internal.module.ModuleInfoExtender;
-import sun.misc.JarIndex;
-import static sun.misc.JarIndex.INDEX_NAME;
+import jdk.internal.util.jar.JarIndex;
+import static jdk.internal.util.jar.JarIndex.INDEX_NAME;
import static java.util.jar.JarFile.MANIFEST_NAME;
import static java.util.stream.Collectors.joining;
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/jdk.jdwp.agent/share/native/libjdwp/util.c
--- a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/util.c Tue Apr 05 18:23:10 2016 +0300
+++ b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/util.c Tue Apr 05 09:17:15 2016 -0700
@@ -257,9 +257,9 @@
gdata->property_user_dir
= getPropertyUTF8(env, "user.dir");
- /* Get agent properties: invoke sun.misc.VMSupport.getAgentProperties */
+ /* Get agent properties: invoke VMSupport.getAgentProperties */
localVMSupportClass = JNI_FUNC_PTR(env,FindClass)
- (env, "sun/misc/VMSupport");
+ (env, "jdk/internal/vm/VMSupport");
if (localVMSupportClass == NULL) {
gdata->agent_properties = NULL;
if (JNI_FUNC_PTR(env,ExceptionOccurred)(env)) {
@@ -276,7 +276,7 @@
if (JNI_FUNC_PTR(env,ExceptionOccurred)(env)) {
JNI_FUNC_PTR(env,ExceptionClear)(env);
EXIT_ERROR(AGENT_ERROR_INTERNAL,
- "Exception occurred calling sun.misc.VMSupport.getAgentProperties");
+ "Exception occurred calling VMSupport.getAgentProperties");
}
}
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageFileCreator.java
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageFileCreator.java Tue Apr 05 18:23:10 2016 +0300
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageFileCreator.java Tue Apr 05 09:17:15 2016 -0700
@@ -46,6 +46,7 @@
import jdk.tools.jlink.internal.Archive.Entry.EntryType;
import jdk.tools.jlink.internal.PoolImpl.CompressedModuleData;
import jdk.tools.jlink.plugin.ExecutableImage;
+import jdk.tools.jlink.plugin.PluginException;
import jdk.tools.jlink.plugin.Pool;
import jdk.tools.jlink.plugin.Pool.ModuleData;
import jdk.tools.jlink.plugin.Pool.ModuleDataType;
@@ -183,6 +184,8 @@
PoolImpl resultResources;
try {
resultResources = pluginSupport.visitResources(allContent);
+ } catch (PluginException pe) {
+ throw pe;
} catch (Exception ex) {
throw new IOException(ex);
}
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java Tue Apr 05 09:17:15 2016 -0700
@@ -0,0 +1,226 @@
+/*
+ * 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.tools.jlink.internal.plugins;
+
+import java.io.ByteArrayInputStream;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+import jdk.tools.jlink.plugin.PluginException;
+import jdk.tools.jlink.plugin.Pool;
+import jdk.tools.jlink.plugin.TransformerPlugin;
+
+/**
+ * Plugin to generate java.lang.invoke classes.
+ */
+public final class GenerateJLIClassesPlugin implements TransformerPlugin {
+
+ private static final String NAME = "generate-jli-classes";
+
+ private static final String BMH_PARAM = "bmh";
+
+ private static final String BMH_SPECIES_PARAM = "bmh-species";
+
+ private static final String DESCRIPTION = PluginsResourceBundle.getDescription(NAME);
+
+ private static final String BMH = "java/lang/invoke/BoundMethodHandle";
+
+ private static final Method FACTORY_METHOD;
+
+ List speciesTypes;
+
+ public GenerateJLIClassesPlugin() {
+ }
+
+ @Override
+ public Set getType() {
+ return Collections.singleton(CATEGORY.TRANSFORMER);
+ }
+
+ @Override
+ public String getName() {
+ return NAME;
+ }
+
+ @Override
+ public String getDescription() {
+ return DESCRIPTION;
+ }
+
+ @Override
+ public Set getState() {
+ return EnumSet.of(STATE.AUTO_ENABLED, STATE.FUNCTIONAL);
+ }
+
+ @Override
+ public boolean hasArguments() {
+ return true;
+ }
+
+ @Override
+ public String getArgumentsDescription() {
+ return PluginsResourceBundle.getArgument(NAME);
+ }
+
+ /**
+ * @return the default Species forms to generate.
+ *
+ * This list was derived from running a Java concatenating strings
+ * with -Djava.lang.invoke.stringConcat=MH_INLINE_SIZED_EXACT set
+ * plus a subset of octane. A better long-term solution is to define
+ * and run a set of quick generators and extracting this list as a
+ * step in the build process.
+ */
+ public static List defaultSpecies() {
+ return List.of("LL", "L3", "L4", "L5", "L6", "L7", "L7I",
+ "L7II", "L7IIL", "L8", "L9", "L10", "L11", "L11I", "L11II",
+ "L12", "L13", "LI", "D", "L3I", "LIL", "LLI", "LLIL",
+ "LILL", "I", "LLILL");
+ }
+
+ @Override
+ public void configure(Map config) {
+ String mainArgument = config.get(NAME);
+
+ // Enable by default
+ boolean bmhEnabled = true;
+ if (mainArgument != null) {
+ Set args = Arrays.stream(mainArgument.split(","))
+ .collect(Collectors.toSet());
+ if (!args.contains(BMH_PARAM)) {
+ bmhEnabled = false;
+ }
+ }
+
+ if (!bmhEnabled) {
+ speciesTypes = List.of();
+ } else {
+ String args = config.get(BMH_SPECIES_PARAM);
+ List bmhSpecies;
+ if (args != null && !args.isEmpty()) {
+ bmhSpecies = Arrays.stream(args.split(","))
+ .map(String::trim)
+ .filter(s -> !s.isEmpty())
+ .collect(Collectors.toList());
+ } else {
+ bmhSpecies = defaultSpecies();
+ }
+
+ // Expand BMH species signatures
+ speciesTypes = bmhSpecies.stream()
+ .map(type -> expandSignature(type))
+ .collect(Collectors.toList());
+
+ // Validation check
+ for (String type : speciesTypes) {
+ for (char c : type.toCharArray()) {
+ if ("LIJFD".indexOf(c) < 0) {
+ throw new PluginException("All characters must "
+ + "correspond to a basic field type: LIJFD");
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public void visit(Pool in, Pool out) {
+ for (Pool.ModuleData data : in.getContent()) {
+ if (("/java.base/" + BMH + ".class").equals(data.getPath())) {
+ // Add BoundMethodHandle unchanged
+ out.add(data);
+ speciesTypes.forEach(types -> generateConcreteClass(types, data, out));
+ } else {
+ if (!out.contains(data)) {
+ out.add(data);
+ }
+ }
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void generateConcreteClass(String types, Pool.ModuleData data, Pool out) {
+ try {
+ // Generate class
+ Map.Entry result = (Map.Entry)
+ FACTORY_METHOD.invoke(null, types);
+ String className = result.getKey();
+ byte[] bytes = result.getValue();
+
+ // Add class to pool
+ Pool.ModuleData ndata = new Pool.ModuleData(data.getModule(),
+ "/java.base/" + className + ".class",
+ Pool.ModuleDataType.CLASS_OR_RESOURCE,
+ new ByteArrayInputStream(bytes), bytes.length);
+ if (!out.contains(ndata)) {
+ out.add(ndata);
+ }
+ } catch (Exception ex) {
+ throw new PluginException(ex);
+ }
+ }
+
+ static {
+ try {
+ Class> BMHFactory = Class.forName("java.lang.invoke.BoundMethodHandle$Factory");
+ Method genClassMethod = BMHFactory.getDeclaredMethod("generateConcreteBMHClassBytes",
+ String.class);
+ genClassMethod.setAccessible(true);
+ FACTORY_METHOD = genClassMethod;
+ } catch (Exception e) {
+ throw new PluginException(e);
+ }
+ }
+
+ // Convert LL -> LL, L3 -> LLL
+ private static String expandSignature(String signature) {
+ StringBuilder sb = new StringBuilder();
+ char last = 'X';
+ int count = 0;
+ for (int i = 0; i < signature.length(); i++) {
+ char c = signature.charAt(i);
+ if (c >= '0' && c <= '9') {
+ count *= 10;
+ count += (c - '0');
+ } else {
+ for (int j = 1; j < count; j++) {
+ sb.append(last);
+ }
+ sb.append(c);
+ last = c;
+ count = 0;
+ }
+ }
+ for (int j = 1; j < count; j++) {
+ sb.append(last);
+ }
+ return sb.toString();
+ }
+}
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java Tue Apr 05 18:23:10 2016 +0300
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java Tue Apr 05 09:17:15 2016 -0700
@@ -41,12 +41,13 @@
import java.util.stream.IntStream;
import java.util.stream.Stream;
import jdk.internal.org.objectweb.asm.ClassReader;
-import jdk.tools.jlink.plugin.TransformerPlugin;
-import jdk.tools.jlink.plugin.Pool;
-import jdk.tools.jlink.plugin.PluginException;
import jdk.tools.jlink.internal.ResourcePrevisitor;
import jdk.tools.jlink.internal.StringTable;
import jdk.tools.jlink.internal.Utils;
+import jdk.tools.jlink.plugin.PluginException;
+import jdk.tools.jlink.plugin.Pool;
+import jdk.tools.jlink.plugin.Pool.ModuleDataType;
+import jdk.tools.jlink.plugin.TransformerPlugin;
/**
* Plugin to explicitly specify the locale data included in jdk.localedata
@@ -84,14 +85,15 @@
private static final String METAINFONAME = "LocaleDataMetaInfo";
private static final String META_FILES =
"*module-info.class," +
- "*LocaleDataProvider*," +
- "*" + METAINFONAME + "*,";
+ "*LocaleDataProvider.class," +
+ "*" + METAINFONAME + ".class,";
private static final String INCLUDE_LOCALE_FILES =
"*sun/text/resources/ext/[^\\/]+_%%.class," +
"*sun/util/resources/ext/[^\\/]+_%%.class," +
"*sun/text/resources/cldr/ext/[^\\/]+_%%.class," +
"*sun/util/resources/cldr/ext/[^\\/]+_%%.class,";
private Predicate predicate;
+ private String userParam;
private List priorityList;
private List available;
private List filtered;
@@ -115,7 +117,8 @@
if (resource.getModule().equals(MODULENAME)) {
String path = resource.getPath();
resource = predicate.test(path) ? resource: null;
- if (resource != null) {
+ if (resource != null &&
+ resource.getType().equals(ModuleDataType.CLASS_OR_RESOURCE)) {
byte[] bytes = resource.getBytes();
ClassReader cr = new ClassReader(bytes);
if (Arrays.stream(cr.getInterfaces())
@@ -155,13 +158,17 @@
@Override
public void configure(Map config) {
- try {
- priorityList = Arrays.stream(config.get(NAME).split(","))
- .map(Locale.LanguageRange::new)
- .collect(Collectors.toList());
- } catch (IllegalArgumentException iae) {
- throw new PluginException(iae.getLocalizedMessage());
- }
+ userParam = config.get(NAME);
+ priorityList = Arrays.stream(userParam.split(","))
+ .map(s -> {
+ try {
+ return new Locale.LanguageRange(s);
+ } catch (IllegalArgumentException iae) {
+ throw new PluginException(String.format(
+ PluginsResourceBundle.getMessage(NAME + ".invalidtag"), s));
+ }
+ })
+ .collect(Collectors.toList());
}
@Override
@@ -191,7 +198,8 @@
filtered = filterLocales(available);
if (filtered.isEmpty()) {
- throw new PluginException(PluginsResourceBundle.getMessage(NAME + ".nomatchinglocales"));
+ throw new PluginException(
+ String.format(PluginsResourceBundle.getMessage(NAME + ".nomatchinglocales"), userParam));
}
try {
@@ -243,10 +251,10 @@
files += INCLUDE_LOCALE_FILES.replaceAll("%%", isoSpecial + "_[0-9]{3}");
}
- // Add Thai BreakIterator related files
+ // Add Thai BreakIterator related data files
if (lang.equals("th")) {
files += "*sun/text/resources/thai_dict," +
- "*sun/text/resources/[^\\/]+_th,";
+ "*sun/text/resources/[^\\/]+BreakIteratorData_th,";
}
// Add Taiwan resource bundles for Hong Kong
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins.properties
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins.properties Tue Apr 05 18:23:10 2016 +0300
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins.properties Tue Apr 05 09:17:15 2016 -0700
@@ -20,7 +20,7 @@
Level 1: ZIP\n\
Level 2: both.\n\
An optional filter can be specified to list the pattern of files to be filtered.\n\
-Use ^ for negation. eg: *Exception.class,*Error.class,^/java.base/java/lang/*
+Use ^ for negation. e.g.: *Exception.class,*Error.class,^/java.base/java/lang/*
compact-cp.argument=
@@ -32,17 +32,22 @@
copy-files.description=\
If files to copy are not absolute path, JDK home dir is used.\n\
-eg: jrt-fs.jar,LICENSE,/home/me/myfile.txt=somewehere/conf.txt
+e.g.: jrt-fs.jar,LICENSE,/home/me/myfile.txt=somewehere/conf.txt
exclude-files.argument=
exclude-files.description=\
-Specify files to exclude. eg: *.diz, /java.base/native/client/*
+Specify files to exclude. e.g.: *.diz, /java.base/native/client/*
exclude-resources.argument=
exclude-resources.description=\
-Specify resources to exclude. eg: *.jcov, */META-INF/*
+Specify resources to exclude. e.g.: *.jcov, */META-INF/*
+
+generate-jli-classes.argument=
+
+generate-jli-classes.description=\
+Concrete java.lang.invoke classes to generate
installed-modules.description=Fast loading of module descriptors (always enabled)
@@ -51,7 +56,7 @@
sort-resources.argument=
sort-resources.description=\
-Sort resources. eg: */modules-info.class,/java-base/java/lang/*
+Sort resources. e.g.: */modules-info.class,/java-base/java/lang/*
strip-debug.description=\
Strip debug information from the output image
@@ -73,13 +78,16 @@
include-locales.description=\
BCP 47 language tags separated by a comma, allowing locale matching\n\
-defined in RFC 4647. eg: en,ja,*-IN
+defined in RFC 4647. e.g.: en,ja,*-IN
include-locales.missingpackages=\
Missing locale data packages in jdk.localedata:\n\t
include-locales.nomatchinglocales=\
-No matching locales found. Check the specified pattern.
+No matching locales found for \"%s\". Check the specified pattern.
+
+include-locales.invalidtag=\
+Invalid language tag: %s
main.status.ok=Functional.
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/jdk.jlink/share/classes/module-info.java
--- a/jdk/src/jdk.jlink/share/classes/module-info.java Tue Apr 05 18:23:10 2016 +0300
+++ b/jdk/src/jdk.jlink/share/classes/module-info.java Tue Apr 05 09:17:15 2016 -0700
@@ -45,5 +45,6 @@
provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.OptimizationPlugin;
provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.ExcludeVMPlugin;
provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.IncludeLocalesPlugin;
+ provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.GenerateJLIClassesPlugin;
provides jdk.tools.jlink.plugin.PostProcessorPlugin with jdk.tools.jlink.internal.plugins.ReleaseInfoPlugin;
}
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/PerfDataFile.java
--- a/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/PerfDataFile.java Tue Apr 05 18:23:10 2016 +0300
+++ b/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/PerfDataFile.java Tue Apr 05 09:17:15 2016 -0700
@@ -27,6 +27,7 @@
import java.io.File;
import java.io.FilenameFilter;
+import jdk.internal.vm.VMSupport;
/**
* Class to provide translations from the local Vm Identifier
@@ -291,7 +292,7 @@
* the same directory. Instead of guessing which directory the
* VM is using, we will ask.
*/
- String tmpdir = sun.misc.VMSupport.getVMTemporaryDirectory();
+ String tmpdir = VMSupport.getVMTemporaryDirectory();
/*
* Assure that the string returned has a trailing File.separator
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/jdk.localedata/share/classes/sun/util/resources/provider/LocaleDataProvider.java
--- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/provider/LocaleDataProvider.java Tue Apr 05 18:23:10 2016 +0300
+++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/provider/LocaleDataProvider.java Tue Apr 05 09:17:15 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
@@ -25,34 +25,33 @@
package sun.util.resources.provider;
-import java.lang.reflect.Module;
import java.util.Locale;
import java.util.ResourceBundle;
-import sun.util.locale.provider.ResourceBundleProviderSupport;
import sun.util.resources.LocaleData;
/**
- * {@code LocaleDataProvider} in module jdk.localedata implements
- * {@code LocaleDataBundleProvider} in module java.base. This class works as a
- * service agent between {@code ResourceBundle.getBundle} callers in java.base
- * and resource bundles in jdk.localedata.
+ * Service Provider for loading locale data resource bundles in jdk.localedata
+ * except for JavaTimeSupplementary resource bundles.
*/
public class LocaleDataProvider extends LocaleData.CommonResourceBundleProvider {
@Override
- protected boolean isSupportedInModule(String baseName, Locale locale) {
- // The assumption here is that there are two modules containing
- // resource bundles for locale support. If resource bundles are split
- // into more modules, this method will need to be changed to determine
- // what locales are exactly supported.
- return !super.isSupportedInModule(baseName, locale);
+ public ResourceBundle getBundle(String baseName, Locale locale) {
+ return loadResourceBundle(toBundleName(baseName, locale));
}
- @Override
- public ResourceBundle getBundle(String baseName, Locale locale) {
- if (isSupportedInModule(baseName, locale)) {
- Module module = LocaleDataProvider.class.getModule();
- String bundleName = toBundleName(baseName, locale);
- return ResourceBundleProviderSupport.loadResourceBundle(module, bundleName);
+ /**
+ * Utility method for loading a resource bundle in jdk.localedata.
+ */
+ static ResourceBundle loadResourceBundle(String bundleName) {
+ Class> c = Class.forName(LocaleDataProvider.class.getModule(), bundleName);
+ if (c != null && ResourceBundle.class.isAssignableFrom(c)) {
+ try {
+ @SuppressWarnings("unchecked")
+ ResourceBundle rb = ((Class) c).newInstance();
+ return rb;
+ } catch (InstantiationException | IllegalAccessException e) {
+ throw new InternalError(e);
+ }
}
return null;
}
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/src/jdk.localedata/share/classes/sun/util/resources/provider/SupplementaryLocaleDataProvider.java
--- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/provider/SupplementaryLocaleDataProvider.java Tue Apr 05 18:23:10 2016 +0300
+++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/provider/SupplementaryLocaleDataProvider.java Tue Apr 05 09:17:15 2016 -0700
@@ -25,33 +25,16 @@
package sun.util.resources.provider;
-import java.lang.reflect.Module;
import java.util.Locale;
import java.util.ResourceBundle;
-
-import sun.util.locale.provider.ResourceBundleProviderSupport;
import sun.util.resources.LocaleData;
/**
- * {@code SupplementaryLocaleDataProvider} in module jdk.localedata implements
- * {@code JavaTimeSupplementaryProvider} in module java.base. This class works as a
- * service agent between {@code ResourceBundle.getBundle} callers in java.base
- * and resource bundles in jdk.localedata.
+ * Service Provider for loading JavaTimeSupplementary resource bundles in jdk.localedata.
*/
public class SupplementaryLocaleDataProvider extends LocaleData.SupplementaryResourceBundleProvider {
@Override
- protected boolean isSupportedInModule(String baseName, Locale locale) {
- // The assumption here is that there are two modules containing
- // resource bundles for locale support. If resource bundles are split
- // into more modules, this method will need to be changed to determine
- // what locales are exactly supported.
- return !super.isSupportedInModule(baseName, locale);
- }
-
- @Override
public ResourceBundle getBundle(String baseName, Locale locale) {
- Module module = LocaleDataProvider.class.getModule();
- String bundleName = toBundleName(baseName, locale);
- return ResourceBundleProviderSupport.loadResourceBundle(module, bundleName);
+ return LocaleDataProvider.loadResourceBundle(toBundleName(baseName, locale));
}
}
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/test/Makefile
--- a/jdk/test/Makefile Tue Apr 05 18:23:10 2016 +0300
+++ b/jdk/test/Makefile Tue Apr 05 09:17:15 2016 -0700
@@ -302,6 +302,8 @@
# Set the max memory for jtreg control vm
JTREG_MEMORY_OPTION = -J-Xmx512m
JTREG_BASIC_OPTIONS += $(JTREG_MEMORY_OPTION)
+# Give tests access to JT_JAVA, see JDK-8141609
+JTREG_BASIC_OPTIONS += -e:JDK8_HOME=${JT_JAVA}
# Add any extra options
JTREG_BASIC_OPTIONS += $(EXTRA_JTREG_OPTIONS)
# Set other vm and test options
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/test/ProblemList.txt
--- a/jdk/test/ProblemList.txt Tue Apr 05 18:23:10 2016 +0300
+++ b/jdk/test/ProblemList.txt Tue Apr 05 09:17:15 2016 -0700
@@ -116,221 +116,184 @@
# jdk_beans
-# 8060027
-java/beans/XMLEncoder/Test4903007.java generic-all
-java/beans/XMLEncoder/java_awt_GridBagLayout.java generic-all
-java/beans/XMLDecoder/8028054/TestConstructorFinder.java generic-all
-java/beans/XMLDecoder/8028054/TestMethodFinder.java generic-all
+java/beans/XMLEncoder/Test4903007.java 8060027 generic-all
+java/beans/XMLEncoder/java_awt_GridBagLayout.java 8060027 generic-all
+java/beans/XMLDecoder/8028054/TestConstructorFinder.java 8060027 generic-all
+java/beans/XMLDecoder/8028054/TestMethodFinder.java 8060027 generic-all
-# 8132565
-java/beans/Introspector/8132566/OverridePropertyInfoTest.java generic-all
-java/beans/Introspector/8132566/OverrideUserDefPropertyInfoTest.java generic-all
+java/beans/Introspector/8132566/OverridePropertyInfoTest.java 8132565 generic-all
+java/beans/Introspector/8132566/OverrideUserDefPropertyInfoTest.java 8132565 generic-all
############################################################################
# jdk_lang
-# 8029891
-java/lang/ClassLoader/deadlock/GetResource.java generic-all
+java/lang/ClassLoader/deadlock/GetResource.java 8029891 generic-all
-# 7008363
-java/lang/StringCoding/CheckEncodings.sh generic-all
+java/lang/StringCoding/CheckEncodings.sh 7008363 generic-all
############################################################################
# jdk_instrument
-# 8061177
-java/lang/instrument/RedefineBigClass.sh generic-all
-java/lang/instrument/RetransformBigClass.sh generic-all
+java/lang/instrument/RedefineBigClass.sh 8061177 generic-all
+java/lang/instrument/RetransformBigClass.sh 8061177 generic-all
-# 8072130
-java/lang/instrument/BootClassPath/BootClassPathTest.sh macosx-all
+java/lang/instrument/BootClassPath/BootClassPathTest.sh 8072130 macosx-all
-# 8130339
-java/lang/management/MemoryMXBean/LowMemoryTest.java generic-all
+java/lang/management/MemoryMXBean/LowMemoryTest.java 8130339 generic-all
############################################################################
# jdk_jmx
-# 8030957
-com/sun/management/OperatingSystemMXBean/GetProcessCpuLoad.java aix-all
-com/sun/management/OperatingSystemMXBean/GetSystemCpuLoad.java aix-all
-javax/management/MBeanServer/OldMBeanServerTest.java aix-all
+com/sun/management/OperatingSystemMXBean/GetProcessCpuLoad.java 8030957 aix-all
+com/sun/management/OperatingSystemMXBean/GetSystemCpuLoad.java 8030957 aix-all
+javax/management/MBeanServer/OldMBeanServerTest.java 8030957 aix-all
-# 8042215
-javax/management/remote/mandatory/notif/NotifReconnectDeadlockTest.java generic-all
+javax/management/remote/mandatory/notif/NotifReconnectDeadlockTest.java 8042215 generic-all
-# 8147985
-sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java generic-all
+sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java 8147985 generic-all
############################################################################
# jdk_net
-# 7148829
-sun/net/InetAddress/nameservice/simple/CacheTest.java generic-all
-sun/net/InetAddress/nameservice/simple/DefaultCaching.java generic-all
+sun/net/InetAddress/nameservice/simple/CacheTest.java 7148829 generic-all
+sun/net/InetAddress/nameservice/simple/DefaultCaching.java 7148829 generic-all
-# 7122846
-java/net/MulticastSocket/NoLoopbackPackets.java macosx-all
-java/net/MulticastSocket/SetLoopbackMode.java macosx-all
+java/net/MulticastSocket/NoLoopbackPackets.java 7122846 macosx-all
+java/net/MulticastSocket/SetLoopbackMode.java 7122846 macosx-all
-# 7145658
-java/net/MulticastSocket/Test.java macosx-all
+java/net/MulticastSocket/Test.java 7145658 macosx-all
-# 7143960
-java/net/DatagramSocket/SendDatagramToBadAddress.java macosx-all
+java/net/DatagramSocket/SendDatagramToBadAddress.java 7143960 macosx-all
############################################################################
# jdk_nio
-# 6963118
-java/nio/channels/Selector/Wakeup.java windows-all
+java/nio/channels/Selector/Wakeup.java 6963118 windows-all
-# 7141822
-java/nio/channels/DatagramChannel/ChangingAddress.java macosx-all
+java/nio/channels/DatagramChannel/ChangingAddress.java 7141822 macosx-all
+
+java/nio/channels/Selector/OutOfBand.java 7132677 macosx-all
-# 7132677
-java/nio/channels/Selector/OutOfBand.java macosx-all
+java/nio/file/WatchService/Basic.java 7158947 solaris-all Solaris 11
+java/nio/file/WatchService/MayFlies.java 7158947 solaris-all Solaris 11
+java/nio/file/WatchService/LotsOfEvents.java 7158947 solaris-all Solaris 11
-# 7158947, Solaris 11
-java/nio/file/WatchService/Basic.java solaris-all
-java/nio/file/WatchService/MayFlies.java solaris-all
-java/nio/file/WatchService/LotsOfEvents.java solaris-all
-
-# 8149712
-java/nio/charset/coders/BashStreams.java generic-all
+java/nio/charset/coders/BashStreams.java 8149712 generic-all
############################################################################
# jdk_rmi
-# 7140992
-java/rmi/server/Unreferenced/finiteGCLatency/FiniteGCLatency.java generic-all
+java/rmi/server/Unreferenced/finiteGCLatency/FiniteGCLatency.java 7140992 generic-all
-# 7146541
-java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java linux-all
+java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java 7146541 linux-all
-# 7191877
-java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java generic-all
+java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java 7191877 generic-all
-# 7195095
-sun/rmi/transport/proxy/EagerHttpFallback.java generic-all
+sun/rmi/transport/proxy/EagerHttpFallback.java 7195095 generic-all
-# 8062724
-java/rmi/activation/Activatable/extLoadedImpl/ext.sh generic-all
+java/rmi/activation/Activatable/extLoadedImpl/ext.sh 8062724 generic-all
-# 8145980
-sun/rmi/rmic/newrmic/equivalence/run.sh generic-all
+sun/rmi/rmic/newrmic/equivalence/run.sh 8145980 generic-all
############################################################################
# jdk_security
-# 7157786
-sun/security/pkcs11/ec/TestKeyFactory.java generic-all
+sun/security/pkcs11/ec/TestKeyFactory.java 7157786 generic-all
-# 7164518: no PortUnreachableException on Mac
-sun/security/krb5/auto/Unreachable.java macosx-all
+sun/security/krb5/auto/Unreachable.java 7164518 macosx-all no PortUnreachableException on Mac
-# 7041639: Solaris DSA keypair generation bug
-java/security/KeyPairGenerator/SolarisShortDSA.java solaris-all
-sun/security/tools/keytool/standard.sh solaris-all
+java/security/KeyPairGenerator/SolarisShortDSA.java 7041639 solaris-all
+sun/security/tools/keytool/standard.sh 7041639 solaris-all
-# 8062758
-java/security/Security/ClassLoaderDeadlock/Deadlock2.sh generic-all
+java/security/Security/ClassLoaderDeadlock/Deadlock2.sh 8062758 generic-all
-# 8026393
-sun/security/tools/jarsigner/warnings/BadKeyUsageTest.java generic-all
+sun/security/tools/jarsigner/warnings/BadKeyUsageTest.java 8026393 generic-all
-# 8077138: Some PKCS11 tests fail because NSS library is not initialized
-# 8023434: NSS initialization failed
-sun/security/pkcs11/Cipher/ReinitCipher.java windows-all
-sun/security/pkcs11/Cipher/TestPKCS5PaddingError.java windows-all
-sun/security/pkcs11/Cipher/TestRSACipher.java windows-all
-sun/security/pkcs11/Cipher/TestRSACipherWrap.java windows-all
-sun/security/pkcs11/Cipher/TestRawRSACipher.java windows-all
-sun/security/pkcs11/Cipher/TestSymmCiphers.java windows-all
-sun/security/pkcs11/Cipher/TestSymmCiphersNoPad.java windows-all
-sun/security/pkcs11/KeyAgreement/TestDH.java windows-all
-sun/security/pkcs11/KeyAgreement/TestInterop.java windows-all
-sun/security/pkcs11/KeyAgreement/TestShort.java windows-all
-sun/security/pkcs11/KeyGenerator/DESParity.java windows-all
-sun/security/pkcs11/KeyGenerator/TestKeyGenerator.java windows-all
-sun/security/pkcs11/KeyPairGenerator/TestDH2048.java windows-all
-sun/security/pkcs11/KeyStore/SecretKeysBasic.sh windows-all
-sun/security/pkcs11/Mac/MacKAT.java windows-all
-sun/security/pkcs11/Mac/MacSameTest.java windows-all
-sun/security/pkcs11/Mac/ReinitMac.java windows-all
-sun/security/pkcs11/MessageDigest/ByteBuffers.java windows-all
-sun/security/pkcs11/MessageDigest/DigestKAT.java windows-all
-sun/security/pkcs11/MessageDigest/ReinitDigest.java windows-all
-sun/security/pkcs11/MessageDigest/TestCloning.java windows-all
-sun/security/pkcs11/Provider/ConfigQuotedString.sh windows-all
-sun/security/pkcs11/Provider/Login.sh windows-all
-sun/security/pkcs11/SampleTest.java windows-all
-sun/security/pkcs11/Secmod/AddPrivateKey.java windows-all
-sun/security/pkcs11/Secmod/AddTrustedCert.java windows-all
-sun/security/pkcs11/Secmod/Crypto.java windows-all
-sun/security/pkcs11/Secmod/GetPrivateKey.java windows-all
-sun/security/pkcs11/Secmod/JksSetPrivateKey.java windows-all
-sun/security/pkcs11/Secmod/LoadKeystore.java windows-all
-sun/security/pkcs11/SecureRandom/Basic.java windows-all
-sun/security/pkcs11/SecureRandom/TestDeserialization.java windows-all
-sun/security/pkcs11/Serialize/SerializeProvider.java windows-all
-sun/security/pkcs11/Signature/ByteBuffers.java windows-all
-sun/security/pkcs11/Signature/ReinitSignature.java windows-all
-sun/security/pkcs11/Signature/TestDSA.java windows-all
-sun/security/pkcs11/Signature/TestDSAKeyLength.java windows-all
-sun/security/pkcs11/Signature/TestRSAKeyLength.java windows-all
-sun/security/pkcs11/ec/ReadCertificates.java windows-all
-sun/security/pkcs11/ec/ReadPKCS12.java windows-all
-sun/security/pkcs11/ec/TestCurves.java windows-all
-sun/security/pkcs11/ec/TestECDH.java windows-all
-sun/security/pkcs11/ec/TestECDH2.java windows-all
-sun/security/pkcs11/ec/TestECDSA.java windows-all
-sun/security/pkcs11/ec/TestECDSA2.java windows-all
-sun/security/pkcs11/ec/TestECGenSpec.java windows-all
-sun/security/pkcs11/rsa/KeyWrap.java windows-all
-sun/security/pkcs11/rsa/TestCACerts.java windows-all
-sun/security/pkcs11/rsa/TestKeyFactory.java windows-all
-sun/security/pkcs11/rsa/TestKeyPairGenerator.java windows-all
-sun/security/pkcs11/rsa/TestSignatures.java windows-all
-sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java windows-all
-sun/security/pkcs11/tls/TestKeyMaterial.java windows-all
-sun/security/pkcs11/tls/TestLeadingZeroesP11.java windows-all
-sun/security/pkcs11/tls/TestMasterSecret.java windows-all
-sun/security/pkcs11/tls/TestPRF.java windows-all
-sun/security/pkcs11/tls/TestPremaster.java windows-all
+sun/security/pkcs11/Cipher/ReinitCipher.java 8077138,8023434 windows-all
+sun/security/pkcs11/Cipher/TestPKCS5PaddingError.java 8077138,8023434 windows-all
+sun/security/pkcs11/Cipher/TestRSACipher.java 8077138,8023434 windows-all
+sun/security/pkcs11/Cipher/TestRSACipherWrap.java 8077138,8023434 windows-all
+sun/security/pkcs11/Cipher/TestRawRSACipher.java 8077138,8023434 windows-all
+sun/security/pkcs11/Cipher/TestSymmCiphers.java 8077138,8023434 windows-all
+sun/security/pkcs11/Cipher/TestSymmCiphersNoPad.java 8077138,8023434 windows-all
+sun/security/pkcs11/KeyAgreement/TestDH.java 8077138,8023434 windows-all
+sun/security/pkcs11/KeyAgreement/TestInterop.java 8077138,8023434 windows-all
+sun/security/pkcs11/KeyAgreement/TestShort.java 8077138,8023434 windows-all
+sun/security/pkcs11/KeyGenerator/DESParity.java 8077138,8023434 windows-all
+sun/security/pkcs11/KeyGenerator/TestKeyGenerator.java 8077138,8023434 windows-all
+sun/security/pkcs11/KeyPairGenerator/TestDH2048.java 8077138,8023434 windows-all
+sun/security/pkcs11/KeyStore/SecretKeysBasic.sh 8077138,8023434 windows-all
+sun/security/pkcs11/Mac/MacKAT.java 8077138,8023434 windows-all
+sun/security/pkcs11/Mac/MacSameTest.java 8077138,8023434 windows-all
+sun/security/pkcs11/Mac/ReinitMac.java 8077138,8023434 windows-all
+sun/security/pkcs11/MessageDigest/ByteBuffers.java 8077138,8023434 windows-all
+sun/security/pkcs11/MessageDigest/DigestKAT.java 8077138,8023434 windows-all
+sun/security/pkcs11/MessageDigest/ReinitDigest.java 8077138,8023434 windows-all
+sun/security/pkcs11/MessageDigest/TestCloning.java 8077138,8023434 windows-all
+sun/security/pkcs11/Provider/ConfigQuotedString.sh 8077138,8023434 windows-all
+sun/security/pkcs11/Provider/Login.sh 8077138,8023434 windows-all
+sun/security/pkcs11/SampleTest.java 8077138,8023434 windows-all
+sun/security/pkcs11/Secmod/AddPrivateKey.java 8077138,8023434 windows-all
+sun/security/pkcs11/Secmod/AddTrustedCert.java 8077138,8023434 windows-all
+sun/security/pkcs11/Secmod/Crypto.java 8077138,8023434 windows-all
+sun/security/pkcs11/Secmod/GetPrivateKey.java 8077138,8023434 windows-all
+sun/security/pkcs11/Secmod/JksSetPrivateKey.java 8077138,8023434 windows-all
+sun/security/pkcs11/Secmod/LoadKeystore.java 8077138,8023434 windows-all
+sun/security/pkcs11/SecureRandom/Basic.java 8077138,8023434 windows-all
+sun/security/pkcs11/SecureRandom/TestDeserialization.java 8077138,8023434 windows-all
+sun/security/pkcs11/Serialize/SerializeProvider.java 8077138,8023434 windows-all
+sun/security/pkcs11/Signature/ByteBuffers.java 8077138,8023434 windows-all
+sun/security/pkcs11/Signature/ReinitSignature.java 8077138,8023434 windows-all
+sun/security/pkcs11/Signature/TestDSA.java 8077138,8023434 windows-all
+sun/security/pkcs11/Signature/TestDSAKeyLength.java 8077138,8023434 windows-all
+sun/security/pkcs11/Signature/TestRSAKeyLength.java 8077138,8023434 windows-all
+sun/security/pkcs11/ec/ReadCertificates.java 8077138,8023434 windows-all
+sun/security/pkcs11/ec/ReadPKCS12.java 8077138,8023434 windows-all
+sun/security/pkcs11/ec/TestCurves.java 8077138,8023434 windows-all
+sun/security/pkcs11/ec/TestECDH.java 8077138,8023434 windows-all
+sun/security/pkcs11/ec/TestECDH2.java 8077138,8023434 windows-all
+sun/security/pkcs11/ec/TestECDSA.java 8077138,8023434 windows-all
+sun/security/pkcs11/ec/TestECDSA2.java 8077138,8023434 windows-all
+sun/security/pkcs11/ec/TestECGenSpec.java 8077138,8023434 windows-all
+sun/security/pkcs11/rsa/KeyWrap.java 8077138,8023434 windows-all
+sun/security/pkcs11/rsa/TestCACerts.java 8077138,8023434 windows-all
+sun/security/pkcs11/rsa/TestKeyFactory.java 8077138,8023434 windows-all
+sun/security/pkcs11/rsa/TestKeyPairGenerator.java 8077138,8023434 windows-all
+sun/security/pkcs11/rsa/TestSignatures.java 8077138,8023434 windows-all
+sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java 8077138,8023434 windows-all
+sun/security/pkcs11/tls/TestKeyMaterial.java 8077138,8023434 windows-all
+sun/security/pkcs11/tls/TestLeadingZeroesP11.java 8077138,8023434 windows-all
+sun/security/pkcs11/tls/TestMasterSecret.java 8077138,8023434 windows-all
+sun/security/pkcs11/tls/TestPRF.java 8077138,8023434 windows-all
+sun/security/pkcs11/tls/TestPremaster.java 8077138,8023434 windows-all
-# 8051770
-sun/security/provider/SecureRandom/StrongSecureRandom.java macosx-10.10
+sun/security/provider/SecureRandom/StrongSecureRandom.java 8051770 macosx-10.10
-# 8074580
-sun/security/pkcs11/rsa/TestKeyPairGenerator.java generic-all
+sun/security/pkcs11/rsa/TestKeyPairGenerator.java 8074580 generic-all
-# 8038079
-sun/security/krb5/auto/HttpNegotiateServer.java generic-all
+sun/security/krb5/auto/HttpNegotiateServer.java 8038079 generic-all
-# 8130302
-sun/security/tools/keytool/autotest.sh generic-all
+sun/security/tools/keytool/autotest.sh 8130302 generic-all
############################################################################
# jdk_sound
-# 8059743
-javax/sound/midi/Gervill/SoftProvider/GetDevice.java generic-all
+javax/sound/midi/Gervill/SoftProvider/GetDevice.java 8059743 generic-all
############################################################################
# jdk_imageio
-javax/imageio/plugins/shared/CanWriteSequence.java generic-all
-javax/imageio/plugins/tiff/MultiPageTest/MultiPageTest.java generic-all
-javax/imageio/plugins/tiff/WriteToSequenceAfterAbort.java generic-all
+javax/imageio/plugins/shared/CanWriteSequence.java 8148454 generic-all
+javax/imageio/plugins/tiff/MultiPageTest/MultiPageTest.java 8148454 generic-all
+javax/imageio/plugins/tiff/WriteToSequenceAfterAbort.java 8148454 generic-all
############################################################################
@@ -348,56 +311,41 @@
# jdk_tools
-# Tests take too long, on sparcs see 7143279
-# also see 8059906
-tools/pack200/CommandLineTests.java generic-all
+tools/pack200/CommandLineTests.java 7143279,8059906 generic-all
+
+tools/pack200/Pack200Test.java 8059906,8151901 generic-all
-# 8059906 fails on solaris and macosx, 8151901
-tools/pack200/Pack200Test.java generic-all
+tools/pack200/Pack200Props.java 8152622 macosx-all
-# 8152622
-tools/pack200/Pack200Props.java macosx-all
-
-# 8068049
-tools/launcher/FXLauncherTest.java linux-all,macosx-all
+tools/launcher/FXLauncherTest.java 8068049 linux-all,macosx-all
############################################################################
# jdk_jdi
-# 8004127
-com/sun/jdi/RedefineImplementor.sh generic-all
+com/sun/jdi/RedefineImplementor.sh 8004127 generic-all
-# 8031555
-com/sun/jdi/JdbMethodExitTest.sh generic-all
+com/sun/jdi/JdbMethodExitTest.sh 8031555 generic-all
-# 8043571
-com/sun/jdi/RepStep.java generic-all
+com/sun/jdi/RepStep.java 8043571 generic-all
-# 8058616
-com/sun/jdi/RedefinePop.sh generic-all
+com/sun/jdi/RedefinePop.sh 8058616 generic-all
-# 8068645
-com/sun/jdi/CatchPatternTest.sh generic-all
+com/sun/jdi/CatchPatternTest.sh 8068645 generic-all
-# 8067354
-com/sun/jdi/GetLocalVariables4Test.sh windows-all
+com/sun/jdi/GetLocalVariables4Test.sh 8067354 windows-all
############################################################################
# jdk_util
-# 8062512
-java/util/spi/ResourceBundleControlProvider/UserDefaultControlTest.java generic-all
+java/util/spi/ResourceBundleControlProvider/UserDefaultControlTest.java 8062512 generic-all
-# 8130337
-java/util/stream/test/org/openjdk/tests/java/util/stream/IntPrimitiveOpsTests.java generic-all
+java/util/stream/test/org/openjdk/tests/java/util/stream/IntPrimitiveOpsTests.java 8130337 generic-all
-# 8080165, 8085982
-java/util/Arrays/ParallelPrefix.java generic-all
+java/util/Arrays/ParallelPrefix.java 8080165,8085982 generic-all
-# 8079538
-java/util/BitSet/BitSetStreamTest.java generic-all
+java/util/BitSet/BitSetStreamTest.java 8079538 generic-all
############################################################################
@@ -407,43 +355,33 @@
# svc_tools
-# 8031482
-sun/tools/jcmd/TestJcmdSanity.java windows-all
+sun/tools/jcmd/TestJcmdSanity.java 8031482 windows-all
-# 8072131, 8132452
-sun/tools/jmap/heapconfig/JMapHeapConfigTest.java generic-all
+sun/tools/jmap/heapconfig/JMapHeapConfigTest.java 8072131,8132452 generic-all
-# 8046285
-sun/tools/jstatd/TestJstatdExternalRegistry.java generic-all
+sun/tools/jstatd/TestJstatdExternalRegistry.java 8046285 generic-all
-# 6456333
-sun/tools/jps/TestJpsJarRelative.java generic-all
+sun/tools/jps/TestJpsJarRelative.java 6456333 generic-all
-# 6734748
-sun/tools/jinfo/JInfoRunningProcessFlagTest.java generic-all
+sun/tools/jinfo/JInfoRunningProcessFlagTest.java 6734748 generic-all
-# 8057732
-sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java generic-all
+sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java 8057732 generic-all
-# 8059035
-sun/tools/jinfo/JInfoSanityTest.java generic-all
+sun/tools/jinfo/JInfoSanityTest.java 8059035 generic-all
-# 8151899
-demo/jvmti/compiledMethodLoad/CompiledMethodLoadTest.java generic-all
+demo/jvmti/compiledMethodLoad/CompiledMethodLoadTest.java 8151899 generic-all
############################################################################
# jdk_other
-# 8141370
-com/sun/jndi/ldap/DeadSSLLdapTimeoutTest.java linux-i586,macosx-all
+com/sun/jndi/ldap/DeadSSLLdapTimeoutTest.java 8141370 linux-i586,macosx-all
############################################################################
# core_tools
-# 8150975
-# tools/jimage/JImageTest.java linux-i586,windows-i586
+tools/jimage/JImageTest.java 8150975 linux-i586,windows-i586
############################################################################
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/test/TEST.groups
--- a/jdk/test/TEST.groups Tue Apr 05 18:23:10 2016 +0300
+++ b/jdk/test/TEST.groups Tue Apr 05 09:17:15 2016 -0700
@@ -60,7 +60,8 @@
:jdk_rmi \
:jdk_beans \
:jdk_imageio \
- :jdk_sound
+ :jdk_sound \
+ :jdk_client_sanity
###############################################################################
#
@@ -351,6 +352,10 @@
:jdk_sound \
:jdk_imageio
+# SwingSet3 tests.
+jdk_client_sanity = \
+ sanity/client/SwingSet
+
###############################################################################
#
# Serviceability sanity groups
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/test/java/net/BindException/Test.java
--- a/jdk/test/java/net/BindException/Test.java Tue Apr 05 18:23:10 2016 +0300
+++ b/jdk/test/java/net/BindException/Test.java Tue Apr 05 09:17:15 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2013, 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
@@ -24,6 +24,7 @@
/*
* @test
* @bug 4417734
+ * @key intermittent
* @summary Test that we get a BindException in all expected combinations
*/
import java.net.*;
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/test/java/util/Calendar/Bug8152077.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Calendar/Bug8152077.java Tue Apr 05 09:17:15 2016 -0700
@@ -0,0 +1,135 @@
+/*
+ * 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 8152077
+ * @summary Make sure that roll() with HOUR/HOUR_OF_DAY works around standard/daylight
+ * time transitions
+ */
+
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.util.TimeZone;
+import static java.util.Calendar.*;
+
+public class Bug8152077 {
+ private static final TimeZone LA = TimeZone.getTimeZone("America/Los_Angeles");
+ private static final TimeZone BR = TimeZone.getTimeZone("America/Sao_Paulo");
+
+ private static final int[] ALLDAY_HOURS = {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23
+ };
+ private static final int[] AM_HOURS = {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
+ };
+ private static final int[] PM_HOURS = { // in 24-hour clock
+ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23
+ };
+
+ private static int errors;
+
+ public static void main(String[] args) {
+ TimeZone initialTz = TimeZone.getDefault();
+ try {
+ testRoll(LA, new int[] { 2016, MARCH, 13 },
+ new int[] { 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 });
+ testRoll(LA, new int[] { 2016, MARCH, 13 },
+ new int[] { 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11 });
+ testRoll(LA, new int[] { 2016, MARCH, 13 }, PM_HOURS);
+
+ testRoll(LA, new int[] { 2016, NOVEMBER, 6 }, ALLDAY_HOURS);
+ testRoll(LA, new int[] { 2016, NOVEMBER, 6 }, AM_HOURS);
+ testRoll(LA, new int[] { 2016, NOVEMBER, 6 }, PM_HOURS);
+
+ testRoll(BR, new int[] { 2016, FEBRUARY, 21 }, ALLDAY_HOURS);
+ testRoll(BR, new int[] { 2016, FEBRUARY, 21 }, AM_HOURS);
+ testRoll(BR, new int[] { 2016, FEBRUARY, 21 }, PM_HOURS);
+
+ testRoll(BR, new int[] { 2016, OCTOBER, 15 }, ALLDAY_HOURS);
+ testRoll(BR, new int[] { 2016, OCTOBER, 15 }, PM_HOURS);
+ testRoll(BR, new int[] { 2016, OCTOBER, 16 },
+ new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 });
+ testRoll(BR, new int[] { 2016, OCTOBER, 16 },
+ new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 });
+ testRoll(BR, new int[] { 2016, OCTOBER, 16 }, PM_HOURS);
+ } finally {
+ TimeZone.setDefault(initialTz);
+ }
+ if (errors > 0) {
+ throw new RuntimeException("Test failed");
+ }
+ }
+
+ private static void testRoll(TimeZone tz, int[] params, int[] sequence) {
+ TimeZone.setDefault(tz);
+ for (int i = 0; i < sequence.length; i++) {
+ testRoll(+1, params, sequence, i);
+ testRoll(-1, params, sequence, i);
+ }
+ }
+
+ // amount must be 1 or -1.
+ private static void testRoll(int amount, int[] params, int[] sequence, int startIndex) {
+ int year = params[0];
+ int month = params[1];
+ int dayOfMonth = params[2];
+ int hourOfDay = sequence[startIndex];
+ Calendar cal = new GregorianCalendar(year, month, dayOfMonth,
+ hourOfDay, 0, 0);
+ int ampm = cal.get(AM_PM);
+
+ int length = sequence.length;
+ int count = length * 2;
+ int field = (length > 12) ? HOUR_OF_DAY : HOUR;
+
+ System.out.printf("roll(%s, %2d) starting from %s%n",
+ (field == HOUR) ? "HOUR" : "HOUR_OF_DAY", amount, cal.getTime());
+ for (int i = 0; i < count; i++) {
+ int index = (amount > 0) ? (startIndex + i + 1) % length
+ : Math.floorMod(startIndex - i - 1, length);
+ int expected = sequence[index];
+ if (field == HOUR) {
+ expected %= 12;
+ }
+ cal.roll(field, amount);
+ int value = cal.get(field);
+ if (value != expected) {
+ System.out.println("Unexpected field value: got=" + value
+ + ", expected=" + expected);
+ errors++;
+ }
+ if (cal.get(DAY_OF_MONTH) != dayOfMonth) {
+ System.out.println("DAY_OF_MONTH changed: " + dayOfMonth
+ + " to " + cal.get(DAY_OF_MONTH));
+ }
+ if (field == HOUR && cal.get(AM_PM) != ampm) {
+ System.out.println("AM_PM changed: " + ampm + " to " + cal.get(AM_PM));
+ errors++;
+ }
+ }
+ }
+}
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/test/java/util/Currency/PropertiesTest.sh
--- a/jdk/test/java/util/Currency/PropertiesTest.sh Tue Apr 05 18:23:10 2016 +0300
+++ b/jdk/test/java/util/Currency/PropertiesTest.sh Tue Apr 05 09:17:15 2016 -0700
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 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 6332666 6863624 7180362 8003846 8074350 8074351 8130246
+# @bug 6332666 6863624 7180362 8003846 8074350 8074351 8130246 8149735
# @summary tests the capability of replacing the currency data with user
# specified currency properties file
# @build PropertiesTest
@@ -85,12 +85,13 @@
# Dump built-in currency data
run PropertiesTest -d dump1
-
+if [ ! -f dump1 ]; then echo "file dump1 not created. Test cannot execute. Failed."; exit 1; fi
# Dump built-in currency data + overrides in properties file specified
# by system property.
run -Djava.util.currency.data=${PROPS} PropertiesTest -d dump2
+if [ ! -f dump2 ]; then echo "file dump2 not created. Test cannot execute. Failed."; exit 1; fi
run PropertiesTest -c dump1 dump2 ${PROPS}
@@ -102,7 +103,7 @@
WRITABLEJDK=.${FS}testjava
cp -H -R $TESTJAVA $WRITABLEJDK || exit 1
PROPLOCATION=${WRITABLEJDK}${FS}lib
-chmod -R +w $WRITABLEJDK || exit 1
+chmod -R a+rx $WRITABLEJDK || exit 1
cp ${PROPS} $PROPLOCATION || exit 1
echo "Properties location: ${PROPLOCATION}"
@@ -110,6 +111,7 @@
echo ''
${WRITABLEJDK}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} PropertiesTest -d dump3
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
+if [ ! -f dump3 ]; then echo "file dump3 not created. Test cannot execute. Failed."; exit 1; fi
# Cleanup
rm -rf $WRITABLEJDK
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/test/java/util/List/NestedSubList.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/List/NestedSubList.java Tue Apr 05 09:17:15 2016 -0700
@@ -0,0 +1,97 @@
+/*
+ * 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 8079136
+ * @run testng NestedSubList
+ * @summary Accessing a nested sublist leads to StackOverflowError
+ */
+
+import java.util.AbstractList;
+import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Vector;
+
+import org.testng.annotations.Test;
+import org.testng.annotations.DataProvider;
+import static org.testng.Assert.fail;
+
+public class NestedSubList {
+
+ static final int NEST_LIMIT = 65536;
+
+ @Test(dataProvider="lists")
+ public void testAccessToSublists(List list, boolean modifiable) {
+ Class> cls = list.getClass();
+ for (int i = 0; i < NEST_LIMIT; ++i) {
+ list = list.subList(0, 1);
+ }
+
+ try {
+ list.get(0);
+ if (modifiable) {
+ list.remove(0);
+ list.add(0, 42);
+ }
+ } catch (StackOverflowError e) {
+ fail("failed for " + cls);
+ }
+ }
+
+ @DataProvider
+ public static Object[][] lists() {
+ final boolean MODIFIABLE = true;
+ final boolean NON_MODIFIABLE = false;
+ List c = Arrays.asList(42);
+
+ return new Object[][] {
+ {c, NON_MODIFIABLE},
+ {new ArrayList<>(c), MODIFIABLE},
+ {new LinkedList<>(c), MODIFIABLE},
+ {new MyList(), NON_MODIFIABLE},
+ {new Vector<>(c), MODIFIABLE},
+ {Collections.singletonList(42), NON_MODIFIABLE},
+ {Collections.checkedList(c, Integer.class), NON_MODIFIABLE},
+ {Collections.checkedList(new ArrayList<>(c), Integer.class), MODIFIABLE},
+ {Collections.checkedList(new LinkedList<>(c), Integer.class), MODIFIABLE},
+ {Collections.checkedList(new Vector<>(c), Integer.class), MODIFIABLE},
+ {Collections.synchronizedList(c), NON_MODIFIABLE},
+ {Collections.synchronizedList(new ArrayList<>(c)), MODIFIABLE},
+ {Collections.synchronizedList(new LinkedList<>(c)), MODIFIABLE},
+ {Collections.synchronizedList(new Vector<>(c)), MODIFIABLE},
+ {Collections.unmodifiableList(c), NON_MODIFIABLE},
+ {Collections.unmodifiableList(new ArrayList<>(c)), NON_MODIFIABLE},
+ {Collections.unmodifiableList(new LinkedList<>(c)), NON_MODIFIABLE},
+ {Collections.unmodifiableList(new Vector<>(c)), NON_MODIFIABLE},
+ };
+ }
+
+ static class MyList extends AbstractList {
+ public Integer get(int index) { return 42; }
+ public int size() { return 1; }
+ }
+}
diff -r 09143ccbfc6e -r 5070d74da2bc jdk/test/java/util/List/SubList.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/List/SubList.java Tue Apr 05 09:17:15 2016 -0700
@@ -0,0 +1,676 @@
+/*
+ * 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 8079136
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.*
+ * @run testng SubList
+ * @summary Basic functionality of sublists
+ * @key randomness
+ */
+
+import java.util.AbstractList;
+import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.ConcurrentModificationException;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Random;
+import java.util.Vector;
+
+import org.testng.annotations.Test;
+import org.testng.annotations.DataProvider;
+
+import jdk.testlibrary.RandomFactory;
+
+
+public class SubList extends org.testng.Assert {
+
+ final Random rnd = RandomFactory.getRandom();
+
+ @Test(dataProvider = "modifiable")
+ public void testAdd(List list, int from, int to) {
+ List subList = list.subList(from, to);
+ Integer e = rnd.nextInt();
+ subList.add(e);
+ assertEquals(list.get(to), e);
+ assertEquals(subList.size(), to - from + 1);
+ }
+
+ @Test(dataProvider = "modifiable",
+ expectedExceptions = ConcurrentModificationException.class)
+ public void testModAdd(List list, int from, int to) {
+ List subList = list.subList(from, to);
+ list.add(42);
+ subList.add(42);
+ }
+
+ @Test(dataProvider = "unresizable",
+ expectedExceptions = UnsupportedOperationException.class)
+ public void testUnmodAdd(List list, int from, int to) {
+ List subList = list.subList(from, to);
+ subList.add(42);
+ }
+
+ @Test(dataProvider = "modifiable")
+ public void testAddAtPos(List list, int from, int to) {
+ List subList = list.subList(from, to);
+ int i = rnd.nextInt(1 + to - from);
+ Integer e = rnd.nextInt();
+ subList.add(i, e);
+ assertEquals(list.get(from + i), e);
+ assertEquals(subList.size(), to - from + 1);
+ }
+
+ @Test(dataProvider = "modifiable",
+ expectedExceptions = ConcurrentModificationException.class)
+ public void testModAddAtPos(List list, int from, int to) {
+ List subList = list.subList(from, to);
+ list.add(42);
+ int i = rnd.nextInt(1 + to - from);
+ subList.add(i, 42);
+ }
+
+ @Test(dataProvider = "unresizable",
+ expectedExceptions = UnsupportedOperationException.class)
+ public void testUnmodAddAtPos(List list, int from, int to) {
+ List subList = list.subList(from, to);
+ int i = rnd.nextInt(1 + to - from);
+ subList.add(i, 42);
+ }
+
+ @Test(dataProvider = "modifiable")
+ public void testClear(List list, int from, int to) {
+ List subList = list.subList(from, to);
+ subList.clear();
+ assertTrue(subList.isEmpty());
+ assertEquals(subList.size(), 0);
+ }
+
+ @Test(dataProvider = "modifiable",
+ expectedExceptions = ConcurrentModificationException.class)
+ public void testModClear(List list, int from, int to) {
+ List subList = list.subList(from, to);
+ list.add(42);
+ subList.clear();
+ }
+
+ @Test(dataProvider = "unresizable",
+ expectedExceptions = UnsupportedOperationException.class)
+ public void testUnmodClear(List list, int from, int to) {
+ List subList = list.subList(from, to);
+ subList.clear();
+ }
+
+ @Test(dataProvider = "all")
+ public void testEquals(List list, int from, int to) {
+ List subList1 = list.subList(from, to);
+ List subList2 = list.subList(from, to);
+ assertTrue(subList1.equals(subList2));
+ assertEquals(subList1.hashCode(), subList2.hashCode());
+ for (int i = 0; i != 16; ++i) {
+ int from3 = rnd.nextInt(1 + list.size());
+ int to3 = from3 + rnd.nextInt(1 + list.size() - from3);
+ boolean equal = (to - from) == (to3 - from3);
+ for (int j = 0; j < to - from && j < to3 - from3; ++j)
+ equal &= list.get(from + j) == list.get(from3 + j);
+ List subList3 = list.subList(from3, to3);
+ assertEquals(subList1.equals(subList3), equal);
+ }
+ }
+
+// @Test(dataProvider = "modifiable",
+// expectedExceptions = ConcurrentModificationException.class)
+// public void testModEquals(List list, int from, int to) {
+// List subList = list.subList(from, to);
+// list.add(42);
+// subList.equals(subList);
+// }
+
+ @Test(dataProvider = "modifiable",
+ expectedExceptions = ConcurrentModificationException.class)
+ public void testModHashCode(List list, int from, int to) {
+ List subList = list.subList(from, to);
+ list.add(42);
+ subList.hashCode();
+ }
+
+ @Test(dataProvider = "all")
+ public void testGet(List list, int from, int to) {
+ List subList = list.subList(from, to);
+ for (int i = 0; i < to - from; ++i)
+ assertEquals(list.get(from + i), subList.get(i));
+ }
+
+ @Test(dataProvider = "modifiable",
+ expectedExceptions = ConcurrentModificationException.class)
+ public void testModGet(List list, int from, int to) {
+ List subList = list.subList(from, to);
+ list.add(42);
+ subList.get(from);
+ }
+
+ @Test(dataProvider = "all")
+ public void testIndexOf(List list, int from, int to) {
+ List subList = list.subList(from, to);
+ if (from < to) {
+ Integer e = list.get(from);
+ int j = subList.indexOf(e);
+ assertTrue(j == 0);
+ }
+ for (int i = 0; i < list.size(); ++i) {
+ Integer e = list.get(i);
+ int j = subList.indexOf(e);
+ if (i < from || i >= to) {
+ assertTrue(j == -1 || subList.get(j) == e);
+ } else {
+ assertTrue(j >= 0);
+ assertTrue(j <= i - from);
+ assertEquals(subList.get(j), e);
+ }
+ }
+ for (int i = 0; i < 16; ++i) {
+ Integer r = rnd.nextInt();
+ if (list.contains(r)) continue;
+ int j = subList.indexOf(r);
+ assertTrue(j == -1);
+ }
+ }
+
+ @Test(dataProvider = "modifiable",
+ expectedExceptions = ConcurrentModificationException.class)
+ public void testModIndexOf(List list, int from, int to) {
+ List subList = list.subList(from, to);
+ list.add(42);
+ subList.indexOf(from);
+ }
+
+ @Test(dataProvider = "all")
+ public void testIterator(List list, int from, int to) {
+ List subList = list.subList(from, to);
+ Iterator it = subList.iterator();
+ for (int i = from; i < to; ++i) {
+ assertTrue(it.hasNext());
+ assertEquals(list.get(i), it.next());
+ }
+ assertFalse(it.hasNext());
+ }
+
+ @Test(dataProvider = "modifiable",
+ expectedExceptions = ConcurrentModificationException.class)
+ public void testModIteratorNext(List list, int from, int to) {
+ List subList = list.subList(from, to);
+ Iterator it = subList.iterator();
+ list.add(42);
+ it.next();
+ }
+
+ @Test(dataProvider = "modifiable")
+ public void testIteratorRemove(List list, int from, int to) {
+ List subList = list.subList(from, to);
+ Iterator it = subList.iterator();
+ for (int i = from; i < to; ++i) {
+ assertTrue(it.hasNext());
+ assertEquals(list.get(from), it.next());
+ it.remove();
+ }
+ assertFalse(it.hasNext());
+ assertTrue(subList.isEmpty());
+ }
+
+ @Test(dataProvider = "modifiable",
+ expectedExceptions = ConcurrentModificationException.class)
+ public void testModIteratorRemove(List list, int from, int to) {
+ List subList = list.subList(from, to);
+ Iterator it = subList.iterator();
+ it.next();
+ list.add(42);
+ it.remove();
+ }
+
+ @Test(dataProvider = "unresizable",
+ expectedExceptions = UnsupportedOperationException.class)
+ public void testUnmodIteratorRemove(List list, int from, int to) {
+ List subList = list.subList(from, to);
+ Iterator it = subList.iterator();
+ it.next();
+ it.remove();
+ }
+
+ @Test(dataProvider = "all")
+ public void testIteratorForEachRemaining(List list, int from, int to) {
+ List subList = list.subList(from, to);
+ for (int k = 0; k < 16; ++k) {
+ int r = from + rnd.nextInt(1 + to - from);
+ Iterator it = subList.iterator();
+ for (int i = from; i < to; ++i) {
+ assertTrue(it.hasNext());
+ if (i == r) {
+ Iterator jt = list.listIterator(r);
+ it.forEachRemaining(x ->
+ assertTrue(jt.hasNext() && x == jt.next()));
+ break;
+ }
+ assertEquals(list.get(i), it.next());
+ }
+ it.forEachRemaining(x -> fail());
+ }
+ }
+
+ @Test(dataProvider = "all")
+ public void testLastIndexOf(List list, int from, int to) {
+ List subList = list.subList(from, to);
+ if (from < to) {
+ Integer e = list.get(to - 1);
+ int j = subList.lastIndexOf(e);
+ assertTrue(j == to - from - 1);
+ }
+ for (int i = 0; i < list.size(); ++i) {
+ Integer e = list.get(i);
+ int j = subList.lastIndexOf(e);
+ if (i < from || i >= to) {
+ assertTrue(j == -1 || subList.get(j) == e);
+ } else {
+ assertTrue(j >= 0 && j >= i - from);
+ assertEquals(subList.get(j), e);
+ }
+ }
+ for (int i = 0; i < 16; ++i) {
+ Integer r = rnd.nextInt();
+ if (list.contains(r)) continue;
+ int j = subList.lastIndexOf(r);
+ assertTrue(j == -1);
+ }
+ }
+
+ @Test(dataProvider = "modifiable",
+ expectedExceptions = ConcurrentModificationException.class)
+ public void testModLastIndexOf(List list, int from, int to) {
+ List subList = list.subList(from, to);
+ list.add(42);
+ subList.lastIndexOf(42);
+ }
+
+ @Test(dataProvider = "unresizable")
+ public void testListIterator(List list, int from, int to) {
+ List subList = list.subList(from, to);
+ ListIterator it = subList.listIterator();
+ for (int i = from; i < to; ++i) {
+ assertTrue(it.hasNext());
+ assertTrue(it.nextIndex() == i - from);
+ assertEquals(list.get(i), it.next());
+ }
+ assertFalse(it.hasNext());
+ }
+
+ @Test(dataProvider = "modifiable",
+ expectedExceptions = ConcurrentModificationException.class)
+ public void testModListIteratorNext(List list, int from, int to) {
+ List subList = list.subList(from, to);
+ ListIterator it = subList.listIterator();
+ list.add(42);
+ it.next();
+ }
+
+ @Test(dataProvider = "modifiable")
+ public void testListIteratorSet(List list, int from, int to) {
+ List subList = list.subList(from, to);
+ ListIterator it = subList.listIterator();
+ for (int i = from; i < to; ++i) {
+ assertTrue(it.hasNext());
+ assertTrue(it.nextIndex() == i - from);
+ assertEquals(list.get(i), it.next());
+ Integer e = rnd.nextInt();
+ it.set(e);
+ assertEquals(list.get(i), e);
+ }
+ assertFalse(it.hasNext());
+ }
+
+ @Test(dataProvider = "modifiable",
+ expectedExceptions = ConcurrentModificationException.class)
+ public void testModListIteratorSet(List list, int from, int to) {
+ List subList = list.subList(from, to);
+ ListIterator it = subList.listIterator();
+ it.next();
+ list.add(42);
+ it.set(42);
+ }
+
+ @Test(dataProvider = "unsettable",
+ expectedExceptions = UnsupportedOperationException.class)
+ public void testUnmodListIteratorSet(List list, int from, int to) {
+ List