>")) {
+ allFiles = true;
directory = true;
recursive = true;
cpath = "";
return;
}
+ // Validate path by platform's default file system
+ try {
+ String name = cpath.endsWith("*") ? cpath.substring(0, cpath.length() - 1) + "-" : cpath;
+ builtInFS.getPath(new File(name).getPath());
+ } catch (InvalidPathException ipe) {
+ invalid = true;
+ return;
+ }
+
// store only the canonical cpath if possible
cpath = AccessController.doPrivileged(new PrivilegedAction<>() {
public String run() {
@@ -463,6 +473,9 @@
*
* The default value of the {@code jdk.io.permissionsUseCanonicalPath}
* system property is {@code false} in this implementation.
+ *
+ * The value can also be set with a security property using the same name,
+ * but setting a system property will override the security property value.
*
* @param path the pathname of the file/directory.
* @param actions the action string.
@@ -573,19 +586,19 @@
* @return the effective mask
*/
boolean impliesIgnoreMask(FilePermission that) {
+ if (this == that) {
+ return true;
+ }
+ if (allFiles) {
+ return true;
+ }
+ if (this.invalid || that.invalid) {
+ return false;
+ }
+ if (that.allFiles) {
+ return false;
+ }
if (FilePermCompat.nb) {
- if (this == that) {
- return true;
- }
- if (allFiles) {
- return true;
- }
- if (this.invalid || that.invalid) {
- return false;
- }
- if (that.allFiles) {
- return false;
- }
// Left at least same level of wildness as right
if ((this.recursive && that.recursive) != that.recursive
|| (this.directory && that.directory) != that.directory) {
@@ -783,10 +796,10 @@
FilePermission that = (FilePermission) obj;
+ if (this.invalid || that.invalid) {
+ return false;
+ }
if (FilePermCompat.nb) {
- if (this.invalid || that.invalid) {
- return false;
- }
return (this.mask == that.mask) &&
(this.allFiles == that.allFiles) &&
this.npath.equals(that.npath) &&
@@ -795,6 +808,7 @@
(this.recursive == that.recursive);
} else {
return (this.mask == that.mask) &&
+ (this.allFiles == that.allFiles) &&
this.cpath.equals(that.cpath) &&
(this.directory == that.directory) &&
(this.recursive == that.recursive);
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/java/lang/ClassLoader.java
--- a/src/java.base/share/classes/java/lang/ClassLoader.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/java/lang/ClassLoader.java Wed Oct 16 15:31:05 2019 +0200
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, Azul Systems, Inc. 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
@@ -2004,6 +2005,17 @@
return scl;
}
+ /*
+ * Initialize default paths for native libraries search.
+ * Must be done early as JDK may load libraries during bootstrap.
+ *
+ * @see java.lang.System#initPhase1
+ */
+ static void initLibraryPaths() {
+ usr_paths = initializePath("java.library.path");
+ sys_paths = initializePath("sun.boot.library.path");
+ }
+
// Returns true if the specified class loader can be found in this class
// loader's delegation chain.
boolean isAncestor(ClassLoader cl) {
@@ -2473,8 +2485,7 @@
*
* We use a static stack to hold the list of libraries we are
* loading because this can happen only when called by the
- * same thread because Runtime.load and Runtime.loadLibrary
- * are synchronous.
+ * same thread because this block is synchronous.
*
* If there is a pending load operation for the library, we
* immediately return success; otherwise, we raise
@@ -2619,10 +2630,9 @@
boolean isAbsolute) {
ClassLoader loader =
(fromClass == null) ? null : fromClass.getClassLoader();
- if (sys_paths == null) {
- usr_paths = initializePath("java.library.path");
- sys_paths = initializePath("sun.boot.library.path");
- }
+ assert sys_paths != null : "should be initialized at this point";
+ assert usr_paths != null : "should be initialized at this point";
+
if (isAbsolute) {
if (loadLibrary0(fromClass, new File(name))) {
return;
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/java/lang/Runtime.java
--- a/src/java.base/share/classes/java/lang/Runtime.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/java/lang/Runtime.java Wed Oct 16 15:31:05 2019 +0200
@@ -1,5 +1,6 @@
/*
* Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, Azul Systems, Inc. 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
@@ -732,7 +733,7 @@
load0(Reflection.getCallerClass(), filename);
}
- synchronized void load0(Class> fromClass, String filename) {
+ void load0(Class> fromClass, String filename) {
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkLink(filename);
@@ -794,14 +795,14 @@
loadLibrary0(Reflection.getCallerClass(), libname);
}
- synchronized void loadLibrary0(Class> fromClass, String libname) {
+ void loadLibrary0(Class> fromClass, String libname) {
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkLink(libname);
}
if (libname.indexOf((int)File.separatorChar) != -1) {
throw new UnsatisfiedLinkError(
- "Directory separator should not appear in library name: " + libname);
+ "Directory separator should not appear in library name: " + libname);
}
ClassLoader.loadLibrary(fromClass, libname, false);
}
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/java/lang/StringCoding.java
--- a/src/java.base/share/classes/java/lang/StringCoding.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/java/lang/StringCoding.java Wed Oct 16 15:31:05 2019 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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
@@ -191,6 +191,12 @@
return result.with(StringLatin1.inflate(ba, off, len), UTF16);
}
}
+ // fastpath for always Latin1 decodable single byte
+ if (COMPACT_STRINGS && cd instanceof ArrayDecoder && ((ArrayDecoder)cd).isLatin1Decodable()) {
+ byte[] dst = new byte[len];
+ ((ArrayDecoder)cd).decodeToLatin1(ba, off, len, dst);
+ return result.with(dst, LATIN1);
+ }
int en = scale(len, cd.maxCharsPerByte());
char[] ca = new char[en];
if (cd instanceof ArrayDecoder) {
@@ -278,6 +284,13 @@
((ArrayDecoder)cd).isASCIICompatible() && !hasNegatives(ba, off, len)) {
return decodeLatin1(ba, off, len);
}
+ // fastpath for always Latin1 decodable single byte
+ if (COMPACT_STRINGS && cd instanceof ArrayDecoder && ((ArrayDecoder)cd).isLatin1Decodable()) {
+ byte[] dst = new byte[len];
+ ((ArrayDecoder)cd).decodeToLatin1(ba, off, len, dst);
+ return new Result().with(dst, LATIN1);
+ }
+
int en = scale(len, cd.maxCharsPerByte());
if (len == 0) {
return new Result().with();
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/java/lang/System.java
--- a/src/java.base/share/classes/java/lang/System.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/java/lang/System.java Wed Oct 16 15:31:05 2019 +0200
@@ -2045,6 +2045,8 @@
// register shared secrets
setJavaLangAccess();
+ ClassLoader.initLibraryPaths();
+
// Subsystems that are invoked during initialization can invoke
// VM.isBooted() in order to avoid doing things that should
// wait until the VM is fully initialized. The initialization level
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/java/lang/Throwable.java
--- a/src/java.base/share/classes/java/lang/Throwable.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/java/lang/Throwable.java Wed Oct 16 15:31:05 2019 +0200
@@ -230,6 +230,7 @@
* @serial
* @since 1.7
*/
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private List suppressedExceptions = SUPPRESSED_SENTINEL;
/** Message for trying to suppress a null exception. */
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/java/lang/invoke/SerializedLambda.java
--- a/src/java.base/share/classes/java/lang/invoke/SerializedLambda.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/java/lang/invoke/SerializedLambda.java Wed Oct 16 15:31:05 2019 +0200
@@ -76,6 +76,7 @@
private final String implMethodSignature;
private final int implMethodKind;
private final String instantiatedMethodType;
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private final Object[] capturedArgs;
/**
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/java/lang/reflect/Proxy.java
--- a/src/java.base/share/classes/java/lang/reflect/Proxy.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/java/lang/reflect/Proxy.java Wed Oct 16 15:31:05 2019 +0200
@@ -308,6 +308,7 @@
* the invocation handler for this proxy instance.
* @serial
*/
+ @SuppressWarnings("serial") // Not statically typed as Serializable
protected InvocationHandler h;
/**
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/java/net/DatagramSocket.java
--- a/src/java.base/share/classes/java/net/DatagramSocket.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/java/net/DatagramSocket.java Wed Oct 16 15:31:05 2019 +0200
@@ -434,14 +434,15 @@
* verify that datagrams are permitted to be sent and received
* respectively.
*
- * When a socket is connected, {@link #receive receive} and
- * {@link #send send} will not perform any security checks
- * on incoming and outgoing packets, other than matching the packet's
- * and the socket's address and port. On a send operation, if the
- * packet's address is set and the packet's address and the socket's
- * address do not match, an {@code IllegalArgumentException} will be
- * thrown. A socket connected to a multicast address may only be used
- * to send packets.
+ *
Care should be taken to ensure that a connected datagram socket
+ * is not shared with untrusted code. When a socket is connected,
+ * {@link #receive receive} and {@link #send send} will not perform
+ * any security checks on incoming and outgoing packets, other than
+ * matching the packet's and the socket's address and port. On a send
+ * operation, if the packet's address is set and the packet's address
+ * and the socket's address do not match, an {@code IllegalArgumentException}
+ * will be thrown. A socket connected to a multicast address may only
+ * be used to send packets.
*
* @param address the remote address for the socket
*
@@ -708,9 +709,11 @@
* the length of the received message. If the message is longer than
* the packet's length, the message is truncated.
*
- * If there is a security manager, a packet cannot be received if the
- * security manager's {@code checkAccept} method
- * does not allow it.
+ * If there is a security manager, and the socket is not currently
+ * connected to a remote address, a packet cannot be received if the
+ * security manager's {@code checkAccept} method does not allow it.
+ * Datagrams that are not permitted by the security manager are silently
+ * discarded.
*
* @param p the {@code DatagramPacket} into which to place
* the incoming data.
@@ -896,12 +899,15 @@
*
* @param timeout the specified timeout in milliseconds.
* @throws SocketException if there is an error in the underlying protocol, such as an UDP error.
+ * @throws IllegalArgumentException if {@code timeout} is negative
* @since 1.1
* @see #getSoTimeout()
*/
public synchronized void setSoTimeout(int timeout) throws SocketException {
if (isClosed())
throw new SocketException("Socket is closed");
+ if (timeout < 0)
+ throw new IllegalArgumentException("timeout < 0");
getImpl().setOption(SocketOptions.SO_TIMEOUT, timeout);
}
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/java/net/NetPermission.java
--- a/src/java.base/share/classes/java/net/NetPermission.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/java/net/NetPermission.java Wed Oct 16 15:31:05 2019 +0200
@@ -145,6 +145,15 @@
*
*
*
+ * setSocketImpl |
+ * The ability to create a sub-class of Socket or ServerSocket with a
+ * user specified SocketImpl. |
+ * Malicious user-defined SocketImpls can change the behavior of
+ * Socket and ServerSocket in surprising ways, by virtue of their
+ * ability to access the protected fields of SocketImpl. |
+ *
+ *
+ *
* specifyStreamHandler |
* The ability
* to specify a stream handler when constructing a URL |
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/java/net/ServerSocket.java
--- a/src/java.base/share/classes/java/net/ServerSocket.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/java/net/ServerSocket.java Wed Oct 16 15:31:05 2019 +0200
@@ -32,6 +32,7 @@
import java.util.Set;
import java.util.Collections;
+import sun.security.util.SecurityConstants;
import sun.net.PlatformSocketImpl;
/**
@@ -73,13 +74,25 @@
*
* @throws NullPointerException if impl is {@code null}.
*
+ * @throws SecurityException if a security manager is set and
+ * its {@code checkPermission} method doesn't allow
+ * {@code NetPermission("setSocketImpl")}.
* @since 12
*/
protected ServerSocket(SocketImpl impl) {
Objects.requireNonNull(impl);
+ checkPermission();
this.impl = impl;
}
+ private static Void checkPermission() {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ sm.checkPermission(SecurityConstants.SET_SOCKETIMPL_PERMISSION);
+ }
+ return null;
+ }
+
/**
* Creates an unbound server socket.
*
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/java/net/Socket.java
--- a/src/java.base/share/classes/java/net/Socket.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/java/net/Socket.java Wed Oct 16 15:31:05 2019 +0200
@@ -25,6 +25,8 @@
package java.net;
+import sun.security.util.SecurityConstants;
+
import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
@@ -182,12 +184,28 @@
*
* @throws SocketException if there is an error in the underlying protocol,
* such as a TCP error.
+ *
+ * @throws SecurityException if {@code impl} is non-null and a security manager is set
+ * and its {@code checkPermission} method doesn't allow {@code NetPermission("setSocketImpl")}.
+ *
* @since 1.1
*/
protected Socket(SocketImpl impl) throws SocketException {
+ checkPermission(impl);
this.impl = impl;
}
+ private static Void checkPermission(SocketImpl impl) {
+ if (impl == null) {
+ return null;
+ }
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ sm.checkPermission(SecurityConstants.SET_SOCKETIMPL_PERMISSION);
+ }
+ return null;
+ }
+
/**
* Creates a stream socket and connects it to the specified port
* number on the named host.
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/java/net/URL.java
--- a/src/java.base/share/classes/java/net/URL.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/java/net/URL.java Wed Oct 16 15:31:05 2019 +0200
@@ -484,6 +484,16 @@
throw new MalformedURLException(s);
}
}
+ if ("jar".equalsIgnoreCase(protocol)) {
+ if (handler instanceof sun.net.www.protocol.jar.Handler) {
+ // URL.openConnection() would throw a confusing exception
+ // so generate a better exception here instead.
+ String s = ((sun.net.www.protocol.jar.Handler) handler).checkNestedProtocol(file);
+ if (s != null) {
+ throw new MalformedURLException(s);
+ }
+ }
+ }
}
/**
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/java/nio/channels/DatagramChannel.java
--- a/src/java.base/share/classes/java/nio/channels/DatagramChannel.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/java/nio/channels/DatagramChannel.java Wed Oct 16 15:31:05 2019 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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
@@ -265,7 +265,10 @@
* java.lang.SecurityManager#checkAccept checkAccept} and {@link
* java.lang.SecurityManager#checkConnect checkConnect} methods permit
* datagrams to be received from and sent to, respectively, the given
- * remote address.
+ * remote address. Once connected, no further security checks are performed
+ * for datagrams received from, or sent to, the given remote address. Care
+ * should be taken to ensure that a connected datagram channel is not shared
+ * with untrusted code.
*
* This method may be invoked at any time. It will not have any effect
* on read or write operations that are already in progress at the moment
@@ -325,6 +328,10 @@
*
If this channel's socket is not connected, or if the channel is
* closed, then invoking this method has no effect.
*
+ * @apiNote If this method throws an IOException, the channel's socket
+ * may be left in an unspecified state. It is strongly recommended that
+ * the channel be closed when disconnect fails.
+ *
* @return This datagram channel
*
* @throws IOException
@@ -369,9 +376,10 @@
* to a specific remote address and a security manager has been installed
* then for each datagram received this method verifies that the source's
* address and port number are permitted by the security manager's {@link
- * java.lang.SecurityManager#checkAccept checkAccept} method. The overhead
- * of this security check can be avoided by first connecting the socket via
- * the {@link #connect connect} method.
+ * java.lang.SecurityManager#checkAccept checkAccept} method. Datagrams
+ * that are not permitted by the security manager are silently discarded.
+ * The overhead of this security check can be avoided by first connecting
+ * the socket via the {@link #connect connect} method.
*
* This method may be invoked at any time. If another thread has
* already initiated a read operation upon this channel, however, then an
@@ -401,11 +409,6 @@
* closing the channel and setting the current thread's
* interrupt status
*
- * @throws SecurityException
- * If a security manager has been installed
- * and it does not permit datagrams to be accepted
- * from the datagram's sender
- *
* @throws IOException
* If some other I/O error occurs
*/
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/java/nio/channels/SelectionKey.java
--- a/src/java.base/share/classes/java/nio/channels/SelectionKey.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/java/nio/channels/SelectionKey.java Wed Oct 16 15:31:05 2019 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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,7 +25,8 @@
package java.nio.channels;
-import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.VarHandle;
/**
* A token representing the registration of a {@link SelectableChannel} with a
@@ -428,13 +429,17 @@
// -- Attachments --
+ private static final VarHandle ATTACHMENT;
+ static {
+ try {
+ MethodHandles.Lookup l = MethodHandles.lookup();
+ ATTACHMENT = l.findVarHandle(SelectionKey.class, "attachment", Object.class);
+ } catch (Exception e) {
+ throw new InternalError(e);
+ }
+ }
private volatile Object attachment;
- private static final AtomicReferenceFieldUpdater
- attachmentUpdater = AtomicReferenceFieldUpdater.newUpdater(
- SelectionKey.class, Object.class, "attachment"
- );
-
/**
* Attaches the given object to this key.
*
@@ -450,7 +455,7 @@
* otherwise {@code null}
*/
public final Object attach(Object ob) {
- return attachmentUpdater.getAndSet(this, ob);
+ return ATTACHMENT.getAndSet(this, ob);
}
/**
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/java/nio/file/Files.java
--- a/src/java.base/share/classes/java/nio/file/Files.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/java/nio/file/Files.java Wed Oct 16 15:31:05 2019 +0200
@@ -3550,8 +3550,8 @@
// ensure lines is not null before opening file
Objects.requireNonNull(lines);
CharsetEncoder encoder = cs.newEncoder();
- OutputStream out = newOutputStream(path, options);
- try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out, encoder))) {
+ try (OutputStream out = newOutputStream(path, options);
+ BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out, encoder))) {
for (CharSequence line: lines) {
writer.append(line);
writer.newLine();
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/java/security/GuardedObject.java
--- a/src/java.base/share/classes/java/security/GuardedObject.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/java/security/GuardedObject.java Wed Oct 16 15:31:05 2019 +0200
@@ -52,7 +52,9 @@
@java.io.Serial
private static final long serialVersionUID = -5240450096227834308L;
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private Object object; // the object we are guarding
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private Guard guard; // the guard
/**
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/java/security/SecureRandom.java
--- a/src/java.base/share/classes/java/security/SecureRandom.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/java/security/SecureRandom.java Wed Oct 16 15:31:05 2019 +0200
@@ -1043,6 +1043,7 @@
/**
* @serial
*/
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private MessageDigest digest = null;
/**
* @serial
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/java/text/DecimalFormat.java
--- a/src/java.base/share/classes/java/text/DecimalFormat.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/java/text/DecimalFormat.java Wed Oct 16 15:31:05 2019 +0200
@@ -2756,7 +2756,10 @@
/**
* Return the grouping size. Grouping size is the number of digits between
* grouping separators in the integer portion of a number. For example,
- * in the number "123,456.78", the grouping size is 3.
+ * in the number "123,456.78", the grouping size is 3. Grouping size of
+ * zero designates that grouping is not used, which provides the same
+ * formatting as if calling {@link #setGroupingUsed(boolean)
+ * setGroupingUsed(false)}.
*
* @return the grouping size
* @see #setGroupingSize
@@ -2770,16 +2773,28 @@
/**
* Set the grouping size. Grouping size is the number of digits between
* grouping separators in the integer portion of a number. For example,
- * in the number "123,456.78", the grouping size is 3.
- *
+ * in the number "123,456.78", the grouping size is 3. Grouping size of
+ * zero designates that grouping is not used, which provides the same
+ * formatting as if calling {@link #setGroupingUsed(boolean)
+ * setGroupingUsed(false)}.
+ *
* The value passed in is converted to a byte, which may lose information.
+ * Values that are negative or greater than
+ * {@link java.lang.Byte#MAX_VALUE Byte.MAX_VALUE}, will throw an
+ * {@code IllegalArgumentException}.
*
* @param newValue the new grouping size
* @see #getGroupingSize
* @see java.text.NumberFormat#setGroupingUsed
* @see java.text.DecimalFormatSymbols#setGroupingSeparator
+ * @throws IllegalArgumentException if {@code newValue} is negative or
+ * greater than {@link java.lang.Byte#MAX_VALUE Byte.MAX_VALUE}
*/
public void setGroupingSize (int newValue) {
+ if (newValue < 0 || newValue > Byte.MAX_VALUE) {
+ throw new IllegalArgumentException(
+ "newValue is out of valid range. value: " + newValue);
+ }
groupingSize = (byte)newValue;
fastPathCheckNeeded = true;
}
@@ -3906,6 +3921,12 @@
// Didn't have exponential fields
useExponentialNotation = false;
}
+
+ // Restore the invariant value if groupingSize is invalid.
+ if (groupingSize < 0) {
+ groupingSize = 3;
+ }
+
serialVersionOnStream = currentSerialVersion;
}
@@ -4009,14 +4030,15 @@
/**
* The number of digits between grouping separators in the integer
- * portion of a number. Must be greater than 0 if
+ * portion of a number. Must be non-negative and less than or equal to
+ * {@link java.lang.Byte#MAX_VALUE Byte.MAX_VALUE} if
* {@code NumberFormat.groupingUsed} is true.
*
* @serial
* @see #getGroupingSize
* @see java.text.NumberFormat#isGroupingUsed
*/
- private byte groupingSize = 3; // invariant, > 0 if useThousands
+ private byte groupingSize = 3; // invariant, 0 - 127, if groupingUsed
/**
* If true, forces the decimal separator to always appear in a formatted
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/java/time/Clock.java
--- a/src/java.base/share/classes/java/time/Clock.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/java/time/Clock.java Wed Oct 16 15:31:05 2019 +0200
@@ -641,6 +641,7 @@
static final class OffsetClock extends Clock implements Serializable {
@java.io.Serial
private static final long serialVersionUID = 2007484719125426256L;
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private final Clock baseClock;
private final Duration offset;
@@ -692,6 +693,7 @@
static final class TickClock extends Clock implements Serializable {
@java.io.Serial
private static final long serialVersionUID = 6504659149906368850L;
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private final Clock baseClock;
private final long tickNanos;
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/java/time/chrono/ChronoPeriodImpl.java
--- a/src/java.base/share/classes/java/time/chrono/ChronoPeriodImpl.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/java/time/chrono/ChronoPeriodImpl.java Wed Oct 16 15:31:05 2019 +0200
@@ -109,6 +109,7 @@
/**
* The chronology.
*/
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private final Chronology chrono;
/**
* The number of years.
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/java/util/AbstractMap.java
--- a/src/java.base/share/classes/java/util/AbstractMap.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/java/util/AbstractMap.java Wed Oct 16 15:31:05 2019 +0200
@@ -607,7 +607,9 @@
@java.io.Serial
private static final long serialVersionUID = -8499721149061103585L;
+ @SuppressWarnings("serial") // Conditionally serializable
private final K key;
+ @SuppressWarnings("serial") // Conditionally serializable
private V value;
/**
@@ -738,7 +740,9 @@
@java.io.Serial
private static final long serialVersionUID = 7138329143949025153L;
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private final K key;
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private final V value;
/**
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/java/util/ArrayPrefixHelpers.java
--- a/src/java.base/share/classes/java/util/ArrayPrefixHelpers.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/java/util/ArrayPrefixHelpers.java Wed Oct 16 15:31:05 2019 +0200
@@ -103,10 +103,15 @@
static final int MIN_PARTITION = 16;
static final class CumulateTask extends CountedCompleter {
+ @SuppressWarnings("serial") // Not statically typed as Serializable
final T[] array;
+ @SuppressWarnings("serial") // Not statically typed as Serializable
final BinaryOperator function;
CumulateTask left, right;
- T in, out;
+ @SuppressWarnings("serial") // Not statically typed as Serializable
+ T in;
+ @SuppressWarnings("serial") // Not statically typed as Serializable
+ T out;
final int lo, hi, origin, fence, threshold;
/** Root task constructor */
@@ -257,6 +262,7 @@
static final class LongCumulateTask extends CountedCompleter {
final long[] array;
+ @SuppressWarnings("serial") // Not statically typed as Serializable
final LongBinaryOperator function;
LongCumulateTask left, right;
long in, out;
@@ -408,6 +414,7 @@
static final class DoubleCumulateTask extends CountedCompleter {
final double[] array;
+ @SuppressWarnings("serial") // Not statically typed as Serializable
final DoubleBinaryOperator function;
DoubleCumulateTask left, right;
double in, out;
@@ -559,6 +566,7 @@
static final class IntCumulateTask extends CountedCompleter {
final int[] array;
+ @SuppressWarnings("serial") // Not statically typed as Serializable
final IntBinaryOperator function;
IntCumulateTask left, right;
int in, out;
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/java/util/Arrays.java
--- a/src/java.base/share/classes/java/util/Arrays.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/java/util/Arrays.java Wed Oct 16 15:31:05 2019 +0200
@@ -4339,6 +4339,7 @@
{
@java.io.Serial
private static final long serialVersionUID = -2764017481108945198L;
+ @SuppressWarnings("serial") // Conditionally serializable
private final E[] a;
ArrayList(E[] array) {
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/java/util/ArraysParallelSortHelpers.java
--- a/src/java.base/share/classes/java/util/ArraysParallelSortHelpers.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/java/util/ArraysParallelSortHelpers.java Wed Oct 16 15:31:05 2019 +0200
@@ -115,8 +115,12 @@
static final class Sorter extends CountedCompleter {
@java.io.Serial
static final long serialVersionUID = 2446542900576103244L;
- final T[] a, w;
+ @SuppressWarnings("serial") // Not statically typed as Serializable
+ final T[] a;
+ @SuppressWarnings("serial") // Not statically typed as Serializable
+ final T[] w;
final int base, size, wbase, gran;
+ @SuppressWarnings("serial") // Not statically typed as Serializable
Comparator super T> comparator;
Sorter(CountedCompleter> par, T[] a, T[] w, int base, int size,
int wbase, int gran,
@@ -153,8 +157,13 @@
static final class Merger extends CountedCompleter {
@java.io.Serial
static final long serialVersionUID = 2446542900576103244L;
- final T[] a, w; // main and workspace arrays
+ // main and workspace arrays
+ @SuppressWarnings("serial") // Not statically typed as Serializable
+ final T[] a;
+ @SuppressWarnings("serial") // Not statically typed as Serializable
+ final T[] w;
final int lbase, lsize, rbase, rsize, wbase, gran;
+ @SuppressWarnings("serial") // Not statically typed as Serializable
Comparator super T> comparator;
Merger(CountedCompleter> par, T[] a, T[] w,
int lbase, int lsize, int rbase,
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/java/util/Collection.java
--- a/src/java.base/share/classes/java/util/Collection.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/java/util/Collection.java Wed Oct 16 15:31:05 2019 +0200
@@ -188,6 +188,38 @@
* or if the only reference to the backing collection is through an
* unmodifiable view, the view can be considered effectively immutable.
*
+ *
+ *
+ * Serializability of collections is optional. As such, none of the collections
+ * interfaces are declared to implement the {@link java.io.Serializable} interface.
+ * However, serializability is regarded as being generally useful, so most collection
+ * implementations are serializable.
+ *
+ *
The collection implementations that are public classes (such as {@code ArrayList}
+ * or {@code HashMap}) are declared to implement the {@code Serializable} interface if they
+ * are in fact serializable. Some collections implementations are not public classes,
+ * such as the unmodifiable collections. In such cases, the
+ * serializability of such collections is described in the specification of the method
+ * that creates them, or in some other suitable place. In cases where the serializability
+ * of a collection is not specified, there is no guarantee about the serializability of such
+ * collections. In particular, many view collections are not serializable.
+ *
+ *
A collection implementation that implements the {@code Serializable} interface cannot
+ * be guaranteed to be serializable. The reason is that in general, collections
+ * contain elements of other types, and it is not possible to determine statically
+ * whether instances of some element type are actually serializable. For example, consider
+ * a serializable {@code Collection}, where {@code E} does not implement the
+ * {@code Serializable} interface. The collection may be serializable, if it contains only
+ * elements of some serializable subtype of {@code E}, or if it is empty. Collections are
+ * thus said to be conditionally serializable, as the serializability of the collection
+ * as a whole depends on whether the collection itself is serializable and on whether all
+ * contained elements are also serializable.
+ *
+ * An additional case occurs with instances of {@link SortedSet} and {@link SortedMap}.
+ * These collections can be created with a {@link Comparator} that imposes an ordering on
+ * the set elements or map keys. Such a collection is serializable only if the provided
+ * {@code Comparator} is also serializable.
+ *
*
This interface is a member of the
*
* Java Collections Framework.
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/java/util/Collections.java
--- a/src/java.base/share/classes/java/util/Collections.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/java/util/Collections.java Wed Oct 16 15:31:05 2019 +0200
@@ -1024,6 +1024,7 @@
@java.io.Serial
private static final long serialVersionUID = 1820017752578914078L;
+ @SuppressWarnings("serial") // Conditionally serializable
final Collection extends E> c;
UnmodifiableCollection(Collection extends E> c) {
@@ -1164,6 +1165,7 @@
implements SortedSet, Serializable {
@java.io.Serial
private static final long serialVersionUID = -4929149591599911165L;
+ @SuppressWarnings("serial") // Conditionally serializable
private final SortedSet ss;
UnmodifiableSortedSet(SortedSet s) {super(s); ss = s;}
@@ -1244,6 +1246,7 @@
/**
* The instance we are protecting.
*/
+ @SuppressWarnings("serial") // Conditionally serializable
private final NavigableSet ns;
UnmodifiableNavigableSet(NavigableSet s) {super(s); ns = s;}
@@ -1304,6 +1307,7 @@
@java.io.Serial
private static final long serialVersionUID = -283967356065247728L;
+ @SuppressWarnings("serial") // Conditionally serializable
final List extends E> list;
UnmodifiableList(List extends E> list) {
@@ -1450,6 +1454,7 @@
@java.io.Serial
private static final long serialVersionUID = -1034234728574286014L;
+ @SuppressWarnings("serial") // Conditionally serializable
private final Map extends K, ? extends V> m;
UnmodifiableMap(Map extends K, ? extends V> m) {
@@ -1809,6 +1814,7 @@
@java.io.Serial
private static final long serialVersionUID = -8806743815996713206L;
+ @SuppressWarnings("serial") // Conditionally serializable
private final SortedMap sm;
UnmodifiableSortedMap(SortedMap m) {super(m); sm = m; }
@@ -1886,6 +1892,7 @@
/**
* The instance we wrap and protect.
*/
+ @SuppressWarnings("serial") // Conditionally serializable
private final NavigableMap nm;
UnmodifiableNavigableMap(NavigableMap m)
@@ -2017,7 +2024,9 @@
@java.io.Serial
private static final long serialVersionUID = 3053995032091335093L;
+ @SuppressWarnings("serial") // Conditionally serializable
final Collection c; // Backing Collection
+ @SuppressWarnings("serial") // Conditionally serializable
final Object mutex; // Object on which to synchronize
SynchronizedCollection(Collection c) {
@@ -2219,6 +2228,7 @@
@java.io.Serial
private static final long serialVersionUID = 8695801310862127406L;
+ @SuppressWarnings("serial") // Conditionally serializable
private final SortedSet ss;
SynchronizedSortedSet(SortedSet s) {
@@ -2314,6 +2324,7 @@
@java.io.Serial
private static final long serialVersionUID = -5505529816273629798L;
+ @SuppressWarnings("serial") // Conditionally serializable
private final NavigableSet ns;
SynchronizedNavigableSet(NavigableSet s) {
@@ -2424,6 +2435,7 @@
@java.io.Serial
private static final long serialVersionUID = -7754090372962971524L;
+ @SuppressWarnings("serial") // Conditionally serializable
final List list;
SynchronizedList(List list) {
@@ -2591,7 +2603,9 @@
@java.io.Serial
private static final long serialVersionUID = 1978198479659022715L;
+ @SuppressWarnings("serial") // Conditionally serializable
private final Map m; // Backing Map
+ @SuppressWarnings("serial") // Conditionally serializable
final Object mutex; // Object on which to synchronize
SynchronizedMap(Map m) {
@@ -2788,6 +2802,7 @@
@java.io.Serial
private static final long serialVersionUID = -8798146769416483793L;
+ @SuppressWarnings("serial") // Conditionally serializable
private final SortedMap sm;
SynchronizedSortedMap(SortedMap m) {
@@ -2891,6 +2906,7 @@
@java.io.Serial
private static final long serialVersionUID = 699392247599746807L;
+ @SuppressWarnings("serial") // Conditionally serializable
private final NavigableMap nm;
SynchronizedNavigableMap(NavigableMap m) {
@@ -3070,7 +3086,9 @@
@java.io.Serial
private static final long serialVersionUID = 1578914078182001775L;
+ @SuppressWarnings("serial") // Conditionally serializable
final Collection c;
+ @SuppressWarnings("serial") // Conditionally serializable
final Class type;
@SuppressWarnings("unchecked")
@@ -3126,6 +3144,7 @@
public boolean add(E e) { return c.add(typeCheck(e)); }
+ @SuppressWarnings("serial") // Conditionally serializable
private E[] zeroLengthElementArray; // Lazily initialized
private E[] zeroLengthElementArray() {
@@ -3219,6 +3238,7 @@
{
@java.io.Serial
private static final long serialVersionUID = 1433151992604707767L;
+ @SuppressWarnings("serial") // Conditionally serializable
final Queue queue;
CheckedQueue(Queue queue, Class elementType) {
@@ -3323,6 +3343,7 @@
@java.io.Serial
private static final long serialVersionUID = 1599911165492914959L;
+ @SuppressWarnings("serial") // Conditionally serializable
private final SortedSet ss;
CheckedSortedSet(SortedSet s, Class type) {
@@ -3387,6 +3408,7 @@
@java.io.Serial
private static final long serialVersionUID = -5429120189805438922L;
+ @SuppressWarnings("serial") // Conditionally serializable
private final NavigableSet ns;
CheckedNavigableSet(NavigableSet s, Class type) {
@@ -3470,6 +3492,7 @@
{
@java.io.Serial
private static final long serialVersionUID = 65247728283967356L;
+ @SuppressWarnings("serial") // Conditionally serializable
final List list;
CheckedList(List list, Class type) {
@@ -3619,8 +3642,11 @@
@java.io.Serial
private static final long serialVersionUID = 5742860141034234728L;
+ @SuppressWarnings("serial") // Conditionally serializable
private final Map m;
+ @SuppressWarnings("serial") // Conditionally serializable
final Class keyType;
+ @SuppressWarnings("serial") // Conditionally serializable
final Class valueType;
private void typeCheck(Object key, Object value) {
@@ -4019,6 +4045,7 @@
@java.io.Serial
private static final long serialVersionUID = 1599671320688067438L;
+ @SuppressWarnings("serial") // Conditionally serializable
private final SortedMap sm;
CheckedSortedMap(SortedMap m,
@@ -4094,6 +4121,7 @@
@java.io.Serial
private static final long serialVersionUID = -4852462692372534096L;
+ @SuppressWarnings("serial") // Conditionally serializable
private final NavigableMap nm;
CheckedNavigableMap(NavigableMap m,
@@ -4825,6 +4853,7 @@
@java.io.Serial
private static final long serialVersionUID = 3193687207550431679L;
+ @SuppressWarnings("serial") // Conditionally serializable
private final E element;
SingletonSet(E e) {element = e;}
@@ -4879,6 +4908,7 @@
@java.io.Serial
private static final long serialVersionUID = 3093736618740652951L;
+ @SuppressWarnings("serial") // Conditionally serializable
private final E element;
SingletonList(E obj) {element = obj;}
@@ -4948,7 +4978,9 @@
@java.io.Serial
private static final long serialVersionUID = -6979724477215052911L;
+ @SuppressWarnings("serial") // Conditionally serializable
private final K k;
+ @SuppressWarnings("serial") // Conditionally serializable
private final V v;
SingletonMap(K key, V value) {
@@ -5087,6 +5119,7 @@
private static final long serialVersionUID = 2739099268398711800L;
final int n;
+ @SuppressWarnings("serial") // Conditionally serializable
final E element;
CopiesList(int n, E e) {
@@ -5320,6 +5353,7 @@
*
* @serial
*/
+ @SuppressWarnings("serial") // Conditionally serializable
final Comparator cmp;
ReverseComparator2(Comparator cmp) {
@@ -5601,6 +5635,7 @@
private static class SetFromMap extends AbstractSet
implements Set, Serializable
{
+ @SuppressWarnings("serial") // Conditionally serializable
private final Map m; // The backing map
private transient Set s; // Its keySet
@@ -5686,6 +5721,7 @@
implements Queue, Serializable {
@java.io.Serial
private static final long serialVersionUID = 1802017725587941708L;
+ @SuppressWarnings("serial") // Conditionally serializable
private final Deque q;
AsLIFOQueue(Deque q) { this.q = q; }
public boolean add(E e) { q.addFirst(e); return true; }
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/java/util/Comparators.java
--- a/src/java.base/share/classes/java/util/Comparators.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/java/util/Comparators.java Wed Oct 16 15:31:05 2019 +0200
@@ -66,6 +66,7 @@
private static final long serialVersionUID = -7569533591570686392L;
private final boolean nullFirst;
// if null, non-null Ts are considered equal
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private final Comparator real;
@SuppressWarnings("unchecked")
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/java/util/PriorityQueue.java
--- a/src/java.base/share/classes/java/util/PriorityQueue.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/java/util/PriorityQueue.java Wed Oct 16 15:31:05 2019 +0200
@@ -111,6 +111,7 @@
* The comparator, or null if priority queue uses elements'
* natural ordering.
*/
+ @SuppressWarnings("serial") // Conditionally serializable
private final Comparator super E> comparator;
/**
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/java/util/TreeMap.java
--- a/src/java.base/share/classes/java/util/TreeMap.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/java/util/TreeMap.java Wed Oct 16 15:31:05 2019 +0200
@@ -118,6 +118,7 @@
*
* @serial
*/
+ @SuppressWarnings("serial") // Conditionally serializable
private final Comparator super K> comparator;
private transient Entry root;
@@ -1353,7 +1354,10 @@
* if loInclusive is true, lo is the inclusive bound, else lo
* is the exclusive bound. Similarly for the upper bound.
*/
- final K lo, hi;
+ @SuppressWarnings("serial") // Conditionally serializable
+ final K lo;
+ @SuppressWarnings("serial") // Conditionally serializable
+ final K hi;
final boolean fromStart, toEnd;
final boolean loInclusive, hiInclusive;
@@ -1936,6 +1940,7 @@
super(m, fromStart, lo, loInclusive, toEnd, hi, hiInclusive);
}
+ @SuppressWarnings("serial") // Conditionally serializable
private final Comparator super K> reverseComparator =
Collections.reverseOrder(m.comparator);
@@ -2024,7 +2029,10 @@
@java.io.Serial
private static final long serialVersionUID = -6520786458950516097L;
private boolean fromStart = false, toEnd = false;
- private K fromKey, toKey;
+ @SuppressWarnings("serial") // Conditionally serializable
+ private K fromKey;
+ @SuppressWarnings("serial") // Conditionally serializable
+ private K toKey;
@java.io.Serial
private Object readResolve() {
return new AscendingSubMap<>(TreeMap.this,
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/java/util/Vector.java
--- a/src/java.base/share/classes/java/util/Vector.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/java/util/Vector.java Wed Oct 16 15:31:05 2019 +0200
@@ -102,6 +102,7 @@
*
* @serial
*/
+ @SuppressWarnings("serial") // Conditionally serializable
protected Object[] elementData;
/**
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/java/util/jar/JarVerifier.java
--- a/src/java.base/share/classes/java/util/jar/JarVerifier.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/java/util/jar/JarVerifier.java Wed Oct 16 15:31:05 2019 +0200
@@ -590,6 +590,7 @@
URL vlocation;
CodeSigner[] vsigners;
java.security.cert.Certificate[] vcerts;
+ @SuppressWarnings("serial") // Not statically typed as Serializable
Object csdomain;
VerifierCodeSource(Object csdomain, URL location, CodeSigner[] signers) {
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/java/util/regex/Pattern.java
--- a/src/java.base/share/classes/java/util/regex/Pattern.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/java/util/regex/Pattern.java Wed Oct 16 15:31:05 2019 +0200
@@ -1427,7 +1427,11 @@
localTCNCount = 0;
if (!pattern.isEmpty()) {
- compile();
+ try {
+ compile();
+ } catch (StackOverflowError soe) {
+ throw error("Stack overflow during pattern compilation");
+ }
} else {
root = new Start(lastAccept);
matchRoot = lastAccept;
@@ -1965,6 +1969,10 @@
int ch = temp[cursor++];
while (ch != 0 && !isLineSeparator(ch))
ch = temp[cursor++];
+ if (ch == 0 && cursor > patternLength) {
+ cursor = patternLength;
+ ch = temp[cursor++];
+ }
return ch;
}
@@ -1975,6 +1983,10 @@
int ch = temp[++cursor];
while (ch != 0 && !isLineSeparator(ch))
ch = temp[++cursor];
+ if (ch == 0 && cursor > patternLength) {
+ cursor = patternLength;
+ ch = temp[cursor];
+ }
return ch;
}
@@ -3415,9 +3427,10 @@
private int N() {
if (read() == '{') {
int i = cursor;
- while (cursor < patternLength && read() != '}') {}
- if (cursor > patternLength)
- throw error("Unclosed character name escape sequence");
+ while (read() != '}') {
+ if (cursor >= patternLength)
+ throw error("Unclosed character name escape sequence");
+ }
String name = new String(temp, i, cursor - i - 1);
try {
return Character.codePointOf(name);
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/javax/crypto/CryptoPermission.java
--- a/src/java.base/share/classes/javax/crypto/CryptoPermission.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/javax/crypto/CryptoPermission.java Wed Oct 16 15:31:05 2019 +0200
@@ -55,6 +55,7 @@
private String alg;
private int maxKeySize = Integer.MAX_VALUE; // no restriction on maxKeySize
private String exemptionMechanism = null;
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private AlgorithmParameterSpec algParamSpec = null;
private boolean checkParam = false; // no restriction on param
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/javax/security/auth/PrivateCredentialPermission.java
--- a/src/java.base/share/classes/javax/security/auth/PrivateCredentialPermission.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/javax/security/auth/PrivateCredentialPermission.java Wed Oct 16 15:31:05 2019 +0200
@@ -119,6 +119,7 @@
* The set contains elements of type,
* {@code PrivateCredentialPermission.CredOwner}.
*/
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private Set principals; // ignored - kept around for compatibility
private transient CredOwner[] credOwners;
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/javax/security/auth/Subject.java
--- a/src/java.base/share/classes/javax/security/auth/Subject.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/javax/security/auth/Subject.java Wed Oct 16 15:31:05 2019 +0200
@@ -111,6 +111,7 @@
* {@code java.security.Principal}.
* The set is a {@code Subject.SecureSet}.
*/
+ @SuppressWarnings("serial") // Not statically typed as Serializable
Set principals;
/**
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/javax/security/auth/callback/UnsupportedCallbackException.java
--- a/src/java.base/share/classes/javax/security/auth/callback/UnsupportedCallbackException.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/javax/security/auth/callback/UnsupportedCallbackException.java Wed Oct 16 15:31:05 2019 +0200
@@ -39,6 +39,7 @@
/**
* @serial
*/
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private Callback callback;
/**
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java
--- a/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java Wed Oct 16 15:31:05 2019 +0200
@@ -2171,6 +2171,10 @@
} while (retryTunnel < maxRedirects);
if (retryTunnel >= maxRedirects || (respCode != HTTP_OK)) {
+ if (respCode != HTTP_PROXY_AUTH) {
+ // remove all but authenticate responses
+ responses.reset();
+ }
throw new IOException("Unable to tunnel through proxy."+
" Proxy returns \"" +
statusLine + "\"");
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/sun/net/www/protocol/http/NegotiateAuthentication.java
--- a/src/java.base/share/classes/sun/net/www/protocol/http/NegotiateAuthentication.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/sun/net/www/protocol/http/NegotiateAuthentication.java Wed Oct 16 15:31:05 2019 +0200
@@ -49,6 +49,7 @@
private static final long serialVersionUID = 100L;
private static final PlatformLogger logger = HttpURLConnection.getHttpLogger();
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private final HttpCallerInfo hci;
// These maps are used to manage the GSS availability for diffrent
@@ -67,6 +68,7 @@
}
// The HTTP Negotiate Helper
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private Negotiator negotiator = null;
/**
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/sun/net/www/protocol/jar/Handler.java
--- a/src/java.base/share/classes/sun/net/www/protocol/jar/Handler.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/sun/net/www/protocol/jar/Handler.java Wed Oct 16 15:31:05 2019 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, 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
@@ -121,6 +121,13 @@
return h;
}
+ public String checkNestedProtocol(String spec) {
+ if (spec.regionMatches(true, 0, "jar:", 0, 4)) {
+ return "Nested JAR URLs are not supported";
+ } else {
+ return null;
+ }
+ }
@Override
@SuppressWarnings("deprecation")
@@ -146,6 +153,12 @@
: false;
spec = spec.substring(start, limit);
+ String exceptionMessage = checkNestedProtocol(spec);
+ if (exceptionMessage != null) {
+ // NPE will be transformed into MalformedURLException by the caller
+ throw new NullPointerException(exceptionMessage);
+ }
+
if (absoluteSpec) {
file = parseAbsoluteSpec(spec);
} else if (!refOnly) {
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java
--- a/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java Wed Oct 16 15:31:05 2019 +0200
@@ -875,6 +875,11 @@
if (state == ST_CONNECTED)
throw new AlreadyConnectedException();
+ // ensure that the socket is bound
+ if (localAddress == null) {
+ bindInternal(null);
+ }
+
int n = Net.connect(family,
fd,
isa.getAddress(),
@@ -932,8 +937,21 @@
remoteAddress = null;
state = ST_UNCONNECTED;
- // refresh local address
- localAddress = Net.localAddress(fd);
+ // check whether rebind is needed
+ InetSocketAddress isa = Net.localAddress(fd);
+ if (isa.getPort() == 0) {
+ // On Linux, if bound to ephemeral port,
+ // disconnect does not preserve that port.
+ // In this case, try to rebind to the previous port.
+ int port = localAddress.getPort();
+ localAddress = isa; // in case Net.bind fails
+ Net.bind(family, fd, isa.getAddress(), port);
+ isa = Net.localAddress(fd); // refresh address
+ assert isa.getPort() == port;
+ }
+
+ // refresh localAddress
+ localAddress = isa;
}
} finally {
writeLock.unlock();
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/sun/nio/ch/SelectorImpl.java
--- a/src/java.base/share/classes/sun/nio/ch/SelectorImpl.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/sun/nio/ch/SelectorImpl.java Wed Oct 16 15:31:05 2019 +0200
@@ -208,7 +208,8 @@
if (!(ch instanceof SelChImpl))
throw new IllegalSelectorException();
SelectionKeyImpl k = new SelectionKeyImpl((SelChImpl)ch, this);
- k.attach(attachment);
+ if (attachment != null)
+ k.attach(attachment);
// register (if needed) before adding to key set
implRegister(k);
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/sun/nio/ch/ServerSocketAdaptor.java
--- a/src/java.base/share/classes/sun/nio/ch/ServerSocketAdaptor.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/sun/nio/ch/ServerSocketAdaptor.java Wed Oct 16 15:31:05 2019 +0200
@@ -37,6 +37,9 @@
import java.nio.channels.IllegalBlockingModeException;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
import java.util.Set;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
@@ -59,7 +62,12 @@
private volatile int timeout;
static ServerSocket create(ServerSocketChannelImpl ssc) {
- return new ServerSocketAdaptor(ssc);
+ PrivilegedExceptionAction pa = () -> new ServerSocketAdaptor(ssc);
+ try {
+ return AccessController.doPrivileged(pa);
+ } catch (PrivilegedActionException pae) {
+ throw new InternalError("Should not reach here", pae);
+ }
}
private ServerSocketAdaptor(ServerSocketChannelImpl ssc) {
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/sun/nio/ch/SocketAdaptor.java
--- a/src/java.base/share/classes/sun/nio/ch/SocketAdaptor.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/sun/nio/ch/SocketAdaptor.java Wed Oct 16 15:31:05 2019 +0200
@@ -36,6 +36,9 @@
import java.net.SocketOption;
import java.net.StandardSocketOptions;
import java.nio.channels.SocketChannel;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
import java.util.Set;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
@@ -61,10 +64,11 @@
}
static Socket create(SocketChannelImpl sc) {
+ PrivilegedExceptionAction pa = () -> new SocketAdaptor(sc);
try {
- return new SocketAdaptor(sc);
- } catch (SocketException e) {
- throw new InternalError("Should not reach here");
+ return AccessController.doPrivileged(pa);
+ } catch (PrivilegedActionException pae) {
+ throw new InternalError("Should not reach here", pae);
}
}
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/sun/nio/cs/ArrayDecoder.java
--- a/src/java.base/share/classes/sun/nio/cs/ArrayDecoder.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/sun/nio/cs/ArrayDecoder.java Wed Oct 16 15:31:05 2019 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, 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
@@ -28,6 +28,9 @@
/*
* FastPath byte[]->char[] decoder, REPLACE on malformed or
* unmappable input.
+ *
+ * FastPath encoded byte[]-> "String Latin1 coding" byte[] decoder for use when
+ * charset is always decodable to the internal String Latin1 coding byte[], ie. all mappings <=0xff
*/
public interface ArrayDecoder {
@@ -36,4 +39,14 @@
default boolean isASCIICompatible() {
return false;
}
+
+ // Is always decodable to internal String Latin1 coding, ie. all mappings <= 0xff
+ default boolean isLatin1Decodable() {
+ return false;
+ }
+
+ // Decode to internal String Latin1 coding byte[] fastpath for when isLatin1Decodable == true
+ default int decodeToLatin1(byte[] src, int sp, int len, byte[] dst) {
+ return 0;
+ }
}
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/sun/nio/cs/SingleByte.java
--- a/src/java.base/share/classes/sun/nio/cs/SingleByte.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/sun/nio/cs/SingleByte.java Wed Oct 16 15:31:05 2019 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2019, 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
@@ -50,17 +50,27 @@
implements ArrayDecoder {
private final char[] b2c;
private final boolean isASCIICompatible;
+ private final boolean isLatin1Decodable;
public Decoder(Charset cs, char[] b2c) {
super(cs, 1.0f, 1.0f);
this.b2c = b2c;
this.isASCIICompatible = false;
+ this.isLatin1Decodable = false;
}
public Decoder(Charset cs, char[] b2c, boolean isASCIICompatible) {
super(cs, 1.0f, 1.0f);
this.b2c = b2c;
this.isASCIICompatible = isASCIICompatible;
+ this.isLatin1Decodable = false;
+ }
+
+ public Decoder(Charset cs, char[] b2c, boolean isASCIICompatible, boolean isLatin1Decodable) {
+ super(cs, 1.0f, 1.0f);
+ this.b2c = b2c;
+ this.isASCIICompatible = isASCIICompatible;
+ this.isLatin1Decodable = isLatin1Decodable;
}
private CoderResult decodeArrayLoop(ByteBuffer src, CharBuffer dst) {
@@ -125,6 +135,18 @@
}
@Override
+ public int decodeToLatin1(byte[] src, int sp, int len, byte[] dst) {
+ if (len > dst.length)
+ len = dst.length;
+
+ int dp = 0;
+ while (dp < len) {
+ dst[dp++] = (byte)decode(src[sp++]);
+ }
+ return dp;
+ }
+
+ @Override
public int decode(byte[] src, int sp, int len, char[] dst) {
if (len > dst.length)
len = dst.length;
@@ -143,6 +165,11 @@
public boolean isASCIICompatible() {
return isASCIICompatible;
}
+
+ @Override
+ public boolean isLatin1Decodable() {
+ return isLatin1Decodable;
+ }
}
public static final class Encoder extends CharsetEncoder
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java
--- a/src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java Wed Oct 16 15:31:05 2019 +0200
@@ -44,6 +44,7 @@
@java.io.Serial
private static final long serialVersionUID = 6182022883658399397L;
private final Class extends Annotation> type;
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private final Map memberValues;
AnnotationInvocationHandler(Class extends Annotation> type, Map memberValues) {
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/sun/reflect/annotation/AnnotationTypeMismatchExceptionProxy.java
--- a/src/java.base/share/classes/sun/reflect/annotation/AnnotationTypeMismatchExceptionProxy.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/sun/reflect/annotation/AnnotationTypeMismatchExceptionProxy.java Wed Oct 16 15:31:05 2019 +0200
@@ -36,7 +36,8 @@
class AnnotationTypeMismatchExceptionProxy extends ExceptionProxy {
@java.io.Serial
private static final long serialVersionUID = 7844069490309503934L;
- private Method member;
+ @SuppressWarnings("serial") // Not statically typed as Serializable
+ private Method member; // Would be more robust to null-out in a writeObject method.
private final String foundType;
/**
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/sun/security/internal/spec/TlsKeyMaterialSpec.java
--- a/src/java.base/share/classes/sun/security/internal/spec/TlsKeyMaterialSpec.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/sun/security/internal/spec/TlsKeyMaterialSpec.java Wed Oct 16 15:31:05 2019 +0200
@@ -50,7 +50,11 @@
private final SecretKey clientMacKey, serverMacKey;
private final SecretKey clientCipherKey, serverCipherKey;
- private final IvParameterSpec clientIv, serverIv;
+
+ @SuppressWarnings("serial") // Not statically typed as Serializable
+ private final IvParameterSpec clientIv;
+ @SuppressWarnings("serial") // Not statically typed as Serializable
+ private final IvParameterSpec serverIv;
/**
* Constructs a new TlsKeymaterialSpec from the client and server MAC
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/sun/security/provider/PolicyParser.java
--- a/src/java.base/share/classes/sun/security/provider/PolicyParser.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/sun/security/provider/PolicyParser.java Wed Oct 16 15:31:05 2019 +0200
@@ -1315,7 +1315,9 @@
private static final long serialVersionUID = -4330692689482574072L;
private String i18nMessage;
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private LocalizedMessage localizedMsg;
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private Object[] source;
/**
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/sun/security/provider/SubjectCodeSource.java
--- a/src/java.base/share/classes/sun/security/provider/SubjectCodeSource.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/sun/security/provider/SubjectCodeSource.java Wed Oct 16 15:31:05 2019 +0200
@@ -54,6 +54,7 @@
private static final Class>[] PARAMS = { String.class };
private static final sun.security.util.Debug debug =
sun.security.util.Debug.getInstance("auth", "\t[Auth Access]");
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private ClassLoader sysClassLoader;
/**
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/sun/security/provider/certpath/X509CertPath.java
--- a/src/java.base/share/classes/sun/security/provider/certpath/X509CertPath.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/sun/security/provider/certpath/X509CertPath.java Wed Oct 16 15:31:05 2019 +0200
@@ -69,6 +69,7 @@
/**
* List of certificates in this chain
*/
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private List certs;
/**
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/sun/security/rsa/RSAPrivateCrtKeyImpl.java
--- a/src/java.base/share/classes/sun/security/rsa/RSAPrivateCrtKeyImpl.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/sun/security/rsa/RSAPrivateCrtKeyImpl.java Wed Oct 16 15:31:05 2019 +0200
@@ -70,6 +70,7 @@
// Optional parameters associated with this RSA key
// specified in the encoding of its AlgorithmId.
// Must be null for "RSA" keys.
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private AlgorithmParameterSpec keyParams;
/**
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/sun/security/rsa/RSAPrivateKeyImpl.java
--- a/src/java.base/share/classes/sun/security/rsa/RSAPrivateKeyImpl.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/sun/security/rsa/RSAPrivateKeyImpl.java Wed Oct 16 15:31:05 2019 +0200
@@ -61,6 +61,7 @@
// optional parameters associated with this RSA key
// specified in the encoding of its AlgorithmId.
// must be null for "RSA" keys.
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private final AlgorithmParameterSpec keyParams;
/**
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/sun/security/rsa/RSAPublicKeyImpl.java
--- a/src/java.base/share/classes/sun/security/rsa/RSAPublicKeyImpl.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/sun/security/rsa/RSAPublicKeyImpl.java Wed Oct 16 15:31:05 2019 +0200
@@ -62,6 +62,7 @@
// optional parameters associated with this RSA key
// specified in the encoding of its AlgorithmId
// must be null for "RSA" keys.
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private AlgorithmParameterSpec keyParams;
/**
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java
--- a/src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java Wed Oct 16 15:31:05 2019 +0200
@@ -201,7 +201,7 @@
// Primary XDH (RFC 7748) curves
NamedGroup.X25519,
- // Primary NIST curves (e.g. used in TLSv1.3)
+ // Primary NIST Suite B curves
NamedGroup.SECP256_R1,
NamedGroup.SECP384_R1,
NamedGroup.SECP521_R1,
@@ -209,17 +209,6 @@
// Secondary XDH curves
NamedGroup.X448,
- // Secondary NIST curves
- NamedGroup.SECT283_K1,
- NamedGroup.SECT283_R1,
- NamedGroup.SECT409_K1,
- NamedGroup.SECT409_R1,
- NamedGroup.SECT571_K1,
- NamedGroup.SECT571_R1,
-
- // non-NIST curves
- NamedGroup.SECP256_K1,
-
// FFDHE (RFC 7919)
NamedGroup.FFDHE_2048,
NamedGroup.FFDHE_3072,
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/sun/security/util/FilePermCompat.java
--- a/src/java.base/share/classes/sun/security/util/FilePermCompat.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/sun/security/util/FilePermCompat.java Wed Oct 16 15:31:05 2019 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -42,8 +42,11 @@
public static final boolean compat;
static {
- String flag = GetPropertyAction.privilegedGetProperty(
- "jdk.io.permissionsUseCanonicalPath", "false");
+ String flag = SecurityProperties.privilegedGetOverridable(
+ "jdk.io.permissionsUseCanonicalPath");
+ if (flag == null) {
+ flag = "false";
+ }
switch (flag) {
case "true":
nb = false;
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/sun/security/util/ObjectIdentifier.java
--- a/src/java.base/share/classes/sun/security/util/ObjectIdentifier.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/sun/security/util/ObjectIdentifier.java Wed Oct 16 15:31:05 2019 +0200
@@ -98,6 +98,7 @@
* Changed to Object
* @serial
*/
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private Object components = null; // path from root
/**
* @serial
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/sun/security/util/SecurityConstants.java
--- a/src/java.base/share/classes/sun/security/util/SecurityConstants.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/sun/security/util/SecurityConstants.java Wed Oct 16 15:31:05 2019 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, 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
@@ -97,6 +97,10 @@
public static final NetPermission GET_RESPONSECACHE_PERMISSION =
new NetPermission("getResponseCache");
+ // java.net.ServerSocket, java.net.Socket
+ public static final NetPermission SET_SOCKETIMPL_PERMISSION =
+ new NetPermission("setSocketImpl");
+
// java.lang.SecurityManager, sun.applet.AppletPanel
public static final RuntimePermission CREATE_CLASSLOADER_PERMISSION =
new RuntimePermission("createClassLoader");
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/sun/security/validator/ValidatorException.java
--- a/src/java.base/share/classes/sun/security/validator/ValidatorException.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/sun/security/validator/ValidatorException.java Wed Oct 16 15:31:05 2019 +0200
@@ -62,6 +62,7 @@
public static final Object T_UNTRUSTED_CERT =
"Untrusted certificate";
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private Object type;
private X509Certificate cert;
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/sun/security/x509/AlgorithmId.java
--- a/src/java.base/share/classes/sun/security/x509/AlgorithmId.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/sun/security/x509/AlgorithmId.java Wed Oct 16 15:31:05 2019 +0200
@@ -72,6 +72,7 @@
private ObjectIdentifier algid;
// The (parsed) parameters
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private AlgorithmParameters algParams;
private boolean constructedFromDer = true;
@@ -80,6 +81,7 @@
* DER-encoded form; subclasses can be made to automaticaly parse
* them so there is fast access to these parameters.
*/
+ @SuppressWarnings("serial") // Not statically typed as Serializable
protected DerValue params;
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/sun/security/x509/X509CertImpl.java
--- a/src/java.base/share/classes/sun/security/x509/X509CertImpl.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/sun/security/x509/X509CertImpl.java Wed Oct 16 15:31:05 2019 +0200
@@ -70,6 +70,7 @@
* @author Hemma Prafullchandra
* @see X509CertInfo
*/
+@SuppressWarnings("serial") // See writeReplace method in Certificate
public class X509CertImpl extends X509Certificate implements DerEncoder {
@java.io.Serial
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/classes/sun/security/x509/X509Key.java
--- a/src/java.base/share/classes/sun/security/x509/X509Key.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/classes/sun/security/x509/X509Key.java Wed Oct 16 15:31:05 2019 +0200
@@ -84,7 +84,7 @@
private int unusedBits = 0;
/* BitArray form of key */
- private BitArray bitStringKey = null;
+ private transient BitArray bitStringKey = null;
/* The encoding for the key. */
protected byte[] encodedKey;
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/conf/security/java.security
--- a/src/java.base/share/conf/security/java.security Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/conf/security/java.security Wed Oct 16 15:31:05 2019 +0200
@@ -1213,3 +1213,51 @@
# if this property is not enabled.
#
jdk.security.caDistrustPolicies=SYMANTEC_TLS
+
+#
+# FilePermission path canonicalization
+#
+# This security property dictates how the path argument is processed and stored
+# while constructing a FilePermission object. If the value is set to true, the
+# path argument is canonicalized and FilePermission methods (such as implies,
+# equals, and hashCode) are implemented based on this canonicalized result.
+# Otherwise, the path argument is not canonicalized and FilePermission methods are
+# implemented based on the original input. See the implementation note of the
+# FilePermission class for more details.
+#
+# If a system property of the same name is also specified, it supersedes the
+# security property value defined here.
+#
+# The default value for this property is false.
+#
+jdk.io.permissionsUseCanonicalPath=false
+
+
+#
+# Policies for the proxy_impersonator Kerberos ccache configuration entry
+#
+# The proxy_impersonator ccache configuration entry indicates that the ccache
+# is a synthetic delegated credential for use with S4U2Proxy by an intermediate
+# server. The ccache file should also contain the TGT of this server and
+# an evidence ticket from the default principal of the ccache to this server.
+#
+# This security property determines how Java uses this configuration entry.
+# There are 3 possible values:
+#
+# no-impersonate - Ignore this configuration entry, and always act as
+# the owner of the TGT (if it exists).
+#
+# try-impersonate - Try impersonation when this configuration entry exists.
+# If no matching TGT or evidence ticket is found,
+# fallback to no-impersonate.
+#
+# always-impersonate - Always impersonate when this configuration entry exists.
+# If no matching TGT or evidence ticket is found,
+# no initial credential is read from the ccache.
+#
+# The default value is "always-impersonate".
+#
+# If a system property of the same name is also specified, it supersedes the
+# security property value defined here.
+#
+#jdk.security.krb5.default.initiate.credential=always-impersonate
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/native/libjava/Class.c
--- a/src/java.base/share/native/libjava/Class.c Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/native/libjava/Class.c Wed Oct 16 15:31:05 2019 +0200
@@ -35,12 +35,9 @@
#include "jni.h"
#include "jni_util.h"
#include "jvm.h"
+#include "check_classname.h"
#include "java_lang_Class.h"
-/* defined in libverify.so/verify.dll (src file common/check_format.c) */
-extern jboolean VerifyClassname(char *utf_name, jboolean arrayAllowed);
-extern jboolean VerifyFixClassname(char *utf_name);
-
#define OBJ "Ljava/lang/Object;"
#define CLS "Ljava/lang/Class;"
#define CPL "Ljdk/internal/reflect/ConstantPool;"
@@ -123,14 +120,14 @@
}
(*env)->GetStringUTFRegion(env, classname, 0, unicode_len, clname);
- if (VerifyFixClassname(clname) == JNI_TRUE) {
+ if (verifyFixClassname(clname) == JNI_TRUE) {
/* slashes present in clname, use name b4 translation for exception */
(*env)->GetStringUTFRegion(env, classname, 0, unicode_len, clname);
JNU_ThrowClassNotFoundException(env, clname);
goto done;
}
- if (!VerifyClassname(clname, JNI_TRUE)) { /* expects slashed name */
+ if (!verifyClassname(clname, JNI_TRUE)) { /* expects slashed name */
JNU_ThrowClassNotFoundException(env, clname);
goto done;
}
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/native/libjava/ClassLoader.c
--- a/src/java.base/share/native/libjava/ClassLoader.c Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/native/libjava/ClassLoader.c Wed Oct 16 15:31:05 2019 +0200
@@ -30,14 +30,11 @@
#include "jni_util.h"
#include "jlong.h"
#include "jvm.h"
+#include "check_classname.h"
#include "java_lang_ClassLoader.h"
#include "java_lang_ClassLoader_NativeLibrary.h"
#include
-/* defined in libverify.so/verify.dll (src file common/check_format.c) */
-extern jboolean VerifyClassname(char *utf_name, jboolean arrayAllowed);
-extern jboolean VerifyFixClassname(char *utf_name);
-
static JNINativeMethod methods[] = {
{"retrieveDirectives", "()Ljava/lang/AssertionStatusDirectives;", (void *)&JVM_AssertionStatusDirectives}
};
@@ -120,7 +117,7 @@
if (utfName == NULL) {
goto free_body;
}
- VerifyFixClassname(utfName);
+ fixClassname(utfName);
} else {
utfName = NULL;
}
@@ -185,7 +182,7 @@
JNU_ThrowOutOfMemoryError(env, NULL);
return result;
}
- VerifyFixClassname(utfName);
+ fixClassname(utfName);
} else {
utfName = NULL;
}
@@ -231,9 +228,9 @@
JNU_ThrowOutOfMemoryError(env, NULL);
return NULL;
}
- VerifyFixClassname(clname);
+ fixClassname(clname);
- if (!VerifyClassname(clname, JNI_TRUE)) { /* expects slashed name */
+ if (!verifyClassname(clname, JNI_TRUE)) { /* expects slashed name */
goto done;
}
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/native/libjava/VM.c
--- a/src/java.base/share/native/libjava/VM.c Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/native/libjava/VM.c Wed Oct 16 15:31:05 2019 +0200
@@ -42,11 +42,6 @@
JNIEXPORT void JNICALL
Java_jdk_internal_misc_VM_initialize(JNIEnv *env, jclass cls) {
- if (!JDK_InitJvmHandle()) {
- JNU_ThrowInternalError(env, "Handle for JVM not found for symbol lookup");
- return;
- }
-
// Registers implementations of native methods described in methods[]
// above.
// In particular, registers JVM_GetNanoTimeAdjustment as the implementation
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/native/libjava/check_classname.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/native/libjava/check_classname.c Wed Oct 16 15:31:05 2019 +0200
@@ -0,0 +1,292 @@
+/*
+ * Copyright (c) 1997, 2019, 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
+#include
+#include
+
+#include "jni.h"
+#include "jvm.h"
+#include "check_classname.h"
+
+typedef unsigned short unicode;
+
+static char *
+skip_over_fieldname(char *name, jboolean slash_okay,
+ unsigned int len);
+static char *
+skip_over_field_signature(char *name, jboolean void_okay,
+ unsigned int len);
+
+/*
+ * Return non-zero if the character is a valid in JVM class name, zero
+ * otherwise. The only characters currently disallowed from JVM class
+ * names are given in the table below:
+ *
+ * Character Hex Decimal
+ * '.' 0x2e 46
+ * '/' 0x2f 47
+ * ';' 0x3b 59
+ * '[' 0x5b 91
+ *
+ * (Method names have further restrictions dealing with the '<' and
+ * '>' characters.)
+ */
+static int isJvmIdentifier(unicode ch) {
+ if( ch > 91 || ch < 46 )
+ return 1; /* Lowercase ASCII letters are > 91 */
+ else { /* 46 <= ch <= 91 */
+ if (ch <= 90 && ch >= 60) {
+ return 1; /* Uppercase ASCII recognized here */
+ } else { /* ch == 91 || 46 <= ch <= 59 */
+ if (ch == 91 || ch == 59 || ch <= 47)
+ return 0;
+ else
+ return 1;
+ }
+ }
+}
+
+static unicode
+next_utf2unicode(char **utfstring_ptr, int * valid)
+{
+ unsigned char *ptr = (unsigned char *)(*utfstring_ptr);
+ unsigned char ch, ch2, ch3;
+ int length = 1; /* default length */
+ unicode result = 0x80; /* default bad result; */
+ *valid = 1;
+ switch ((ch = ptr[0]) >> 4) {
+ default:
+ result = ch;
+ break;
+
+ case 0x8: case 0x9: case 0xA: case 0xB: case 0xF:
+ /* Shouldn't happen. */
+ *valid = 0;
+ break;
+
+ case 0xC: case 0xD:
+ /* 110xxxxx 10xxxxxx */
+ if (((ch2 = ptr[1]) & 0xC0) == 0x80) {
+ unsigned char high_five = ch & 0x1F;
+ unsigned char low_six = ch2 & 0x3F;
+ result = (high_five << 6) + low_six;
+ length = 2;
+ }
+ break;
+
+ case 0xE:
+ /* 1110xxxx 10xxxxxx 10xxxxxx */
+ if (((ch2 = ptr[1]) & 0xC0) == 0x80) {
+ if (((ch3 = ptr[2]) & 0xC0) == 0x80) {
+ unsigned char high_four = ch & 0x0f;
+ unsigned char mid_six = ch2 & 0x3f;
+ unsigned char low_six = ch3 & 0x3f;
+ result = (((high_four << 6) + mid_six) << 6) + low_six;
+ length = 3;
+ } else {
+ length = 2;
+ }
+ }
+ break;
+ } /* end of switch */
+
+ *utfstring_ptr = (char *)(ptr + length);
+ return result;
+}
+
+/* Take pointer to a string. Skip over the longest part of the string that
+ * could be taken as a fieldname. Allow '/' if slash_okay is JNI_TRUE.
+ *
+ * Return a pointer to just past the fieldname. Return NULL if no fieldname
+ * at all was found, or in the case of slash_okay being true, we saw
+ * consecutive slashes (meaning we were looking for a qualified path but
+ * found something that was badly-formed).
+ */
+static char *
+skip_over_fieldname(char *name, jboolean slash_okay,
+ unsigned int length)
+{
+ char *p;
+ unicode ch;
+ unicode last_ch = 0;
+ int valid = 1;
+ /* last_ch == 0 implies we are looking at the first char. */
+ for (p = name; p != name + length; last_ch = ch) {
+ char *old_p = p;
+ ch = *p;
+ if (ch < 128) {
+ p++;
+ if (isJvmIdentifier(ch)) {
+ continue;
+ }
+ } else {
+ char *tmp_p = p;
+ ch = next_utf2unicode(&tmp_p, &valid);
+ if (valid == 0)
+ return 0;
+ p = tmp_p;
+ if (isJvmIdentifier(ch)) {
+ continue;
+ }
+ }
+
+ if (slash_okay && ch == '/' && last_ch) {
+ if (last_ch == '/') {
+ return 0; /* Don't permit consecutive slashes */
+ }
+ } else if (ch == '_' || ch == '$') {
+ } else {
+ return last_ch ? old_p : 0;
+ }
+ }
+ return last_ch ? p : 0;
+}
+
+/* Take pointer to a string. Skip over the longest part of the string that
+ * could be taken as a field signature. Allow "void" if void_okay.
+ *
+ * Return a pointer to just past the signature. Return NULL if no legal
+ * signature is found.
+ */
+
+static char *
+skip_over_field_signature(char *name, jboolean void_okay,
+ unsigned int length)
+{
+ unsigned int array_dim = 0;
+ for (;length > 0;) {
+ switch (name[0]) {
+ case JVM_SIGNATURE_VOID:
+ if (!void_okay) return 0;
+ /* FALL THROUGH */
+ case JVM_SIGNATURE_BOOLEAN:
+ case JVM_SIGNATURE_BYTE:
+ case JVM_SIGNATURE_CHAR:
+ case JVM_SIGNATURE_SHORT:
+ case JVM_SIGNATURE_INT:
+ case JVM_SIGNATURE_FLOAT:
+ case JVM_SIGNATURE_LONG:
+ case JVM_SIGNATURE_DOUBLE:
+ return name + 1;
+
+ case JVM_SIGNATURE_CLASS: {
+ /* Skip over the classname, if one is there. */
+ char *p =
+ skip_over_fieldname(name + 1, JNI_TRUE, --length);
+ /* The next character better be a semicolon. */
+ if (p && p - name - 1 > 0 && p[0] == ';')
+ return p + 1;
+ return 0;
+ }
+
+ case JVM_SIGNATURE_ARRAY:
+ array_dim++;
+ /* JVMS 2nd ed. 4.10 */
+ /* The number of dimensions in an array is limited to 255 ... */
+ if (array_dim > 255) {
+ return 0;
+ }
+ /* The rest of what's there better be a legal signature. */
+ name++;
+ length--;
+ void_okay = JNI_FALSE;
+ break;
+
+ default:
+ return 0;
+ }
+ }
+ return 0;
+}
+
+/* Determine if the specified name is legal
+ * UTF name for a classname.
+ *
+ * Note that this routine expects the internal form of qualified classes:
+ * the dots should have been replaced by slashes.
+ */
+jboolean verifyClassname(char *name, jboolean allowArrayClass)
+{
+ size_t s = strlen(name);
+ assert(s <= UINT_MAX);
+ unsigned int length = (unsigned int)s;
+ char *p;
+
+ if (length > 0 && name[0] == JVM_SIGNATURE_ARRAY) {
+ if (!allowArrayClass) {
+ return JNI_FALSE;
+ } else {
+ /* Everything that's left better be a field signature */
+ p = skip_over_field_signature(name, JNI_FALSE, length);
+ }
+ } else {
+ /* skip over the fieldname. Slashes are okay */
+ p = skip_over_fieldname(name, JNI_TRUE, length);
+ }
+ return (p != 0 && p - name == (ptrdiff_t)length);
+}
+
+/*
+ * Translates '.' to '/'. Returns JNI_TRUE if any / were present.
+ */
+jboolean verifyFixClassname(char *name)
+{
+ char *p = name;
+ jboolean slashesFound = JNI_FALSE;
+ int valid = 1;
+
+ while (valid != 0 && *p != '\0') {
+ if (*p == '/') {
+ slashesFound = JNI_TRUE;
+ p++;
+ } else if (*p == '.') {
+ *p++ = '/';
+ } else {
+ next_utf2unicode(&p, &valid);
+ }
+ }
+
+ return slashesFound && valid != 0;
+}
+
+/*
+ * Translates '.' to '/'.
+ */
+void fixClassname(char *name)
+{
+ char *p = name;
+ int valid = 1;
+
+ while (valid != 0 && *p != '\0') {
+ if (*p == '.') {
+ *p++ = '/';
+ } else {
+ next_utf2unicode(&p, &valid);
+ }
+ }
+}
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/native/libjava/check_classname.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/native/libjava/check_classname.h Wed Oct 16 15:31:05 2019 +0200
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2019, 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 "jni.h"
+
+/*
+ * Class name checking methods
+ */
+
+jboolean verifyClassname(char *name, jboolean allowArrayClass);
+jboolean verifyFixClassname(char *name);
+void fixClassname(char *name);
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/native/libjava/jdk_util.h
--- a/src/java.base/share/native/libjava/jdk_util.h Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/native/libjava/jdk_util.h Wed Oct 16 15:31:05 2019 +0200
@@ -45,20 +45,6 @@
JNIEXPORT void
JDK_GetVersionInfo0(jdk_version_info* info, size_t info_size);
-
-/*-------------------------------------------------------
- * Internal interface for JDK to use
- *-------------------------------------------------------
- */
-
-/* Init JVM handle for symbol lookup;
- * Return 0 if JVM handle not found.
- */
-int JDK_InitJvmHandle();
-
-/* Find the named JVM entry; returns NULL if not found. */
-void* JDK_FindJvmEntry(const char* name);
-
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/native/libjava/jni_util.c
--- a/src/java.base/share/native/libjava/jni_util.c Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/native/libjava/jni_util.c Wed Oct 16 15:31:05 2019 +0200
@@ -77,77 +77,23 @@
}
JNIEXPORT void JNICALL
-JNU_ThrowIllegalAccessError(JNIEnv *env, const char *msg)
-{
- JNU_ThrowByName(env, "java/lang/IllegalAccessError", msg);
-}
-
-JNIEXPORT void JNICALL
-JNU_ThrowIllegalAccessException(JNIEnv *env, const char *msg)
-{
- JNU_ThrowByName(env, "java/lang/IllegalAccessException", msg);
-}
-
-JNIEXPORT void JNICALL
JNU_ThrowInternalError(JNIEnv *env, const char *msg)
{
JNU_ThrowByName(env, "java/lang/InternalError", msg);
}
JNIEXPORT void JNICALL
-JNU_ThrowNoSuchFieldException(JNIEnv *env, const char *msg)
-{
- JNU_ThrowByName(env, "java/lang/NoSuchFieldException", msg);
-}
-
-JNIEXPORT void JNICALL
-JNU_ThrowNoSuchMethodException(JNIEnv *env, const char *msg)
-{
- JNU_ThrowByName(env, "java/lang/NoSuchMethodException", msg);
-}
-
-JNIEXPORT void JNICALL
JNU_ThrowClassNotFoundException(JNIEnv *env, const char *msg)
{
JNU_ThrowByName(env, "java/lang/ClassNotFoundException", msg);
}
JNIEXPORT void JNICALL
-JNU_ThrowNumberFormatException(JNIEnv *env, const char *msg)
-{
- JNU_ThrowByName(env, "java/lang/NumberFormatException", msg);
-}
-
-JNIEXPORT void JNICALL
JNU_ThrowIOException(JNIEnv *env, const char *msg)
{
JNU_ThrowByName(env, "java/io/IOException", msg);
}
-JNIEXPORT void JNICALL
-JNU_ThrowNoSuchFieldError(JNIEnv *env, const char *msg)
-{
- JNU_ThrowByName(env, "java/lang/NoSuchFieldError", msg);
-}
-
-JNIEXPORT void JNICALL
-JNU_ThrowNoSuchMethodError(JNIEnv *env, const char *msg)
-{
- JNU_ThrowByName(env, "java/lang/NoSuchMethodError", msg);
-}
-
-JNIEXPORT void JNICALL
-JNU_ThrowStringIndexOutOfBoundsException(JNIEnv *env, const char *msg)
-{
- JNU_ThrowByName(env, "java/lang/StringIndexOutOfBoundsException", msg);
-}
-
-JNIEXPORT void JNICALL
-JNU_ThrowInstantiationException(JNIEnv *env, const char *msg)
-{
- JNU_ThrowByName(env, "java/lang/InstantiationException", msg);
-}
-
/*
* Throw an exception by name, using the string returned by
* getLastErrorString for the detail string. If the last-error
@@ -845,12 +791,6 @@
CHECK_NULL(String_value_ID);
}
-JNIEXPORT jstring
-NewStringPlatform(JNIEnv *env, const char *str)
-{
- return JNU_NewStringPlatform(env, str);
-}
-
JNIEXPORT jstring JNICALL
JNU_NewStringPlatform(JNIEnv *env, const char *str)
{
@@ -1024,54 +964,6 @@
return cls;
}
-JNIEXPORT jclass JNICALL
-JNU_ClassClass(JNIEnv *env)
-{
- static jclass cls = 0;
- if (cls == 0) {
- jclass c;
- if ((*env)->EnsureLocalCapacity(env, 1) < 0)
- return 0;
- c = (*env)->FindClass(env, "java/lang/Class");
- CHECK_NULL_RETURN(c, NULL);
- cls = (*env)->NewGlobalRef(env, c);
- (*env)->DeleteLocalRef(env, c);
- }
- return cls;
-}
-
-JNIEXPORT jclass JNICALL
-JNU_ClassObject(JNIEnv *env)
-{
- static jclass cls = 0;
- if (cls == 0) {
- jclass c;
- if ((*env)->EnsureLocalCapacity(env, 1) < 0)
- return 0;
- c = (*env)->FindClass(env, "java/lang/Object");
- CHECK_NULL_RETURN(c, NULL);
- cls = (*env)->NewGlobalRef(env, c);
- (*env)->DeleteLocalRef(env, c);
- }
- return cls;
-}
-
-JNIEXPORT jclass JNICALL
-JNU_ClassThrowable(JNIEnv *env)
-{
- static jclass cls = 0;
- if (cls == 0) {
- jclass c;
- if ((*env)->EnsureLocalCapacity(env, 1) < 0)
- return 0;
- c = (*env)->FindClass(env, "java/lang/Throwable");
- CHECK_NULL_RETURN(c, NULL);
- cls = (*env)->NewGlobalRef(env, c);
- (*env)->DeleteLocalRef(env, c);
- }
- return cls;
-}
-
JNIEXPORT jint JNICALL
JNU_CopyObjectArray(JNIEnv *env, jobjectArray dst, jobjectArray src,
jint count)
@@ -1110,125 +1002,10 @@
return JNI_ERR;
}
-JNIEXPORT jboolean JNICALL
-JNU_Equals(JNIEnv *env, jobject object1, jobject object2)
-{
- static jmethodID mid = NULL;
- if (mid == NULL) {
- jclass objClazz = JNU_ClassObject(env);
- CHECK_NULL_RETURN(objClazz, JNI_FALSE);
- mid = (*env)->GetMethodID(env, objClazz, "equals",
- "(Ljava/lang/Object;)Z");
- CHECK_NULL_RETURN(mid, JNI_FALSE);
- }
- return (*env)->CallBooleanMethod(env, object1, mid, object2);
-}
-
-
-/************************************************************************
- * Thread calls
- */
-
-static jmethodID Object_waitMID;
-static jmethodID Object_notifyMID;
-static jmethodID Object_notifyAllMID;
-
-JNIEXPORT void JNICALL
-JNU_MonitorWait(JNIEnv *env, jobject object, jlong timeout)
-{
- if (object == NULL) {
- JNU_ThrowNullPointerException(env, "JNU_MonitorWait argument");
- return;
- }
- if (Object_waitMID == NULL) {
- jclass cls = JNU_ClassObject(env);
- if (cls == NULL) {
- return;
- }
- Object_waitMID = (*env)->GetMethodID(env, cls, "wait", "(J)V");
- if (Object_waitMID == NULL) {
- return;
- }
- }
- (*env)->CallVoidMethod(env, object, Object_waitMID, timeout);
-}
-
-JNIEXPORT void JNICALL
-JNU_Notify(JNIEnv *env, jobject object)
-{
- if (object == NULL) {
- JNU_ThrowNullPointerException(env, "JNU_Notify argument");
- return;
- }
- if (Object_notifyMID == NULL) {
- jclass cls = JNU_ClassObject(env);
- if (cls == NULL) {
- return;
- }
- Object_notifyMID = (*env)->GetMethodID(env, cls, "notify", "()V");
- if (Object_notifyMID == NULL) {
- return;
- }
- }
- (*env)->CallVoidMethod(env, object, Object_notifyMID);
-}
-
-JNIEXPORT void JNICALL
-JNU_NotifyAll(JNIEnv *env, jobject object)
-{
- if (object == NULL) {
- JNU_ThrowNullPointerException(env, "JNU_NotifyAll argument");
- return;
- }
- if (Object_notifyAllMID == NULL) {
- jclass cls = JNU_ClassObject(env);
- if (cls == NULL) {
- return;
- }
- Object_notifyAllMID = (*env)->GetMethodID(env, cls,"notifyAll", "()V");
- if (Object_notifyAllMID == NULL) {
- return;
- }
- }
- (*env)->CallVoidMethod(env, object, Object_notifyAllMID);
-}
-
-
/************************************************************************
* Debugging utilities
*/
-JNIEXPORT void JNICALL
-JNU_PrintString(JNIEnv *env, char *hdr, jstring string)
-{
- if (string == NULL) {
- fprintf(stderr, "%s: is NULL\n", hdr);
- } else {
- const char *stringPtr = JNU_GetStringPlatformChars(env, string, 0);
- if (stringPtr == 0)
- return;
- fprintf(stderr, "%s: %s\n", hdr, stringPtr);
- JNU_ReleaseStringPlatformChars(env, string, stringPtr);
- }
-}
-
-JNIEXPORT void JNICALL
-JNU_PrintClass(JNIEnv *env, char* hdr, jobject object)
-{
- if (object == NULL) {
- fprintf(stderr, "%s: object is NULL\n", hdr);
- return;
- } else {
- jclass cls = (*env)->GetObjectClass(env, object);
- jstring clsName = JNU_ToString(env, cls);
- if (clsName == NULL) {
- JNU_PrintString(env, hdr, clsName);
- }
- (*env)->DeleteLocalRef(env, cls);
- (*env)->DeleteLocalRef(env, clsName);
- }
-}
-
JNIEXPORT jstring JNICALL
JNU_ToString(JNIEnv *env, jobject object)
{
@@ -1437,70 +1214,3 @@
}
return result;
}
-
-JNIEXPORT void JNICALL
-JNU_SetStaticFieldByName(JNIEnv *env,
- jboolean *hasException,
- const char *classname,
- const char *name,
- const char *signature,
- ...)
-{
- jclass cls;
- jfieldID fid;
- va_list args;
-
- if ((*env)->EnsureLocalCapacity(env, 3) < 0)
- goto done2;
-
- cls = (*env)->FindClass(env, classname);
- if (cls == 0)
- goto done2;
-
- fid = (*env)->GetStaticFieldID(env, cls, name, signature);
- if (fid == 0)
- goto done1;
-
- va_start(args, signature);
- switch (*signature) {
- case '[':
- case 'L':
- (*env)->SetStaticObjectField(env, cls, fid, va_arg(args, jobject));
- break;
- case 'Z':
- (*env)->SetStaticBooleanField(env, cls, fid, (jboolean)va_arg(args, int));
- break;
- case 'B':
- (*env)->SetStaticByteField(env, cls, fid, (jbyte)va_arg(args, int));
- break;
- case 'C':
- (*env)->SetStaticCharField(env, cls, fid, (jchar)va_arg(args, int));
- break;
- case 'S':
- (*env)->SetStaticShortField(env, cls, fid, (jshort)va_arg(args, int));
- break;
- case 'I':
- (*env)->SetStaticIntField(env, cls, fid, va_arg(args, jint));
- break;
- case 'J':
- (*env)->SetStaticLongField(env, cls, fid, va_arg(args, jlong));
- break;
- case 'F':
- (*env)->SetStaticFloatField(env, cls, fid, (jfloat)va_arg(args, jdouble));
- break;
- case 'D':
- (*env)->SetStaticDoubleField(env, cls, fid, va_arg(args, jdouble));
- break;
-
- default:
- (*env)->FatalError(env, "JNU_SetStaticFieldByName: illegal signature");
- }
- va_end(args);
-
- done1:
- (*env)->DeleteLocalRef(env, cls);
- done2:
- if (hasException) {
- *hasException = (*env)->ExceptionCheck(env);
- }
-}
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/native/libjava/jni_util.h
--- a/src/java.base/share/native/libjava/jni_util.h Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/native/libjava/jni_util.h Wed Oct 16 15:31:05 2019 +0200
@@ -62,41 +62,14 @@
JNU_ThrowIllegalArgumentException(JNIEnv *env, const char *msg);
JNIEXPORT void JNICALL
-JNU_ThrowIllegalAccessError(JNIEnv *env, const char *msg);
-
-JNIEXPORT void JNICALL
-JNU_ThrowIllegalAccessException(JNIEnv *env, const char *msg);
-
-JNIEXPORT void JNICALL
JNU_ThrowInternalError(JNIEnv *env, const char *msg);
JNIEXPORT void JNICALL
JNU_ThrowIOException(JNIEnv *env, const char *msg);
JNIEXPORT void JNICALL
-JNU_ThrowNoSuchFieldException(JNIEnv *env, const char *msg);
-
-JNIEXPORT void JNICALL
-JNU_ThrowNoSuchMethodException(JNIEnv *env, const char *msg);
-
-JNIEXPORT void JNICALL
JNU_ThrowClassNotFoundException(JNIEnv *env, const char *msg);
-JNIEXPORT void JNICALL
-JNU_ThrowNumberFormatException(JNIEnv *env, const char *msg);
-
-JNIEXPORT void JNICALL
-JNU_ThrowNoSuchFieldError(JNIEnv *env, const char *msg);
-
-JNIEXPORT void JNICALL
-JNU_ThrowNoSuchMethodError(JNIEnv *env, const char *msg);
-
-JNIEXPORT void JNICALL
-JNU_ThrowStringIndexOutOfBoundsException(JNIEnv *env, const char *msg);
-
-JNIEXPORT void JNICALL
-JNU_ThrowInstantiationException(JNIEnv *env, const char *msg);
-
/* Throw an exception by name, using the string returned by
* getLastErrorString for the detail string. If the last-error
* string is NULL, use the given default detail string.
@@ -120,9 +93,6 @@
JNU_ThrowIOExceptionWithLastError(JNIEnv *env, const char *defaultDetail);
/* Convert between Java strings and i18n C strings */
-JNIEXPORT jstring
-NewStringPlatform(JNIEnv *env, const char *str);
-
JNIEXPORT const char *
GetStringPlatformChars(JNIEnv *env, jstring jstr, jboolean *isCopy);
@@ -139,15 +109,6 @@
JNIEXPORT jclass JNICALL
JNU_ClassString(JNIEnv *env);
-JNIEXPORT jclass JNICALL
-JNU_ClassClass(JNIEnv *env);
-
-JNIEXPORT jclass JNICALL
-JNU_ClassObject(JNIEnv *env);
-
-JNIEXPORT jclass JNICALL
-JNU_ClassThrowable(JNIEnv *env);
-
/* Copy count number of arguments from src to dst. Array bounds
* and ArrayStoreException are checked.
*/
@@ -246,36 +207,6 @@
const char *classname,
const char *name,
const char *sig);
-JNIEXPORT void JNICALL
-JNU_SetStaticFieldByName(JNIEnv *env,
- jboolean *hasException,
- const char *classname,
- const char *name,
- const char *sig,
- ...);
-
-
-/*
- * Calls the .equals method.
- */
-JNIEXPORT jboolean JNICALL
-JNU_Equals(JNIEnv *env, jobject object1, jobject object2);
-
-
-/************************************************************************
- * Thread calls
- *
- * Convenience thread-related calls on the java.lang.Object class.
- */
-
-JNIEXPORT void JNICALL
-JNU_MonitorWait(JNIEnv *env, jobject object, jlong timeout);
-
-JNIEXPORT void JNICALL
-JNU_Notify(JNIEnv *env, jobject object);
-
-JNIEXPORT void JNICALL
-JNU_NotifyAll(JNIEnv *env, jobject object);
/************************************************************************
@@ -349,19 +280,15 @@
} \
} while (0)
#endif /* __cplusplus */
+
/************************************************************************
* Debugging utilities
*/
-JNIEXPORT void JNICALL
-JNU_PrintString(JNIEnv *env, char *hdr, jstring string);
-
-JNIEXPORT void JNICALL
-JNU_PrintClass(JNIEnv *env, char *hdr, jobject object);
-
JNIEXPORT jstring JNICALL
JNU_ToString(JNIEnv *env, jobject object);
+
/*
* Package shorthand for use by native libraries
*/
@@ -402,8 +329,6 @@
FAST_UTF_8
};
-int getFastEncoding();
-
JNIEXPORT void InitializeEncoding(JNIEnv *env, const char *name);
void* getProcessHandle();
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/native/libjava/verify_stub.c
--- a/src/java.base/share/native/libjava/verify_stub.c Mon Oct 07 16:48:42 2019 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 1999, 2003, 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.
- */
-
-
-/*
- * The real verifier now lives in libverifier.so/verifier.dll.
- *
- * This dummy exists so that HotSpot will run with the new
- * libjava.so/java.dll which is where is it accustomed to finding the
- * verifier.
- */
-
-#include "jni.h"
-
-struct struct_class_size_info;
-typedef struct struct_class_size_info class_size_info;
-
-
-JNIIMPORT jboolean
-VerifyClass(JNIEnv *env, jclass cb, char *buffer, jint len);
-
-JNIIMPORT jboolean
-VerifyClassForMajorVersion(JNIEnv *env, jclass cb, char *buffer, jint len,
- jint major_version);
-
-JNIEXPORT jboolean
-VerifyClassCodes(JNIEnv *env, jclass cb, char *buffer, jint len)
-{
- return VerifyClass(env, cb, buffer, len);
-}
-
-JNIEXPORT jboolean
-VerifyClassCodesForMajorVersion(JNIEnv *env, jclass cb, char *buffer,
- jint len, jint major_version)
-{
- return VerifyClassForMajorVersion(env, cb, buffer, len, major_version);
-}
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/native/libverify/check_code.c
--- a/src/java.base/share/native/libverify/check_code.c Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/native/libverify/check_code.c Wed Oct 16 15:31:05 2019 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,9 +31,6 @@
Exported function:
jboolean
- VerifyClass(JNIEnv *env, jclass cb, char *message_buffer,
- jint buffer_length)
- jboolean
VerifyClassForMajorVersion(JNIEnv *env, jclass cb, char *message_buffer,
jint buffer_length, jint major_version)
@@ -910,20 +907,6 @@
return result;
}
-#define OLD_FORMAT_MAX_MAJOR_VERSION 48
-
-JNIEXPORT jboolean
-VerifyClass(JNIEnv *env, jclass cb, char *buffer, jint len)
-{
- static int warned = 0;
- if (!warned) {
- jio_fprintf(stdout, "Warning! An old version of jvm is used. This is not supported.\n");
- warned = 1;
- }
- return VerifyClassForMajorVersion(env, cb, buffer, len,
- OLD_FORMAT_MAX_MAJOR_VERSION);
-}
-
static void
verify_field(context_type *context, jclass cb, int field_index)
{
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/native/libverify/check_format.c
--- a/src/java.base/share/native/libverify/check_format.c Mon Oct 07 16:48:42 2019 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,278 +0,0 @@
-/*
- * Copyright (c) 1997, 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.
- */
-
-#include
-#include
-#include
-#include
-#include
-
-#include "jni.h"
-#include "jvm.h"
-
-typedef unsigned short unicode;
-
-static char *
-skip_over_fieldname(char *name, jboolean slash_okay,
- unsigned int len);
-static char *
-skip_over_field_signature(char *name, jboolean void_okay,
- unsigned int len);
-
-/*
- * Return non-zero if the character is a valid in JVM class name, zero
- * otherwise. The only characters currently disallowed from JVM class
- * names are given in the table below:
- *
- * Character Hex Decimal
- * '.' 0x2e 46
- * '/' 0x2f 47
- * ';' 0x3b 59
- * '[' 0x5b 91
- *
- * (Method names have further restrictions dealing with the '<' and
- * '>' characters.)
- */
-static int isJvmIdentifier(unicode ch) {
- if( ch > 91 || ch < 46 )
- return 1; /* Lowercase ASCII letters are > 91 */
- else { /* 46 <= ch <= 91 */
- if (ch <= 90 && ch >= 60) {
- return 1; /* Uppercase ASCII recognized here */
- } else { /* ch == 91 || 46 <= ch <= 59 */
- if (ch == 91 || ch == 59 || ch <= 47)
- return 0;
- else
- return 1;
- }
- }
-}
-
-static unicode
-next_utf2unicode(char **utfstring_ptr, int * valid)
-{
- unsigned char *ptr = (unsigned char *)(*utfstring_ptr);
- unsigned char ch, ch2, ch3;
- int length = 1; /* default length */
- unicode result = 0x80; /* default bad result; */
- *valid = 1;
- switch ((ch = ptr[0]) >> 4) {
- default:
- result = ch;
- break;
-
- case 0x8: case 0x9: case 0xA: case 0xB: case 0xF:
- /* Shouldn't happen. */
- *valid = 0;
- break;
-
- case 0xC: case 0xD:
- /* 110xxxxx 10xxxxxx */
- if (((ch2 = ptr[1]) & 0xC0) == 0x80) {
- unsigned char high_five = ch & 0x1F;
- unsigned char low_six = ch2 & 0x3F;
- result = (high_five << 6) + low_six;
- length = 2;
- }
- break;
-
- case 0xE:
- /* 1110xxxx 10xxxxxx 10xxxxxx */
- if (((ch2 = ptr[1]) & 0xC0) == 0x80) {
- if (((ch3 = ptr[2]) & 0xC0) == 0x80) {
- unsigned char high_four = ch & 0x0f;
- unsigned char mid_six = ch2 & 0x3f;
- unsigned char low_six = ch3 & 0x3f;
- result = (((high_four << 6) + mid_six) << 6) + low_six;
- length = 3;
- } else {
- length = 2;
- }
- }
- break;
- } /* end of switch */
-
- *utfstring_ptr = (char *)(ptr + length);
- return result;
-}
-
-/* Take pointer to a string. Skip over the longest part of the string that
- * could be taken as a fieldname. Allow '/' if slash_okay is JNI_TRUE.
- *
- * Return a pointer to just past the fieldname. Return NULL if no fieldname
- * at all was found, or in the case of slash_okay being true, we saw
- * consecutive slashes (meaning we were looking for a qualified path but
- * found something that was badly-formed).
- */
-static char *
-skip_over_fieldname(char *name, jboolean slash_okay,
- unsigned int length)
-{
- char *p;
- unicode ch;
- unicode last_ch = 0;
- int valid = 1;
- /* last_ch == 0 implies we are looking at the first char. */
- for (p = name; p != name + length; last_ch = ch) {
- char *old_p = p;
- ch = *p;
- if (ch < 128) {
- p++;
- if (isJvmIdentifier(ch)) {
- continue;
- }
- } else {
- char *tmp_p = p;
- ch = next_utf2unicode(&tmp_p, &valid);
- if (valid == 0)
- return 0;
- p = tmp_p;
- if (isJvmIdentifier(ch)) {
- continue;
- }
- }
-
- if (slash_okay && ch == '/' && last_ch) {
- if (last_ch == '/') {
- return 0; /* Don't permit consecutive slashes */
- }
- } else if (ch == '_' || ch == '$') {
- } else {
- return last_ch ? old_p : 0;
- }
- }
- return last_ch ? p : 0;
-}
-
-/* Take pointer to a string. Skip over the longest part of the string that
- * could be taken as a field signature. Allow "void" if void_okay.
- *
- * Return a pointer to just past the signature. Return NULL if no legal
- * signature is found.
- */
-
-static char *
-skip_over_field_signature(char *name, jboolean void_okay,
- unsigned int length)
-{
- unsigned int array_dim = 0;
- for (;length > 0;) {
- switch (name[0]) {
- case JVM_SIGNATURE_VOID:
- if (!void_okay) return 0;
- /* FALL THROUGH */
- case JVM_SIGNATURE_BOOLEAN:
- case JVM_SIGNATURE_BYTE:
- case JVM_SIGNATURE_CHAR:
- case JVM_SIGNATURE_SHORT:
- case JVM_SIGNATURE_INT:
- case JVM_SIGNATURE_FLOAT:
- case JVM_SIGNATURE_LONG:
- case JVM_SIGNATURE_DOUBLE:
- return name + 1;
-
- case JVM_SIGNATURE_CLASS: {
- /* Skip over the classname, if one is there. */
- char *p =
- skip_over_fieldname(name + 1, JNI_TRUE, --length);
- /* The next character better be a semicolon. */
- if (p && p - name - 1 > 0 && p[0] == ';')
- return p + 1;
- return 0;
- }
-
- case JVM_SIGNATURE_ARRAY:
- array_dim++;
- /* JVMS 2nd ed. 4.10 */
- /* The number of dimensions in an array is limited to 255 ... */
- if (array_dim > 255) {
- return 0;
- }
- /* The rest of what's there better be a legal signature. */
- name++;
- length--;
- void_okay = JNI_FALSE;
- break;
-
- default:
- return 0;
- }
- }
- return 0;
-}
-
-
-/* Used in java/lang/Class.c */
-/* Determine if the specified name is legal
- * UTF name for a classname.
- *
- * Note that this routine expects the internal form of qualified classes:
- * the dots should have been replaced by slashes.
- */
-JNIEXPORT jboolean
-VerifyClassname(char *name, jboolean allowArrayClass)
-{
- size_t s = strlen(name);
- assert(s <= UINT_MAX);
- unsigned int length = (unsigned int)s;
- char *p;
-
- if (length > 0 && name[0] == JVM_SIGNATURE_ARRAY) {
- if (!allowArrayClass) {
- return JNI_FALSE;
- } else {
- /* Everything that's left better be a field signature */
- p = skip_over_field_signature(name, JNI_FALSE, length);
- }
- } else {
- /* skip over the fieldname. Slashes are okay */
- p = skip_over_fieldname(name, JNI_TRUE, length);
- }
- return (p != 0 && p - name == (ptrdiff_t)length);
-}
-
-/*
- * Translates '.' to '/'. Returns JNI_TRUE is any / were present.
- */
-JNIEXPORT jboolean
-VerifyFixClassname(char *name)
-{
- char *p = name;
- jboolean slashesFound = JNI_FALSE;
- int valid = 1;
-
- while (valid != 0 && *p != '\0') {
- if (*p == '/') {
- slashesFound = JNI_TRUE;
- p++;
- } else if (*p == '.') {
- *p++ = '/';
- } else {
- next_utf2unicode(&p, &valid);
- }
- }
-
- return slashesFound && valid != 0;
-}
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/share/native/libzip/Deflater.c
--- a/src/java.base/share/native/libzip/Deflater.c Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/share/native/libzip/Deflater.c Wed Oct 16 15:31:05 2019 +0200
@@ -257,7 +257,7 @@
res = doDeflate(env, addr, input, inputLen, output + outputOff, outputLen,
flush, params);
- (*env)->ReleasePrimitiveArrayCritical(env, outputArray, input, 0);
+ (*env)->ReleasePrimitiveArrayCritical(env, outputArray, output, 0);
retVal = checkDeflateStatus(env, addr, inputLen, outputLen, params, res);
return retVal;
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/unix/native/libjava/jdk_util_md.c
--- a/src/java.base/unix/native/libjava/jdk_util_md.c Mon Oct 07 16:48:42 2019 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2004, 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.
- */
-
-#include
-#include "jdk_util.h"
-
-int JDK_InitJvmHandle() {
- /* nop */
- return 1;
-}
-
-void* JDK_FindJvmEntry(const char* name) {
- return dlsym(RTLD_DEFAULT, name);
-}
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/unix/native/libnio/ch/Net.c
--- a/src/java.base/unix/native/libnio/ch/Net.c Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/unix/native/libnio/ch/Net.c Wed Oct 16 15:31:05 2019 +0200
@@ -66,34 +66,6 @@
#endif
#endif
-#if defined(_AIX)
- #ifndef IP_BLOCK_SOURCE
- #define IP_BLOCK_SOURCE 58 /* Block data from a given source to a given group */
- #define IP_UNBLOCK_SOURCE 59 /* Unblock data from a given source to a given group */
- #define IP_ADD_SOURCE_MEMBERSHIP 60 /* Join a source-specific group */
- #define IP_DROP_SOURCE_MEMBERSHIP 61 /* Leave a source-specific group */
- #endif
-
- #ifndef MCAST_BLOCK_SOURCE
- #define MCAST_BLOCK_SOURCE 64
- #define MCAST_UNBLOCK_SOURCE 65
- #define MCAST_JOIN_SOURCE_GROUP 66
- #define MCAST_LEAVE_SOURCE_GROUP 67
-
- /* This means we're on AIX 5.3 and 'group_source_req' and 'ip_mreq_source' aren't defined as well */
- struct group_source_req {
- uint32_t gsr_interface;
- struct sockaddr_storage gsr_group;
- struct sockaddr_storage gsr_source;
- };
- struct ip_mreq_source {
- struct in_addr imr_multiaddr; /* IP multicast address of group */
- struct in_addr imr_sourceaddr; /* IP address of source */
- struct in_addr imr_interface; /* local IP address of interface */
- };
- #endif
-#endif /* _AIX */
-
#define COPY_INET6_ADDRESS(env, source, target) \
(*env)->GetByteArrayRegion(env, source, 0, 16, target)
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/windows/classes/java/lang/ProcessImpl.java
--- a/src/java.base/windows/classes/java/lang/ProcessImpl.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/windows/classes/java/lang/ProcessImpl.java Wed Oct 16 15:31:05 2019 +0200
@@ -38,6 +38,7 @@
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
+import java.util.Locale;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
@@ -46,6 +47,8 @@
import jdk.internal.access.JavaIOFileDescriptorAccess;
import jdk.internal.access.SharedSecrets;
import jdk.internal.ref.CleanerFactory;
+import sun.security.action.GetBooleanAction;
+import sun.security.action.GetPropertyAction;
/* This class is for the exclusive use of ProcessBuilder.start() to
* create new processes.
@@ -209,12 +212,15 @@
private static final int VERIFICATION_CMD_BAT = 0;
private static final int VERIFICATION_WIN32 = 1;
- private static final int VERIFICATION_LEGACY = 2;
+ private static final int VERIFICATION_WIN32_SAFE = 2; // inside quotes not allowed
+ private static final int VERIFICATION_LEGACY = 3;
+ // See Command shell overview for documentation of special characters.
+ // https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-xp/bb490954(v=technet.10)
private static final char ESCAPE_VERIFICATION[][] = {
// We guarantee the only command file execution for implicit [cmd.exe] run.
// http://technet.microsoft.com/en-us/library/bb490954.aspx
{' ', '\t', '<', '>', '&', '|', '^'},
-
+ {' ', '\t', '<', '>'},
{' ', '\t', '<', '>'},
{' ', '\t'}
};
@@ -231,8 +237,25 @@
cmdbuf.append(' ');
String s = cmd[i];
if (needsEscaping(verificationType, s)) {
- cmdbuf.append('"').append(s);
+ cmdbuf.append('"');
+ if (verificationType == VERIFICATION_WIN32_SAFE) {
+ // Insert the argument, adding '\' to quote any interior quotes
+ int length = s.length();
+ for (int j = 0; j < length; j++) {
+ char c = s.charAt(j);
+ if (c == DOUBLEQUOTE) {
+ int count = countLeadingBackslash(verificationType, s, j);
+ while (count-- > 0) {
+ cmdbuf.append(BACKSLASH); // double the number of backslashes
+ }
+ cmdbuf.append(BACKSLASH); // backslash to quote the quote
+ }
+ cmdbuf.append(c);
+ }
+ } else {
+ cmdbuf.append(s);
+ }
// The code protects the [java.exe] and console command line
// parser, that interprets the [\"] combination as an escape
// sequence for the ["] char.
@@ -245,8 +268,9 @@
// command line parser. The case of the [""] tail escape
// sequence could not be realized due to the argument validation
// procedure.
- if ((verificationType != VERIFICATION_CMD_BAT) && s.endsWith("\\")) {
- cmdbuf.append('\\');
+ int count = countLeadingBackslash(verificationType, s, s.length());
+ while (count-- > 0) {
+ cmdbuf.append(BACKSLASH); // double the number of backslashes
}
cmdbuf.append('"');
} else {
@@ -256,26 +280,16 @@
return cmdbuf.toString();
}
- private static boolean isQuoted(boolean noQuotesInside, String arg,
- String errorMessage) {
- int lastPos = arg.length() - 1;
- if (lastPos >=1 && arg.charAt(0) == '"' && arg.charAt(lastPos) == '"') {
- // The argument has already been quoted.
- if (noQuotesInside) {
- if (arg.indexOf('"', 1) != lastPos) {
- // There is ["] inside.
- throw new IllegalArgumentException(errorMessage);
- }
- }
- return true;
- }
- if (noQuotesInside) {
- if (arg.indexOf('"') >= 0) {
- // There is ["] inside.
- throw new IllegalArgumentException(errorMessage);
- }
- }
- return false;
+ /**
+ * Return the argument without quotes (1st and last) if present, else the arg.
+ * @param str a string
+ * @return the string without 1st and last quotes
+ */
+ private static String unQuote(String str) {
+ int len = str.length();
+ return (len >= 2 && str.charAt(0) == DOUBLEQUOTE && str.charAt(len - 1) == DOUBLEQUOTE)
+ ? str.substring(1, len - 1)
+ : str;
}
private static boolean needsEscaping(int verificationType, String arg) {
@@ -286,9 +300,26 @@
// For [.exe] or [.com] file the unpaired/internal ["]
// in the argument is not a problem.
- boolean argIsQuoted = isQuoted(
- (verificationType == VERIFICATION_CMD_BAT),
- arg, "Argument has embedded quote, use the explicit CMD.EXE call.");
+ String unquotedArg = unQuote(arg);
+ boolean argIsQuoted = !arg.equals(unquotedArg);
+ boolean embeddedQuote = unquotedArg.indexOf(DOUBLEQUOTE) >= 0;
+
+ switch (verificationType) {
+ case VERIFICATION_CMD_BAT:
+ if (embeddedQuote) {
+ throw new IllegalArgumentException("Argument has embedded quote, " +
+ "use the explicit CMD.EXE call.");
+ }
+ break; // break determine whether to quote
+ case VERIFICATION_WIN32_SAFE:
+ if (argIsQuoted && embeddedQuote) {
+ throw new IllegalArgumentException("Malformed argument has embedded quote: "
+ + unquotedArg);
+ }
+ break;
+ default:
+ break;
+ }
if (!argIsQuoted) {
char testEscape[] = ESCAPE_VERIFICATION[verificationType];
@@ -304,13 +335,13 @@
private static String getExecutablePath(String path)
throws IOException
{
- boolean pathIsQuoted = isQuoted(true, path,
- "Executable name has embedded quote, split the arguments");
-
+ String name = unQuote(path);
+ if (name.indexOf(DOUBLEQUOTE) >= 0) {
+ throw new IllegalArgumentException("Executable name has embedded quote, " +
+ "split the arguments: " + name);
+ }
// Win32 CreateProcess requires path to be normalized
- File fileToRun = new File(pathIsQuoted
- ? path.substring(1, path.length() - 1)
- : path);
+ File fileToRun = new File(name);
// From the [CreateProcess] function documentation:
//
@@ -325,13 +356,26 @@
// sequence:..."
//
// In practice ANY non-existent path is extended by [.exe] extension
- // in the [CreateProcess] funcion with the only exception:
+ // in the [CreateProcess] function with the only exception:
// the path ends by (.)
return fileToRun.getPath();
}
+ /**
+ * An executable is any program that is an EXE or does not have an extension
+ * and the Windows createProcess will be looking for .exe.
+ * The comparison is case insensitive based on the name.
+ * @param executablePath the executable file
+ * @return true if the path ends in .exe or does not have an extension.
+ */
+ private boolean isExe(String executablePath) {
+ File file = new File(executablePath);
+ String upName = file.getName().toUpperCase(Locale.ROOT);
+ return (upName.endsWith(".EXE") || upName.indexOf('.') < 0);
+ }
+ // Old version that can be bypassed
private boolean isShellFile(String executablePath) {
String upPath = executablePath.toUpperCase();
return (upPath.endsWith(".CMD") || upPath.endsWith(".BAT"));
@@ -342,6 +386,21 @@
return argbuf.append('"').append(arg).append('"').toString();
}
+ // Count backslashes before start index of string.
+ // .bat files don't include backslashes as part of the quote
+ private static int countLeadingBackslash(int verificationType,
+ CharSequence input, int start) {
+ if (verificationType == VERIFICATION_CMD_BAT)
+ return 0;
+ int j;
+ for (j = start - 1; j >= 0 && input.charAt(j) == BACKSLASH; j--) {
+ // just scanning backwards
+ }
+ return (start - 1) - j; // number of BACKSLASHES
+ }
+
+ private static final char DOUBLEQUOTE = '\"';
+ private static final char BACKSLASH = '\\';
private final long handle;
private final ProcessHandle processHandle;
@@ -358,15 +417,13 @@
throws IOException
{
String cmdstr;
- SecurityManager security = System.getSecurityManager();
- boolean allowAmbiguousCommands = false;
- if (security == null) {
- allowAmbiguousCommands = true;
- String value = System.getProperty("jdk.lang.Process.allowAmbiguousCommands");
- if (value != null)
- allowAmbiguousCommands = !"false".equalsIgnoreCase(value);
- }
- if (allowAmbiguousCommands) {
+ final SecurityManager security = System.getSecurityManager();
+ final String value = GetPropertyAction.
+ privilegedGetProperty("jdk.lang.Process.allowAmbiguousCommands",
+ (security == null ? "true" : "false"));
+ final boolean allowAmbiguousCommands = !"false".equalsIgnoreCase(value);
+
+ if (allowAmbiguousCommands && security == null) {
// Legacy mode.
// Normalize path if possible.
@@ -413,11 +470,12 @@
// Quotation protects from interpretation of the [path] argument as
// start of longer path with spaces. Quotation has no influence to
// [.exe] extension heuristic.
+ boolean isShell = allowAmbiguousCommands ? isShellFile(executablePath)
+ : !isExe(executablePath);
cmdstr = createCommandLine(
- // We need the extended verification procedure for CMD files.
- isShellFile(executablePath)
- ? VERIFICATION_CMD_BAT
- : VERIFICATION_WIN32,
+ // We need the extended verification procedures
+ isShell ? VERIFICATION_CMD_BAT
+ : (allowAmbiguousCommands ? VERIFICATION_WIN32 : VERIFICATION_WIN32_SAFE),
quoteString(executablePath),
cmd);
}
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.base/windows/native/libjava/jdk_util_md.c
--- a/src/java.base/windows/native/libjava/jdk_util_md.c Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.base/windows/native/libjava/jdk_util_md.c Wed Oct 16 15:31:05 2019 +0200
@@ -28,17 +28,6 @@
#define JVM_DLL "jvm.dll"
-static HMODULE jvm_handle = NULL;
-
-int JDK_InitJvmHandle() {
- jvm_handle = GetModuleHandle(JVM_DLL);
- return (jvm_handle != NULL);
-}
-
-void* JDK_FindJvmEntry(const char* name) {
- return (void*) GetProcAddress(jvm_handle, name);
-}
-
JNIEXPORT HMODULE JDK_LoadSystemLibrary(const char* name) {
HMODULE handle = NULL;
char path[MAX_PATH];
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.datatransfer/share/classes/java/awt/datatransfer/MimeType.java
--- a/src/java.datatransfer/share/classes/java/awt/datatransfer/MimeType.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.datatransfer/share/classes/java/awt/datatransfer/MimeType.java Wed Oct 16 15:31:05 2019 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, 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
@@ -346,9 +346,9 @@
return newObj;
}
- private String primaryType;
- private String subType;
- private MimeTypeParameterList parameters;
+ private transient String primaryType;
+ private transient String subType;
+ private transient MimeTypeParameterList parameters;
// below here be scary parsing related things
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.desktop/macosx/classes/sun/awt/CGraphicsDevice.java
--- a/src/java.desktop/macosx/classes/sun/awt/CGraphicsDevice.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.desktop/macosx/classes/sun/awt/CGraphicsDevice.java Wed Oct 16 15:31:05 2019 +0200
@@ -61,6 +61,10 @@
public CGraphicsDevice(final int displayID) {
this.displayID = displayID;
config = CGLGraphicsConfig.getConfig(this, displayID, 0);
+ // initializes default device state, might be redundant step since we
+ // call "displayChanged()" later anyway, but we do not want to leave the
+ // device in an inconsistent state after construction
+ displayChanged();
}
/**
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.desktop/macosx/classes/sun/java2d/opengl/CGLSurfaceData.java
--- a/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLSurfaceData.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLSurfaceData.java Wed Oct 16 15:31:05 2019 +0200
@@ -25,7 +25,6 @@
package sun.java2d.opengl;
-import java.awt.Graphics;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
@@ -33,9 +32,7 @@
import java.awt.Rectangle;
import java.awt.image.ColorModel;
-import sun.java2d.SunGraphics2D;
import sun.java2d.SurfaceData;
-
import sun.lwawt.macosx.CPlatformView;
public abstract class CGLSurfaceData extends OGLSurfaceData {
@@ -342,43 +339,4 @@
return offscreenImage;
}
}
-
- // Mac OS X specific APIs for JOGL/Java2D bridge...
-
- // given a surface create and attach GL context, then return it
- private static native long createCGLContextOnSurface(CGLSurfaceData sd,
- long sharedContext);
-
- public static long createOGLContextOnSurface(Graphics g, long sharedContext) {
- SurfaceData sd = ((SunGraphics2D) g).surfaceData;
- if ((sd instanceof CGLSurfaceData) == true) {
- CGLSurfaceData cglsd = (CGLSurfaceData) sd;
- return createCGLContextOnSurface(cglsd, sharedContext);
- } else {
- return 0L;
- }
- }
-
- // returns whether or not the makeCurrent operation succeeded
- static native boolean makeCGLContextCurrentOnSurface(CGLSurfaceData sd,
- long ctx);
-
- public static boolean makeOGLContextCurrentOnSurface(Graphics g, long ctx) {
- SurfaceData sd = ((SunGraphics2D) g).surfaceData;
- if ((ctx != 0L) && ((sd instanceof CGLSurfaceData) == true)) {
- CGLSurfaceData cglsd = (CGLSurfaceData) sd;
- return makeCGLContextCurrentOnSurface(cglsd, ctx);
- } else {
- return false;
- }
- }
-
- // additional cleanup
- private static native void destroyCGLContext(long ctx);
-
- public static void destroyOGLContext(long ctx) {
- if (ctx != 0L) {
- destroyCGLContext(ctx);
- }
- }
}
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.desktop/macosx/classes/sun/lwawt/macosx/LWCToolkit.java
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/LWCToolkit.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/LWCToolkit.java Wed Oct 16 15:31:05 2019 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, 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
@@ -444,6 +444,7 @@
fontHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
desktopProperties.put(SunToolkit.DESKTOPFONTHINTS, fontHints);
desktopProperties.put("awt.mouse.numButtons", BUTTONS);
+ desktopProperties.put("awt.multiClickInterval", getMultiClickTime());
// These DnD properties must be set, otherwise Swing ends up spewing NPEs
// all over the place. The values came straight off of MToolkit.
@@ -538,6 +539,11 @@
return BUTTONS;
}
+ /**
+ * Returns the double-click time interval in ms.
+ */
+ private static native int getMultiClickTime();
+
@Override
public boolean isTraySupported() {
return true;
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m Wed Oct 16 15:31:05 2019 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, 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
@@ -831,3 +831,19 @@
}
return JNI_FALSE;
}
+
+/*
+ * Class: sun_lwawt_macosx_LWCToolkit
+ * Method: getMultiClickTime
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL
+Java_sun_lwawt_macosx_LWCToolkit_getMultiClickTime(JNIEnv *env, jclass klass) {
+ __block jint multiClickTime = 0;
+ JNF_COCOA_ENTER(env);
+ [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
+ multiClickTime = (jint)([NSEvent doubleClickInterval] * 1000);
+ }];
+ JNF_COCOA_EXIT(env);
+ return multiClickTime;
+}
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.m
--- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.m Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.m Wed Oct 16 15:31:05 2019 +0200
@@ -152,7 +152,6 @@
AWT_ASSERT_APPKIT_THREAD;
jint displayID = (jint)[(NSNumber *)[argValue objectAtIndex: 0] intValue];
- jint pixfmt = (jint)[(NSNumber *)[argValue objectAtIndex: 1] intValue];
jint swapInterval = (jint)[(NSNumber *)[argValue objectAtIndex: 2] intValue];
JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
[argValue removeAllObjects];
@@ -161,11 +160,7 @@
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
- CGOpenGLDisplayMask glMask = (CGOpenGLDisplayMask)pixfmt;
if (sharedContext == NULL) {
- if (glMask == 0) {
- glMask = CGDisplayIDToOpenGLDisplayMask(displayID);
- }
NSOpenGLPixelFormatAttribute attrs[] = {
NSOpenGLPFAAllowOfflineRenderers,
@@ -176,16 +171,17 @@
NSOpenGLPFAColorSize, 32,
NSOpenGLPFAAlphaSize, 8,
NSOpenGLPFADepthSize, 16,
- NSOpenGLPFAScreenMask, glMask,
0
};
sharedPixelFormat =
[[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
if (sharedPixelFormat == nil) {
- J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLGraphicsConfig_getCGLConfigInfo: shared NSOpenGLPixelFormat is NULL");
- [argValue addObject: [NSNumber numberWithLong: 0L]];
- return;
+ J2dRlsTraceLn(J2D_TRACE_ERROR,
+ "CGLGraphicsConfig_getCGLConfigInfo: shared NSOpenGLPixelFormat is NULL");
+
+ [argValue addObject: [NSNumber numberWithLong: 0L]];
+ return;
}
sharedContext =
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.desktop/share/classes/java/awt/Font.java
--- a/src/java.desktop/share/classes/java/awt/Font.java Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.desktop/share/classes/java/awt/Font.java Wed Oct 16 15:31:05 2019 +0200
@@ -1929,6 +1929,7 @@
// value is the default.
if (fRequestedAttributes != null) {
+ try {
values = getAttributeValues(); // init
AttributeValues extras =
AttributeValues.fromSerializableHashtable(fRequestedAttributes);
@@ -1938,10 +1939,13 @@
values = getAttributeValues().merge(extras);
this.nonIdentityTx = values.anyNonDefault(EXTRA_MASK);
this.hasLayoutAttributes = values.anyNonDefault(LAYOUT_MASK);
-
+ } catch (Throwable t) {
+ throw new IOException(t);
+ } finally {
fRequestedAttributes = null; // don't need it any more
}
}
+ }
/**
* Returns the number of glyphs in this {@code Font}. Glyph codes
diff -r 54c1ba464b78 -r 28c7e6711871 src/java.desktop/share/classes/java/awt/doc-files/AWTThreadIssues.html
--- a/src/java.desktop/share/classes/java/awt/doc-files/AWTThreadIssues.html Mon Oct 07 16:48:42 2019 +0200
+++ b/src/java.desktop/share/classes/java/awt/doc-files/AWTThreadIssues.html Wed Oct 16 15:31:05 2019 +0200
@@ -5,7 +5,7 @@
AWT Threading Issues