# HG changeset patch
# User duke
# Date 1499276573 -7200
# Node ID 601eefdb8ac7de451680a7f225a89406a3adb3b5
# Parent e3b9d834796ddc9cb599be2aef8d9ae6e1dabf22# Parent ddeee2ddb366dfe77bf668c726e39ca3dacd43e8
Merge
diff -r e3b9d834796d -r 601eefdb8ac7 .hgtags-top-repo
--- a/.hgtags-top-repo Fri May 30 09:24:59 2014 -0700
+++ b/.hgtags-top-repo Wed Jul 05 19:42:53 2017 +0200
@@ -257,3 +257,4 @@
59f6350295f9681fe5956d8bc889bf341914c6cb jdk9-b12
5800456add07e1a68170a229fb5e27376f8875e5 jdk9-b13
4e3aa9723e9972623e3dafc321b368e7db7e9b3b jdk9-b14
+b114474fb25af4e73cb7219f7c04bd8994da03a5 jdk9-b15
diff -r e3b9d834796d -r 601eefdb8ac7 corba/.hgtags
--- a/corba/.hgtags Fri May 30 09:24:59 2014 -0700
+++ b/corba/.hgtags Wed Jul 05 19:42:53 2017 +0200
@@ -257,3 +257,4 @@
e212cdcc8c11f0ba5acf6f5ddb596c4c545a93f9 jdk9-b12
088eec4c36f4d7f250fcd19c4969bf698e3d2cdc jdk9-b13
a2b82f863ba95a596da555a4c1b871c404863e7e jdk9-b14
+e54022d0dd92106fff7f7fe670010cd7e6517ee3 jdk9-b15
diff -r e3b9d834796d -r 601eefdb8ac7 hotspot/.hgtags
--- a/hotspot/.hgtags Fri May 30 09:24:59 2014 -0700
+++ b/hotspot/.hgtags Wed Jul 05 19:42:53 2017 +0200
@@ -417,3 +417,4 @@
1c383bb39e2849ca62cb763f4e182a29b421d60a jdk9-b12
456ad9c99133803d4e1433124c85a6fd141b9ac9 jdk9-b13
bd333491bb6c012d7b606939406d0fa9a5ac7ffd jdk9-b14
+170f6d733d7aec062f743a6b8c1cce940a7a984a jdk9-b15
diff -r e3b9d834796d -r 601eefdb8ac7 jdk/.hgtags
--- a/jdk/.hgtags Fri May 30 09:24:59 2014 -0700
+++ b/jdk/.hgtags Wed Jul 05 19:42:53 2017 +0200
@@ -257,3 +257,4 @@
83d9bc20973de232cae45b139fdff8a4549c130f jdk9-b12
c7c8002d02721e02131d104549ebeb8b379fb8d2 jdk9-b13
5c7a17a81afd0906b53ee31d95a3211c96ff6b25 jdk9-b14
+4537360f09fe23ab339ee588747b657feb12d0c8 jdk9-b15
diff -r e3b9d834796d -r 601eefdb8ac7 jdk/make/CopyIntoClasses.gmk
--- a/jdk/make/CopyIntoClasses.gmk Fri May 30 09:24:59 2014 -0700
+++ b/jdk/make/CopyIntoClasses.gmk Wed Jul 05 19:42:53 2017 +0200
@@ -30,7 +30,6 @@
# These directories should not be copied at all
EXCLUDES += \
- com/sun/org/apache/xml/internal/security/resource/schema \
java/awt/doc-files \
java/lang/doc-files \
javax/swing/doc-files \
diff -r e3b9d834796d -r 601eefdb8ac7 jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/etsi.xsd
--- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/etsi.xsd Fri May 30 09:24:59 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,347 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff -r e3b9d834796d -r 601eefdb8ac7 jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xenc-schema.rng
--- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xenc-schema.rng Fri May 30 09:24:59 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,219 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff -r e3b9d834796d -r 601eefdb8ac7 jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xenc-schema.xsd
--- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xenc-schema.xsd Fri May 30 09:24:59 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,146 +0,0 @@
-
-
-
-
-
- ]>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff -r e3b9d834796d -r 601eefdb8ac7 jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xmldsig-core-schema.dtd
--- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xmldsig-core-schema.dtd Fri May 30 09:24:59 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,171 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff -r e3b9d834796d -r 601eefdb8ac7 jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xmldsig-core-schema.rng
--- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xmldsig-core-schema.rng Fri May 30 09:24:59 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,339 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff -r e3b9d834796d -r 601eefdb8ac7 jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xmldsig-core-schema.xsd
--- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xmldsig-core-schema.xsd Fri May 30 09:24:59 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,318 +0,0 @@
-
-
-
-
-
- ]>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff -r e3b9d834796d -r 601eefdb8ac7 jdk/src/share/classes/jdk/internal/util/xml/impl/Parser.java
--- a/jdk/src/share/classes/jdk/internal/util/xml/impl/Parser.java Fri May 30 09:24:59 2014 -0700
+++ b/jdk/src/share/classes/jdk/internal/util/xml/impl/Parser.java Wed Jul 05 19:42:53 2017 +0200
@@ -2860,14 +2860,25 @@
} else {
// Get encoding from BOM or the xml text decl.
reader = bom(is.getByteStream(), ' ');
+ /**
+ * [#4.3.3] requires BOM for UTF-16, however, it's not uncommon
+ * that it may be missing. A mature technique exists in Xerces
+ * to further check for possible UTF-16 encoding
+ */
+ if (reader == null) {
+ reader = utf16(is.getByteStream());
+ }
+
if (reader == null) {
// Encoding is defined by the xml text decl.
reader = enc("UTF-8", is.getByteStream());
expenc = xml(reader);
- if (expenc.startsWith("UTF-16")) {
- panic(FAULT); // UTF-16 must have BOM [#4.3.3]
+ if (!expenc.equals("UTF-8")) {
+ if (expenc.startsWith("UTF-16")) {
+ panic(FAULT); // UTF-16 must have BOM [#4.3.3]
+ }
+ reader = enc(expenc, is.getByteStream());
}
- reader = enc(expenc, is.getByteStream());
} else {
// Encoding is defined by the BOM.
xml(reader);
@@ -2956,6 +2967,49 @@
}
}
+
+ /**
+ * Using a mature technique from Xerces, this method checks further after
+ * the bom method above to see if the encoding is UTF-16
+ *
+ * @param is A byte stream of the entity.
+ * @return a reader, may be null
+ * @exception Exception is parser specific exception form panic method.
+ * @exception IOException
+ */
+ private Reader utf16(InputStream is)
+ throws Exception {
+ if (mChIdx != 0) {
+ //The bom method has read ONE byte into the buffer.
+ byte b0 = (byte)mChars[0];
+ if (b0 == 0x00 || b0 == 0x3C) {
+ int b1 = is.read();
+ int b2 = is.read();
+ int b3 = is.read();
+ if (b0 == 0x00 && b1 == 0x3C && b2 == 0x00 && b3 == 0x3F) {
+ // UTF-16, big-endian, no BOM
+ mChars[0] = (char)(b1);
+ mChars[mChIdx++] = (char)(b3);
+ return new ReaderUTF16(is, 'b');
+ } else if (b0 == 0x3C && b1 == 0x00 && b2 == 0x3F && b3 == 0x00) {
+ // UTF-16, little-endian, no BOM
+ mChars[0] = (char)(b0);
+ mChars[mChIdx++] = (char)(b2);
+ return new ReaderUTF16(is, 'l');
+ } else {
+ /**not every InputStream supports reset, so we have to remember
+ * the state for further parsing
+ **/
+ mChars[0] = (char)(b0);
+ mChars[mChIdx++] = (char)(b1);
+ mChars[mChIdx++] = (char)(b2);
+ mChars[mChIdx++] = (char)(b3);
+ }
+
+ }
+ }
+ return null;
+ }
/**
* Parses the xml text declaration.
*
@@ -2974,17 +3028,17 @@
String enc = "UTF-8";
char ch;
int val;
- short st;
- // Read the xml text declaration into the buffer
- if (mChIdx != 0) {
- // The bom method have read ONE char into the buffer.
- st = (short) ((mChars[0] == '<') ? 1 : -1);
- } else {
- st = 0;
- }
+ short st = 0;
+ int byteRead = mChIdx; //number of bytes read prior to entering this method
+
while (st >= 0 && mChIdx < mChars.length) {
- ch = ((val = reader.read()) >= 0) ? (char) val : EOS;
- mChars[mChIdx++] = ch;
+ if (st < byteRead) {
+ ch = mChars[st];
+ } else {
+ ch = ((val = reader.read()) >= 0) ? (char) val : EOS;
+ mChars[mChIdx++] = ch;
+ }
+
switch (st) {
case 0: // read '<' of xml declaration
switch (ch) {
diff -r e3b9d834796d -r 601eefdb8ac7 jdk/src/share/classes/sun/nio/ch/ServerSocketAdaptor.java
--- a/jdk/src/share/classes/sun/nio/ch/ServerSocketAdaptor.java Fri May 30 09:24:59 2014 -0700
+++ b/jdk/src/share/classes/sun/nio/ch/ServerSocketAdaptor.java Wed Jul 05 19:42:53 2017 +0200
@@ -93,9 +93,9 @@
public Socket accept() throws IOException {
synchronized (ssc.blockingLock()) {
- if (!ssc.isBound())
- throw new IllegalBlockingModeException();
try {
+ if (!ssc.isBound())
+ throw new NotYetBoundException();
if (timeout == 0) {
SocketChannel sc = ssc.accept();
if (sc == null && !ssc.isBlocking())
diff -r e3b9d834796d -r 601eefdb8ac7 jdk/src/share/classes/sun/security/krb5/KdcComm.java
--- a/jdk/src/share/classes/sun/security/krb5/KdcComm.java Fri May 30 09:24:59 2014 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/KdcComm.java Wed Jul 05 19:42:53 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, 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
@@ -144,7 +144,8 @@
try {
Config cfg = Config.getInstance();
String temp = cfg.get("libdefaults", "kdc_timeout");
- timeout = parsePositiveIntString(temp);
+ timeout = parseTimeString(temp);
+
temp = cfg.get("libdefaults", "max_retries");
max_retries = parsePositiveIntString(temp);
temp = cfg.get("libdefaults", "udp_preference_limit");
@@ -426,6 +427,25 @@
}
/**
+ * Parses a time value string. If it ends with "s", parses as seconds.
+ * Otherwise, parses as milliseconds.
+ * @param s the time string
+ * @return the integer value in milliseconds, or -1 if input is null or
+ * has an invalid format
+ */
+ private static int parseTimeString(String s) {
+ if (s == null) {
+ return -1;
+ }
+ if (s.endsWith("s")) {
+ int seconds = parsePositiveIntString(s.substring(0, s.length()-1));
+ return (seconds < 0) ? -1 : (seconds*1000);
+ } else {
+ return parsePositiveIntString(s);
+ }
+ }
+
+ /**
* Returns krb5.conf setting of {@code key} for a specific realm,
* which can be:
* 1. defined in the sub-stanza for the given realm inside [realms], or
@@ -446,7 +466,11 @@
try {
String value =
Config.getInstance().get("realms", realm, key);
- temp = parsePositiveIntString(value);
+ if (key.equals("kdc_timeout")) {
+ temp = parseTimeString(value);
+ } else {
+ temp = parsePositiveIntString(value);
+ }
} catch (Exception exc) {
// Ignored, defValue will be picked up
}
diff -r e3b9d834796d -r 601eefdb8ac7 jdk/src/share/classes/sun/security/smartcardio/CardImpl.java
--- a/jdk/src/share/classes/sun/security/smartcardio/CardImpl.java Fri May 30 09:24:59 2014 -0700
+++ b/jdk/src/share/classes/sun/security/smartcardio/CardImpl.java Wed Jul 05 19:42:53 2017 +0200
@@ -246,7 +246,7 @@
}
checkExclusive();
try {
- SCardDisconnect(cardId, (reset ? SCARD_LEAVE_CARD : SCARD_RESET_CARD));
+ SCardDisconnect(cardId, (reset ? SCARD_RESET_CARD : SCARD_LEAVE_CARD));
} catch (PCSCException e) {
throw new CardException("disconnect() failed", e);
} finally {
diff -r e3b9d834796d -r 601eefdb8ac7 jdk/src/share/classes/sun/security/tools/jarsigner/Main.java
--- a/jdk/src/share/classes/sun/security/tools/jarsigner/Main.java Fri May 30 09:24:59 2014 -0700
+++ b/jdk/src/share/classes/sun/security/tools/jarsigner/Main.java Wed Jul 05 19:42:53 2017 +0200
@@ -1560,8 +1560,7 @@
first = false;
}
try {
- CertPath cp = certificateFactory.generateCertPath(certs);
- validator.validate(cp, pkixParameters);
+ validateCertChain(certs);
} catch (Exception e) {
if (debug) {
e.printStackTrace();
@@ -1871,8 +1870,7 @@
printCert("", certChain[0], true, null, true);
try {
- CertPath cp = certificateFactory.generateCertPath(Arrays.asList(certChain));
- validator.validate(cp, pkixParameters);
+ validateCertChain(Arrays.asList(certChain));
} catch (Exception e) {
if (debug) {
e.printStackTrace();
@@ -1937,6 +1935,22 @@
System.exit(1);
}
+ void validateCertChain(List extends Certificate> certs) throws Exception {
+ int cpLen = 0;
+ out: for (; cpLen 0) {
+ CertPath cp = certificateFactory.generateCertPath(
+ (cpLen == certs.size())? certs: certs.subList(0, cpLen));
+ validator.validate(cp, pkixParameters);
+ }
+ }
+
char[] getPass(String prompt)
{
System.err.print(prompt);
diff -r e3b9d834796d -r 601eefdb8ac7 jdk/src/share/native/sun/security/smartcardio/pcsc.c
--- a/jdk/src/share/native/sun/security/smartcardio/pcsc.c Fri May 30 09:24:59 2014 -0700
+++ b/jdk/src/share/native/sun/security/smartcardio/pcsc.c Wed Jul 05 19:42:53 2017 +0200
@@ -125,7 +125,7 @@
jobjectArray pcsc_multi2jstring(JNIEnv *env, char *spec) {
jobjectArray result;
jclass stringClass;
- char *cp, **tab;
+ char *cp, **tab = NULL;
jstring js;
int cnt = 0;
@@ -179,7 +179,7 @@
{
SCARDCONTEXT context = (SCARDCONTEXT)jContext;
LONG rv;
- LPTSTR mszReaders;
+ LPTSTR mszReaders = NULL;
DWORD size = 0;
jobjectArray result;
@@ -190,18 +190,20 @@
}
dprintf1("-size: %d\n", size);
- mszReaders = malloc(size);
- if (mszReaders == NULL) {
- throwOutOfMemoryError(env, NULL);
- return NULL;
- }
+ if (size) {
+ mszReaders = malloc(size);
+ if (mszReaders == NULL) {
+ throwOutOfMemoryError(env, NULL);
+ return NULL;
+ }
- rv = CALL_SCardListReaders(context, NULL, mszReaders, &size);
- if (handleRV(env, rv)) {
- free(mszReaders);
- return NULL;
+ rv = CALL_SCardListReaders(context, NULL, mszReaders, &size);
+ if (handleRV(env, rv)) {
+ free(mszReaders);
+ return NULL;
+ }
+ dprintf1("-String: %s\n", mszReaders);
}
- dprintf1("-String: %s\n", mszReaders);
result = pcsc_multi2jstring(env, mszReaders);
free(mszReaders);
@@ -336,7 +338,7 @@
const char *readerName;
readerState = calloc(readers, sizeof(SCARD_READERSTATE));
- if (readerState == NULL) {
+ if (readerState == NULL && readers > 0) {
throwOutOfMemoryError(env, NULL);
return NULL;
}
@@ -348,6 +350,10 @@
}
for (i = 0; i < readers; i++) {
+ readerState[i].szReader = NULL;
+ }
+
+ for (i = 0; i < readers; i++) {
jobject jReaderName = (*env)->GetObjectArrayElement(env, jReaderNames, i);
if ((*env)->ExceptionCheck(env)) {
goto cleanup;
@@ -369,9 +375,11 @@
(*env)->DeleteLocalRef(env, jReaderName);
}
- rv = CALL_SCardGetStatusChange(context, (DWORD)jTimeout, readerState, readers);
- if (handleRV(env, rv)) {
- goto cleanup;
+ if (readers > 0) {
+ rv = CALL_SCardGetStatusChange(context, (DWORD)jTimeout, readerState, readers);
+ if (handleRV(env, rv)) {
+ goto cleanup;
+ }
}
jEventState = (*env)->NewIntArray(env, readers);
diff -r e3b9d834796d -r 601eefdb8ac7 jdk/src/solaris/classes/java/lang/UNIXProcess.java
--- a/jdk/src/solaris/classes/java/lang/UNIXProcess.java Fri May 30 09:24:59 2014 -0700
+++ b/jdk/src/solaris/classes/java/lang/UNIXProcess.java Wed Jul 05 19:42:53 2017 +0200
@@ -97,6 +97,7 @@
EnumSet.copyOf(Arrays.asList(launchMechanisms));
}
+ @SuppressWarnings("fallthrough")
private String helperPath(String javahome, String osArch) {
switch (this) {
case SOLARIS:
diff -r e3b9d834796d -r 601eefdb8ac7 jdk/src/solaris/native/sun/security/smartcardio/pcsc_md.c
--- a/jdk/src/solaris/native/sun/security/smartcardio/pcsc_md.c Fri May 30 09:24:59 2014 -0700
+++ b/jdk/src/solaris/native/sun/security/smartcardio/pcsc_md.c Wed Jul 05 19:42:53 2017 +0200
@@ -136,5 +136,9 @@
if ((*env)->ExceptionCheck(env)) {
return;
}
+#ifndef __APPLE__
scardControl = (FPTR_SCardControl) findFunction(env, hModule, "SCardControl");
+#else
+ scardControl = (FPTR_SCardControl) findFunction(env, hModule, "SCardControl132");
+#endif // __APPLE__
}
diff -r e3b9d834796d -r 601eefdb8ac7 jdk/test/ProblemList.txt
--- a/jdk/test/ProblemList.txt Fri May 30 09:24:59 2014 -0700
+++ b/jdk/test/ProblemList.txt Wed Jul 05 19:42:53 2017 +0200
@@ -261,6 +261,10 @@
# 8041934
com/sun/jdi/RepStep.java generic-all
+# 8044419
+com/sun/jdi/JdbReadTwiceTest.sh generic-all
+
+
############################################################################
# jdk_util
diff -r e3b9d834796d -r 601eefdb8ac7 jdk/test/java/lang/invoke/lambda/LogGeneratedClassesTest.java
--- a/jdk/test/java/lang/invoke/lambda/LogGeneratedClassesTest.java Fri May 30 09:24:59 2014 -0700
+++ b/jdk/test/java/lang/invoke/lambda/LogGeneratedClassesTest.java Wed Jul 05 19:42:53 2017 +0200
@@ -33,11 +33,9 @@
import java.util.ArrayList;
import java.util.List;
import java.nio.file.Files;
-import java.nio.file.LinkOption;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.PosixFileAttributeView;
-import java.util.stream.Stream;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
@@ -163,34 +161,66 @@
tr.assertZero("Should still return 0");
}
+ private static boolean isWriteableDirectory(Path p) {
+ if (!Files.isDirectory(p)) {
+ return false;
+ }
+ Path test = p.resolve(Paths.get("test"));
+ try {
+ Files.createFile(test);
+ assertTrue(Files.exists(test));
+ return true;
+ } catch (IOException e) {
+ assertFalse(Files.exists(test));
+ return false;
+ } finally {
+ if (Files.exists(test)) {
+ try {
+ Files.delete(test);
+ } catch (IOException e) {
+ throw new Error(e);
+ }
+ }
+ }
+ }
+
@Test
public void testDumpDirNotWritable() throws IOException {
- if (! Files.getFileStore(Paths.get("."))
- .supportsFileAttributeView(PosixFileAttributeView.class)) {
+ if (!Files.getFileStore(Paths.get("."))
+ .supportsFileAttributeView(PosixFileAttributeView.class)) {
// No easy way to setup readonly directory without POSIX
// We would like to skip the test with a cause with
// throw new SkipException("Posix not supported");
// but jtreg will report failure so we just pass the test
// which we can look at if jtreg changed its behavior
+ System.out.println("WARNING: POSIX is not supported. Skipping testDumpDirNotWritable test.");
return;
}
Files.createDirectory(Paths.get("readOnly"),
asFileAttribute(fromString("r-xr-xr-x")));
+ try {
+ if (isWriteableDirectory(Paths.get("readOnly"))) {
+ // Skipping the test: it's allowed to write into read-only directory
+ // (e.g. current user is super user).
+ System.out.println("WARNING: readOnly directory is writeable. Skipping testDumpDirNotWritable test.");
+ return;
+ }
- TestResult tr = doExec(JAVA_CMD.getAbsolutePath(),
- "-cp", ".",
- "-Djdk.internal.lambda.dumpProxyClasses=readOnly",
- "-Djava.security.manager",
- "com.example.TestLambda");
- assertEquals(tr.testOutput.stream()
- .filter(s -> s.startsWith("WARNING"))
- .peek(s -> assertTrue(s.contains("not writable")))
- .count(),
- 1, "only show error once");
- tr.assertZero("Should still return 0");
-
- TestUtil.removeAll(Paths.get("readOnly"));
+ TestResult tr = doExec(JAVA_CMD.getAbsolutePath(),
+ "-cp", ".",
+ "-Djdk.internal.lambda.dumpProxyClasses=readOnly",
+ "-Djava.security.manager",
+ "com.example.TestLambda");
+ assertEquals(tr.testOutput.stream()
+ .filter(s -> s.startsWith("WARNING"))
+ .peek(s -> assertTrue(s.contains("not writable")))
+ .count(),
+ 1, "only show error once");
+ tr.assertZero("Should still return 0");
+ } finally {
+ TestUtil.removeAll(Paths.get("readOnly"));
+ }
}
@Test
diff -r e3b9d834796d -r 601eefdb8ac7 jdk/test/java/util/Properties/LoadAndStoreXML.java
--- a/jdk/test/java/util/Properties/LoadAndStoreXML.java Fri May 30 09:24:59 2014 -0700
+++ b/jdk/test/java/util/Properties/LoadAndStoreXML.java Wed Jul 05 19:42:53 2017 +0200
@@ -32,6 +32,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
+import java.nio.charset.Charset;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -47,6 +48,7 @@
import java.util.PropertyPermission;
public class LoadAndStoreXML {
+ static final String bomChar = "\uFEFF";
/**
* Simple policy implementation that grants a set of permissions to
@@ -125,13 +127,14 @@
* Sanity test that properties saved with Properties#storeToXML can be
* read with Properties#loadFromXML.
*/
- static void testLoadAndStore(String encoding) throws IOException {
+ static void testLoadAndStore(String encoding, boolean appendBOM) throws IOException {
System.out.println("testLoadAndStore, encoding=" + encoding);
Properties props = new Properties();
+ props.put("k0", "\u6C34");
props.put("k1", "foo");
props.put("k2", "bar");
- props.put("k3", "\\u0020\\u0391\\u0392\\u0393\\u0394\\u0395\\u0396\\u0397");
+ props.put("k3", "\u0020\u0391\u0392\u0393\u0394\u0395\u0396\u0397");
props.put("k4", "\u7532\u9aa8\u6587");
props.put("k5", "/lib/jaxp.properties");
@@ -141,7 +144,17 @@
throw new RuntimeException("OutputStream closed by storeToXML");
Properties p = new Properties();
- TestInputStream in = new TestInputStream(out.toByteArray());
+ TestInputStream in;
+ if (appendBOM) {
+ byte[] byteOrderMark = bomChar.getBytes(Charset.forName(encoding));
+ byte[] outArray = out.toByteArray();
+ byte[] inputArray = new byte[byteOrderMark.length + outArray.length];
+ System.arraycopy(byteOrderMark, 0, inputArray, 0, byteOrderMark.length);
+ System.arraycopy(outArray, 0, inputArray, byteOrderMark.length, outArray.length);
+ in = new TestInputStream(inputArray);
+ } else {
+ in = new TestInputStream(out.toByteArray());
+ }
p.loadFromXML(in);
if (in.isOpen())
throw new RuntimeException("InputStream not closed by loadFromXML");
@@ -231,8 +244,12 @@
public static void main(String[] args) throws IOException {
- testLoadAndStore("UTF-8");
- testLoadAndStore("UTF-16");
+ testLoadAndStore("UTF-8", false);
+ testLoadAndStore("UTF-16", false);
+ testLoadAndStore("UTF-16BE", false);
+ testLoadAndStore("UTF-16LE", false);
+ testLoadAndStore("UTF-16BE", true);
+ testLoadAndStore("UTF-16LE", true);
testLoadWithoutEncoding();
testLoadWithBadEncoding();
testStoreWithBadEncoding();
@@ -250,7 +267,7 @@
Policy.setPolicy(p);
System.setSecurityManager(new SecurityManager());
try {
- testLoadAndStore("UTF-8");
+ testLoadAndStore("UTF-8", false);
} finally {
// turn off security manager and restore policy
System.setSecurityManager(null);
diff -r e3b9d834796d -r 601eefdb8ac7 jdk/test/sun/nio/ch/ServerSocketAdaptorTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/nio/ch/ServerSocketAdaptorTest.java Wed Jul 05 19:42:53 2017 +0200
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8024832
+ */
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.SocketException;
+import java.nio.channels.ServerSocketChannel;
+
+public class ServerSocketAdaptorTest {
+
+ public static void main(String[] args) throws IOException {
+
+ String message = null;
+
+ try (ServerSocket s = new ServerSocket()) {
+ s.accept();
+ throw new AssertionError();
+ } catch (IOException e) {
+ message = e.getMessage();
+ }
+
+ try (ServerSocket ss = ServerSocketChannel.open().socket()) {
+
+ assert !ss.isBound() : "the assumption !ss.isBound() doesn't hold";
+
+ try {
+ ss.accept();
+ throw new AssertionError();
+ } catch (Exception e) {
+ if (e instanceof SocketException && message.equals(e.getMessage())) {
+ return;
+ } else {
+ throw new AssertionError(
+ "Expected to throw SocketException with a particular message", e);
+ }
+ }
+ }
+ }
+}
diff -r e3b9d834796d -r 601eefdb8ac7 jdk/test/sun/security/krb5/auto/KDC.java
--- a/jdk/test/sun/security/krb5/auto/KDC.java Fri May 30 09:24:59 2014 -0700
+++ b/jdk/test/sun/security/krb5/auto/KDC.java Wed Jul 05 19:42:53 2017 +0200
@@ -141,6 +141,8 @@
private BlockingQueue q = new ArrayBlockingQueue<>(100);
// Options
private Map