Merge
diff --git a/.hgtags-top-repo b/.hgtags-top-repo
index 99d1638..9e244af 100644
--- a/.hgtags-top-repo
+++ b/.hgtags-top-repo
@@ -770,3 +770,4 @@
 7a25d12cd94fa7a881f064dcb35f0e88ed073c45 jdk8u152-b16
 2093adf5331251080398d5a2f0f2cf58cffcb0a1 jdk8u152-b31
 54a2665aef21b20d7e436bd615a3e722649accb1 jdk8u152-b32
+d988f1e20caa1bd03e04374ebbacbb9434026641 jdk8u152-b33
diff --git a/corba/.hgtags b/corba/.hgtags
index 98b319d..c299685 100644
--- a/corba/.hgtags
+++ b/corba/.hgtags
@@ -805,3 +805,4 @@
 674aecf3d87ae774e2026a1cb2a60eaa651bc7c2 jdk8u152-b16
 e05b7f7238ddad4c2fe428da73c1d234cb90284f jdk8u152-b31
 c4e0935e4570dd821b19ede0e06d27378b93caf4 jdk8u152-b32
+a6c0eb254c54d050bd04dcd308a2993e517bb0de jdk8u152-b33
diff --git a/hotspot/.hgtags b/hotspot/.hgtags
index 6e48ddc..e3f75bf 100644
--- a/hotspot/.hgtags
+++ b/hotspot/.hgtags
@@ -1035,3 +1035,4 @@
 98b4b0661837817cc39047000e1a7efa6015af7c jdk8u152-b16
 91894ffc746c1681172aaa37e2cf5bff69560f20 jdk8u152-b31
 d278f122e65dfb5d239ed420a534df75f527a504 jdk8u152-b32
+c066fe30d0a141b14ab7788cbbd35eba11196e72 jdk8u152-b33
diff --git a/jaxp/.hgtags b/jaxp/.hgtags
index a6bfd82..3cf0293 100644
--- a/jaxp/.hgtags
+++ b/jaxp/.hgtags
@@ -775,3 +775,4 @@
 6a1402a0b31d25d607d7cf0c20cf8f1a2d17711c jdk8u152-b16
 f4505a7897c74ae0ff3176a68757dc00048ee570 jdk8u152-b31
 f20c7cdf672808f0695949c2481a7526f0b848a4 jdk8u152-b32
+31c2dd5d72a301d64481bf6d2429d93e90c90dd8 jdk8u152-b33
diff --git a/jaxws/.hgtags b/jaxws/.hgtags
index 79f0d45..3cba6f5 100644
--- a/jaxws/.hgtags
+++ b/jaxws/.hgtags
@@ -764,3 +764,4 @@
 04128156e506e8375c1c97eafea773317e5719bc jdk8u152-b16
 52c09505e989dee9176ac0e968ee5ec18a0cee3a jdk8u152-b31
 ddf13a1bca64ef6d12ced03f8d0065325a8f07e1 jdk8u152-b32
