Merge
diff --git a/.hgtags-top-repo b/.hgtags-top-repo
index 2b1dfe4..1a76512 100644
--- a/.hgtags-top-repo
+++ b/.hgtags-top-repo
@@ -591,6 +591,9 @@
94158f2e5cbdff8956b8e643e0305ca178d856e3 jdk8u92-b13
51f64c980bcdef152a6eb043aaa5d04cc08c6624 jdk8u92-b14
9005b6faa5f616a8b403ea3aa660b963a7cdde24 jdk8u92-b31
+7e728e8e6120e276d05f82c1a01c3d8fe4a63584 jdk8u92-b32
+5e69844e2c69d21e6f139845451ad8c5acdef709 jdk8u92-b33
+f8ea719757e3bee133e59c7fd69589e190785292 jdk8u92-b34
722fc7e276ff8b4b6460b399e4eb65da518435f0 jdk8u81-b00
534d4e07c81fc8656cdb0856e22aafbdc54e474a jdk8u101-b01
18e1f0ee965b0565514027543546348ed99bf4a4 jdk8u101-b02
@@ -625,3 +628,8 @@
5839c5f4292a8755a4c102cb0f983536f5bfe8be jdk8u102-b11
163dc486915300b020f203e89fdf1985cc3c4814 jdk8u102-b12
04471bfd1cc2e8f4d8d198e79b21e64dd4499db8 jdk8u102-b13
+daafd7d3a76a0c448e4982afd7c4e9471ab1c916 jdk8u102-b14
+3a3064f9363c79f70a0d9b2201342acc880e1e76 jdk8u102-b31
+fb4fc26136253424c0a4f4f5a10dc54f612b64fd jdk8u102-b32
+b8ca429448f7d3dfbdea3a6c349a7a3850fdd27f jdk8u102-b33
+57cbdae98283951a2e2fc382223c5736a9d8d57c jdk8u102-b34
diff --git a/corba/.hgtags b/corba/.hgtags
index d8c4631..99e072c 100644
--- a/corba/.hgtags
+++ b/corba/.hgtags
@@ -597,6 +597,9 @@
8f0466c0dce60b1df3bc01785b01a7f09fa7b564 jdk8u92-b13
5617f9bec354fb2c60bbb816d175f4cee7d2c56e jdk8u92-b14
fe88377e18b0c5f3da8e6741e0d5b9bfd45d2648 jdk8u92-b31
+11e4e7e901bc86d14163afbc5d28345e36737344 jdk8u92-b32
+9ed665d319590e0b9997b3703314c6b0341d4362 jdk8u92-b33
+5b5f76caf6e4ffa51f25e64d0d79a3f0913c633e jdk8u92-b34
073b951904b3ee7c54fb79a169478fa66d925320 jdk8u75-b00
5b48f7defe40eab668fe554df0afd87d84d60722 jdk8u75-b01
0015f4a7f0d02a9bb79b7a0c737590f01feaabd4 jdk8u75-b02
@@ -660,3 +663,8 @@
360a2772486dd1aa818132222ea0b7fcfa5707ef jdk8u102-b11
57546b5b575dec9ecfbb1e9a77d87c391a44ab96 jdk8u102-b12
a7c292080d5ed76ea5e3b123c0dee4c340aa174f jdk8u102-b13
+56b133772ec1aa4f44f2eee2c4103c645f764935 jdk8u102-b14
+8ba5a41487af9fe72aeb92e790327d12dce0de8c jdk8u102-b31
+8f015ee0842df021532a4b88c436ea9daed785b6 jdk8u102-b32
+f98a2ad119c097d532b013c275f67ad50a4236b7 jdk8u102-b33
+4da84a2c86c336c06265a2a7e9e3b7b7b4596f74 jdk8u102-b34
diff --git a/hotspot/.hgtags b/hotspot/.hgtags
index 9884927..35dd76d 100644
--- a/hotspot/.hgtags
+++ b/hotspot/.hgtags
@@ -861,6 +861,9 @@
f3e1e734e2d29101a9537ddeb71ecad413fcd352 jdk8u92-b13
24a09407d71bb2cc4848bfa21660c890b4d722b1 jdk8u92-b14
445941ba41c0e3829fe02140690b144281ac2141 jdk8u92-b31
+f958bebdee267695e37aadd27753ac8b1e1823c8 jdk8u92-b32
+d1bb0e79ff79d21068388d9c62ca01e3c072fd0d jdk8u92-b33
+d0388be32561e4bd00c1a79adbe301cfdd6ba9f2 jdk8u92-b34
b374548dcb4834eb8731a06b52faddd0f10bd45d jdk8u81-b00
ead07188d11107e877e8e4ad215ff6cb238a8a92 jdk8u101-b01
34429bad9986677f4991c80aeb22665842881cba jdk8u101-b02
@@ -890,3 +893,8 @@
36a1a2875ed55fa17818f3eb203e27922a7b4589 jdk8u102-b11
340e1a736ef7169786e70db7f31ffd32bc3be24d jdk8u102-b12
f6daf04c0f48dab5420ad63d21da82a7fa4e3ad7 jdk8u102-b13
+ac29c9c1193aef5d480b200ed94c5d579243c17b jdk8u102-b14
+96e1c72fc617d3c6c125bcfc9182f77fc6aa38e6 jdk8u102-b31
+c8988d2e4212583ec0f04591c8e241ad3cf95674 jdk8u102-b32
+9050d85e29600400ce4ba2b4db9616388082ae08 jdk8u102-b33
+b678b66d1538af31bac7cf5e74c029395607decd jdk8u102-b34
diff --git a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp
index e2ea04b..30490d4 100644
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp
@@ -3202,7 +3202,24 @@
jmp(done);
} else {
// Stack: X Y
- Label x_negative, y_odd;
+ Label x_negative, y_not_2;
+
+ static double two = 2.0;
+ ExternalAddress two_addr((address)&two);
+
+ // constant maybe too far on 64 bit
+ lea(tmp2, two_addr);
+ fld_d(Address(tmp2, 0)); // Stack: 2 X Y
+ fcmp(tmp, 2, true, false); // Stack: X Y
+ jcc(Assembler::parity, y_not_2);
+ jcc(Assembler::notEqual, y_not_2);
+
+ fxch(); fpop(); // Stack: X
+ fmul(0); // Stack: X*X
+
+ jmp(done);
+
+ bind(y_not_2);
fldz(); // Stack: 0 X Y
fcmp(tmp, 1, true, false); // Stack: X Y
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp
index 406ac73..fc86a50 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -148,7 +148,9 @@
do {
// Drain the overflow stack first, so other threads can steal.
while (_refs->pop_overflow(ref)) {
- dispatch_reference(ref);
+ if (!_refs->try_push_to_taskqueue(ref)) {
+ dispatch_reference(ref);
+ }
}
while (_refs->pop_local(ref)) {
diff --git a/hotspot/src/share/vm/opto/stringopts.cpp b/hotspot/src/share/vm/opto/stringopts.cpp
index 90655d80..0f8e671 100644
--- a/hotspot/src/share/vm/opto/stringopts.cpp
+++ b/hotspot/src/share/vm/opto/stringopts.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1640,6 +1640,17 @@
kit.store_String_length(kit.control(), result, length);
}
kit.store_String_value(kit.control(), result, char_array);
+
+ // Do not let stores that initialize this object be reordered with
+ // a subsequent store that would make this object accessible by
+ // other threads.
+ // Record what AllocateNode this StoreStore protects so that
+ // escape analysis can go from the MemBarStoreStoreNode to the
+ // AllocateNode and eliminate the MemBarStoreStoreNode if possible
+ // based on the escape status of the AllocateNode.
+ AllocateNode* alloc = AllocateNode::Ideal_allocation(result, _gvn);
+ assert(alloc != NULL, "should be newly allocated");
+ kit.insert_mem_bar(Op_MemBarStoreStore, alloc->proj_out(AllocateNode::RawAddress));
} else {
result = C->top();
}
diff --git a/hotspot/src/share/vm/utilities/taskqueue.hpp b/hotspot/src/share/vm/utilities/taskqueue.hpp
index fb9ea61..8bdb38d 100644
--- a/hotspot/src/share/vm/utilities/taskqueue.hpp
+++ b/hotspot/src/share/vm/utilities/taskqueue.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -453,6 +453,9 @@
// Push task t onto the queue or onto the overflow stack. Return true.
inline bool push(E t);
+ // Try to push task t onto the queue only. Returns true if successful, false otherwise.
+ inline bool try_push_to_taskqueue(E t);
+
// Attempt to pop from the overflow stack; return true if anything was popped.
inline bool pop_overflow(E& t);
@@ -486,6 +489,10 @@
return true;
}
+template <class E, MEMFLAGS F, unsigned int N>
+bool OverflowTaskQueue<E, F, N>::try_push_to_taskqueue(E t) {
+ return taskqueue_t::push(t);
+}
class TaskQueueSetSuper {
protected:
static int randomParkAndMiller(int* seed0);
diff --git a/hotspot/test/compiler/floatingpoint/TestPow2.java b/hotspot/test/compiler/floatingpoint/TestPow2.java
new file mode 100644
index 0000000..f0cf160
--- /dev/null
+++ b/hotspot/test/compiler/floatingpoint/TestPow2.java
@@ -0,0 +1,73 @@
+/*
+ * 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 8063086
+ * @summary X^2 special case for C2 yields different result than interpreter
+ * @library /testlibrary /testlibrary/whitebox /compiler/whitebox
+ * @build TestPow2
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
+ * -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestPow2
+ *
+ */
+
+import java.lang.reflect.*;
+import sun.hotspot.WhiteBox;
+
+public class TestPow2 {
+
+ private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
+
+ private static final double base = 5350.456329377186;
+ private static final double exp = 2.0;
+
+ static double m() {
+ return Math.pow(base, exp);
+ }
+
+ static public void main(String[] args) throws NoSuchMethodException {
+ Method test_method = TestPow2.class.getDeclaredMethod("m");
+
+ double interpreter_result = m();
+
+ // Compile with C1 if possible
+ WHITE_BOX.enqueueMethodForCompilation(test_method, CompilerWhiteBoxTest.COMP_LEVEL_SIMPLE);
+
+ double c1_result = m();
+
+ WHITE_BOX.deoptimizeMethod(test_method);
+
+ // Compile it with C2 if possible
+ WHITE_BOX.enqueueMethodForCompilation(test_method, CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION);
+
+ double c2_result = m();
+
+ if (interpreter_result != c1_result || interpreter_result != c2_result ||
+ c1_result != c2_result) {
+ System.out.println("interpreter = " + interpreter_result + " c1 = " + c1_result + " c2 = " + c2_result);
+ throw new RuntimeException("Test Failed");
+ }
+ }
+}
diff --git a/hotspot/test/compiler/stringopts/TestStringObjectInitialization.java b/hotspot/test/compiler/stringopts/TestStringObjectInitialization.java
new file mode 100644
index 0000000..6c6fa7e
--- /dev/null
+++ b/hotspot/test/compiler/stringopts/TestStringObjectInitialization.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import java.util.Arrays;
+
+/*
+ * @test
+ * @bug 8159244
+ * @summary Verifies that no partially initialized String object escapes from
+ * C2's String concat optimization in a highly concurrent setting.
+ * This test triggers the bug in about 1 out of 10 runs.
+ * @compile -XDstringConcat=inline TestStringObjectInitialization.java
+ * @run main/othervm/timeout=300 -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:-CompactStrings
+ * -XX:-UseG1GC -XX:+UseParallelGC TestStringObjectInitialization
+ */
+public class TestStringObjectInitialization {
+
+ String myString;
+
+ public static void main(String[] args) throws Exception {
+ TestStringObjectInitialization t = new TestStringObjectInitialization();
+ // Create some threads that concurrently update 'myString'
+ for (int i = 0; i < 100; ++i) {
+ (new Thread(new Runner(t))).start();
+ }
+ Thread last = new Thread(new Runner(t));
+ last.start();
+ last.join();
+ }
+
+ private void add(String message) {
+ // String escapes to other threads here
+ myString += message;
+ }
+
+ public void run(String s, String[] sArray) {
+ // Trigger C2's string concatenation optimization
+ add(s + Arrays.toString(sArray) + " const ");
+ }
+}
+
+class Runner implements Runnable {
+ private TestStringObjectInitialization test;
+
+ public Runner(TestStringObjectInitialization t) {
+ test = t;
+ }
+
+ public void run(){
+ String[] array = {"a", "b", "c"};
+ for (int i = 0; i < 10000; ++i) {
+ test.run("a", array);
+ }
+ }
+}
+
diff --git a/jaxp/.hgtags b/jaxp/.hgtags
index 305e61a..d44542b 100644
--- a/jaxp/.hgtags
+++ b/jaxp/.hgtags
@@ -596,6 +596,9 @@
1bce84411d37ecf9a4335d1348f4b2f0b7ab6e08 jdk8u92-b13
fb9f98ed6ef2505a424864f0a9468e59298fede6 jdk8u92-b14
ac887193179bae82fd1cdf4d8c463457163a6535 jdk8u92-b31
+edce55dd16423b70ebdb36a14b3e6c62d223637b jdk8u92-b32
+69550dfee4b1adb5c73175f0555dd69e7436ca8b jdk8u92-b33
+75757308d2785ab9dc36fddf022e6d3f6e9246a6 jdk8u92-b34
cb072b12f5dbe3a249d596078d98a34ec9364187 jdk8u81-b00
fb5e0a18ad7d49134616879d1a500b1356e12fd4 jdk8u101-b01
c7aeb4e55b0f7de8c5bd2a6e41dc5c54c4239271 jdk8u101-b02
@@ -630,3 +633,8 @@
429621d25778abb1ab7a0ede8dc48d5606f76108 jdk8u102-b11
fef62f7eb59982f2c92a3bb135c6ae4d6a466328 jdk8u102-b12
e9de037c3b4c7691662d996c49b42f3e639e65ee jdk8u102-b13
+1f032000ff4b70c3adc02669b6324880199f8db8 jdk8u102-b14
+ff603463199f8a2140cb97fd3ff98046dfeecb3f jdk8u102-b31
+58dea534c1d49731a40de645cfa3450949f31d26 jdk8u102-b32
+d31aad84c2727e40792cba85073713424b6b209f jdk8u102-b33
+6d28aaf99e9383e968654867e9fd2195046f33f4 jdk8u102-b34
diff --git a/jaxws/.hgtags b/jaxws/.hgtags
index 19d91fb..095f380 100644
--- a/jaxws/.hgtags
+++ b/jaxws/.hgtags
@@ -585,6 +585,9 @@
008547c7dd3e324c46c2711b54285ca99e2ae0b9 jdk8u92-b13
759ba92444a9e85434cb381f437aba65e3c9f780 jdk8u92-b14
38c6262b86559ff589f65f5bcc744b1763e20311 jdk8u92-b31
+b762186ac713fbb0fc759110a1c88bca4b4818cd jdk8u92-b32
+ff694a4e9cae136032855516e5f0cd7f1a0e6957 jdk8u92-b33
+283147c5fcc5027b39ca577250edaec4b4b87c0f jdk8u92-b34
6580edbc4511d5a2281138c476700b8ab12165af jdk8u81-b00
0bff22fbd91f48c37f7c5a4544929231b92bd9bf jdk8u101-b01
31e437ae0354e628a675bc4eb6b9ca67af552fc2 jdk8u101-b02
@@ -619,3 +622,8 @@
0305736a8580ad84733878623eda8f770ae04d60 jdk8u102-b11
d02665ceefe5b12539bcd2bde95d4ada1a135cb0 jdk8u102-b12
d84434eb3e4e991812a7b0c3c9e6bfdabae910d0 jdk8u102-b13
+81f2d81a48d74d2d4882c11330366517b73ee064 jdk8u102-b14
+de23881ca76c9c69f4e47e9b15d09a91fbb17176 jdk8u102-b31
+f638db3f652d3ec698aad0193c118c8afdaa001b jdk8u102-b32
+c28a73050d99040158ade12858b38d27686800ce jdk8u102-b33
+0cf16c3a71ab070daa1aee4367afdd8c4aa1daa3 jdk8u102-b34
diff --git a/jdk/.hgtags b/jdk/.hgtags
index 6d07ecf..c86c63f 100644
--- a/jdk/.hgtags
+++ b/jdk/.hgtags
@@ -589,6 +589,9 @@
cc8d0d6c6f9543120836e70e0aa3fa9c9b6fe0f3 jdk8u92-b13
4f06a20cdc59ce9742e6538ff4b9040baba0778a jdk8u92-b14
5875e297cfcf18304b4b062dc44fa9be312ad6e8 jdk8u92-b31
+ed69541ce48b38bf0830c762f353e4379ce43630 jdk8u92-b32
+739b1dc838cdf73c7e16bacb5ce4d1c4534c7d76 jdk8u92-b33
+1f29ae07173450d753189e5aa9d8bb46fb2f5982 jdk8u92-b34
f6cc9dbb5db5883385c91bb71ca02081220aaf3d jdk8u81-b00
00f8f39308687cde45f23282871c46cc6c2f10b3 jdk8u101-b01
6042757c329b1b96fa6bc931e09306794f5c50c0 jdk8u101-b02
@@ -623,3 +626,8 @@
e915a408ebf7ba05b36d1b714e166a1d9e5c7edd jdk8u102-b11
8e12cb096db33b525ec010de5e857ef1cc985ddd jdk8u102-b12
901ecf04370c7c03c61e22ab87a266c355baff54 jdk8u102-b13
+48c99b42383912886c005891c04b5f599adf6722 jdk8u102-b14
+222d3ac3aa1f99f16e31c1c4a10f916ce83ff759 jdk8u102-b31
+e3839fe291add6e0ea199457fb31c9312cc5dd77 jdk8u102-b32
+275fcb7d4e3e70a37ac70c33d087a805ba182f1e jdk8u102-b33
+d783f00bb04a6fff7ddf1555572c1f3cdfd21e59 jdk8u102-b34
diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
index e449227..cdaae47 100644
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
@@ -427,9 +427,6 @@
@Override // PlatformWindow
public void dispose() {
- if (owner != null) {
- CWrapper.NSWindow.removeChildWindow(owner.getNSWindowPtr(), getNSWindowPtr());
- }
contentView.dispose();
nativeDispose(getNSWindowPtr());
CPlatformWindow.super.dispose();
@@ -526,25 +523,6 @@
public void setVisible(boolean visible) {
final long nsWindowPtr = getNSWindowPtr();
- // Process parent-child relationship when hiding
- if (!visible) {
- // Unparent my children
- for (Window w : target.getOwnedWindows()) {
- WindowPeer p = (WindowPeer)w.getPeer();
- if (p instanceof LWWindowPeer) {
- CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow();
- if (pw != null && pw.isVisible()) {
- CWrapper.NSWindow.removeChildWindow(nsWindowPtr, pw.getNSWindowPtr());
- }
- }
- }
-
- // Unparent myself
- if (owner != null && owner.isVisible()) {
- CWrapper.NSWindow.removeChildWindow(owner.getNSWindowPtr(), nsWindowPtr);
- }
- }
-
// Configure stuff
updateIconImages();
updateFocusabilityForAutoRequestFocus(false);
@@ -618,19 +596,19 @@
// Manage parent-child relationship when showing
if (visible) {
- // Add myself as a child
+ // Order myself above my parent
if (owner != null && owner.isVisible()) {
- CWrapper.NSWindow.addChildWindow(owner.getNSWindowPtr(), nsWindowPtr, CWrapper.NSWindow.NSWindowAbove);
+ CWrapper.NSWindow.orderWindow(nsWindowPtr, CWrapper.NSWindow.NSWindowAbove, owner.getNSWindowPtr());
applyWindowLevel(target);
}
- // Add my own children to myself
+ // Order my own children above myself
for (Window w : target.getOwnedWindows()) {
WindowPeer p = (WindowPeer)w.getPeer();
if (p instanceof LWWindowPeer) {
CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow();
if (pw != null && pw.isVisible()) {
- CWrapper.NSWindow.addChildWindow(nsWindowPtr, pw.getNSWindowPtr(), CWrapper.NSWindow.NSWindowAbove);
+ CWrapper.NSWindow.orderWindow(pw.getNSWindowPtr(), CWrapper.NSWindow.NSWindowAbove, nsWindowPtr);
pw.applyWindowLevel(w);
}
}
@@ -1059,8 +1037,8 @@
// Order the window to front of the stack of child windows
final long nsWindowSelfPtr = getNSWindowPtr();
final long nsWindowOwnerPtr = owner.getNSWindowPtr();
- CWrapper.NSWindow.removeChildWindow(nsWindowOwnerPtr, nsWindowSelfPtr);
- CWrapper.NSWindow.addChildWindow(nsWindowOwnerPtr, nsWindowSelfPtr, CWrapper.NSWindow.NSWindowAbove);
+ CWrapper.NSWindow.orderFront(nsWindowOwnerPtr);
+ CWrapper.NSWindow.orderWindow(nsWindowSelfPtr, CWrapper.NSWindow.NSWindowAbove, nsWindowOwnerPtr);
}
applyWindowLevel(target);
diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CWarningWindow.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CWarningWindow.java
index 800d76f..5962b7f 100644
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CWarningWindow.java
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CWarningWindow.java
@@ -221,15 +221,6 @@
synchronized (lock) {
final long nsWindowPtr = getNSWindowPtr();
- // Process parent-child relationship when hiding
- if (!visible) {
- // Unparent myself
- if (owner != null && owner.isVisible()) {
- CWrapper.NSWindow.removeChildWindow(
- owner.getNSWindowPtr(), nsWindowPtr);
- }
- }
-
// Actually show or hide the window
if (visible) {
CWrapper.NSWindow.orderFront(nsWindowPtr);
@@ -241,10 +232,10 @@
// Manage parent-child relationship when showing
if (visible) {
- // Add myself as a child
+ // Order myself above my parent
if (owner != null && owner.isVisible()) {
- CWrapper.NSWindow.addChildWindow(owner.getNSWindowPtr(),
- nsWindowPtr, CWrapper.NSWindow.NSWindowAbove);
+ CWrapper.NSWindow.orderWindow(nsWindowPtr,
+ CWrapper.NSWindow.NSWindowAbove, owner.getNSWindowPtr());
// do not allow security warning to be obscured by other windows
applyWindowLevel(ownerWindow);
diff --git a/jdk/src/macosx/native/sun/awt/AWTView.m b/jdk/src/macosx/native/sun/awt/AWTView.m
index 66ad514..2244cda 100644
--- a/jdk/src/macosx/native/sun/awt/AWTView.m
+++ b/jdk/src/macosx/native/sun/awt/AWTView.m
@@ -515,8 +515,10 @@
}
-(BOOL) isCodePointInUnicodeBlockNeedingIMEvent: (unichar) codePoint {
- if ((codePoint >= 0x3000) && (codePoint <= 0x303F)) {
- // Code point is in 'CJK Symbols and Punctuation' Unicode block.
+ if (((codePoint >= 0x3000) && (codePoint <= 0x303F)) ||
+ ((codePoint >= 0xFF00) && (codePoint <= 0xFFEF))) {
+ // Code point is in 'CJK Symbols and Punctuation' or
+ // 'Halfwidth and Fullwidth Forms' Unicode block.
return YES;
}
return NO;
diff --git a/jdk/src/macosx/native/sun/awt/AWTWindow.h b/jdk/src/macosx/native/sun/awt/AWTWindow.h
index 7f7bac7..ee01181 100644
--- a/jdk/src/macosx/native/sun/awt/AWTWindow.h
+++ b/jdk/src/macosx/native/sun/awt/AWTWindow.h
@@ -46,6 +46,7 @@
NSWindow *nsWindow;
AWTWindow *ownerWindow;
jint preFullScreenLevel;
+ BOOL isMinimizing;
}
// An instance of either AWTWindow_Normal or AWTWindow_Panel
@@ -59,6 +60,7 @@
@property (nonatomic) jint styleBits;
@property (nonatomic) BOOL isEnabled;
@property (nonatomic) jint preFullScreenLevel;
+@property (nonatomic) BOOL isMinimizing;
- (id) initWithPlatformWindow:(JNFWeakJObjectWrapper *)javaPlatformWindow
diff --git a/jdk/src/macosx/native/sun/awt/AWTWindow.m b/jdk/src/macosx/native/sun/awt/AWTWindow.m
index 324f9d5..a20a3ed 100644
--- a/jdk/src/macosx/native/sun/awt/AWTWindow.m
+++ b/jdk/src/macosx/native/sun/awt/AWTWindow.m
@@ -184,6 +184,7 @@
@synthesize isEnabled;
@synthesize ownerWindow;
@synthesize preFullScreenLevel;
+@synthesize isMinimizing;
- (void) updateMinMaxSize:(BOOL)resizable {
if (resizable) {
@@ -308,6 +309,7 @@
[self.nsWindow release]; // the property retains the object already
self.isEnabled = YES;
+ self.isMinimizing = NO;
self.javaPlatformWindow = platformWindow;
self.styleBits = bits;
self.ownerWindow = owner;
@@ -427,6 +429,68 @@
[super dealloc];
}
+// Tests wheather the corresponding Java paltform window is visible or not
++ (BOOL) isJavaPlatformWindowVisible:(NSWindow *)window {
+ BOOL isVisible = NO;
+
+ if ([AWTWindow isAWTWindow:window] && [window delegate] != nil) {
+ AWTWindow *awtWindow = (AWTWindow *)[window delegate];
+ [AWTToolkit eventCountPlusPlus];
+
+ JNIEnv *env = [ThreadUtilities getJNIEnv];
+ jobject platformWindow = [awtWindow.javaPlatformWindow jObjectWithEnv:env];
+ if (platformWindow != NULL) {
+ static JNF_MEMBER_CACHE(jm_isVisible, jc_CPlatformWindow, "isVisible", "()Z");
+ isVisible = JNFCallBooleanMethod(env, platformWindow, jm_isVisible) == JNI_TRUE ? YES : NO;
+ (*env)->DeleteLocalRef(env, platformWindow);
+
+ }
+ }
+ return isVisible;
+}
+
+// Orders window's childs based on the current focus state
+- (void) orderChildWindows:(BOOL)focus {
+AWT_ASSERT_APPKIT_THREAD;
+
+ if (self.isMinimizing) {
+ // Do not perform any ordering, if iconify is in progress
+ return;
+ }
+
+ NSEnumerator *windowEnumerator = [[NSApp windows]objectEnumerator];
+ NSWindow *window;
+ while ((window = [windowEnumerator nextObject]) != nil) {
+ if ([AWTWindow isJavaPlatformWindowVisible:window]) {
+ AWTWindow *awtWindow = (AWTWindow *)[window delegate];
+ AWTWindow *owner = awtWindow.ownerWindow;
+ if (IS(awtWindow.styleBits, ALWAYS_ON_TOP)) {
+ // Do not order 'always on top' windows
+ continue;
+ }
+ while (awtWindow.ownerWindow != nil) {
+ if (awtWindow.ownerWindow == self) {
+ if (focus) {
+ // Move the childWindow to floating level
+ // so it will appear in front of its
+ // parent which owns the focus
+ [window setLevel:NSFloatingWindowLevel];
+ } else {
+ // Focus owner has changed, move the childWindow
+ // back to normal window level
+ [window setLevel:NSNormalWindowLevel];
+ }
+ // The childWindow should be displayed in front of
+ // its nearest parentWindow
+ [window orderWindow:NSWindowAbove relativeTo:[owner.nsWindow windowNumber]];
+ break;
+ }
+ awtWindow = awtWindow.ownerWindow;
+ }
+ }
+ }
+}
+
// NSWindow overrides
- (BOOL) canBecomeKeyWindow {
AWT_ASSERT_APPKIT_THREAD;
@@ -509,6 +573,30 @@
// window exposing in _setVisible:(BOOL)
}
+// Hides/shows window's childs during iconify/de-iconify operation
+- (void) iconifyChildWindows:(BOOL)iconify {
+AWT_ASSERT_APPKIT_THREAD;
+
+ NSEnumerator *windowEnumerator = [[NSApp windows]objectEnumerator];
+ NSWindow *window;
+ while ((window = [windowEnumerator nextObject]) != nil) {
+ if ([AWTWindow isJavaPlatformWindowVisible:window]) {
+ AWTWindow *awtWindow = (AWTWindow *)[window delegate];
+ while (awtWindow.ownerWindow != nil) {
+ if (awtWindow.ownerWindow == self) {
+ if (iconify) {
+ [window orderOut:window];
+ } else {
+ [window orderFront:window];
+ }
+ break;
+ }
+ awtWindow = awtWindow.ownerWindow;
+ }
+ }
+ }
+}
+
- (void) _deliverIconify:(BOOL)iconify {
AWT_ASSERT_APPKIT_THREAD;
@@ -522,16 +610,28 @@
}
}
+- (void)windowWillMiniaturize:(NSNotification *)notification {
+AWT_ASSERT_APPKIT_THREAD;
+
+ self.isMinimizing = YES;
+ // Excplicitly make myself a key window to avoid possible
+ // negative visual effects during iconify operation
+ [self.nsWindow makeKeyAndOrderFront:self.nsWindow];
+ [self iconifyChildWindows:YES];
+}
+
- (void)windowDidMiniaturize:(NSNotification *)notification {
AWT_ASSERT_APPKIT_THREAD;
[self _deliverIconify:JNI_TRUE];
+ self.isMinimizing = NO;
}
- (void)windowDidDeminiaturize:(NSNotification *)notification {
AWT_ASSERT_APPKIT_THREAD;
[self _deliverIconify:JNI_FALSE];
+ [self iconifyChildWindows:NO];
}
- (void) _deliverWindowFocusEvent:(BOOL)focused oppositeWindow:(AWTWindow *)opposite {
@@ -577,6 +677,7 @@
[AWTWindow setLastKeyWindow:nil];
[self _deliverWindowFocusEvent:YES oppositeWindow: opposite];
+ [self orderChildWindows:YES];
}
- (void) windowDidResignKey: (NSNotification *) notification {
@@ -604,6 +705,7 @@
}
[self _deliverWindowFocusEvent:NO oppositeWindow: opposite];
+ [self orderChildWindows:NO];
}
- (void) windowDidBecomeMain: (NSNotification *) notification {
@@ -698,6 +800,18 @@
- (void)sendEvent:(NSEvent *)event {
if ([event type] == NSLeftMouseDown || [event type] == NSRightMouseDown || [event type] == NSOtherMouseDown) {
+ // Move parent windows to front and make sure that a child window is displayed
+ // in front of its nearest parent.
+ if (self.ownerWindow != nil) {
+ JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
+ jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];
+ if (platformWindow != NULL) {
+ static JNF_MEMBER_CACHE(jm_orderAboveSiblings, jc_CPlatformWindow, "orderAboveSiblings", "()V");
+ JNFCallVoidMethod(env,platformWindow, jm_orderAboveSiblings);
+ (*env)->DeleteLocalRef(env, platformWindow);
+ }
+ }
+ [self orderChildWindows:YES];
NSPoint p = [NSEvent mouseLocation];
NSRect frame = [self.nsWindow frame];
@@ -998,6 +1112,16 @@
NSWindow *nsWindow = OBJC(windowPtr);
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[nsWindow orderBack:nil];
+ // Order parent windows
+ AWTWindow *awtWindow = (AWTWindow*)[nsWindow delegate];
+ while (awtWindow.ownerWindow != nil) {
+ awtWindow = awtWindow.ownerWindow;
+ if ([AWTWindow isJavaPlatformWindowVisible:awtWindow.nsWindow]) {
+ [awtWindow.nsWindow orderBack:nil];
+ }
+ }
+ // Order child windows
+ [(AWTWindow*)[nsWindow delegate] orderChildWindows:NO];
}];
JNF_COCOA_EXIT(env);
diff --git a/jdk/src/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java b/jdk/src/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java
index 241105b..4b97591 100644
--- a/jdk/src/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java
@@ -300,7 +300,7 @@
errEx = e;
}
- protected abstract AbstractLdapNamingEnumeration<T> getReferredResults(
+ protected abstract AbstractLdapNamingEnumeration<? extends NameClassPair> getReferredResults(
LdapReferralContext refCtx) throws NamingException;
/*
@@ -360,7 +360,7 @@
* Merge the entries and/or referrals from the supplied enumeration
* with those of the current enumeration.
*/
- protected void update(AbstractLdapNamingEnumeration<T> ne) {
+ protected void update(AbstractLdapNamingEnumeration<? extends NameClassPair> ne) {
// Cleanup previous context first
homeCtx.decEnumCount();
diff --git a/jdk/src/share/classes/com/sun/jndi/ldap/LdapBindingEnumeration.java b/jdk/src/share/classes/com/sun/jndi/ldap/LdapBindingEnumeration.java
index 65c8051..8d385d3 100644
--- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapBindingEnumeration.java
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapBindingEnumeration.java
@@ -104,9 +104,9 @@
}
@Override
- protected LdapBindingEnumeration getReferredResults(
+ protected AbstractLdapNamingEnumeration<? extends NameClassPair> getReferredResults(
LdapReferralContext refCtx) throws NamingException{
// repeat the original operation at the new context
- return (LdapBindingEnumeration)refCtx.listBindings(listArg);
+ return (AbstractLdapNamingEnumeration<? extends NameClassPair>)refCtx.listBindings(listArg);
}
}
diff --git a/jdk/src/share/classes/com/sun/jndi/ldap/LdapNamingEnumeration.java b/jdk/src/share/classes/com/sun/jndi/ldap/LdapNamingEnumeration.java
index 422ce79..c923fda 100644
--- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapNamingEnumeration.java
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapNamingEnumeration.java
@@ -72,9 +72,9 @@
}
@Override
- protected LdapNamingEnumeration getReferredResults(
+ protected AbstractLdapNamingEnumeration<? extends NameClassPair> getReferredResults(
LdapReferralContext refCtx) throws NamingException {
// repeat the original operation at the new context
- return (LdapNamingEnumeration)refCtx.list(listArg);
+ return (AbstractLdapNamingEnumeration<? extends NameClassPair>)refCtx.list(listArg);
}
}
diff --git a/jdk/src/share/classes/com/sun/jndi/ldap/LdapSearchEnumeration.java b/jdk/src/share/classes/com/sun/jndi/ldap/LdapSearchEnumeration.java
index 329b1d2..24c421e 100644
--- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapSearchEnumeration.java
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapSearchEnumeration.java
@@ -199,15 +199,15 @@
}
@Override
- protected LdapSearchEnumeration getReferredResults(
+ protected AbstractLdapNamingEnumeration<? extends NameClassPair> getReferredResults(
LdapReferralContext refCtx) throws NamingException {
// repeat the original operation at the new context
- return (LdapSearchEnumeration)refCtx.search(
+ return (AbstractLdapNamingEnumeration<? extends NameClassPair>)refCtx.search(
searchArgs.name, searchArgs.filter, searchArgs.cons);
}
@Override
- protected void update(AbstractLdapNamingEnumeration<SearchResult> ne) {
+ protected void update(AbstractLdapNamingEnumeration<? extends NameClassPair> ne) {
super.update(ne);
// Update search-specific variables
diff --git a/jdk/src/share/classes/javax/swing/JEditorPane.java b/jdk/src/share/classes/javax/swing/JEditorPane.java
index 0df1181..9707523 100644
--- a/jdk/src/share/classes/javax/swing/JEditorPane.java
+++ b/jdk/src/share/classes/javax/swing/JEditorPane.java
@@ -24,15 +24,12 @@
*/
package javax.swing;
-import sun.swing.SwingUtilities2;
import java.awt.*;
-import java.awt.event.*;
import java.lang.reflect.*;
import java.net.*;
import java.util.*;
import java.io.*;
-import java.util.*;
import javax.swing.plaf.*;
import javax.swing.text.*;
@@ -1244,7 +1241,11 @@
*/
public static void registerEditorKitForContentType(String type, String classname, ClassLoader loader) {
getKitTypeRegistry().put(type, classname);
- getKitLoaderRegistry().put(type, loader);
+ if (loader != null) {
+ getKitLoaderRegistry().put(type, loader);
+ } else {
+ getKitLoaderRegistry().remove(type);
+ }
getKitRegisty().remove(type);
}
diff --git a/jdk/src/share/classes/sun/security/ssl/RSAClientKeyExchange.java b/jdk/src/share/classes/sun/security/ssl/RSAClientKeyExchange.java
index 783146c..a6439ef 100644
--- a/jdk/src/share/classes/sun/security/ssl/RSAClientKeyExchange.java
+++ b/jdk/src/share/classes/sun/security/ssl/RSAClientKeyExchange.java
@@ -90,6 +90,30 @@
}
/*
+ * Retrieving the cipher's provider name for the debug purposes
+ * can throw an exception by itself.
+ */
+ private static String safeProviderName(Cipher cipher) {
+ try {
+ return cipher.getProvider().toString();
+ } catch (Exception e) {
+ if (debug != null && Debug.isOn("handshake")) {
+ System.out.println("Retrieving The Cipher provider name" +
+ " caused exception " + e.getMessage());
+ }
+ }
+ try {
+ return cipher.toString() + " (provider name not available)";
+ } catch (Exception e) {
+ if (debug != null && Debug.isOn("handshake")) {
+ System.out.println("Retrieving The Cipher name" +
+ " caused exception " + e.getMessage());
+ }
+ }
+ return "(cipher/provider names not available)";
+ }
+
+ /*
* Server gets the PKCS #1 (block format 02) data, decrypts
* it with its private key.
*/
@@ -130,15 +154,19 @@
cipher.getProvider().getName());
} catch (InvalidKeyException | UnsupportedOperationException iue) {
if (debug != null && Debug.isOn("handshake")) {
- System.out.println("The Cipher provider " +
- cipher.getProvider().getName() +
- " caused exception: " + iue.getMessage());
+ System.out.println("The Cipher provider "
+ + safeProviderName(cipher)
+ + " caused exception: " + iue.getMessage());
}
needFailover = true;
}
if (needFailover) {
+ // The cipher might be spoiled by unsuccessful call to init(),
+ // so request a fresh instance
+ cipher = JsseJce.getCipher(JsseJce.CIPHER_RSA_PKCS1);
+
// Use DECRYPT_MODE and dispose the previous initialization.
cipher.init(Cipher.DECRYPT_MODE, privateKey);
boolean failed = false;
diff --git a/jdk/src/windows/native/java/net/Inet4AddressImpl.c b/jdk/src/windows/native/java/net/Inet4AddressImpl.c
index bb7f110..1ddbf55 100644
--- a/jdk/src/windows/native/java/net/Inet4AddressImpl.c
+++ b/jdk/src/windows/native/java/net/Inet4AddressImpl.c
@@ -33,6 +33,7 @@
#include <process.h>
#include <iphlpapi.h>
#include <icmpapi.h>
+#include <WinError.h>
#include "java_net_InetAddress.h"
#include "java_net_Inet4AddressImpl.h"
@@ -488,7 +489,15 @@
return JNI_FALSE;
}
- ReplySize = sizeof(ICMP_ECHO_REPLY) + sizeof(SendData);
+ // https://msdn.microsoft.com/en-us/library/windows/desktop/aa366051%28v=vs.85%29.aspx
+ ReplySize = sizeof(ICMP_ECHO_REPLY) // The buffer should be large enough
+ // to hold at least one ICMP_ECHO_REPLY
+ // structure
+ + sizeof(SendData) // plus RequestSize bytes of data.
+ + 8; // This buffer should also be large enough
+ // to also hold 8 more bytes of data
+ // (the size of an ICMP error message)
+
ReplyBuffer = (VOID*) malloc(ReplySize);
if (ReplyBuffer == NULL) {
IcmpCloseHandle(hIcmpFile);
@@ -524,10 +533,45 @@
(timeout < 1000) ? 1000 : timeout); // DWORD Timeout
}
- if (dwRetVal != 0) {
+ if (dwRetVal == 0) { // if the call failed
+ TCHAR *buf;
+ DWORD err = WSAGetLastError();
+ switch (err) {
+ case ERROR_NO_NETWORK:
+ case ERROR_NETWORK_UNREACHABLE:
+ case ERROR_HOST_UNREACHABLE:
+ case ERROR_PROTOCOL_UNREACHABLE:
+ case ERROR_PORT_UNREACHABLE:
+ case ERROR_REQUEST_ABORTED:
+ case ERROR_INCORRECT_ADDRESS:
+ case ERROR_HOST_DOWN:
+ case WSAEHOSTUNREACH: /* Host Unreachable */
+ case WSAENETUNREACH: /* Network Unreachable */
+ case WSAENETDOWN: /* Network is down */
+ case WSAEPFNOSUPPORT: /* Protocol Family unsupported */
+ case IP_REQ_TIMED_OUT:
+ break;
+ default:
+ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR)&buf, 0, NULL);
+ NET_ThrowNew(env, err, buf);
+ LocalFree(buf);
+ break;
+ }
+ } else {
PICMP_ECHO_REPLY pEchoReply = (PICMP_ECHO_REPLY)ReplyBuffer;
- if ((int)pEchoReply->RoundTripTime <= timeout)
+
+ // This is to take into account the undocumented minimum
+ // timeout mentioned in the IcmpSendEcho call above.
+ // We perform an extra check to make sure that our
+ // roundtrip time was less than our desired timeout
+ // for cases where that timeout is < 1000ms.
+ if (pEchoReply->Status == IP_SUCCESS
+ && (int)pEchoReply->RoundTripTime <= timeout)
+ {
ret = JNI_TRUE;
+ }
}
free(ReplyBuffer);
diff --git a/jdk/src/windows/native/sun/security/mscapi/security.cpp b/jdk/src/windows/native/sun/security/mscapi/security.cpp
index 553dd42..5796c30 100644
--- a/jdk/src/windows/native/sun/security/mscapi/security.cpp
+++ b/jdk/src/windows/native/sun/security/mscapi/security.cpp
@@ -352,38 +352,50 @@
BOOL bHasNoPrivateKey = FALSE;
DWORD dwPublicKeyLength = 0;
- if (::CryptAcquireCertificatePrivateKey(pCertContext, NULL, NULL,
- &hCryptProv, &dwKeySpec, &bCallerFreeProv) == FALSE)
+ // First, probe it silently
+ if (::CryptAcquireCertificatePrivateKey(pCertContext, CRYPT_ACQUIRE_SILENT_FLAG, NULL,
+ &hCryptProv, &dwKeySpec, &bCallerFreeProv) == FALSE
+ && GetLastError() != NTE_SILENT_CONTEXT)
{
bHasNoPrivateKey = TRUE;
-
- } else {
- // Private key is available
-
- BOOL bGetUserKey = ::CryptGetUserKey(hCryptProv, dwKeySpec, &hUserKey);
-
- // Skip certificate if cannot find private key
- if (bGetUserKey == FALSE)
- {
- if (bCallerFreeProv)
- ::CryptReleaseContext(hCryptProv, NULL);
-
- continue;
+ }
+ else
+ {
+ if (bCallerFreeProv == TRUE) {
+ ::CryptReleaseContext(hCryptProv, NULL);
+ bCallerFreeProv = FALSE;
}
- // Set cipher mode to ECB
- DWORD dwCipherMode = CRYPT_MODE_ECB;
- ::CryptSetKeyParam(hUserKey, KP_MODE, (BYTE*)&dwCipherMode, NULL);
+ // Second, acquire the key normally (not silently)
+ if (::CryptAcquireCertificatePrivateKey(pCertContext, 0, NULL,
+ &hCryptProv, &dwKeySpec, &bCallerFreeProv) == FALSE)
+ {
+ bHasNoPrivateKey = TRUE;
+ }
+ else
+ {
+ // Private key is available
+ BOOL bGetUserKey = ::CryptGetUserKey(hCryptProv, dwKeySpec, &hUserKey);
+ // Skip certificate if cannot find private key
+ if (bGetUserKey == FALSE) {
+ if (bCallerFreeProv)
+ ::CryptReleaseContext(hCryptProv, NULL);
+ continue;
+ }
- // If the private key is present in smart card, we may not be able to
- // determine the key length by using the private key handle. However,
- // since public/private key pairs must have the same length, we could
- // determine the key length of the private key by using the public key
- // in the certificate.
- dwPublicKeyLength = ::CertGetPublicKeyLength(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
- &(pCertContext->pCertInfo->SubjectPublicKeyInfo));
+ // Set cipher mode to ECB
+ DWORD dwCipherMode = CRYPT_MODE_ECB;
+ ::CryptSetKeyParam(hUserKey, KP_MODE, (BYTE*)&dwCipherMode, NULL);
+ // If the private key is present in smart card, we may not be able to
+ // determine the key length by using the private key handle. However,
+ // since public/private key pairs must have the same length, we could
+ // determine the key length of the private key by using the public key
+ // in the certificate.
+ dwPublicKeyLength = ::CertGetPublicKeyLength(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
+ &(pCertContext->pCertInfo->SubjectPublicKeyInfo));
+ }
}
PCCERT_CHAIN_CONTEXT pCertChainContext = NULL;
@@ -392,8 +404,7 @@
//
if (GetCertificateChain(OID_EKU_ANY, pCertContext, &pCertChainContext))
{
-
- for (unsigned int i=0; i < pCertChainContext->cChain; i++)
+ for (DWORD i = 0; i < pCertChainContext->cChain; i++)
{
// Found cert chain
PCERT_SIMPLE_CHAIN rgpChain =
@@ -443,6 +454,7 @@
// cert collection
env->CallVoidMethod(obj, mGenCert, byteArray, jArrayList);
}
+
if (bHasNoPrivateKey)
{
// Generate certificate chain and store into cert chain
@@ -1361,43 +1373,57 @@
HCRYPTPROV hCryptProv = NULL;
HCRYPTKEY hKey = NULL;
DWORD dwKeySpec;
+ BOOL bCallerFreeProv = FALSE;
+ BOOL bRes;
__try
{
if (usePrivateKey == JNI_TRUE) {
// Locate the key container for the certificate's private key
- if (!(::CryptAcquireCertificatePrivateKey(
- (PCCERT_CONTEXT) pCertContext, 0, NULL, &hCryptProv,
- &dwKeySpec, NULL))) {
+ // First, probe it silently
+ bRes = ::CryptAcquireCertificatePrivateKey(
+ (PCCERT_CONTEXT) pCertContext, CRYPT_ACQUIRE_SILENT_FLAG,
+ NULL, &hCryptProv, &dwKeySpec, &bCallerFreeProv);
+
+ if (bRes == FALSE && GetLastError() != NTE_SILENT_CONTEXT)
+ {
+ ThrowException(env, KEYSTORE_EXCEPTION, GetLastError());
+ __leave;
+ }
+
+ if (bCallerFreeProv == TRUE) {
+ ::CryptReleaseContext(hCryptProv, NULL);
+ bCallerFreeProv = FALSE;
+ }
+
+ // Now, do it normally (not silently)
+ if (::CryptAcquireCertificatePrivateKey(
+ (PCCERT_CONTEXT) pCertContext, 0, NULL, &hCryptProv,
+ &dwKeySpec, &bCallerFreeProv) == FALSE)
+ {
ThrowException(env, KEYSTORE_EXCEPTION, GetLastError());
__leave;
}
// Get a handle to the private key
- if (!(::CryptGetUserKey(hCryptProv, dwKeySpec, &hKey))) {
+ if (::CryptGetUserKey(hCryptProv, dwKeySpec, &hKey) == FALSE) {
ThrowException(env, KEY_EXCEPTION, GetLastError());
__leave;
}
-
- } else { // use public key
+ }
+ else // use public key
+ {
+ bCallerFreeProv = TRUE;
// Acquire a CSP context.
- if(::CryptAcquireContext(
- &hCryptProv,
- "J2SE",
- NULL,
- PROV_RSA_FULL,
- 0) == FALSE)
+ if (::CryptAcquireContext(&hCryptProv, "J2SE", NULL,
+ PROV_RSA_FULL, 0) == FALSE)
{
// If CSP context hasn't been created, create one.
//
- if (::CryptAcquireContext(
- &hCryptProv,
- "J2SE",
- NULL,
- PROV_RSA_FULL,
- CRYPT_NEWKEYSET) == FALSE)
+ if (::CryptAcquireContext(&hCryptProv, "J2SE", NULL,
+ PROV_RSA_FULL, CRYPT_NEWKEYSET) == FALSE)
{
ThrowException(env, KEYSTORE_EXCEPTION, GetLastError());
__leave;
@@ -1405,10 +1431,10 @@
}
// Import the certificate's public key into the key container
- if (!(::CryptImportPublicKeyInfo(hCryptProv, X509_ASN_ENCODING,
- &(((PCCERT_CONTEXT) pCertContext)->pCertInfo->SubjectPublicKeyInfo),
- &hKey))) {
-
+ if (::CryptImportPublicKeyInfo(hCryptProv, X509_ASN_ENCODING,
+ &(((PCCERT_CONTEXT) pCertContext)->pCertInfo->SubjectPublicKeyInfo),
+ &hKey) == FALSE)
+ {
ThrowException(env, KEY_EXCEPTION, GetLastError());
__leave;
}
@@ -1419,7 +1445,7 @@
//--------------------------------------------------------------------
// Clean up.
- if (hCryptProv)
+ if (bCallerFreeProv == TRUE && hCryptProv != NULL)
::CryptReleaseContext(hCryptProv, 0);
}
diff --git a/jdk/test/java/awt/Window/WindowJumpingTest/WindowJumpingTest.java b/jdk/test/java/awt/Window/WindowJumpingTest/WindowJumpingTest.java
new file mode 100644
index 0000000..f2e2100
--- /dev/null
+++ b/jdk/test/java/awt/Window/WindowJumpingTest/WindowJumpingTest.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8080729
+ * @summary Dialogs on multiscreen jump to parent frame on focus gain
+ * @author Dmitry Markov
+ * @library ../../regtesthelpers
+ * @build Util
+ * @run main WindowJumpingTest
+ */
+import java.awt.*;
+
+import test.java.awt.regtesthelpers.Util;
+
+public class WindowJumpingTest {
+ public static void main(String[] args) throws AWTException {
+ Robot r = Util.createRobot();
+
+ GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ GraphicsDevice[] graphicsDevices = graphicsEnvironment.getScreenDevices();
+ if (graphicsDevices.length < 2) {
+ System.out.println("This is multi-screen test... Skipping!");
+ return;
+ }
+
+ Frame frame = new Frame("Frame", graphicsDevices[0].getDefaultConfiguration());
+ frame.setSize(400, 300);
+ frame.setVisible(true);
+ Util.waitForIdle(r);
+
+ Dialog dialog = new Dialog(frame, "Dialog", false, graphicsDevices[1].getDefaultConfiguration());
+ dialog.setSize(400, 300);
+ dialog.setVisible(true);
+ Util.waitForIdle(r);
+
+ checkGraphicsDevice(frame, graphicsDevices[0]);
+ checkGraphicsDevice(dialog, graphicsDevices[1]);
+
+ Util.clickOnComp(frame, r);
+ Util.waitForIdle(r);
+
+ checkGraphicsDevice(frame, graphicsDevices[0]);
+ checkGraphicsDevice(dialog, graphicsDevices[1]);
+
+ Util.clickOnComp(dialog, r);
+ Util.waitForIdle(r);
+
+ checkGraphicsDevice(frame, graphicsDevices[0]);
+ checkGraphicsDevice(dialog, graphicsDevices[1]);
+
+ dialog.dispose();
+ frame.dispose();
+ }
+
+ private static void checkGraphicsDevice(Window window, GraphicsDevice graphicsDevice) {
+ GraphicsDevice actualGraphicsDevice = window.getGraphicsConfiguration().getDevice();
+
+ if (!actualGraphicsDevice.equals(graphicsDevice)) {
+ System.err.println("Expected screen: " + graphicsDevice);
+ System.err.println("Actual screen: "+ actualGraphicsDevice);
+ throw new RuntimeException("Test FAILED: " + window + " is displayed on wrong screen");
+ }
+ }
+}
+
diff --git a/jdk/test/java/awt/im/8148984/bug8148984.html b/jdk/test/java/awt/im/8148984/bug8148984.html
new file mode 100644
index 0000000..c6eb7c2
--- /dev/null
+++ b/jdk/test/java/awt/im/8148984/bug8148984.html
@@ -0,0 +1,38 @@
+<!--
+ Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html>
+<body>
+Verify that Chinese comma can be entered in JTextField with Pinyin input method (IM).
+
+This test is for OS X only. For other platforms please simply press "Pass".
+
+1. Go to "System Preferences -> Keyboard -> Input Sources" and add "Pinyin – Traditional" or "Pinyin – Simplified" IM from Chinese language group.
+2. Set current IM to "Pinyin".
+3. Set focus to the text field of the test and press "comma" character on the keyboard.
+4. Set current IM to the IM used before "Pinyin" was set.
+5. If "," character is displayed in the text area, press "Pass", if "," character is displayed, press "Fail".
+
+<applet code="bug8148984.class" width=400 height=400></applet>
+</body>
+</html>
diff --git a/jdk/test/java/awt/im/8148984/bug8148984.java b/jdk/test/java/awt/im/8148984/bug8148984.java
new file mode 100644
index 0000000..3869b3c
--- /dev/null
+++ b/jdk/test/java/awt/im/8148984/bug8148984.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8148984
+ * @summary Chinese Comma cannot be entered using Pinyin Input Method on OS X
+ * @author Dmitry Markov
+ * @run applet/manual=yesno bug8148984.html
+ */
+
+import javax.swing.*;
+
+public class bug8148984 extends JApplet {
+ @Override
+ public void init() {
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ JPanel panel = new JPanel();
+ panel.add(new JLabel("Text field:"));
+ panel.add(new JTextField(20));
+ add(panel);
+ }
+ });
+ }
+}
+
diff --git a/jdk/test/javax/swing/JEditorPane/6882559/bug6882559.java b/jdk/test/javax/swing/JEditorPane/6882559/bug6882559.java
new file mode 100644
index 0000000..5bcd041
--- /dev/null
+++ b/jdk/test/javax/swing/JEditorPane/6882559/bug6882559.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ @bug 6882559
+ @summary new JEditorPane("text/plain","") fails for null context class loader
+ @author Mikhail Cherkasov
+ @run main bug6882559
+*/
+
+import javax.swing.*;
+
+
+public class bug6882559 {
+ public static void main(String[] args) throws Exception {
+ SwingUtilities.invokeAndWait(() -> {
+ Thread.currentThread().setContextClassLoader(null);
+ new javax.swing.JEditorPane("text/plain", "");
+ });
+ }
+}
diff --git a/jdk/test/javax/swing/JEditorPane/8158734/bug8158734.java b/jdk/test/javax/swing/JEditorPane/8158734/bug8158734.java
new file mode 100644
index 0000000..3514303
--- /dev/null
+++ b/jdk/test/javax/swing/JEditorPane/8158734/bug8158734.java
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ @bug 8158734
+ @summary JEditorPane.createEditorKitForContentType throws NPE after 6882559
+ @author Mikhail Cherkasov
+ @run main bug8158734
+*/
+
+import javax.swing.*;
+import javax.swing.text.*;
+import java.io.*;
+import java.lang.reflect.InvocationTargetException;
+
+
+public class bug8158734 {
+
+ public static final String TYPE = "test/test";
+ public static final String TYPE_2 = "test2/test2";
+
+ static boolean myClassloaderWasUsed = false;
+
+ static class MyEditorKit extends EditorKit {
+ @Override
+ public String getContentType() {
+ return null;
+ }
+
+ @Override
+ public ViewFactory getViewFactory() {
+ return null;
+ }
+
+ @Override
+ public Action[] getActions() {
+ return new Action[0];
+ }
+
+ @Override
+ public Caret createCaret() {
+ return null;
+ }
+
+ @Override
+ public Document createDefaultDocument() {
+ return null;
+ }
+
+ @Override
+ public void read(InputStream in, Document doc, int pos) throws IOException, BadLocationException {
+ }
+
+ @Override
+ public void write(OutputStream out, Document doc, int pos, int len) throws IOException, BadLocationException {
+
+ }
+
+ @Override
+ public void read(Reader in, Document doc, int pos) throws IOException, BadLocationException {
+ }
+
+ @Override
+ public void write(Writer out, Document doc, int pos, int len) throws IOException, BadLocationException {
+ }
+ }
+
+ static class MyClassloader extends ClassLoader {
+ @Override
+ public Class<?> loadClass(String name) throws ClassNotFoundException {
+ myClassloaderWasUsed = true;
+ return super.loadClass(name);
+ }
+ }
+
+ public static void main(String[] args) throws InvocationTargetException, InterruptedException {
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ JEditorPane c = new JEditorPane();
+ c.setContentType(TYPE);
+
+ final MyClassloader loader = new MyClassloader();
+ JEditorPane.registerEditorKitForContentType(TYPE_2, MyEditorKit.class.getName(), loader);
+ JEditorPane.registerEditorKitForContentType(TYPE_2, MyEditorKit.class.getName(), null);
+ JEditorPane.createEditorKitForContentType(TYPE_2);
+
+ if (myClassloaderWasUsed) {
+ throw new RuntimeException("Class loader has not been removed for '" + TYPE_2 + "' type");
+ }
+ }
+ });
+
+ }
+}
\ No newline at end of file
diff --git a/nashorn/.hgtags b/nashorn/.hgtags
index b752874..aa4aff4 100644
--- a/nashorn/.hgtags
+++ b/nashorn/.hgtags
@@ -577,6 +577,9 @@
e2294411edbda51165bc1a10261c246cb4d3c5c5 jdk8u92-b13
d2af8d0297223ff16d59ee64b7058cafef8f3bb8 jdk8u92-b14
ff47e8b14690edada1d0a4386e63bb4bc2f38ab4 jdk8u92-b31
+895bb16c7f9fe0c74317afef671a0d5ccde58afa jdk8u92-b32
+6c3f8e359668ec22e9c577d875cdb5a918534498 jdk8u92-b33
+59d90c3cc2bfdfda7664877d0e2529ef6c558558 jdk8u92-b34
16d657d6cb22e832139a1cbc2ec23a5cf9db8985 jdk8u81-b00
793156da7cc9c74489ab5fa5f5598bba172846e2 jdk8u101-b01
79fc469a68bbe03f69919f4cebe0381df1b1d2a3 jdk8u101-b02
@@ -606,3 +609,8 @@
7bd6f4f266f66d32e4ce743928d7c4021c23c477 jdk8u102-b11
e3db6994bbbd654be3ebd677b2cc80469f7133a3 jdk8u102-b12
a010893ca6ee93c1a4832d1c484be6a119ca7ae4 jdk8u102-b13
+0948e61a3722ea7519323dffcce4f26430fe2881 jdk8u102-b14
+908d77c3a01687e99fb426cff41cf000f3f28e68 jdk8u102-b31
+4510fa72a613e8bd8b02f7519362de60907ca652 jdk8u102-b32
+36e3c21b5fcaaa138da59d3b1e72239a2c8b13f6 jdk8u102-b33
+de8a9d055c88ae9373a7be118231b7ccfc662ccb jdk8u102-b34