* 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 496bbf554c5c -r 38176d1c5ec2 src/java.base/share/classes/java/lang/ClassLoader.java
--- a/src/java.base/share/classes/java/lang/ClassLoader.java Wed Oct 16 01:16:12 2019 +0200
+++ b/src/java.base/share/classes/java/lang/ClassLoader.java Wed Oct 16 11:23:46 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 496bbf554c5c -r 38176d1c5ec2 src/java.base/share/classes/java/lang/Runtime.java
--- a/src/java.base/share/classes/java/lang/Runtime.java Wed Oct 16 01:16:12 2019 +0200
+++ b/src/java.base/share/classes/java/lang/Runtime.java Wed Oct 16 11:23:46 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 496bbf554c5c -r 38176d1c5ec2 src/java.base/share/classes/java/lang/StringCoding.java
--- a/src/java.base/share/classes/java/lang/StringCoding.java Wed Oct 16 01:16:12 2019 +0200
+++ b/src/java.base/share/classes/java/lang/StringCoding.java Wed Oct 16 11:23:46 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 496bbf554c5c -r 38176d1c5ec2 src/java.base/share/classes/java/lang/System.java
--- a/src/java.base/share/classes/java/lang/System.java Wed Oct 16 01:16:12 2019 +0200
+++ b/src/java.base/share/classes/java/lang/System.java Wed Oct 16 11:23:46 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 496bbf554c5c -r 38176d1c5ec2 src/java.base/share/classes/java/net/NetPermission.java
--- a/src/java.base/share/classes/java/net/NetPermission.java Wed Oct 16 01:16:12 2019 +0200
+++ b/src/java.base/share/classes/java/net/NetPermission.java Wed Oct 16 11:23:46 2019 +0200
@@ -145,6 +145,15 @@
*
*
*
* specifyStreamHandler |
* The ability
* to specify a stream handler when constructing a URL |
diff -r 496bbf554c5c -r 38176d1c5ec2 src/java.base/share/classes/java/net/ServerSocket.java
--- a/src/java.base/share/classes/java/net/ServerSocket.java Wed Oct 16 01:16:12 2019 +0200
+++ b/src/java.base/share/classes/java/net/ServerSocket.java Wed Oct 16 11:23:46 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 496bbf554c5c -r 38176d1c5ec2 src/java.base/share/classes/java/net/Socket.java
--- a/src/java.base/share/classes/java/net/Socket.java Wed Oct 16 01:16:12 2019 +0200
+++ b/src/java.base/share/classes/java/net/Socket.java Wed Oct 16 11:23:46 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 496bbf554c5c -r 38176d1c5ec2 src/java.base/share/classes/java/net/URL.java
--- a/src/java.base/share/classes/java/net/URL.java Wed Oct 16 01:16:12 2019 +0200
+++ b/src/java.base/share/classes/java/net/URL.java Wed Oct 16 11:23:46 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 496bbf554c5c -r 38176d1c5ec2 src/java.base/share/classes/java/text/DecimalFormat.java
--- a/src/java.base/share/classes/java/text/DecimalFormat.java Wed Oct 16 01:16:12 2019 +0200
+++ b/src/java.base/share/classes/java/text/DecimalFormat.java Wed Oct 16 11:23:46 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 496bbf554c5c -r 38176d1c5ec2 src/java.base/share/classes/java/util/regex/Pattern.java
--- a/src/java.base/share/classes/java/util/regex/Pattern.java Wed Oct 16 01:16:12 2019 +0200
+++ b/src/java.base/share/classes/java/util/regex/Pattern.java Wed Oct 16 11:23:46 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 496bbf554c5c -r 38176d1c5ec2 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 Wed Oct 16 01:16:12 2019 +0200
+++ b/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java Wed Oct 16 11:23:46 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 496bbf554c5c -r 38176d1c5ec2 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 Wed Oct 16 01:16:12 2019 +0200
+++ b/src/java.base/share/classes/sun/net/www/protocol/jar/Handler.java Wed Oct 16 11:23:46 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 496bbf554c5c -r 38176d1c5ec2 src/java.base/share/classes/sun/nio/ch/ServerSocketAdaptor.java
--- a/src/java.base/share/classes/sun/nio/ch/ServerSocketAdaptor.java Wed Oct 16 01:16:12 2019 +0200
+++ b/src/java.base/share/classes/sun/nio/ch/ServerSocketAdaptor.java Wed Oct 16 11:23:46 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 496bbf554c5c -r 38176d1c5ec2 src/java.base/share/classes/sun/nio/ch/SocketAdaptor.java
--- a/src/java.base/share/classes/sun/nio/ch/SocketAdaptor.java Wed Oct 16 01:16:12 2019 +0200
+++ b/src/java.base/share/classes/sun/nio/ch/SocketAdaptor.java Wed Oct 16 11:23:46 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 496bbf554c5c -r 38176d1c5ec2 src/java.base/share/classes/sun/nio/cs/ArrayDecoder.java
--- a/src/java.base/share/classes/sun/nio/cs/ArrayDecoder.java Wed Oct 16 01:16:12 2019 +0200
+++ b/src/java.base/share/classes/sun/nio/cs/ArrayDecoder.java Wed Oct 16 11:23:46 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 496bbf554c5c -r 38176d1c5ec2 src/java.base/share/classes/sun/nio/cs/SingleByte.java
--- a/src/java.base/share/classes/sun/nio/cs/SingleByte.java Wed Oct 16 01:16:12 2019 +0200
+++ b/src/java.base/share/classes/sun/nio/cs/SingleByte.java Wed Oct 16 11:23:46 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 496bbf554c5c -r 38176d1c5ec2 src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java
--- a/src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java Wed Oct 16 01:16:12 2019 +0200
+++ b/src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java Wed Oct 16 11:23:46 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 496bbf554c5c -r 38176d1c5ec2 src/java.base/share/classes/sun/security/util/FilePermCompat.java
--- a/src/java.base/share/classes/sun/security/util/FilePermCompat.java Wed Oct 16 01:16:12 2019 +0200
+++ b/src/java.base/share/classes/sun/security/util/FilePermCompat.java Wed Oct 16 11:23:46 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 496bbf554c5c -r 38176d1c5ec2 src/java.base/share/classes/sun/security/util/SecurityConstants.java
--- a/src/java.base/share/classes/sun/security/util/SecurityConstants.java Wed Oct 16 01:16:12 2019 +0200
+++ b/src/java.base/share/classes/sun/security/util/SecurityConstants.java Wed Oct 16 11:23:46 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 496bbf554c5c -r 38176d1c5ec2 src/java.base/share/conf/security/java.security
--- a/src/java.base/share/conf/security/java.security Wed Oct 16 01:16:12 2019 +0200
+++ b/src/java.base/share/conf/security/java.security Wed Oct 16 11:23:46 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 496bbf554c5c -r 38176d1c5ec2 src/java.base/unix/native/libnio/ch/Net.c
--- a/src/java.base/unix/native/libnio/ch/Net.c Wed Oct 16 01:16:12 2019 +0200
+++ b/src/java.base/unix/native/libnio/ch/Net.c Wed Oct 16 11:23:46 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 496bbf554c5c -r 38176d1c5ec2 src/java.base/windows/classes/java/lang/ProcessImpl.java
--- a/src/java.base/windows/classes/java/lang/ProcessImpl.java Wed Oct 16 01:16:12 2019 +0200
+++ b/src/java.base/windows/classes/java/lang/ProcessImpl.java Wed Oct 16 11:23:46 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 496bbf554c5c -r 38176d1c5ec2 src/java.datatransfer/share/classes/java/awt/datatransfer/MimeType.java
--- a/src/java.datatransfer/share/classes/java/awt/datatransfer/MimeType.java Wed Oct 16 01:16:12 2019 +0200
+++ b/src/java.datatransfer/share/classes/java/awt/datatransfer/MimeType.java Wed Oct 16 11:23:46 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 496bbf554c5c -r 38176d1c5ec2 src/java.desktop/macosx/classes/sun/awt/CGraphicsDevice.java
--- a/src/java.desktop/macosx/classes/sun/awt/CGraphicsDevice.java Wed Oct 16 01:16:12 2019 +0200
+++ b/src/java.desktop/macosx/classes/sun/awt/CGraphicsDevice.java Wed Oct 16 11:23:46 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 496bbf554c5c -r 38176d1c5ec2 src/java.desktop/macosx/classes/sun/java2d/opengl/CGLSurfaceData.java
--- a/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLSurfaceData.java Wed Oct 16 01:16:12 2019 +0200
+++ b/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLSurfaceData.java Wed Oct 16 11:23:46 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 496bbf554c5c -r 38176d1c5ec2 src/java.desktop/macosx/classes/sun/lwawt/macosx/LWCToolkit.java
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/LWCToolkit.java Wed Oct 16 01:16:12 2019 +0200
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/LWCToolkit.java Wed Oct 16 11:23:46 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 496bbf554c5c -r 38176d1c5ec2 src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m Wed Oct 16 01:16:12 2019 +0200
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m Wed Oct 16 11:23:46 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 496bbf554c5c -r 38176d1c5ec2 src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.m
--- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.m Wed Oct 16 01:16:12 2019 +0200
+++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.m Wed Oct 16 11:23:46 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 496bbf554c5c -r 38176d1c5ec2 src/java.desktop/share/classes/java/awt/Font.java
--- a/src/java.desktop/share/classes/java/awt/Font.java Wed Oct 16 01:16:12 2019 +0200
+++ b/src/java.desktop/share/classes/java/awt/Font.java Wed Oct 16 11:23:46 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 496bbf554c5c -r 38176d1c5ec2 src/java.desktop/share/classes/java/awt/doc-files/AWTThreadIssues.html
--- a/src/java.desktop/share/classes/java/awt/doc-files/AWTThreadIssues.html Wed Oct 16 01:16:12 2019 +0200
+++ b/src/java.desktop/share/classes/java/awt/doc-files/AWTThreadIssues.html Wed Oct 16 11:23:46 2019 +0200
@@ -5,7 +5,7 @@
AWT Threading Issues