+89c5dcb05c10c52ab8f6f956a061e6661f9fb6b1 jdk8u152-b33
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/saaj/SaajStaxWriter.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/saaj/SaajStaxWriter.java
index f1ed697..f02acfe 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/saaj/SaajStaxWriter.java
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/saaj/SaajStaxWriter.java
@@ -492,7 +492,7 @@
                     }
                     // add namespace declarations
                     for (NamespaceDeclaration namespace : this.namespaceDeclarations) {
-                        target.addNamespaceDeclaration(namespace.prefix, namespace.namespaceUri);
+                        newElement.addNamespaceDeclaration(namespace.prefix, namespace.namespaceUri);
                     }
                     // add attribute declarations
                     for (AttributeDeclaration attribute : this.attributeDeclarations) {
diff --git a/jdk/.hgtags b/jdk/.hgtags
index 62c7c2c..df74356 100644
--- a/jdk/.hgtags
+++ b/jdk/.hgtags
@@ -772,3 +772,4 @@
 1cb70967c4d78a45a60d0d6eb64cb7fbe89ad005 jdk8u152-b16
 9dce8b2a03e056c54789c555176bd2c8a48b844f jdk8u152-b31
 5f0349b6341cf96a478ea14ee820af26fe190e36 jdk8u152-b32
+4c18aa8f0bc0eb78ed02863e465867804415a931 jdk8u152-b33
diff --git a/jdk/src/windows/classes/sun/awt/windows/WInputMethod.java b/jdk/src/windows/classes/sun/awt/windows/WInputMethod.java
index de7c478..343e2a1 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WInputMethod.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WInputMethod.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, 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
@@ -584,6 +584,9 @@
                 Component client = getClientComponent();
 
                 if (client != null) {
+                    if (!client.isShowing()) {
+                        return;
+                    }
                     if (haveActiveClient()) {
                             Rectangle rc = inputContext.getTextLocation(TextHitInfo.leading(0));
                             x = rc.x;
diff --git a/jdk/src/windows/native/sun/windows/awt_Component.cpp b/jdk/src/windows/native/sun/windows/awt_Component.cpp
index 44df115..717eceb 100644
--- a/jdk/src/windows/native/sun/windows/awt_Component.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_Component.cpp
@@ -3779,6 +3779,9 @@
     UINT bits = 1;
     POINT p = {0, 0}; // upper left corner of the client area
     HWND hWnd = GetHWnd();
+    if (!::IsWindowVisible(hWnd)) {
+        return;
+    }
     HWND hTop = GetTopLevelParentForWindow(hWnd);
     ::ClientToScreen(hTop, &p);
     if (!m_bitsCandType) {
@@ -4051,6 +4054,9 @@
 //
 void AwtComponent::InquireCandidatePosition()
 {
+    if (!::IsWindowVisible(GetHWnd())) {
+        return;
+    }
     JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 
     // get global reference of WInputMethod class (run only once)
diff --git a/jdk/test/javax/swing/JFrame/AlwaysOnTop/AlwaysOnTopImeTest.java b/jdk/test/javax/swing/JFrame/AlwaysOnTop/AlwaysOnTopImeTest.java
new file mode 100644
index 0000000..a8d3751
--- /dev/null
+++ b/jdk/test/javax/swing/JFrame/AlwaysOnTop/AlwaysOnTopImeTest.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2017, 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 8179665
+ * @summary [Windows] java.awt.IllegalComponentStateException: component must
+ *          be showing on the screen to determine its location
+ * @run main AlwaysOnTopImeTest
+ */
+
+import javax.swing.*;
+import java.awt.*;
+
+public class AlwaysOnTopImeTest {
+
+    private static JDialog d;
+    private static JFrame f;
+
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeLater(() -> {
+            f = new JFrame();
+            f.setVisible(true);
+            d = new JDialog(f);
+            d.add(new JTextField());
+            d.pack();
+            d.setModal(true);
+            f.setAlwaysOnTop(true);
+            d.setVisible(true);
+            f.setAlwaysOnTop(false);
+        });
+        Robot robot = new Robot();
+        robot.waitForIdle();
+        robot.delay(200);
+        SwingUtilities.invokeAndWait(() -> d.setVisible(false));
+        robot.waitForIdle();
+        robot.delay(200);
+        SwingUtilities.invokeLater(f::dispose);
+    }
+}
diff --git a/jdk/test/javax/xml/ws/8159058/SaajEmptyNamespaceTest.java b/jdk/test/javax/xml/ws/8159058/SaajEmptyNamespaceTest.java
index 348617d..bdc30da 100644
--- a/jdk/test/javax/xml/ws/8159058/SaajEmptyNamespaceTest.java
+++ b/jdk/test/javax/xml/ws/8159058/SaajEmptyNamespaceTest.java
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8159058
+ * @bug 8159058 8186441
  * @summary Test that empty default namespace declaration clears the
  *          default namespace value
  * @compile -XDignore.symbol.file SaajEmptyNamespaceTest.java
@@ -59,6 +59,26 @@
 public class SaajEmptyNamespaceTest {
 
     /*
+     * Test that SOAP reader doesn't move namespaces declarations to SOAP body element
+     *  as reported in JDK-8186441
+     */
+    @Test
+    public void testPreserveNamespacesPosition() throws Exception {
+        // Create SOAP message from XML string and process it with SAAJ reader
+        XMLStreamReader envelope = XMLInputFactory.newFactory().createXMLStreamReader(
+                new StringReader(INPUT_SOAP_MESSAGE_2));
+        StreamMessage streamMessage = new StreamMessage(SOAPVersion.SOAP_11,
+                envelope, null);
+        SAAJFactory saajFact = new SAAJFactory();
+        SOAPMessage soapMessage = saajFact.readAsSOAPMessage(SOAPVersion.SOAP_11, streamMessage);
+
+        //Get SOAP body and convert it to string representation
+        SOAPBody body = soapMessage.getSOAPBody();
+        String bodyAsString = nodeToText(body);
+        Assert.assertEquals(bodyAsString, PRESERVE_NAMESPACES_EXPECTED_RESULT);
+    }
+
+    /*
      * Test that SOAP message with default namespace declaration that contains empty
      * string is properly processed by SAAJ reader.
      */
@@ -273,10 +293,28 @@
 
     // Expected body content after SAAJ processing
     private static String EXPECTED_RESULT = "<SampleServiceRequest"
-            +" xmlns=\"http://example.org/test\">"
+            + " xmlns=\"http://example.org/test\""
+            + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
             + "<RequestParams xmlns=\"\">"
             + "<Param1>hogehoge</Param1>"
             + "<Param2>fugafuga</Param2>"
             + "</RequestParams>"
             + "</SampleServiceRequest>";
+
+    private static String PRESERVE_NAMESPACES_EXPECTED_RESULT =
+            "<s:Body xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">"
+            +"<Request xmlns=\"http://example.org/NS_1\">"
+            +"<Item><Contact xmlns=\"http://example.org/NS_2\">Test_Contact</Contact>"
+            +"</Item></Request></s:Body>";
+
+    private static String INPUT_SOAP_MESSAGE_2 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+            + "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">"
+            + "<s:Body>"
+            + "<Request xmlns=\"http://example.org/NS_1\">"
+            + "<Item>"
+            + "<Contact xmlns=\"http://example.org/NS_2\">Test_Contact</Contact>"
+            + "</Item>"
+            + "</Request>"
+            + "</s:Body>"
+            + "</s:Envelope>";
 }
diff --git a/langtools/.hgtags b/langtools/.hgtags
index 429cba2..3f5fed8 100644
--- a/langtools/.hgtags
+++ b/langtools/.hgtags
@@ -772,3 +772,4 @@
 97dfb267d417415aca378f62b97dbf7a12a93f8a jdk8u152-b16
 757f531633e3feb2d8c08b6afe748134e61ad917 jdk8u152-b31
 73ffe473564c8952813473078497a5e915655665 jdk8u152-b32
+5a188fbdf539e0b35a1f151e6b55b81ca102e4ab jdk8u152-b33
diff --git a/nashorn/.hgtags b/nashorn/.hgtags
index f4c6fb5..a170b1c 100644
--- a/nashorn/.hgtags
+++ b/nashorn/.hgtags
@@ -751,3 +751,4 @@
 d0841bfdb637d83ee0066df2f730b8a9b6fc3450 jdk8u152-b16
 853acc70b8f5541cb6b7ecadebd441ab0c84745c jdk8u152-b31
 94a17ba2690225347ccc3a07b9d15f42c5a20fa5 jdk8u152-b32
+1197ac84319b14e15af503fad2c4fcb3a3ba64b9 jdk8u152-b33