changeset 845:0b6f442e81fe JDK-8182159-branch

Merge
author erikj
date Mon, 10 Jul 2017 15:54:38 +0200
parents 9a3a53278d23 6d17fd0a5133
children 96714d632d9c
files src/java.xml.ws/share/classes/javax/xml/ws/handler/package.html src/java.xml.ws/share/classes/javax/xml/ws/handler/soap/package.html src/java.xml.ws/share/classes/javax/xml/ws/http/package.html src/java.xml.ws/share/classes/javax/xml/ws/soap/package.html src/java.xml.ws/share/classes/javax/xml/ws/spi/package.html src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/newmessages.properties
diffstat 263 files changed, 12845 insertions(+), 10905 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Wed Jun 14 11:19:42 2017 +0200
+++ b/.hgtags	Mon Jul 10 15:54:38 2017 +0200
@@ -430,3 +430,11 @@
 3ccd9f37faa601866db5edb827363e797f5a2493 jdk-10+10
 8c615099f3e3ca137325be34bf566b767d9e3c64 jdk-9+172
 2d22d6732a73e615b9e13d6bc93bf026db3bc231 jdk-10+11
+2bd967aa452c1e0e87a6173bef6fbb96ef1c521b jdk-9+173
+c2296642010f1b215ac35da89e92c3ce44104e32 jdk-9+174
+712a3a657654079514590d37a0f4894d43541d5c jdk-10+12
+a5d361b9d1f7f78a675f3baef0d1fd32deee9ea2 jdk-9+175
+46a14aad004aa0b980d5f4ff7810d894fd5a36ae jdk-10+13
+bddeaa49ffd55567ad232548c38aa270e1a1420a jdk-10+14
+ea819b6009d33a72e6672bab6c101d51db0cfb4c jdk-9+176
+b44a721aee3d3b2537754e559fe9ecccadea548b jdk-9+177
--- a/.jcheck/conf	Wed Jun 14 11:19:42 2017 +0200
+++ b/.jcheck/conf	Mon Jul 10 15:54:38 2017 +0200
@@ -1,1 +1,2 @@
 project=jdk10
+bugids=dup
--- a/src/java.activation/share/classes/javax/activation/CommandInfo.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.activation/share/classes/javax/activation/CommandInfo.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, 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
@@ -118,6 +118,9 @@
      *                  passed to the command.
      * @param loader    The ClassLoader to be used to instantiate the bean.
      * @return The bean
+     * @exception       IOException     for failures reading data
+     * @exception       ClassNotFoundException  if command object class can't
+     *                                          be found
      * @see java.beans.Beans#instantiate
      * @see javax.activation.CommandObject
      */
--- a/src/java.activation/share/classes/javax/activation/CommandObject.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.activation/share/classes/javax/activation/CommandObject.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, 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
@@ -48,6 +48,7 @@
      *
      * @param verb The Command Verb this object refers to.
      * @param dh The DataHandler.
+     * @exception       IOException     for failures accessing data
      */
     public void setCommandContext(String verb, DataHandler dh)
                                                 throws IOException;
--- a/src/java.activation/share/classes/javax/activation/DataHandler.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.activation/share/classes/javax/activation/DataHandler.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, 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
@@ -326,6 +326,7 @@
      * Otherwise, {@code null} is returned.
      *
      * @return the OutputStream
+     * @exception       IOException     for failures creating the OutputStream
      *
      * @see javax.activation.DataSource#getOutputStream
      * @see javax.activation.URLDataSource
--- a/src/java.activation/share/classes/javax/activation/DataSource.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.activation/share/classes/javax/activation/DataSource.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, 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
@@ -49,6 +49,7 @@
      * positioned at the beginning of the data.
      *
      * @return an InputStream
+     * @exception       IOException     for failures creating the InputStream
      */
     public InputStream getInputStream() throws IOException;
 
@@ -60,6 +61,7 @@
      * be positioned at the location the data is to be written.
      *
      * @return an OutputStream
+     * @exception       IOException     for failures creating the OutputStream
      */
     public OutputStream getOutputStream() throws IOException;
 
--- a/src/java.activation/share/classes/javax/activation/MailcapCommandMap.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.activation/share/classes/javax/activation/MailcapCommandMap.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, 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
@@ -29,6 +29,8 @@
 import java.util.*;
 import java.io.*;
 import java.net.*;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import com.sun.activation.registries.MailcapFile;
 import com.sun.activation.registries.LogSupport;
 
@@ -48,12 +50,19 @@
  * <ol>
  * <li> Programatically added entries to the MailcapCommandMap instance.
  * <li> The file {@code .mailcap} in the user's home directory.
- * <li> The file {@literal <}<i>java.home</i>{@literal >}{@code /lib/mailcap}.
+ * <li> The file {@code mailcap} in the Java runtime.
  * <li> The file or resources named {@code META-INF/mailcap}.
  * <li> The file or resource named {@code META-INF/mailcap.default}
  * (usually found only in the {@code activation.jar} file).
  * </ol>
  * <p>
+ * (The current implementation looks for the {@code mailcap} file
+ * in the Java runtime in the directory <i>java.home</i>{@code /conf}
+ * if it exists, and otherwise in the directory
+ * <i>java.home</i>{@code /lib}, where <i>java.home</i> is the value
+ * of the "java.home" System property.  Note that the "conf" directory was
+ * introduced in JDK 9.)
+ * <p>
  * <b>Mailcap file format:</b><p>
  *
  * Mailcap files must conform to the mailcap
@@ -120,6 +129,29 @@
     private MailcapFile[] DB;
     private static final int PROG = 0;  // programmatically added entries
 
+    private static final String confDir;
+
+    static {
+        String dir = null;
+        try {
+            dir = (String)AccessController.doPrivileged(
+                new PrivilegedAction() {
+                    public Object run() {
+                        String home = System.getProperty("java.home");
+                        String newdir = home + File.separator + "conf";
+                        File conf = new File(newdir);
+                        if (conf.exists())
+                            return newdir + File.separator;
+                        else
+                            return home + File.separator + "lib" + File.separator;
+                    }
+                });
+        } catch (Exception ex) {
+            // ignore any exceptions
+        }
+        confDir = dir;
+    }
+
     /**
      * The default Constructor.
      */
@@ -144,11 +176,11 @@
         LogSupport.log("MailcapCommandMap: load SYS");
         try {
             // check system's home
-            String system_mailcap = System.getProperty("java.home") +
-                File.separator + "lib" + File.separator + "mailcap";
-            mf = loadFile(system_mailcap);
-            if (mf != null)
-                dbv.add(mf);
+            if (confDir != null) {
+                mf = loadFile(confDir + "mailcap");
+                if (mf != null)
+                    dbv.add(mf);
+            }
         } catch (SecurityException ex) {}
 
         LogSupport.log("MailcapCommandMap: load JAR");
@@ -633,6 +665,7 @@
      * entries that specify a view command for the specified
      * MIME type are returned.
      *
+     * @param   mimeType        the MIME type
      * @return          array of native command entries
      * @since   1.6, JAF 1.1
      */
--- a/src/java.activation/share/classes/javax/activation/MimeType.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.activation/share/classes/javax/activation/MimeType.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, 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
@@ -58,6 +58,7 @@
      * Constructor that builds a MimeType from a String.
      *
      * @param rawdata   the MIME type string
+     * @exception       MimeTypeParseException  if the MIME type can't be parsed
      */
     public MimeType(String rawdata) throws MimeTypeParseException {
         parse(rawdata);
@@ -258,6 +259,7 @@
      *
      * @param rawdata   the MIME type string to compare with
      * @return          true if they match
+     * @exception       MimeTypeParseException  if the MIME type can't be parsed
      */
     public boolean match(String rawdata) throws MimeTypeParseException {
         return match(new MimeType(rawdata));
--- a/src/java.activation/share/classes/javax/activation/MimeTypeParameterList.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.activation/share/classes/javax/activation/MimeTypeParameterList.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, 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
@@ -58,6 +58,7 @@
      * Constructs a new MimeTypeParameterList with the passed in data.
      *
      * @param parameterList an RFC 2045, 2046 compliant parameter list.
+     * @exception       MimeTypeParseException  if the MIME type can't be parsed
      */
     public MimeTypeParameterList(String parameterList)
                                         throws MimeTypeParseException {
@@ -71,6 +72,7 @@
      * A routine for parsing the parameter list out of a String.
      *
      * @param parameterList an RFC 2045, 2046 compliant parameter list.
+     * @exception       MimeTypeParseException  if the MIME type can't be parsed
      */
     protected void parse(String parameterList) throws MimeTypeParseException {
         if (parameterList == null)
--- a/src/java.activation/share/classes/javax/activation/MimetypesFileTypeMap.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.activation/share/classes/javax/activation/MimetypesFileTypeMap.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, 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
@@ -28,6 +28,8 @@
 import java.io.*;
 import java.net.*;
 import java.util.*;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import com.sun.activation.registries.MimeTypeFile;
 import com.sun.activation.registries.LogSupport;
 
@@ -43,12 +45,19 @@
  * <ol>
  * <li> Programmatically added entries to the MimetypesFileTypeMap instance.
  * <li> The file {@code .mime.types} in the user's home directory.
- * <li> The file {@literal <}<i>java.home</i>{@literal >}{@code /lib/mime.types}.
+ * <li> The file {@code mime.types} in the Java runtime.
  * <li> The file or resources named {@code META-INF/mime.types}.
  * <li> The file or resource named {@code META-INF/mimetypes.default}
  * (usually found only in the {@code activation.jar} file).
  * </ol>
  * <p>
+ * (The current implementation looks for the {@code mime.types} file
+ * in the Java runtime in the directory <i>java.home</i>{@code /conf}
+ * if it exists, and otherwise in the directory
+ * <i>java.home</i>{@code /lib}, where <i>java.home</i> is the value
+ * of the "java.home" System property.  Note that the "conf" directory was
+ * introduced in JDK 9.)
+ * <p>
  * <b>MIME types file format:</b>
  *
  * <pre>{@code
@@ -72,7 +81,30 @@
     private MimeTypeFile[] DB;
     private static final int PROG = 0;  // programmatically added entries
 
-    private static String defaultType = "application/octet-stream";
+    private static final String defaultType = "application/octet-stream";
+
+    private static final String confDir;
+
+    static {
+        String dir = null;
+        try {
+            dir = (String)AccessController.doPrivileged(
+                new PrivilegedAction() {
+                    public Object run() {
+                        String home = System.getProperty("java.home");
+                        String newdir = home + File.separator + "conf";
+                        File conf = new File(newdir);
+                        if (conf.exists())
+                            return newdir + File.separator;
+                        else
+                            return home + File.separator + "lib" + File.separator;
+                    }
+                });
+        } catch (Exception ex) {
+            // ignore any exceptions
+        }
+        confDir = dir;
+    }
 
     /**
      * The default constructor.
@@ -97,11 +129,11 @@
         LogSupport.log("MimetypesFileTypeMap: load SYS");
         try {
             // check system's home
-            String system_mimetypes = System.getProperty("java.home") +
-                File.separator + "lib" + File.separator + "mime.types";
-            mf = loadFile(system_mimetypes);
-            if (mf != null)
-                dbv.addElement(mf);
+            if (confDir != null) {
+                mf = loadFile(confDir + "mime.types");
+                if (mf != null)
+                    dbv.addElement(mf);
+            }
         } catch (SecurityException ex) {}
 
         LogSupport.log("MimetypesFileTypeMap: load JAR");
@@ -239,6 +271,7 @@
      * added from the named file.
      *
      * @param mimeTypeFileName  the file name
+     * @exception       IOException     for errors reading the file
      */
     public MimetypesFileTypeMap(String mimeTypeFileName) throws IOException {
         this();
--- a/src/java.activation/share/classes/module-info.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.activation/share/classes/module-info.java	Mon Jul 10 15:54:38 2017 +0200
@@ -26,13 +26,16 @@
 /**
  * Defines the JavaBeans Activation Framework (JAF) API.
  *
+ * <p> This module is upgradeable.
+ *
  * @moduleGraph
  * @since 9
  */
 @Deprecated(since="9", forRemoval=true)
 module java.activation {
+    requires java.logging;
+
     requires transitive java.datatransfer;
-    requires java.logging;
 
     exports javax.activation;
 }
--- a/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/marshaller/MinimumEscapeHandler.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/marshaller/MinimumEscapeHandler.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, 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
@@ -48,10 +48,10 @@
         int limit = start+length;
         for (int i = start; i < limit; i++) {
             char c = ch[i];
-                if(c == '&' || c == '<' || c == '>' || c == '\r' || (c == '\"' && isAttVal) ) {
-                if(i!=start)
-                    out.write(ch,start,i-start);
-                start = i+1;
+            if (c == '&' || c == '<' || c == '>' || c == '\r' || (c == '\n' && isAttVal) || (c == '\"' && isAttVal)) {
+                if (i != start)
+                    out.write(ch, start, i - start);
+                start = i + 1;
                 switch (ch[i]) {
                     case '&':
                         out.write("&amp;");
@@ -65,6 +65,14 @@
                     case '\"':
                         out.write("&quot;");
                         break;
+                    case '\n':
+                    case '\r':
+                        out.write("&#");
+                        out.write(Integer.toString(c));
+                        out.write(';');
+                        break;
+                    default:
+                        throw new IllegalArgumentException("Cannot escape: '" + c + "'");
                 }
             }
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/marshaller/NoEscapeHandler.java	Mon Jul 10 15:54:38 2017 +0200
@@ -0,0 +1,45 @@
+/*
+ * 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.xml.internal.bind.marshaller;
+
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * Performs no character escaping.
+ *
+ * @author
+ *     Roman Grigoriadi (roman.grigoriadi@oracle.com)
+ */
+public class NoEscapeHandler implements CharacterEscapeHandler {
+
+    public static final NoEscapeHandler theInstance = new NoEscapeHandler();
+
+    @Override
+    public void escape(char[] ch, int start, int length, boolean isAttVal, Writer out) throws IOException {
+        out.write(ch, start, length);
+    }
+}
--- a/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/BridgeImpl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/BridgeImpl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, 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
@@ -76,7 +76,7 @@
 
     public void marshal(Marshaller _m, T t, XMLStreamWriter output) throws JAXBException {
         MarshallerImpl m = (MarshallerImpl)_m;
-        m.write(tagName,bi,t,XMLStreamWriterOutput.create(output,context),new StAXPostInitAction(output,m.serializer));
+        m.write(tagName,bi,t,XMLStreamWriterOutput.create(output,context, m.getEscapeHandler()),new StAXPostInitAction(output,m.serializer));
     }
 
     public void marshal(Marshaller _m, T t, OutputStream output, NamespaceContext nsContext) throws JAXBException {
--- a/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/MarshallerImpl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/MarshallerImpl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, 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
@@ -165,7 +165,7 @@
 
     @Override
     public void marshal(Object obj, XMLStreamWriter writer) throws JAXBException {
-        write(obj, XMLStreamWriterOutput.create(writer,context), new StAXPostInitAction(writer,serializer));
+        write(obj, XMLStreamWriterOutput.create(writer,context, escapeHandler), new StAXPostInitAction(writer,serializer));
     }
 
     @Override
@@ -371,6 +371,15 @@
     }
 
 
+    /**
+     * Returns escape handler provided with JAXB context parameters.
+     *
+     * @return escape handler
+     */
+    CharacterEscapeHandler getEscapeHandler() {
+        return escapeHandler;
+    }
+
     //
     //
     // create XMLWriter by specifing various type of output.
@@ -436,13 +445,14 @@
         if(encoding.equals("UTF-8")) {
             Encoded[] table = context.getUTF8NameTable();
             final UTF8XmlOutput out;
+            CharacterEscapeHandler ceh = createEscapeHandler(encoding);
             if(isFormattedOutput())
-                out = new IndentingUTF8XmlOutput(os, indent, table, escapeHandler);
+                out = new IndentingUTF8XmlOutput(os, indent, table, ceh);
             else {
                 if(c14nSupport)
-                    out = new C14nXmlOutput(os, table, context.c14nSupport, escapeHandler);
+                    out = new C14nXmlOutput(os, table, context.c14nSupport, ceh);
                 else
-                    out = new UTF8XmlOutput(os, table, escapeHandler);
+                    out = new UTF8XmlOutput(os, table, ceh);
             }
             if(header!=null)
                 out.setHeader(header);
--- a/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/output/FastInfosetStreamWriterOutput.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/output/FastInfosetStreamWriterOutput.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, 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
@@ -25,21 +25,22 @@
 
 package com.sun.xml.internal.bind.v2.runtime.output;
 
+import com.sun.xml.internal.bind.marshaller.NoEscapeHandler;
 import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl;
 import com.sun.xml.internal.bind.v2.runtime.Name;
 import com.sun.xml.internal.bind.v2.runtime.XMLSerializer;
-import javax.xml.stream.XMLStreamException;
-
 import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Base64Data;
 import com.sun.xml.internal.fastinfoset.EncodingConstants;
 import com.sun.xml.internal.fastinfoset.stax.StAXDocumentSerializer;
+import com.sun.xml.internal.org.jvnet.fastinfoset.VocabularyApplicationData;
+import org.xml.sax.SAXException;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.stream.XMLStreamException;
 import java.io.IOException;
 import java.util.Collection;
 import java.util.Map;
 import java.util.WeakHashMap;
-import javax.xml.bind.JAXBContext;
-import com.sun.xml.internal.org.jvnet.fastinfoset.VocabularyApplicationData;
-import org.xml.sax.SAXException;
 
 /**
  * {@link XmlOutput} for {@link StAXDocumentSerializer}.
@@ -220,7 +221,7 @@
 
     public FastInfosetStreamWriterOutput(StAXDocumentSerializer out,
             JAXBContextImpl context) {
-        super(out);
+        super(out, NoEscapeHandler.theInstance);
 
         this.fiout = out;
         this.localNames = context.getUTF8NameTable();
--- a/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/output/StAXExStreamWriterOutput.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/output/StAXExStreamWriterOutput.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, 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
@@ -27,6 +27,7 @@
 
 import javax.xml.stream.XMLStreamException;
 
+import com.sun.xml.internal.bind.marshaller.NoEscapeHandler;
 import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Base64Data;
 
 import com.sun.xml.internal.org.jvnet.staxex.XMLStreamWriterEx;
@@ -40,7 +41,7 @@
     private final XMLStreamWriterEx out;
 
     public StAXExStreamWriterOutput(XMLStreamWriterEx out) {
-        super(out);
+        super(out, NoEscapeHandler.theInstance);
         this.out = out;
     }
 
--- a/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/output/XMLStreamWriterOutput.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/output/XMLStreamWriterOutput.java	Mon Jul 10 15:54:38 2017 +0200
@@ -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
@@ -26,15 +26,16 @@
 package com.sun.xml.internal.bind.v2.runtime.output;
 
 import java.io.IOException;
+import java.io.Writer;
 import java.lang.reflect.Constructor;
 
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import com.sun.xml.internal.bind.marshaller.CharacterEscapeHandler;
 import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl;
 import com.sun.xml.internal.bind.v2.runtime.XMLSerializer;
 
-import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl;
 import org.xml.sax.SAXException;
 
 /**
@@ -53,7 +54,7 @@
      * Creates a new {@link XmlOutput} from a {@link XMLStreamWriter}.
      * This method recognizes an FI StAX writer.
      */
-    public static XmlOutput create(XMLStreamWriter out, JAXBContextImpl context) {
+    public static XmlOutput create(XMLStreamWriter out, JAXBContextImpl context, CharacterEscapeHandler escapeHandler) {
         // try optimized path
         final Class writerClass = out.getClass();
         if (writerClass==FI_STAX_WRITER_CLASS) {
@@ -69,17 +70,26 @@
             }
         }
 
+        CharacterEscapeHandler xmlStreamEscapeHandler = escapeHandler != null ?
+                escapeHandler : NewLineEscapeHandler.theInstance;
+
         // otherwise the normal writer.
-        return new XMLStreamWriterOutput(out);
+        return new XMLStreamWriterOutput(out, xmlStreamEscapeHandler);
     }
 
 
     private final XMLStreamWriter out;
 
+    private final CharacterEscapeHandler escapeHandler;
+
+    private final XmlStreamOutWriterAdapter writerWrapper;
+
     protected final char[] buf = new char[256];
 
-    protected XMLStreamWriterOutput(XMLStreamWriter out) {
+    protected XMLStreamWriterOutput(XMLStreamWriter out, CharacterEscapeHandler escapeHandler) {
         this.out = out;
+        this.escapeHandler = escapeHandler;
+        this.writerWrapper = new XmlStreamOutWriterAdapter(out);
     }
 
     // not called if we are generating fragments
@@ -137,7 +147,7 @@
     public void text(String value, boolean needsSeparatingWhitespace) throws IOException, SAXException, XMLStreamException {
         if(needsSeparatingWhitespace)
             out.writeCharacters(" ");
-        out.writeCharacters(value);
+        escapeHandler.escape(value.toCharArray(), 0, value.length(), false, writerWrapper);
     }
 
     public void text(Pcdata value, boolean needsSeparatingWhitespace) throws IOException, SAXException, XMLStreamException {
@@ -207,4 +217,81 @@
         }
     }
 
+    /**
+     * Performs character escaping only for new lines.
+     */
+    private static class NewLineEscapeHandler implements CharacterEscapeHandler {
+
+        public static final NewLineEscapeHandler theInstance = new NewLineEscapeHandler();
+
+        @Override
+        public void escape(char[] ch, int start, int length, boolean isAttVal, Writer out) throws IOException {
+            int limit = start+length;
+            int lastEscaped = start;
+            for (int i = start; i < limit; i++) {
+                char c = ch[i];
+                if (c == '\r' || c == '\n') {
+                    if (i != lastEscaped) {
+                        out.write(ch, lastEscaped, i - lastEscaped);
+                    }
+                    lastEscaped = i + 1;
+                    if (out instanceof XmlStreamOutWriterAdapter) {
+                        try {
+                            ((XmlStreamOutWriterAdapter)out).writeEntityRef("#x" + Integer.toHexString(c));
+                        } catch (XMLStreamException e) {
+                            throw new IOException("Error writing xml stream", e);
+                        }
+                    } else {
+                        out.write("&#x");
+                        out.write(Integer.toHexString(c));
+                        out.write(';');
+                    }
+                }
+            }
+
+            if (lastEscaped != limit) {
+                out.write(ch, lastEscaped, length - lastEscaped);
+            }
+        }
+    }
+
+    private static final class XmlStreamOutWriterAdapter extends Writer {
+
+        private final XMLStreamWriter writer;
+
+        private XmlStreamOutWriterAdapter(XMLStreamWriter writer) {
+            this.writer = writer;
+        }
+
+        @Override
+        public void write(char[] cbuf, int off, int len) throws IOException {
+            try {
+                writer.writeCharacters(cbuf, off, len);
+            } catch (XMLStreamException e) {
+                throw new IOException("Error writing XML stream", e);
+            }
+        }
+
+        public void writeEntityRef(String entityReference) throws XMLStreamException {
+            writer.writeEntityRef(entityReference);
+        }
+
+        @Override
+        public void flush() throws IOException {
+            try {
+                writer.flush();
+            } catch (XMLStreamException e) {
+                throw new IOException("Error flushing XML stream", e);
+            }
+        }
+
+        @Override
+        public void close() throws IOException {
+            try {
+                writer.close();
+            } catch (XMLStreamException e) {
+                throw new IOException("Error closing XML stream", e);
+            }
+        }
+    }
 }
--- a/src/java.xml.bind/share/classes/javax/xml/bind/ContextFinder.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.bind/share/classes/javax/xml/bind/ContextFinder.java	Mon Jul 10 15:54:38 2017 +0200
@@ -150,13 +150,14 @@
      * Create an instance of a class using the specified ClassLoader
      */
     static JAXBContext newInstance(String contextPath,
+                                   Class[] contextPathClasses,
                                    String className,
                                    ClassLoader classLoader,
                                    Map properties) throws JAXBException {
 
         try {
             Class spFactory = ServiceLoaderUtil.safeLoadClass(className, PLATFORM_DEFAULT_FACTORY_CLASS, classLoader);
-            return newInstance(contextPath, spFactory, classLoader, properties);
+            return newInstance(contextPath, contextPathClasses, spFactory, classLoader, properties);
         } catch (ClassNotFoundException x) {
             throw new JAXBException(Messages.format(Messages.DEFAULT_PROVIDER_NOT_FOUND), x);
 
@@ -175,6 +176,7 @@
     }
 
     static JAXBContext newInstance(String contextPath,
+                                   Class[] contextPathClasses,
                                    Class spFactory,
                                    ClassLoader classLoader,
                                    Map properties) throws JAXBException {
@@ -212,6 +214,9 @@
                 // the cast would fail, so generate an exception with a nice message
                 throw handleClassCastException(context.getClass(), JAXBContext.class);
             }
+
+            ModuleUtil.delegateAddOpensToImplModule(contextPathClasses, spFactory);
+
             return (JAXBContext) context;
         } catch (InvocationTargetException x) {
             // throw if it is exception not to be wrapped
@@ -277,6 +282,7 @@
                 // the cast would fail, so generate an exception with a nice message
                 throw handleClassCastException(context.getClass(), JAXBContext.class);
             }
+            ModuleUtil.delegateAddOpensToImplModule(classes,  spFactory);
             return (JAXBContext) context;
 
         } catch (NoSuchMethodException | IllegalAccessException e) {
@@ -295,50 +301,52 @@
                             ClassLoader classLoader,
                             Map properties) throws JAXBException {
 
-        StringTokenizer packages = new StringTokenizer(contextPath, ":");
-        if (!packages.hasMoreTokens()) {
+        if (contextPath == null || contextPath.isEmpty()) {
             // no context is specified
             throw new JAXBException(Messages.format(Messages.NO_PACKAGE_IN_CONTEXTPATH));
         }
 
-        // search for jaxb.properties in the class loader of each class first
-        logger.fine("Searching jaxb.properties");
-        while (packages.hasMoreTokens()) {
-            // com.acme.foo - > com/acme/foo/jaxb.properties
-            String factoryClassName =
-                    classNameFromPackageProperties(
-                        classLoader,
-                        packages.nextToken(":").replace('.', '/'),
-                        factoryId,
-                        JAXB_CONTEXT_FACTORY_DEPRECATED);
+        //ModuleUtil is mr-jar class, scans context path for jaxb classes on jdk9 and higher
+        Class[] contextPathClasses = ModuleUtil.getClassesFromContextPath(contextPath, classLoader);
 
-            if (factoryClassName != null) {
-                return newInstance(contextPath, factoryClassName, classLoader, properties);
-            }
+        //first try with classloader#getResource
+        String factoryClassName = jaxbProperties(contextPath, classLoader, factoryId);
+        if (factoryClassName == null && contextPathClasses != null) {
+            //try with class#getResource
+            factoryClassName = jaxbProperties(contextPathClasses, factoryId);
         }
 
+        if (factoryClassName != null) {
+            return newInstance(contextPath, contextPathClasses, factoryClassName, classLoader, properties);
+        }
+
+
         String factoryName = classNameFromSystemProperties();
-        if (factoryName != null) return newInstance(contextPath, factoryName, classLoader, properties);
+        if (factoryName != null) return newInstance(contextPath, contextPathClasses, factoryName, classLoader, properties);
 
         JAXBContextFactory obj = ServiceLoaderUtil.firstByServiceLoader(
                 JAXBContextFactory.class, logger, EXCEPTION_HANDLER);
 
-        if (obj != null) return obj.createContext(contextPath, classLoader, properties);
+        if (obj != null) {
+            JAXBContext context = obj.createContext(contextPath, classLoader, properties);
+            ModuleUtil.delegateAddOpensToImplModule(contextPathClasses, obj.getClass());
+            return context;
+        }
 
         // to ensure backwards compatibility
         factoryName = firstByServiceLoaderDeprecated(JAXBContext.class, classLoader);
-        if (factoryName != null) return newInstance(contextPath, factoryName, classLoader, properties);
+        if (factoryName != null) return newInstance(contextPath, contextPathClasses, factoryName, classLoader, properties);
 
         Class ctxFactory = (Class) ServiceLoaderUtil.lookupUsingOSGiServiceLoader(
                 "javax.xml.bind.JAXBContext", logger);
 
         if (ctxFactory != null) {
-            return newInstance(contextPath, ctxFactory, classLoader, properties);
+            return newInstance(contextPath, contextPathClasses, ctxFactory, classLoader, properties);
         }
 
         // else no provider found
         logger.fine("Trying to create the platform default provider");
-        return newInstance(contextPath, PLATFORM_DEFAULT_FACTORY_CLASS, classLoader, properties);
+        return newInstance(contextPath, contextPathClasses, PLATFORM_DEFAULT_FACTORY_CLASS, classLoader, properties);
     }
 
     static JAXBContext find(Class<?>[] classes, Map<String, ?> properties) throws JAXBException {
@@ -356,13 +364,18 @@
             // TODO: it's easier to look things up from the class
             // c.getResourceAsStream("jaxb.properties");
 
-            String factoryClassName =
-                    classNameFromPackageProperties(
-                            getClassClassLoader(c),
-                            c.getPackage().getName().replace('.', '/'),
-                            JAXBContext.JAXB_CONTEXT_FACTORY, JAXB_CONTEXT_FACTORY_DEPRECATED);
+            URL jaxbPropertiesUrl = getResourceUrl(c, "jaxb.properties");
 
-            if (factoryClassName != null) return newInstance(classes, properties, factoryClassName);
+            if (jaxbPropertiesUrl != null) {
+
+                String factoryClassName =
+                        classNameFromPackageProperties(
+                                jaxbPropertiesUrl,
+                                JAXBContext.JAXB_CONTEXT_FACTORY, JAXB_CONTEXT_FACTORY_DEPRECATED);
+
+                return newInstance(classes, properties, factoryClassName);
+            }
+
         }
 
         String factoryClassName = classNameFromSystemProperties();
@@ -371,7 +384,11 @@
         JAXBContextFactory factory =
                 ServiceLoaderUtil.firstByServiceLoader(JAXBContextFactory.class, logger, EXCEPTION_HANDLER);
 
-        if (factory != null) return factory.createContext(classes, properties);
+        if (factory != null) {
+            JAXBContext context = factory.createContext(classes, properties);
+            ModuleUtil.delegateAddOpensToImplModule(classes, factory.getClass());
+            return context;
+        }
 
         // to ensure backwards compatibility
         String className = firstByServiceLoaderDeprecated(JAXBContext.class, getContextClassLoader());
@@ -395,22 +412,20 @@
      * first factoryId should be the preferred one,
      * more of those can be provided to support backwards compatibility
      */
-    private static String classNameFromPackageProperties(ClassLoader classLoader,
-                                                         String packageName,
+    private static String classNameFromPackageProperties(URL packagePropertiesUrl,
                                                          String ... factoryIds) throws JAXBException {
 
-        String resourceName = packageName + "/jaxb.properties";
-        logger.log(Level.FINE, "Trying to locate {0}", resourceName);
-        Properties props = loadJAXBProperties(classLoader, resourceName);
-        if (props != null) {
-            for(String factoryId : factoryIds) {
-                if (props.containsKey(factoryId)) {
-                    return props.getProperty(factoryId);
-                }
+        logger.log(Level.FINE, "Trying to locate {0}", packagePropertiesUrl.toString());
+        Properties props = loadJAXBProperties(packagePropertiesUrl);
+        for(String factoryId : factoryIds) {
+            if (props.containsKey(factoryId)) {
+                return props.getProperty(factoryId);
             }
-            throw new JAXBException(Messages.format(Messages.MISSING_PROPERTY, packageName, factoryIds[0]));
         }
-        return null;
+        //Factory key not found
+        String propertiesUrl = packagePropertiesUrl.toExternalForm();
+        String packageName = propertiesUrl.substring(0, propertiesUrl.indexOf("/jaxb.properties"));
+        throw new JAXBException(Messages.format(Messages.MISSING_PROPERTY, packageName, factoryIds[0]));
     }
 
     private static String classNameFromSystemProperties() throws JAXBException {
@@ -452,30 +467,40 @@
         return value;
     }
 
-    private static Properties loadJAXBProperties(ClassLoader classLoader,
-                                                 String propFileName) throws JAXBException {
+    private static Properties loadJAXBProperties(URL url) throws JAXBException {
 
-        Properties props = null;
         try {
-            URL url;
-            if (classLoader == null)
-                url = ClassLoader.getSystemResource(propFileName);
-            else
-                url = classLoader.getResource(propFileName);
-
-            if (url != null) {
-                logger.log(Level.FINE, "loading props from {0}", url);
-                props = new Properties();
-                InputStream is = url.openStream();
-                props.load(is);
-                is.close();
-            }
+            Properties props;
+            logger.log(Level.FINE, "loading props from {0}", url);
+            props = new Properties();
+            InputStream is = url.openStream();
+            props.load(is);
+            is.close();
+            return props;
         } catch (IOException ioe) {
-            logger.log(Level.FINE, "Unable to load " + propFileName, ioe);
+            logger.log(Level.FINE, "Unable to load " + url.toString(), ioe);
             throw new JAXBException(ioe.toString(), ioe);
         }
+    }
 
-        return props;
+    /**
+     * If run on JPMS package containing resource must be open unconditionally.
+     *
+     * @param classLoader classloader to load resource with
+     * @param resourceName qualified name of the resource
+     * @return resource url if found
+     */
+    private static URL getResourceUrl(ClassLoader classLoader, String resourceName) {
+        URL url;
+        if (classLoader == null)
+            url = ClassLoader.getSystemResource(resourceName);
+        else
+            url = classLoader.getResource(resourceName);
+        return url;
+    }
+
+    private static URL getResourceUrl(Class<?> clazz, String resourceName) {
+        return clazz.getResource(resourceName);
     }
 
 
@@ -606,4 +631,28 @@
         }
     }
 
+    private static String jaxbProperties(String contextPath, ClassLoader classLoader, String factoryId) throws JAXBException {
+        String[] packages = contextPath.split(":");
+
+        for (String pkg : packages) {
+            String pkgUrl = pkg.replace('.', '/');
+            URL jaxbPropertiesUrl = getResourceUrl(classLoader, pkgUrl + "/jaxb.properties");
+            if (jaxbPropertiesUrl != null) {
+                return classNameFromPackageProperties(jaxbPropertiesUrl,
+                                                      factoryId, JAXB_CONTEXT_FACTORY_DEPRECATED);
+            }
+        }
+        return null;
+    }
+
+    private static String jaxbProperties(Class[] classesFromContextPath, String factoryId) throws JAXBException {
+        for (Class c : classesFromContextPath) {
+            URL jaxbPropertiesUrl = getResourceUrl(c, "jaxb.properties");
+            if (jaxbPropertiesUrl != null) {
+                return classNameFromPackageProperties(jaxbPropertiesUrl, factoryId, JAXB_CONTEXT_FACTORY_DEPRECATED);
+            }
+        }
+        return null;
+    }
+
 }
--- a/src/java.xml.bind/share/classes/javax/xml/bind/JAXBContext.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.bind/share/classes/javax/xml/bind/JAXBContext.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -27,11 +27,11 @@
 
 import org.w3c.dom.Node;
 
+import java.io.IOException;
+import java.io.InputStream;
 import java.util.Collections;
 import java.util.Map;
 import java.util.Properties;
-import java.io.IOException;
-import java.io.InputStream;
 
 /**
  * The {@code JAXBContext} class provides the client's entry point to the
@@ -227,6 +227,9 @@
  * This phase of the look up allows some packages to force the use of a certain JAXB implementation.
  * (For example, perhaps the schema compiler has generated some vendor extension in the code.)
  *
+ * <p>
+ * This configuration method is deprecated.
+ *
  * <li>
  * If the system property {@link #JAXB_CONTEXT_FACTORY} exists, then its value is assumed to be the provider
  * factory class. If no such property exists, properties {@code "javax.xml.bind.context.factory"} and
@@ -332,7 +335,14 @@
      * the context class loader of the current thread.
      *
      * @throws JAXBException if an error was encountered while creating the
-     *               {@code JAXBContext}. See {@link JAXBContext#newInstance(String, ClassLoader, Map)} for details.
+     *                       {@code JAXBContext} such as
+     * <ol>
+     *   <li>failure to locate either ObjectFactory.class or jaxb.index in the packages</li>
+     *   <li>an ambiguity among global elements contained in the contextPath</li>
+     *   <li>failure to locate a value for the context factory provider property</li>
+     *   <li>mixing schema derived packages from different providers on the same contextPath</li>
+     *   <li>packages are not open to {@code java.xml.bind} module</li>
+     * </ol>
      */
     public static JAXBContext newInstance( String contextPath )
             throws JAXBException {
@@ -414,16 +424,26 @@
      * <p>
      * The steps involved in discovering the JAXB implementation is discussed in the class javadoc.
      *
-     * @param contextPath list of java package names that contain schema
-     *                    derived class and/or java to schema (JAXB-annotated)
-     *                    mapped classes
+     * @param contextPath
+     *      List of java package names that contain schema
+     *      derived class and/or java to schema (JAXB-annotated)
+     *      mapped classes.
+     *      Packages in {@code contextPath} that are in named modules must be
+     *      {@linkplain java.lang.Module#isOpen open} to at least the {@code java.xml.bind} module.
      * @param classLoader
      *      This class loader will be used to locate the implementation
      *      classes.
      *
      * @return a new instance of a {@code JAXBContext}
      * @throws JAXBException if an error was encountered while creating the
-     *               {@code JAXBContext}. See {@link JAXBContext#newInstance(String, ClassLoader, Map)} for details.
+     *                       {@code JAXBContext} such as
+     * <ol>
+     *   <li>failure to locate either ObjectFactory.class or jaxb.index in the packages</li>
+     *   <li>an ambiguity among global elements contained in the contextPath</li>
+     *   <li>failure to locate a value for the context factory provider property</li>
+     *   <li>mixing schema derived packages from different providers on the same contextPath</li>
+     *   <li>packages are not open to {@code java.xml.bind} module</li>
+     * </ol>
      */
     public static JAXBContext newInstance( String contextPath, ClassLoader classLoader ) throws JAXBException {
 
@@ -442,7 +462,12 @@
      * The interpretation of properties is up to implementations. Implementations must
      * throw {@code JAXBException} if it finds properties that it doesn't understand.
      *
-     * @param contextPath list of java package names that contain schema derived classes
+     * @param contextPath
+     *      List of java package names that contain schema
+     *      derived class and/or java to schema (JAXB-annotated)
+     *      mapped classes.
+     *      Packages in {@code contextPath} that are in named modules must be
+     *      {@linkplain java.lang.Module#isOpen open} to at least the {@code java.xml.bind} module.
      * @param classLoader
      *      This class loader will be used to locate the implementation classes.
      * @param properties
@@ -457,6 +482,7 @@
      *   <li>an ambiguity among global elements contained in the contextPath</li>
      *   <li>failure to locate a value for the context factory provider property</li>
      *   <li>mixing schema derived packages from different providers on the same contextPath</li>
+     *   <li>packages are not open to {@code java.xml.bind} module</li>
      * </ol>
      * @since 1.6, JAXB 2.0
      */
@@ -588,15 +614,27 @@
      * The steps involved in discovering the JAXB implementation is discussed in the class javadoc.
      *
      * @param classesToBeBound
-     *      list of java classes to be recognized by the new {@link JAXBContext}.
+     *      List of java classes to be recognized by the new {@link JAXBContext}.
+     *      Classes in {@code classesToBeBound} that are in named modules must be in a package
+     *      that is {@linkplain java.lang.Module#isOpen open} to at least the {@code java.xml.bind} module.
      *      Can be empty, in which case a {@link JAXBContext} that only knows about
      *      spec-defined classes will be returned.
      *
      * @return
      *      A new instance of a {@code JAXBContext}.
      *
-     * @throws JAXBException if an error was encountered while creating the
-     *               {@code JAXBContext}. See {@link JAXBContext#newInstance(Class[], Map)} for details.
+     * @throws JAXBException
+     *      if an error was encountered while creating the
+     *      {@code JAXBContext}, such as (but not limited to):
+     * <ol>
+     *  <li>No JAXB implementation was discovered
+     *  <li>Classes use JAXB annotations incorrectly
+     *  <li>Classes have colliding annotations (i.e., two classes with the same type name)
+     *  <li>The JAXB implementation was unable to locate
+     *      provider-specific out-of-band information (such as additional
+     *      files generated at the development time.)
+     *  <li>{@code classesToBeBound} are not open to {@code java.xml.bind} module
+     * </ol>
      *
      * @throws IllegalArgumentException
      *      if the parameter contains {@code null} (i.e., {@code newInstance(null);})
@@ -621,7 +659,9 @@
      * throw {@code JAXBException} if it finds properties that it doesn't understand.
      *
      * @param classesToBeBound
-     *      list of java classes to be recognized by the new {@link JAXBContext}.
+     *      List of java classes to be recognized by the new {@link JAXBContext}.
+     *      Classes in {@code classesToBeBound} that are in named modules must be in a package
+     *      that is {@linkplain java.lang.Module#isOpen open} to at least the {@code java.xml.bind} module.
      *      Can be empty, in which case a {@link JAXBContext} that only knows about
      *      spec-defined classes will be returned.
      * @param properties
@@ -641,6 +681,7 @@
      *  <li>The JAXB implementation was unable to locate
      *      provider-specific out-of-band information (such as additional
      *      files generated at the development time.)
+     *  <li>{@code classesToBeBound} are not open to {@code java.xml.bind} module
      * </ol>
      *
      * @throws IllegalArgumentException
@@ -702,6 +743,7 @@
      *                       {@code Validator} object
      * @deprecated since JAXB2.0
      */
+    @Deprecated
     public abstract Validator createValidator() throws JAXBException;
 
     /**
--- a/src/java.xml.bind/share/classes/javax/xml/bind/JAXBContextFactory.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.bind/share/classes/javax/xml/bind/JAXBContextFactory.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -44,7 +44,9 @@
      * For semantics see {@link javax.xml.bind.JAXBContext#newInstance(Class[], java.util.Map)}
      *
      * @param classesToBeBound
-     *      list of java classes to be recognized by the new {@link JAXBContext}.
+     *      List of java classes to be recognized by the new {@link JAXBContext}.
+     *      Classes in {@code classesToBeBound} that are in named modules must be in a package
+     *      that is {@linkplain java.lang.Module#isOpen open} to at least the {@code java.xml.bind} module.
      *      Can be empty, in which case a {@link JAXBContext} that only knows about
      *      spec-defined classes will be returned.
      * @param properties
@@ -56,7 +58,16 @@
      *
      * @throws JAXBException
      *      if an error was encountered while creating the
-     *      {@code JAXBContext}. See {@link JAXBContext#newInstance(Class[], Map)} for details.
+     *      {@code JAXBContext}, such as (but not limited to):
+     * <ol>
+     *  <li>No JAXB implementation was discovered
+     *  <li>Classes use JAXB annotations incorrectly
+     *  <li>Classes have colliding annotations (i.e., two classes with the same type name)
+     *  <li>The JAXB implementation was unable to locate
+     *      provider-specific out-of-band information (such as additional
+     *      files generated at the development time.)
+     *  <li>{@code classesToBeBound} are not open to {@code java.xml.bind} module
+     * </ol>
      *
      * @throws IllegalArgumentException
      *      if the parameter contains {@code null} (i.e., {@code newInstance(null,someMap);})
@@ -77,7 +88,10 @@
      * The interpretation of properties is up to implementations. Implementations must
      * throw {@code JAXBException} if it finds properties that it doesn't understand.
      *
-     * @param contextPath list of java package names that contain schema derived classes
+     * @param contextPath
+     *      List of java package names that contain schema derived classes.
+     *      Classes in {@code classesToBeBound} that are in named modules must be in a package
+     *      that is {@linkplain java.lang.Module#isOpen open} to at least the {@code java.xml.bind} module.
      * @param classLoader
      *      This class loader will be used to locate the implementation classes.
      * @param properties
@@ -86,7 +100,14 @@
      *
      * @return a new instance of a {@code JAXBContext}
      * @throws JAXBException if an error was encountered while creating the
-     *      {@code JAXBContext}. See {@link JAXBContext#newInstance(String, ClassLoader, Map)} for details.
+     *                       {@code JAXBContext} such as
+     * <ol>
+     *   <li>failure to locate either ObjectFactory.class or jaxb.index in the packages</li>
+     *   <li>an ambiguity among global elements contained in the contextPath</li>
+     *   <li>failure to locate a value for the context factory provider property</li>
+     *   <li>mixing schema derived packages from different providers on the same contextPath</li>
+     *   <li>packages are not open to {@code java.xml.bind} module</li>
+     * </ol>
      *
      * @since 9, JAXB 2.3
      */
--- a/src/java.xml.bind/share/classes/javax/xml/bind/Messages.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.bind/share/classes/javax/xml/bind/Messages.java	Mon Jul 10 15:54:38 2017 +0200
@@ -91,4 +91,10 @@
 
     static final String ILLEGAL_CAST = // 2 args
         "JAXBContext.IllegalCast";
+
+    static final String ERROR_LOAD_CLASS = // 2 args
+            "ContextFinder.ErrorLoadClass";
+
+    static final String JAXB_CLASSES_NOT_OPEN = // 1 arg
+            "JAXBClasses.notOpen";
 }
--- a/src/java.xml.bind/share/classes/javax/xml/bind/Messages.properties	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.bind/share/classes/javax/xml/bind/Messages.properties	Mon Jul 10 15:54:38 2017 +0200
@@ -44,6 +44,11 @@
 ContextFinder.NoPackageInContextPath = \
     No package name is given
 
+ContextFinder.ErrorLoadClass = \
+    Error loading class {0} listed in {1}, make sure that entries are accessable \
+    on CLASSPATH and of the form ClassName or OuterClass.InnerClass \
+    not ClassName.class or fully.qualified.ClassName
+
 PropertyException.NameValue = \
         name: {0} value: {1}
 
@@ -52,3 +57,6 @@
 
 JAXBContext.IllegalCast = \
     ClassCastException: attempting to cast {0} to {1}.  Please make sure that you are specifying the proper ClassLoader.
+
+JAXBClasses.notOpen = \
+    Package {0} with JAXB class {1} defined in a module {2} must be open to at least java.xml.bind module.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.xml.bind/share/classes/javax/xml/bind/ModuleUtil.java	Mon Jul 10 15:54:38 2017 +0200
@@ -0,0 +1,160 @@
+/*
+ * 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javax.xml.bind;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.lang.Module;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Propagates openness of JAXB annottated classess packages to JAXB impl module.
+ *
+ * @author Roman Grigoriadi
+ */
+class ModuleUtil {
+
+    private static Logger logger = Logger.getLogger("javax.xml.bind");
+
+    /**
+     * Resolves classes from context path.
+     * Only one class per package is needed to access its {@link java.lang.Module}
+     */
+    static Class[] getClassesFromContextPath(String contextPath, ClassLoader classLoader) throws JAXBException {
+        List<Class> classes = new ArrayList<>();
+        if (contextPath == null || contextPath.isEmpty()){
+          return classes.toArray(new Class[]{});
+        }
+
+        String [] tokens = contextPath.split(":");
+        for (String pkg : tokens){
+
+           // look for ObjectFactory and load it
+           final Class<?> o;
+           try {
+               o = classLoader.loadClass(pkg+".ObjectFactory");
+               classes.add(o);
+               continue;
+           } catch (ClassNotFoundException e) {
+               // not necessarily an error
+           }
+
+           // look for jaxb.index and load the list of classes
+           try {
+               final Class firstByJaxbIndex = findFirstByJaxbIndex(pkg, classLoader);
+               if (firstByJaxbIndex != null) {
+                   classes.add(firstByJaxbIndex);
+               }
+           } catch (IOException e) {
+               throw new JAXBException(e);
+           }
+        }
+
+        if (logger.isLoggable(Level.FINE)) {
+            logger.log(Level.FINE, "Resolved classes from context path: {0}", classes);
+        }
+        return classes.toArray(new Class[]{});
+    }
+
+    /**
+     * Find first class in package by {@code jaxb.index} file.
+     */
+    static Class findFirstByJaxbIndex(String pkg, ClassLoader classLoader) throws IOException, JAXBException {
+        final String resource = pkg.replace('.', '/') + "/jaxb.index";
+        final InputStream resourceAsStream = classLoader.getResourceAsStream(resource);
+
+        if (resourceAsStream == null) {
+            return null;
+        }
+
+        BufferedReader in =
+                new BufferedReader(new InputStreamReader(resourceAsStream, "UTF-8"));
+        try {
+            String className = in.readLine();
+            while (className != null) {
+                className = className.trim();
+                if (className.startsWith("#") || (className.length() == 0)) {
+                    className = in.readLine();
+                    continue;
+                }
+
+                try {
+                    return classLoader.loadClass(pkg + '.' + className);
+                } catch (ClassNotFoundException e) {
+                    throw new JAXBException(Messages.format(Messages.ERROR_LOAD_CLASS, className, pkg), e);
+                }
+
+            }
+        } finally {
+            in.close();
+        }
+        return null;
+    }
+
+    /**
+     * Implementation may be defined in other module than {@code java.xml.bind}. In that case openness
+     * {@linkplain Module#isOpen open} of classes should be delegated to implementation module.
+     *
+     * @param classes used to resolve module for {@linkplain Module#addOpens(String, Module)}
+     * @param factorySPI used to resolve {@link Module} of the implementation.
+     *
+     * @throws JAXBException if ony of a classes package is not open to {@code java.xml.bind} module.
+     */
+    static void delegateAddOpensToImplModule(Class[] classes, Class<?> factorySPI) throws JAXBException {
+        final Module implModule = factorySPI.getModule();
+        if (!implModule.isNamed()) {
+            return;
+        }
+
+        Module jaxbModule = JAXBContext.class.getModule();
+
+        for (Class cls : classes) {
+            final Module classModule = cls.getModule();
+            final String packageName = cls.getPackageName();
+            //no need for unnamed
+            if (!classModule.isNamed()) {
+                continue;
+            }
+            //report error if they are not open to java.xml.bind
+            if (!classModule.isOpen(packageName, jaxbModule)) {
+                throw new JAXBException(Messages.format(Messages.JAXB_CLASSES_NOT_OPEN,
+                                                        packageName, cls.getName(), classModule.getName()));
+            }
+            //propagate openness to impl module
+            classModule.addOpens(packageName, implModule);
+            if (logger.isLoggable(Level.FINE)) {
+                logger.log(Level.FINE, "Propagating openness of package {0} in {1} to {2}.",
+                           new String[]{ packageName, classModule.getName(), implModule.getName() });
+            }
+        }
+    }
+
+}
--- a/src/java.xml.bind/share/classes/javax/xml/bind/Unmarshaller.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.bind/share/classes/javax/xml/bind/Unmarshaller.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -23,6 +23,8 @@
  * questions.
  */
 
+
+
 package javax.xml.bind;
 
 import javax.xml.bind.annotation.adapters.XmlAdapter;
@@ -975,7 +977,6 @@
      * {@link #isValidating()} API as well as access to the Schema object.
      * To determine if the Unmarshaller has validation enabled, simply
      * test the return type for null:
-     * <p>
      * <pre>{@code
      *   boolean isValidating = u.getSchema()!=null;
      * }</pre>
--- a/src/java.xml.bind/share/classes/module-info.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.bind/share/classes/module-info.java	Mon Jul 10 15:54:38 2017 +0200
@@ -26,19 +26,22 @@
 /**
  * Defines the Java Architecture for XML Binding (JAXB) API.
  *
+ * <p> This module is upgradeable.
+ *
+ * @uses javax.xml.bind.JAXBContextFactory
+ *
  * @moduleGraph
  * @since 9
  */
 @Deprecated(since="9", forRemoval=true)
 module java.xml.bind {
-    requires transitive java.activation;
-    requires transitive java.xml;
     requires java.compiler;
     requires java.desktop;
     requires java.logging;
     requires jdk.unsupported;
 
-    uses javax.xml.bind.JAXBContextFactory;
+    requires transitive java.activation;
+    requires transitive java.xml;
 
     exports javax.xml.bind;
     exports javax.xml.bind.annotation;
@@ -46,6 +49,7 @@
     exports javax.xml.bind.attachment;
     exports javax.xml.bind.helpers;
     exports javax.xml.bind.util;
+
     exports com.sun.istack.internal to
         java.xml.ws,
         jdk.xml.bind,
@@ -145,4 +149,7 @@
         java.xml.ws,
         jdk.xml.bind,
         jdk.xml.ws;
+
+    uses javax.xml.bind.JAXBContextFactory;
+
 }
--- a/src/java.xml.ws.annotation/share/classes/module-info.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws.annotation/share/classes/module-info.java	Mon Jul 10 15:54:38 2017 +0200
@@ -27,6 +27,8 @@
  * Defines a subset of the Common Annotations API to support programs running
  * on the Java SE Platform.
  *
+ * <p> This module is upgradeable.
+ *
  * @moduleGraph
  * @since 9
  */
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/client/p2p/HttpSOAPConnection.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/client/p2p/HttpSOAPConnection.java	Mon Jul 10 15:54:38 2017 +0200
@@ -76,6 +76,7 @@
         }
     }
 
+    @Override
     public void close() throws SOAPException {
         if (closed) {
             log.severe("SAAJ0002.p2p.close.already.closed.conn");
@@ -86,6 +87,7 @@
         closed = true;
     }
 
+    @Override
    public SOAPMessage call(SOAPMessage message, Object endPoint)
         throws SOAPException {
         if (closed) {
@@ -348,6 +350,7 @@
     // Object identifies where the request should be sent.
     // It is required to support objects of type String and java.net.URL.
 
+    @Override
     public SOAPMessage get(Object endPoint) throws SOAPException {
         if (closed) {
             log.severe("SAAJ0011.p2p.get.already.closed.conn");
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/client/p2p/HttpSOAPConnectionFactory.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/client/p2p/HttpSOAPConnectionFactory.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -34,6 +34,7 @@
  */
 public class HttpSOAPConnectionFactory extends SOAPConnectionFactory {
 
+    @Override
     public SOAPConnection createConnection()
         throws SOAPException
     {
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/MessagingException.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/MessagingException.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -116,6 +116,7 @@
      * Produce the message, include the message from the nested
      * exception if there is one.
      */
+    @Override
     public String getMessage() {
         if (next == null)
             return super.getMessage();
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/BMMimeMultipart.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/BMMimeMultipart.java	Mon Jul 10 15:54:38 2017 +0200
@@ -28,18 +28,20 @@
  */
 
 
-
 package com.sun.xml.internal.messaging.saaj.packaging.mime.internet;
 
-import java.io.*;
-import java.util.BitSet;
+import com.sun.xml.internal.messaging.saaj.packaging.mime.MessagingException;
+import com.sun.xml.internal.messaging.saaj.packaging.mime.util.ASCIIUtility;
+import com.sun.xml.internal.messaging.saaj.packaging.mime.util.OutputUtil;
+import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream;
 
 import javax.activation.DataSource;
-
-import com.sun.xml.internal.messaging.saaj.packaging.mime.*;
-import com.sun.xml.internal.messaging.saaj.packaging.mime.util.*;
-
-import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream;
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.BitSet;
 
 /**
  * The MimeMultipart class is an implementation of the abstract Multipart
@@ -67,11 +69,10 @@
  * subtype by using the <code>MimeMultipart(String subtype)</code>
  * constructor.  For example, to create a "multipart/alternative" object,
  * use <code>new MimeMultipart("alternative")</code>.
- *
  */
 
 //TODO: cleanup the SharedInputStream handling
-public  class BMMimeMultipart extends MimeMultipart {
+public class BMMimeMultipart extends MimeMultipart {
 
     /*
      * When true it indicates parsing hasnt been done at all
@@ -120,12 +121,12 @@
      */
     public BMMimeMultipart(String subtype) {
         super(subtype);
-        /*
-         * Compute a boundary string.
-        String boundary = UniqueValue.getUniqueBoundaryValue();
-        ContentType cType = new ContentType("multipart", subtype, null);
+    /*
+     * Compute a boundary string.
+    String boundary = UniqueValue.getUniqueBoundaryValue();
+    ContentType cType = new ContentType("multipart", subtype, null);
         contentType.setParameter("boundary", boundary);
-         */
+     */
     }
 
     /**
@@ -144,25 +145,25 @@
      * skips the 'preamble' and reads bytes till the terminating
      * boundary and creates MimeBodyParts for each part of the stream.
      *
-     * @param   ds      DataSource, can be a MultipartDataSource.
-     * @param   ct      content type.
-     * @exception MessagingException in case of error.
+     * @param   ct  content type.
+     * @param   ds  DataSource, can be a MultipartDataSource.
+     * @throws  MessagingException in case of error.
      */
     public BMMimeMultipart(DataSource ds, ContentType ct)
-        throws MessagingException {
-        super(ds,ct);
+            throws MessagingException {
+        super(ds, ct);
         boundary = ct.getParameter("boundary");
         /*
-        if (ds instanceof MultipartDataSource) {
-            // ask super to do this for us.
-            setMultipartDataSource((MultipartDataSource)ds);
-            return;
-        }
+    if (ds instanceof MultipartDataSource) {
+        // ask super to do this for us.
+        setMultipartDataSource((MultipartDataSource)ds);
+        return;
+    }
 
-        // 'ds' was not a MultipartDataSource, we have
-        // to parse this ourself.
-        parsed = false;
-        this.ds = ds;
+    // 'ds' was not a MultipartDataSource, we have
+    // to parse this ourself.
+    parsed = false;
+    this.ds = ds;
         if (ct==null)
             contentType = new ContentType(ds.getContentType());
         else
@@ -177,8 +178,8 @@
             try {
                 in = ds.getInputStream();
                 if (!(in instanceof ByteArrayInputStream) &&
-                    !(in instanceof BufferedInputStream) &&
-                    !(in instanceof SharedInputStream))
+                        !(in instanceof BufferedInputStream) &&
+                        !(in instanceof SharedInputStream))
                     in = new BufferedInputStream(in);
             } catch (Exception ex) {
                 throw new MessagingException("No inputstream from datasource");
@@ -186,7 +187,7 @@
 
             if (!in.markSupported()) {
                 throw new MessagingException(
-                    "InputStream does not support Marking");
+                        "InputStream does not support Marking");
             }
         }
         return in;
@@ -199,10 +200,10 @@
      * method is called by all other methods that need data for
      * the body parts, to make sure the data has been parsed.
      *
-     * @since   JavaMail 1.2
+     * @since JavaMail 1.2
      */
     @Override
-    protected  void parse() throws  MessagingException {
+    protected void parse() throws MessagingException {
         if (parsed)
             return;
 
@@ -210,7 +211,7 @@
 
         SharedInputStream sin = null;
         if (in instanceof SharedInputStream) {
-            sin = (SharedInputStream)in;
+            sin = (SharedInputStream) in;
         }
 
         String bnd = "--" + boundary;
@@ -231,8 +232,8 @@
     }
 
     public MimeBodyPart getNextPart(
-        InputStream stream, byte[] pattern, SharedInputStream sin)
-        throws Exception {
+            InputStream stream, byte[] pattern, SharedInputStream sin)
+            throws Exception {
 
         if (!stream.markSupported()) {
             throw new Exception("InputStream does not support Marking");
@@ -242,7 +243,7 @@
             compile(pattern);
             if (!skipPreamble(stream, pattern, sin)) {
                 throw new Exception(
-                    "Missing Start Boundary, or boundary does not start on a new line");
+                        "Missing Start Boundary, or boundary does not start on a new line");
             }
             begining = false;
         }
@@ -256,7 +257,7 @@
             b = readHeaders(stream);
             if (b == -1) {
                 throw new Exception(
-                    "End of Stream encountered while reading part headers");
+                        "End of Stream encountered while reading part headers");
             }
             long[] v = new long[1];
             v[0] = -1; // just to ensure the code later sets it correctly
@@ -276,7 +277,7 @@
         } else {
             InternetHeaders headers = createInternetHeaders(stream);
             ByteOutputStream baos = new ByteOutputStream();
-            b = readBody(stream, pattern, null,baos, null);
+            b = readBody(stream, pattern, null, baos, null);
             // looks like this check has to be disabled
             // in the old impl it is allowed to have Mime Package
             // without closing boundary
@@ -286,7 +287,7 @@
                 }
             }
             MimeBodyPart mbp = createMimeBodyPart(
-                headers, baos.getBytes(), baos.getCount());
+                    headers, baos.getBytes(), baos.getCount());
             addBodyPart(mbp);
             return mbp;
         }
@@ -294,11 +295,11 @@
     }
 
     public boolean parse(
-        InputStream stream, byte[] pattern, SharedInputStream sin)
-        throws Exception {
+            InputStream stream, byte[] pattern, SharedInputStream sin)
+            throws Exception {
 
         while (!lastPartFound.get(0) && (b != -1)) {
-           getNextPart(stream, pattern, sin);
+            getNextPart(stream, pattern, sin);
         }
         return true;
     }
@@ -307,7 +308,7 @@
         // if the headers are to end properly then there has to be CRLF
         // actually we just need to mark the start and end positions
         int b = is.read();
-        while(b != -1) {
+        while (b != -1) {
             // when it is a shared input stream no need to copy
             if (b == '\r') {
                 b = is.read();
@@ -316,7 +317,7 @@
                     if (b == '\r') {
                         b = is.read();
                         if (b == '\n') {
-                           return b;
+                            return b;
                         } else {
                             continue;
                         }
@@ -331,43 +332,43 @@
         }
         if (b == -1) {
             throw new Exception(
-            "End of inputstream while reading Mime-Part Headers");
+                    "End of inputstream while reading Mime-Part Headers");
         }
         return b;
     }
 
     private int readBody(
-        InputStream is, byte[] pattern, long[] posVector,
-        ByteOutputStream baos, SharedInputStream sin)
-        throws Exception {
+            InputStream is, byte[] pattern, long[] posVector,
+            ByteOutputStream baos, SharedInputStream sin)
+            throws Exception {
         if (!find(is, pattern, posVector, baos, sin)) {
             throw new Exception(
-            "Missing boundary delimitier while reading Body Part");
+                    "Missing boundary delimitier while reading Body Part");
         }
         return b;
     }
 
     private boolean skipPreamble(
-        InputStream is, byte[] pattern, SharedInputStream sin)
-        throws Exception {
+            InputStream is, byte[] pattern, SharedInputStream sin)
+            throws Exception {
         if (!find(is, pattern, sin)) {
             return false;
         }
         if (lastPartFound.get(0)) {
             throw new Exception(
-            "Found closing boundary delimiter while trying to skip preamble");
+                    "Found closing boundary delimiter while trying to skip preamble");
         }
         return true;
     }
 
 
-    public int  readNext(InputStream is, byte[] buff, int patternLength,
-        BitSet eof, long[] posVector, SharedInputStream sin)
-        throws Exception {
+    public int readNext(InputStream is, byte[] buff, int patternLength,
+                        BitSet eof, long[] posVector, SharedInputStream sin)
+            throws Exception {
 
         int bufferLength = is.read(buffer, 0, patternLength);
         if (bufferLength == -1) {
-           eof.flip(0);
+            eof.flip(0);
         } else if (bufferLength < patternLength) {
             //repeatedly read patternLength - bufferLength
             int temp = 0;
@@ -385,18 +386,18 @@
                     }
                     break;
                 }
-                buffer[i] = (byte)temp;
+                buffer[i] = (byte) temp;
             }
-            bufferLength=i;
+            bufferLength = i;
         }
         return bufferLength;
     }
 
     public boolean find(InputStream is, byte[] pattern, SharedInputStream sin)
-        throws Exception {
+            throws Exception {
         int i;
         int l = pattern.length;
-        int lx = l -1;
+        int lx = l - 1;
         BitSet eof = new BitSet(1);
         long[] posVector = new long[1];
 
@@ -409,12 +410,12 @@
             }
 
             /*
-            if (bufferLength < l) {
-                //is.reset();
-                return false;
-            }*/
+        if (bufferLength < l) {
+            //is.reset();
+        return false;
+        }*/
 
-            for(i = lx; i >= 0; i--) {
+            for (i = lx; i >= 0; i--) {
                 if (buffer[i] != pattern[i]) {
                     break;
                 }
@@ -435,11 +436,11 @@
     }
 
     public boolean find(
-        InputStream is, byte[] pattern, long[] posVector,
-        ByteOutputStream out, SharedInputStream sin) throws Exception {
+            InputStream is, byte[] pattern, long[] posVector,
+            ByteOutputStream out, SharedInputStream sin) throws Exception {
         int i;
         int l = pattern.length;
-        int lx = l -1;
+        int lx = l - 1;
         int bufferLength = 0;
         int s = 0;
         long endPos = -1;
@@ -466,7 +467,7 @@
                 // looks like it is allowed to not have a closing boundary
                 //return false;
                 //if (sin != null) {
-                 //   posVector[0] = endPos;
+                //   posVector[0] = endPos;
                 //}
                 b = -1;
                 if ((s == l) && (sin == null)) {
@@ -482,7 +483,7 @@
                 } else {
                     // looks like it is allowed to not have a closing boundary
                     // in the old implementation
-                        out.write(buffer, 0, bufferLength);
+                    out.write(buffer, 0, bufferLength);
                 }
                 // looks like it is allowed to not have a closing boundary
                 // in the old implementation
@@ -491,7 +492,7 @@
                 return true;
             }
 
-            for(i = lx; i >= 0; i--) {
+            for (i = lx; i >= 0; i--) {
                 if (buffer[i] != pattern[i]) {
                     break;
                 }
@@ -507,7 +508,7 @@
                         if (s == 2) {
                             if (prevBuffer[1] == '\n') {
                                 if (prevBuffer[0] != '\r' && prevBuffer[0] != '\n') {
-                                    out.write(prevBuffer,0,1);
+                                    out.write(prevBuffer, 0, 1);
                                 }
                                 if (sin != null) {
                                     posVector[0] = endPos;
@@ -516,15 +517,15 @@
                             } else {
                                 throw new Exception(
                                         "Boundary characters encountered in part Body " +
-                                        "without a preceeding CRLF");
+                                                "without a preceeding CRLF");
                             }
 
-                        } else if (s==1) {
+                        } else if (s == 1) {
                             if (prevBuffer[0] != '\n') {
                                 throw new Exception(
                                         "Boundary characters encountered in part Body " +
-                                        "without a preceeding CRLF");
-                            }else {
+                                                "without a preceeding CRLF");
+                            } else {
                                 if (sin != null) {
                                     posVector[0] = endPos;
                                 }
@@ -532,13 +533,13 @@
                         }
 
                     } else if (s > 2) {
-                        if ((prevBuffer[s-2] == '\r') && (prevBuffer[s-1] == '\n')) {
+                        if ((prevBuffer[s - 2] == '\r') && (prevBuffer[s - 1] == '\n')) {
                             if (sin != null) {
                                 posVector[0] = endPos - 2;
                             } else {
                                 out.write(prevBuffer, 0, s - 2);
                             }
-                        } else if (prevBuffer[s-1] == '\n') {
+                        } else if (prevBuffer[s - 1] == '\n') {
                             //old impl allowed just a \n
                             if (sin != null) {
                                 posVector[0] = endPos - 1;
@@ -547,8 +548,8 @@
                             }
                         } else {
                             throw new Exception(
-                                "Boundary characters encountered in part Body " +
-                                "without a preceeding CRLF");
+                                    "Boundary characters encountered in part Body " +
+                                            "without a preceeding CRLF");
                         }
                     }
                 }
@@ -561,22 +562,22 @@
             }
 
             if ((s > 0) && (sin == null)) {
-                if (prevBuffer[s-1] == (byte)13) {
+                if (prevBuffer[s - 1] == (byte) 13) {
                     // if buffer[0] == (byte)10
-                    if (buffer[0] == (byte)10) {
+                    if (buffer[0] == (byte) 10) {
                         int j;
-                        for(j = lx-1; j > 0; j--) {
-                            if (buffer[j+1] != pattern[j]) {
+                        for (j = lx - 1; j > 0; j--) {
+                            if (buffer[j + 1] != pattern[j]) {
                                 break;
-                             }
-                         }
-                         if (j == 0) {
-                             // matched the pattern excluding the last char of the pattern
-                             // so dont write the CR into stream
-                             out.write(prevBuffer,0,s-1);
-                         } else {
-                             out.write(prevBuffer,0,s);
-                         }
+                            }
+                        }
+                        if (j == 0) {
+                            // matched the pattern excluding the last char of the pattern
+                            // so dont write the CR into stream
+                            out.write(prevBuffer, 0, s - 1);
+                        } else {
+                            out.write(prevBuffer, 0, s);
+                        }
                     } else {
                         out.write(prevBuffer, 0, s);
                     }
@@ -612,20 +613,20 @@
                 return true;
             } else {
                 throw new Exception(
-                    "transport padding after a Mime Boundary  should end in a CRLF, found CR only");
+                        "transport padding after a Mime Boundary  should end in a CRLF, found CR only");
             }
         }
 
         if (b == '-') {
             b = is.read();
             if (b != '-') {
-               throw new Exception(
-                   "Unexpected singular '-' character after Mime Boundary");
+                throw new Exception(
+                        "Unexpected singular '-' character after Mime Boundary");
             } else {
                 //System.out.println("Last Part Found");
                 lastPartFound.flip(0);
                 // read the next char
-                b  = is.read();
+                b = is.read();
             }
         }
 
@@ -641,7 +642,7 @@
                     b = is.read();
                 }
                 if (b == '\n') {
-                   return true;
+                    return true;
                 }
             }
         }
@@ -673,7 +674,8 @@
 
         // Initialise Good Suffix Shift table
         gss = new int[l];
-  NEXT: for (i = l; i > 0; i--) {
+        NEXT:
+        for (i = l; i > 0; i--) {
             // j is the beginning index of suffix being considered
             for (j = l - 1; j >= i; j--) {
                 // Testing for good suffix
@@ -681,9 +683,9 @@
                     // pattern[j..len] is a good suffix
                     gss[j - 1] = i;
                 } else {
-                   // No match. The array has already been
-                   // filled up with correct values before.
-                   continue NEXT;
+                    // No match. The array has already been
+                    // filled up with correct values before.
+                    continue NEXT;
                 }
             }
             while (j > 0) {
@@ -756,6 +758,7 @@
             this.contentType.setParameter("boundary", bnd);
         }
     }
+
     public String getBoundary() {
         return this.boundary;
     }
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/InternetHeaders.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/InternetHeaders.java	Mon Jul 10 15:54:38 2017 +0200
@@ -320,15 +320,15 @@
      * @return list of header lines.
      */
     public List<String> getAllHeaderLines() {
-        if(headerValueView==null)
+        if (headerValueView == null)
             headerValueView = new AbstractList<String>() {
                 @Override
-                                public String get(int index) {
+                public String get(int index) {
                     return headers.get(index).line;
                 }
 
                 @Override
-                                public int size() {
+                public int size() {
                     return headers.size();
                 }
             };
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/MimeMultipart.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/MimeMultipart.java	Mon Jul 10 15:54:38 2017 +0200
@@ -31,15 +31,21 @@
 
 package com.sun.xml.internal.messaging.saaj.packaging.mime.internet;
 
-import java.io.*;
+import com.sun.xml.internal.messaging.saaj.packaging.mime.MessagingException;
+import com.sun.xml.internal.messaging.saaj.packaging.mime.MultipartDataSource;
+import com.sun.xml.internal.messaging.saaj.packaging.mime.util.ASCIIUtility;
+import com.sun.xml.internal.messaging.saaj.packaging.mime.util.LineInputStream;
+import com.sun.xml.internal.messaging.saaj.packaging.mime.util.OutputUtil;
+import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream;
+import com.sun.xml.internal.messaging.saaj.util.FinalArrayList;
+import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
 
 import javax.activation.DataSource;
-
-import com.sun.xml.internal.messaging.saaj.packaging.mime.*;
-import com.sun.xml.internal.messaging.saaj.packaging.mime.util.*;
-import com.sun.xml.internal.messaging.saaj.util.FinalArrayList;
-import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream;
-import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
 
 /**
  * The MimeMultipart class is an implementation
@@ -211,7 +217,7 @@
      * @exception       MessagingException if no such MimeBodyPart exists
      */
     public  MimeBodyPart getBodyPart(int index)
-                        throws MessagingException {
+            throws MessagingException {
         parse();
         if (parts == null)
             throw new IndexOutOfBoundsException("No such BodyPart");
@@ -228,19 +234,19 @@
      * @exception       MessagingException if no such MimeBodyPart exists.
      */
     public  MimeBodyPart getBodyPart(String CID)
-                        throws MessagingException {
+            throws MessagingException {
         parse();
 
         int count = getCount();
         for (int i = 0; i < count; i++) {
            MimeBodyPart part = getBodyPart(i);
            String s = part.getContentID();
-           // Old versions of AXIS2 put angle brackets around the content
-           // id but not the start param
-           String sNoAngle = (s!= null) ? s.replaceFirst("^<", "").replaceFirst(">$", "")
-                   :null;
+               // Old versions of AXIS2 put angle brackets around the content
+               // id but not the start param
+               String sNoAngle = (s!= null) ? s.replaceFirst("^<", "").replaceFirst(">$", "")
+                       :null;
            if (s != null && (s.equals(CID) || CID.equals(sNoAngle)))
-                return part;
+               return part;
         }
         return null;
     }
@@ -319,14 +325,14 @@
         try {
             in = ds.getInputStream();
             if (!(in instanceof ByteArrayInputStream) &&
-                !(in instanceof BufferedInputStream) &&
-                !(in instanceof SharedInputStream))
+                    !(in instanceof BufferedInputStream) &&
+                    !(in instanceof SharedInputStream))
                 in = new BufferedInputStream(in);
         } catch (Exception ex) {
             throw new MessagingException("No inputstream from datasource");
         }
         if (in instanceof SharedInputStream)
-            sin = (SharedInputStream)in;
+            sin = (SharedInputStream) in;
 
         String boundary = "--" + contentType.getParameter("boundary");
         byte[] bndbytes = ASCIIUtility.getBytes(boundary);
@@ -338,12 +344,12 @@
             LineInputStream lin = new LineInputStream(in);
             String line;
             while ((line = lin.readLine()) != null) {
-                /*
-                 * Strip trailing whitespace.  Can't use trim method
-                 * because it's too aggressive.  Some bogus MIME
-                 * messages will include control characters in the
-                 * boundary string.
-                 */
+        /*
+         * Strip trailing whitespace.  Can't use trim method
+         * because it's too aggressive.  Some bogus MIME
+         * messages will include control characters in the
+         * boundary string.
+         */
                 int i;
                 for (i = line.length() - 1; i >= 0; i--) {
                     char c = line.charAt(i);
@@ -357,12 +363,12 @@
             if (line == null)
                 throw new MessagingException("Missing start boundary");
 
-            /*
-             * Read and process body parts until we see the
-             * terminating boundary line (or EOF).
-             */
+        /*
+         * Read and process body parts until we see the
+         * terminating boundary line (or EOF).
+         */
             boolean done = false;
-        getparts:
+            getparts:
             while (!done) {
                 InternetHeaders headers = null;
                 if (sin != null) {
@@ -372,7 +378,7 @@
                         ;
                     if (line == null) {
                         if (!ignoreMissingEndBoundary) {
-                           throw new MessagingException("Missing End Boundary for Mime Package : EOF while skipping headers");
+                            throw new MessagingException("Missing End Boundary for Mime Package : EOF while skipping headers");
                         }
                         // assume there's just a missing end boundary
                         break getparts;
@@ -397,7 +403,7 @@
                 /*
                  * Read and save the content bytes in buf.
                  */
-                for (;;) {
+                for (; ; ) {
                     if (bol) {
                         /*
                          * At the beginning of a line, check whether the
@@ -416,7 +422,7 @@
                                 if (in.read() == '-') {
                                     done = true;
                                     foundClosingBoundary = true;
-                                    break;      // ignore trailing text
+                                    break;    // ignore trailing text
                                 }
                             }
                             // skip linear whitespace
@@ -424,12 +430,12 @@
                                 b2 = in.read();
                             // check for end of line
                             if (b2 == '\n')
-                                break;  // got it!  break out of the loop
+                                break;    // got it!  break out of the loop
                             if (b2 == '\r') {
                                 in.mark(1);
                                 if (in.read() != '\n')
                                     in.reset();
-                                break;  // got it!  break out of the loop
+                                break;    // got it!  break out of the loop
                             }
                         }
                         // failed to match, reset and proceed normally
@@ -491,7 +497,7 @@
                 buf.close();
         }
 
-        if (!ignoreMissingEndBoundary && !foundClosingBoundary && sin== null) {
+        if (!ignoreMissingEndBoundary && !foundClosingBoundary && sin == null) {
             throw new MessagingException("Missing End Boundary for Mime Package : EOF while skipping headers");
         }
         parsed = true;
@@ -510,7 +516,7 @@
      * @since           JavaMail 1.2
      */
     protected InternetHeaders createInternetHeaders(InputStream is)
-                                throws MessagingException {
+                throws MessagingException {
         return new InternetHeaders(is);
     }
 
@@ -523,12 +529,12 @@
      *
      * @param   headers         the headers for the body part.
      * @param   content         the content of the body part.
-     * @param   len             the content length.
+     * @param   len                     the content length.
      * @return  MimeBodyPart
      * @since                   JavaMail 1.2
      */
     protected MimeBodyPart createMimeBodyPart(InternetHeaders headers, byte[] content, int len) {
-            return new MimeBodyPart(headers, content,len);
+        return new MimeBodyPart(headers, content,len);
     }
 
     /**
@@ -544,7 +550,7 @@
      * @since                   JavaMail 1.2
      */
     protected MimeBodyPart createMimeBodyPart(InputStream is) throws MessagingException {
-            return new MimeBodyPart(is);
+        return new MimeBodyPart(is);
     }
 
     /**
@@ -564,7 +570,7 @@
      * @exception               MessagingException in case of error.
      */
     protected void setMultipartDataSource(MultipartDataSource mp)
-                        throws MessagingException {
+            throws MessagingException {
         contentType = new ContentType(mp.getContentType());
 
         int count = mp.getCount();
@@ -582,7 +588,7 @@
      * @see     #contentType
      */
     public ContentType getContentType() {
-            return contentType;
+        return contentType;
     }
 
     /**
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/MimePartDataSource.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/MimePartDataSource.java	Mon Jul 10 15:54:38 2017 +0200
@@ -28,21 +28,21 @@
  */
 
 
-
 package com.sun.xml.internal.messaging.saaj.packaging.mime.internet;
 
-import java.io.*;
-import java.net.UnknownServiceException;
+import com.sun.xml.internal.messaging.saaj.packaging.mime.MessagingException;
 
 import javax.activation.DataSource;
-
-import com.sun.xml.internal.messaging.saaj.packaging.mime.MessagingException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.UnknownServiceException;
 
 /**
  * A utility class that implements a DataSource out of
  * a MimeBodyPart. This class is primarily meant for service providers.
  *
- * @author      John Mani
+ * @author John Mani
  */
 
 public final class MimePartDataSource implements DataSource {
@@ -68,13 +68,13 @@
      * using the <code>getContentStream()</code> method and decodes
      * it using the <code>MimeUtility.decode()</code> method.
      *
-     * @return  decoded input stream
+     * @return decoded input stream
      */
     @Override
     public InputStream getInputStream() throws IOException {
 
         try {
-        InputStream is = part.getContentStream();
+            InputStream is = part.getContentStream();
 
             String encoding = part.getEncoding();
             if (encoding != null)
@@ -92,7 +92,7 @@
      * This implementation throws the UnknownServiceException.
      */
     @Override
-        public OutputStream getOutputStream() throws IOException {
+    public OutputStream getOutputStream() throws IOException {
         throw new UnknownServiceException();
     }
 
@@ -113,11 +113,11 @@
      * This implementation just returns an empty string.
      */
     @Override
-        public String getName() {
+    public String getName() {
         try {
-                return part.getFileName();
+            return part.getFileName();
         } catch (MessagingException mex) {
-        return "";
+            return "";
         }
     }
 }
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/MimePullMultipart.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/MimePullMultipart.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -113,6 +113,7 @@
        parsed = true;
     }
 
+    @Override
     protected  void parse() throws MessagingException {
         parseAll();
     }
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/ParameterList.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/ParameterList.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, 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
@@ -50,7 +50,7 @@
      * No-arg Constructor.
      */
     public ParameterList() {
-        this.list = new HashMap<String, String>();
+        this.list = new HashMap<>();
     }
 
     private ParameterList(HashMap<String, String> m) {
@@ -73,7 +73,7 @@
         int type;
         String name;
 
-        list = new HashMap<String, String>();
+        list = new HashMap<>();
         while (true) {
             tk = h.next();
             type = tk.getType();
@@ -171,6 +171,7 @@
      *
      * @return          String
      */
+    @Override
     public String toString() {
         return toString(0);
     }
@@ -232,6 +233,6 @@
     }
 
     public ParameterList copy() {
-        return new ParameterList((HashMap)list.clone());
+        return new ParameterList((HashMap<String, String>)list.clone());
     }
 }
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/util/ASCIIUtility.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/util/ASCIIUtility.java	Mon Jul 10 15:54:38 2017 +0200
@@ -32,12 +32,14 @@
 
 import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream;
 
-import java.io.*;
+import java.io.IOException;
+import java.io.InputStream;
 
 public class ASCIIUtility {
 
     // Private constructor so that this class is not instantiated
-    private ASCIIUtility() { }
+    private ASCIIUtility() {
+    }
 
 
     /**
@@ -47,16 +49,14 @@
      *
      * Based on java.lang.Integer.parseInt().
      *
-     * @param b bytes to convert to integer.
+     * @param b     bytes to convert to integer.
      * @param start start of the range.
-     * @param end end of the range (not including).
+     * @param end   end of the range (not including).
      * @param radix radix.
-     *
      * @return integer.
-     *
      */
     public static int parseInt(byte[] b, int start, int end, int radix)
-                throws NumberFormatException {
+            throws NumberFormatException {
         if (b == null)
             throw new NumberFormatException("null");
 
@@ -77,18 +77,18 @@
             }
             multmin = limit / radix;
             if (i < end) {
-                digit = Character.digit((char)b[i++], radix);
+                digit = Character.digit((char) b[i++], radix);
                 if (digit < 0) {
                     throw new NumberFormatException(
-                        "illegal number: " + toString(b, start, end)
-                        );
+                            "illegal number: " + toString(b, start, end)
+                    );
                 } else {
                     result = -digit;
                 }
             }
             while (i < end) {
                 // Accumulating negatively avoids surprises near MAX_VALUE
-                digit = Character.digit((char)b[i++], radix);
+                digit = Character.digit((char) b[i++], radix);
                 if (digit < 0) {
                     throw new NumberFormatException("illegal number");
                 }
@@ -120,56 +120,48 @@
      * array into a String. The range extends from <code>start</code>
      * till, but not including <code>end</code>.
      *
-     * @param b bytes to convert to integer.
+     * @param b     bytes to convert to integer.
      * @param start start of the range.
-     * @param end end of the range (not including).
-     *
+     * @param end   end of the range (not including).
      * @return integer.
-     *
      */
     public static String toString(byte[] b, int start, int end) {
         int size = end - start;
         char[] theChars = new char[size];
 
         for (int i = 0, j = start; i < size; )
-            theChars[i++] = (char)(b[j++]&0xff);
+            theChars[i++] = (char) (b[j++] & 0xff);
 
         return new String(theChars);
     }
 
-        /**
-         * Encodes specified String into a sequence of bytes using the platform's
-         * default charset, storing the result into a new byte array.
-         *
-         * @param s string to encode into byte array.
-         *
-         * @return byte array.
-         *
-         */
+    /**
+     * Encodes specified String into a sequence of bytes using the platform's
+     * default charset, storing the result into a new byte array.
+     *
+     * @param s string to encode into byte array.
+     * @return byte array.
+     */
     public static byte[] getBytes(String s) {
-        char [] chars= s.toCharArray();
+        char[] chars = s.toCharArray();
         int size = chars.length;
         byte[] bytes = new byte[size];
 
-        for (int i = 0; i < size;)
+        for (int i = 0; i < size; )
             bytes[i] = (byte) chars[i++];
         return bytes;
     }
 
     /**
-         * Converts input stream to array.
-         *
-         * @param is stream to convert to array.
-         *
-         * @return byte array.
-         *
-         * @throws IOException if an I/O error occurs.
+     * Converts input stream to array.
      *
-     * @deprecated
-     *      this is an expensive operation that require an additional
-     *      buffer reallocation just to get the array of an exact size.
-     *      Unless you absolutely need the exact size array, don't use this.
-     *      Use {@link ByteOutputStream} and {@link ByteOutputStream#write(InputStream)}.
+     * @param is stream to convert to array.
+     * @return byte array.
+     * @throws IOException if an I/O error occurs.
+     * @deprecated this is an expensive operation that require an additional
+     * buffer reallocation just to get the array of an exact size.
+     * Unless you absolutely need the exact size array, don't use this.
+     * Use {@link ByteOutputStream} and {@link ByteOutputStream#write(InputStream)}.
      */
     @Deprecated
     public static byte[] getBytes(InputStream is) throws IOException {
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/util/QDecoderStream.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/util/QDecoderStream.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -63,6 +63,7 @@
      *             stream is reached.
      * @exception  IOException  if an I/O error occurs.
      */
+    @Override
     public int read() throws IOException {
         int c = in.read();
 
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/util/QPDecoderStream.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/util/QPDecoderStream.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -67,6 +67,7 @@
      *             stream is reached.
      * @exception  IOException  if an I/O error occurs.
      */
+    @Override
     public int read() throws IOException {
         if (spaces > 0) {
             // We have cached space characters, return one
@@ -150,6 +151,7 @@
      *             the stream has been reached.
      * @exception  IOException  if an I/O error occurs.
      */
+    @Override
     public int read(byte[] buf, int off, int len) throws IOException {
         int i, c;
         for (i = 0; i < len; i++) {
@@ -167,6 +169,7 @@
      * Tests if this input stream supports marks. Currently this class
      * does not support marks
      */
+    @Override
     public boolean markSupported() {
         return false;
     }
@@ -178,6 +181,7 @@
      * this method just invokes the <code>available</code> method
      * of the original input stream.
      */
+    @Override
     public int available() throws IOException {
         // This is bogus ! We don't really know how much
         // bytes are available *after* decoding
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/util/QPEncoderStream.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/util/QPEncoderStream.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -81,6 +81,7 @@
      * @param      len   the number of bytes to write.
      * @exception  IOException  if an I/O error occurs.
      */
+    @Override
     public void write(byte[] b, int off, int len) throws IOException {
         for (int i = 0; i < len; i++)
             write(b[off + i]);
@@ -91,6 +92,7 @@
      * @param      b   the data to be written.
      * @exception  IOException  if an I/O error occurs.
      */
+    @Override
     public void write(byte[] b) throws IOException {
         write(b, 0, b.length);
     }
@@ -100,6 +102,7 @@
      * @param      c   the <code>byte</code>.
      * @exception  IOException  if an I/O error occurs.
      */
+    @Override
     public void write(int c) throws IOException {
         c = c & 0xff; // Turn off the MSB.
         if (gotSpace) { // previous character was <SPACE>
@@ -139,6 +142,7 @@
      * to be encoded out to the stream.
      * @exception  IOException  if an I/O error occurs.
      */
+    @Override
     public void flush() throws IOException {
         out.flush();
     }
@@ -147,6 +151,7 @@
      * Forces any buffered output bytes to be encoded out to the stream
      * and closes this output stream
      */
+    @Override
     public void close() throws IOException {
         out.close();
     }
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/util/UUDecoderStream.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/util/UUDecoderStream.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -78,6 +78,7 @@
      * @see        java.io.FilterInputStream#in
      */
 
+    @Override
     public int read() throws IOException {
         if (index >= bufsize) {
             readPrefix();
@@ -88,6 +89,7 @@
         return buffer[index++] & 0xff; // return lower byte
     }
 
+    @Override
     public int read(byte[] buf, int off, int len) throws IOException {
         int i, c;
         for (i = 0; i < len; i++) {
@@ -101,10 +103,12 @@
         return i;
     }
 
+    @Override
     public boolean markSupported() {
         return false;
     }
 
+    @Override
     public int available() throws IOException {
          // This is only an estimate, since in.available()
          // might include CRLFs too ..
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/AttachmentPartImpl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/AttachmentPartImpl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -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
@@ -88,6 +88,7 @@
         }
     }
 
+    @Override
     public int getSize() throws SOAPException {
         if (mimePart != null) {
             try {
@@ -124,6 +125,7 @@
         }
     }
 
+    @Override
     public void clearContent() {
         if (mimePart != null) {
             mimePart.close();
@@ -133,6 +135,7 @@
         rawContent = null;
     }
 
+    @Override
     public Object getContent() throws SOAPException {
         try {
             if (mimePart != null) {
@@ -153,6 +156,7 @@
         }
     }
 
+    @Override
     public void setContent(Object object, String contentType)
         throws IllegalArgumentException {
         if (mimePart != null) {
@@ -165,23 +169,28 @@
     }
 
 
+    @Override
     public DataHandler getDataHandler() throws SOAPException {
         if (mimePart != null) {
             //return an inputstream
             return new DataHandler(new DataSource() {
 
+                @Override
                 public InputStream getInputStream() throws IOException {
                     return mimePart.read();
                 }
 
+                @Override
                 public OutputStream getOutputStream() throws IOException {
                     throw new UnsupportedOperationException("getOutputStream cannot be supported : You have enabled LazyAttachments Option");
                 }
 
+                @Override
                 public String getContentType() {
                     return mimePart.getContentType();
                 }
 
+                @Override
                 public String getName() {
                     return "MIMEPart Wrapper DataSource";
                 }
@@ -197,6 +206,7 @@
         return dataHandler;
     }
 
+    @Override
     public void setDataHandler(DataHandler dataHandler)
         throws IllegalArgumentException {
         if (mimePart != null) {
@@ -216,35 +226,43 @@
         setMimeHeader("Content-Type", dataHandler.getContentType());
     }
 
+    @Override
     public void removeAllMimeHeaders() {
         headers.removeAllHeaders();
     }
 
+    @Override
     public void removeMimeHeader(String header) {
         headers.removeHeader(header);
     }
 
+    @Override
     public String[] getMimeHeader(String name) {
         return headers.getHeader(name);
     }
 
+    @Override
     public void setMimeHeader(String name, String value) {
         headers.setHeader(name, value);
     }
 
+    @Override
     public void addMimeHeader(String name, String value) {
         headers.addHeader(name, value);
     }
 
-    public Iterator getAllMimeHeaders() {
+    @Override
+    public Iterator<MimeHeader> getAllMimeHeaders() {
         return headers.getAllHeaders();
     }
 
-    public Iterator getMatchingMimeHeaders(String[] names) {
+    @Override
+    public Iterator<MimeHeader> getMatchingMimeHeaders(String[] names) {
         return headers.getMatchingHeaders(names);
     }
 
-    public Iterator getNonMatchingMimeHeaders(String[] names) {
+    @Override
+    public Iterator<MimeHeader> getNonMatchingMimeHeaders(String[] names) {
         return headers.getNonMatchingHeaders(names);
     }
 
@@ -329,6 +347,7 @@
         }
     }
 
+    @Override
     public  void setBase64Content(InputStream content, String contentType)
         throws SOAPException {
 
@@ -365,6 +384,7 @@
         }
     }
 
+    @Override
     public  InputStream getBase64Content() throws SOAPException {
         InputStream stream;
         if (mimePart != null) {
@@ -425,6 +445,7 @@
         }
     }
 
+    @Override
     public void setRawContent(InputStream content, String contentType)
         throws SOAPException {
         if (mimePart != null) {
@@ -475,6 +496,7 @@
         }
     } */
 
+    @Override
     public void setRawContentBytes(
         byte[] content, int off, int len, String contentType)
         throws SOAPException {
@@ -498,6 +520,7 @@
         }
     }
 
+    @Override
     public  InputStream getRawContent() throws SOAPException {
         if (mimePart != null) {
             return mimePart.read();
@@ -522,6 +545,7 @@
         }
     }
 
+    @Override
     public  byte[] getRawContentBytes() throws SOAPException {
         InputStream ret;
         if (mimePart != null) {
@@ -556,12 +580,14 @@
     }
 
     // attachments are equal if they are the same reference
+    @Override
     public boolean equals(Object o) {
         return (this == o);
     }
 
     // In JDK 8 we get a warning if we implement equals() but not hashCode().
     // There is no intuitive value for this, the default one in Object is fine.
+    @Override
     public int hashCode() {
         return super.hashCode();
     }
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ContextClassloaderLocal.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ContextClassloaderLocal.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -71,6 +71,7 @@
 
     private static ClassLoader getContextClassLoader() {
         return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+                    @Override
                     public ClassLoader run() {
                         ClassLoader cl = null;
                         try {
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/MessageFactoryImpl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/MessageFactoryImpl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -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
@@ -63,6 +63,7 @@
         return oldListener;
     }
 
+    @Override
     public SOAPMessage createMessage() throws SOAPException {
         throw new UnsupportedOperationException();
     }
@@ -105,6 +106,7 @@
                 "Unable to parse content type: " + e.getMessage());
         }
     }
+    @Override
     public SOAPMessage createMessage(MimeHeaders headers, InputStream in)
         throws SOAPException, IOException {
         String contentTypeString = MessageImpl.getContentType(headers);
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/MessageImpl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/MessageImpl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -87,7 +87,7 @@
     protected boolean saved = false;
     protected byte[] messageBytes;
     protected int messageByteCount;
-    protected HashMap properties = new HashMap();
+    protected Map<String, Object> properties = new HashMap<>();
 
     // used for lazy attachment initialization
     protected MimeMultipart multiPart = null;
@@ -883,17 +883,17 @@
             throw new RuntimeException(e);
         }
         if (attachments == null)
-            attachments = new FinalArrayList<AttachmentPart>();
+            attachments = new FinalArrayList<>();
 
         attachments.add(attachment);
 
         needsSave();
     }
 
-    static private final Iterator nullIter = Collections.EMPTY_LIST.iterator();
+    static private final Iterator<AttachmentPart> nullIter = Collections.<AttachmentPart>EMPTY_LIST.iterator();
 
     @Override
-    public Iterator getAttachments() {
+    public Iterator<AttachmentPart> getAttachments() {
         try {
             initializeAllAttachments();
         } catch (Exception e) {
@@ -963,7 +963,7 @@
     }
 
     @Override
-    public Iterator getAttachments(MimeHeaders headers) {
+    public Iterator<AttachmentPart> getAttachments(MimeHeaders headers) {
         try {
             initializeAllAttachments();
         } catch (Exception e) {
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/SAAJMetaFactoryImpl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/SAAJMetaFactoryImpl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -42,6 +42,7 @@
         Logger.getLogger(LogDomainConstants.SOAP_DOMAIN,
                          "com.sun.xml.internal.messaging.saaj.soap.LocalStrings");
 
+    @Override
     protected  MessageFactory newMessageFactory(String protocol)
         throws SOAPException {
         if (SOAPConstants.SOAP_1_1_PROTOCOL.equals(protocol)) {
@@ -60,6 +61,7 @@
         }
     }
 
+    @Override
     protected  SOAPFactory newSOAPFactory(String protocol)
         throws SOAPException {
         if (SOAPConstants.SOAP_1_1_PROTOCOL.equals(protocol)) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/SOAPDocumentFragment.java	Mon Jul 10 15:54:38 2017 +0200
@@ -0,0 +1,234 @@
+/*
+ * 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.xml.internal.messaging.saaj.soap;
+
+import com.sun.xml.internal.messaging.saaj.soap.impl.NodeListImpl;
+import org.w3c.dom.*;
+
+/**
+ * SAAJ wrapper for {@link DocumentFragment}
+ *
+ * @author Yan GAO.
+ */
+public class SOAPDocumentFragment implements DocumentFragment {
+
+    private SOAPDocumentImpl soapDocument;
+    private DocumentFragment documentFragment;
+
+    public SOAPDocumentFragment(SOAPDocumentImpl ownerDoc) {
+        this.soapDocument = ownerDoc;
+        this.documentFragment = soapDocument.getDomDocument().createDocumentFragment();
+    }
+
+    public SOAPDocumentFragment() {}
+
+    @Override
+    public boolean hasAttributes() {
+        return documentFragment.hasAttributes();
+    }
+
+    @Override
+    public boolean isSameNode(Node other) {
+        return documentFragment.isSameNode(getDomNode(other));
+    }
+
+    @Override
+    public String lookupNamespaceURI(String prefix) {
+        return documentFragment.lookupNamespaceURI(prefix);
+    }
+
+    @Override
+    public Node getParentNode() {
+        return soapDocument.findIfPresent(documentFragment.getParentNode());
+    }
+
+    @Override
+    public Node getFirstChild() {
+        return soapDocument.findIfPresent(documentFragment.getFirstChild());
+    }
+
+    @Override
+    public Object getUserData(String key) {
+        return documentFragment.getUserData(key);
+    }
+
+    @Override
+    public String getTextContent() throws DOMException {
+        return documentFragment.getTextContent();
+    }
+    @Override
+    public short getNodeType() {
+        return documentFragment.getNodeType();
+    }
+
+    public Node getDomNode(Node node) {
+        return soapDocument.getDomNode(node);
+    }
+
+    @Override
+    public Node appendChild(Node newChild) throws DOMException {
+        Node node = soapDocument.importNode(newChild, true);
+        return soapDocument.findIfPresent(documentFragment.appendChild(getDomNode(node)));
+    }
+
+    @Override
+    public Node removeChild(Node oldChild) throws DOMException {
+        return soapDocument.findIfPresent(documentFragment.removeChild(getDomNode(oldChild)));
+    }
+
+    @Override
+    public NamedNodeMap getAttributes() {
+        return documentFragment.getAttributes();
+    }
+
+    @Override
+    public short compareDocumentPosition(Node other) throws DOMException {
+        return documentFragment.compareDocumentPosition(getDomNode(other));
+    }
+    @Override
+    public void setTextContent(String textContent) throws DOMException {
+        documentFragment.setTextContent(textContent);
+    }
+    @Override
+    public Node insertBefore(Node newChild, Node refChild) throws DOMException {
+        Node node = soapDocument.importNode(newChild, true);
+        return soapDocument.findIfPresent(documentFragment.insertBefore(getDomNode(node), getDomNode(refChild)));
+    }
+    @Override
+    public Object setUserData(String key, Object data, UserDataHandler handler) {
+        return documentFragment.setUserData(key, data, handler);
+    }
+    @Override
+    public boolean isDefaultNamespace(String namespaceURI) {
+        return documentFragment.isDefaultNamespace(namespaceURI);
+    }
+
+    @Override
+    public Node getLastChild() {
+        return soapDocument.findIfPresent(documentFragment.getLastChild());
+    }
+
+    @Override
+    public void setPrefix(String prefix) throws DOMException {
+        documentFragment.setPrefix(prefix);
+    }
+    @Override
+    public String getNodeName() {
+        return documentFragment.getNodeName();
+    }
+
+    @Override
+    public void setNodeValue(String nodeValue) throws DOMException {
+        documentFragment.setNodeValue(nodeValue);
+    }
+    @Override
+    public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
+        Node node = soapDocument.importNode(newChild, true);
+        return soapDocument.findIfPresent(documentFragment.replaceChild(getDomNode(node), getDomNode(oldChild)));
+    }
+    @Override
+    public String getLocalName() {
+        return documentFragment.getLocalName();
+    }
+
+    @Override
+    public void normalize() {
+        documentFragment.normalize();
+    }
+
+    @Override
+    public Node cloneNode(boolean deep) {
+        Node node= documentFragment.cloneNode(deep);
+        soapDocument.registerChildNodes(node, deep);
+        return soapDocument.findIfPresent(node);
+    }
+
+    @Override
+    public boolean isSupported(String feature, String version) {
+        return documentFragment.isSupported(feature, version);
+    }
+
+    @Override
+    public boolean isEqualNode(Node arg) {
+        return documentFragment.isEqualNode(getDomNode(arg));
+    }
+
+    @Override
+    public boolean hasChildNodes() {
+        return documentFragment.hasChildNodes();
+    }
+
+    @Override
+    public String lookupPrefix(String namespaceURI) {
+        return documentFragment.lookupPrefix(namespaceURI);
+    }
+
+    @Override
+    public String getNodeValue() throws DOMException {
+        return documentFragment.getNodeValue();
+    }
+    @Override
+    public Document getOwnerDocument() {
+        return documentFragment.getOwnerDocument();
+    }
+    @Override
+    public Object getFeature(String feature, String version) {
+        return documentFragment.getFeature(feature, version);
+    }
+
+    @Override
+    public Node getPreviousSibling() {
+        return soapDocument.findIfPresent(documentFragment.getPreviousSibling());
+    }
+
+    @Override
+    public NodeList getChildNodes() {
+        return new NodeListImpl(soapDocument, documentFragment.getChildNodes());
+    }
+
+    @Override
+    public String getBaseURI() {
+        return documentFragment.getBaseURI();
+    }
+
+    @Override
+    public Node getNextSibling() {
+        return soapDocument.findIfPresent(documentFragment.getNextSibling());
+    }
+
+    @Override
+    public String getPrefix() {
+        return documentFragment.getPrefix();
+    }
+
+    @Override
+    public String getNamespaceURI() {
+        return documentFragment.getNamespaceURI();
+    }
+    public Document getSoapDocument() {
+        return soapDocument;
+    }
+}
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/SOAPDocumentImpl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/SOAPDocumentImpl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -32,6 +32,8 @@
 import com.sun.xml.internal.messaging.saaj.soap.impl.CDATAImpl;
 import com.sun.xml.internal.messaging.saaj.soap.impl.ElementFactory;
 import com.sun.xml.internal.messaging.saaj.soap.impl.ElementImpl;
+import com.sun.xml.internal.messaging.saaj.soap.impl.NamedNodeMapImpl;
+import com.sun.xml.internal.messaging.saaj.soap.impl.NodeListImpl;
 import com.sun.xml.internal.messaging.saaj.soap.impl.SOAPCommentImpl;
 import com.sun.xml.internal.messaging.saaj.soap.impl.SOAPTextImpl;
 import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
@@ -39,6 +41,7 @@
 import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
 import org.w3c.dom.Attr;
 import org.w3c.dom.CDATASection;
+import org.w3c.dom.CharacterData;
 import org.w3c.dom.Comment;
 import org.w3c.dom.DOMConfiguration;
 import org.w3c.dom.DOMException;
@@ -52,6 +55,7 @@
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 import org.w3c.dom.ProcessingInstruction;
+import org.w3c.dom.Text;
 import org.w3c.dom.UserDataHandler;
 
 import javax.xml.parsers.DocumentBuilder;
@@ -59,13 +63,14 @@
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.soap.SOAPElement;
 import javax.xml.soap.SOAPException;
+import java.lang.reflect.Constructor;
 import java.text.MessageFormat;
-import java.util.HashMap;
-import java.util.Map;
 import java.util.logging.Logger;
 
 public class SOAPDocumentImpl implements SOAPDocument, javax.xml.soap.Node, Document {
 
+    public static final String SAAJ_NODE = "javax.xml.soap.Node";
+
     private static final String XMLNS = "xmlns".intern();
     protected static final Logger log =
         Logger.getLogger(LogDomainConstants.SOAP_DOMAIN,
@@ -75,8 +80,6 @@
 
     private Document document;
 
-    private Map<Node, javax.xml.soap.Node> domToSoap = new HashMap<>();
-
     public SOAPDocumentImpl(SOAPPartImpl enclosingDocument) {
         document = createDocument();
         this.enclosingSOAPPart = enclosingDocument;
@@ -105,6 +108,7 @@
     //        super(doctype, grammarAccess);
     //    }
 
+    @Override
     public SOAPPartImpl getSOAPPart() {
         if (enclosingSOAPPart == null) {
             log.severe("SAAJ0541.soap.fragment.not.bound.to.part");
@@ -113,19 +117,23 @@
         return enclosingSOAPPart;
     }
 
+    @Override
     public SOAPDocumentImpl getDocument() {
         return this;
     }
 
+    @Override
     public DocumentType getDoctype() {
         // SOAP means no DTD, No DTD means no doctype (SOAP 1.2 only?)
         return null;
     }
 
+    @Override
     public DOMImplementation getImplementation() {
         return document.getImplementation();
     }
 
+    @Override
     public Element getDocumentElement() {
         // This had better be an Envelope!
         getSOAPPart().doGetDocumentElement();
@@ -136,6 +144,7 @@
         return document.getDocumentElement();
     }
 
+    @Override
     public Element createElement(String tagName) throws DOMException {
         return ElementFactory.createElement(
             this,
@@ -144,22 +153,27 @@
             null);
     }
 
+    @Override
     public DocumentFragment createDocumentFragment() {
-        return document.createDocumentFragment();
+        return new SOAPDocumentFragment(this);
     }
 
+    @Override
     public org.w3c.dom.Text createTextNode(String data) {
         return new SOAPTextImpl(this, data);
     }
 
+    @Override
     public Comment createComment(String data) {
         return new SOAPCommentImpl(this, data);
     }
 
+    @Override
     public CDATASection createCDATASection(String data) throws DOMException {
         return new CDATAImpl(this, data);
     }
 
+    @Override
     public ProcessingInstruction createProcessingInstruction(
         String target,
         String data)
@@ -168,6 +182,7 @@
         throw new UnsupportedOperationException("Processing Instructions are not allowed in SOAP documents");
     }
 
+    @Override
     public Attr createAttribute(String name) throws DOMException {
         boolean isQualifiedName = (name.indexOf(":") > 0);
         if (isQualifiedName) {
@@ -184,24 +199,70 @@
         return document.createAttribute(name);
     }
 
+    @Override
     public EntityReference createEntityReference(String name)
         throws DOMException {
             log.severe("SAAJ0543.soap.entity.refs.not.allowed.in.docs");
             throw new UnsupportedOperationException("Entity References are not allowed in SOAP documents");
     }
 
+    @Override
     public NodeList getElementsByTagName(String tagname) {
-        return document.getElementsByTagName(tagname);
+        return new NodeListImpl(this, document.getElementsByTagName(tagname));
     }
 
+    @Override
     public org.w3c.dom.Node importNode(Node importedNode, boolean deep)
         throws DOMException {
-        final Node node = document.importNode(getDomNode(importedNode), deep);
-        return node instanceof Element ?
-            ElementFactory.createElement(this, (Element) node)
-                : node;
+        Node domNode = getDomNode(importedNode);
+        final Node newNode = document.importNode(domNode, deep);
+
+        if (importedNode instanceof javax.xml.soap.Node) {
+            Node newSoapNode = createSoapNode(importedNode.getClass(), newNode);
+            newNode.setUserData(SAAJ_NODE, newSoapNode, null);
+            if (deep && importedNode.hasChildNodes()) {
+                NodeList childNodes = importedNode.getChildNodes();
+                for (int i = 0; i < childNodes.getLength(); i++) {
+                    registerChildNodes(childNodes.item(i), deep);
+                }
+            }
+            return newSoapNode;
+        }
+
+        registerChildNodes(newNode, deep);
+        return findIfPresent(newNode);
     }
 
+    //If the parentNode is not registered to domToSoap, create soap wapper for parentNode and register it to domToSoap
+    //If deep = true, also register all children of parentNode to domToSoap map.
+    public void registerChildNodes(Node parentNode, boolean deep) {
+        if (parentNode.getUserData(SAAJ_NODE) == null) {
+            if (parentNode instanceof Element) {
+                ElementFactory.createElement(this, (Element) parentNode);
+            } else if (parentNode instanceof CharacterData) {
+                switch (parentNode.getNodeType()) {
+                    case CDATA_SECTION_NODE:
+                        new CDATAImpl(this, (CharacterData) parentNode);
+                        break;
+                    case COMMENT_NODE:
+                        new SOAPCommentImpl(this, (CharacterData) parentNode);
+                        break;
+                    case TEXT_NODE:
+                        new SOAPTextImpl(this, (CharacterData) parentNode);
+                        break;
+                }
+            }
+        }
+        if (deep) {
+            NodeList nodeList = parentNode.getChildNodes();
+            for (int i = 0; i < nodeList.getLength(); i++) {
+                Node nextChild = nodeList.item(i);
+                registerChildNodes(nextChild, true);
+            }
+        }
+    }
+
+    @Override
     public Element createElementNS(String namespaceURI, String qualifiedName)
         throws DOMException {
         return ElementFactory.createElement(
@@ -211,19 +272,22 @@
             namespaceURI);
     }
 
+    @Override
     public Attr createAttributeNS(String namespaceURI, String qualifiedName)
         throws DOMException {
         return document.createAttributeNS(namespaceURI, qualifiedName);
     }
 
+    @Override
     public NodeList getElementsByTagNameNS(
         String namespaceURI,
         String localName) {
-        return document.getElementsByTagNameNS(namespaceURI, localName);
+        return new NodeListImpl(this, document.getElementsByTagNameNS(namespaceURI, localName));
     }
 
+    @Override
     public Element getElementById(String elementId) {
-        return document.getElementById(elementId);
+        return (Element) findIfPresent(document.getElementById(elementId));
     }
 
     @Override
@@ -293,7 +357,7 @@
 
     @Override
     public Node renameNode(Node n, String namespaceURI, String qualifiedName) throws DOMException {
-        return document.renameNode(n, namespaceURI, qualifiedName);
+        return findIfPresent(document.renameNode(n, namespaceURI, qualifiedName));
     }
 
     @Override
@@ -318,37 +382,37 @@
 
     @Override
     public Node getParentNode() {
-        return document.getParentNode();
+        return findIfPresent(document.getParentNode());
     }
 
     @Override
     public NodeList getChildNodes() {
-        return document.getChildNodes();
+        return new NodeListImpl(this, document.getChildNodes());
     }
 
     @Override
     public Node getFirstChild() {
-        return document.getFirstChild();
+        return findIfPresent(document.getFirstChild());
     }
 
     @Override
     public Node getLastChild() {
-        return document.getLastChild();
+        return findIfPresent(document.getLastChild());
     }
 
     @Override
     public Node getPreviousSibling() {
-        return document.getPreviousSibling();
+        return findIfPresent(document.getPreviousSibling());
     }
 
     @Override
     public Node getNextSibling() {
-        return document.getNextSibling();
+        return findIfPresent(document.getNextSibling());
     }
 
     @Override
     public NamedNodeMap getAttributes() {
-        return document.getAttributes();
+        return new NamedNodeMapImpl(document.getAttributes(), this);
     }
 
     @Override
@@ -383,7 +447,9 @@
 
     @Override
     public Node cloneNode(boolean deep) {
-        return document.cloneNode(deep);
+        Node node = document.cloneNode(deep);
+        registerChildNodes(node, deep);
+        return findIfPresent(node);
     }
 
     @Override
@@ -428,7 +494,7 @@
 
     @Override
     public short compareDocumentPosition(Node other) throws DOMException {
-        return document.compareDocumentPosition(other);
+        return document.compareDocumentPosition(getDomNode(other));
     }
 
     @Override
@@ -443,7 +509,7 @@
 
     @Override
     public boolean isSameNode(Node other) {
-        return document.isSameNode(other);
+        return document.isSameNode(getDomNode(other));
     }
 
     @Override
@@ -463,7 +529,7 @@
 
     @Override
     public boolean isEqualNode(Node arg) {
-        return document.isEqualNode(arg);
+        return document.isEqualNode(getDomNode(arg));
     }
 
     @Override
@@ -496,11 +562,11 @@
      */
     public void register(javax.xml.soap.Node node) {
         final Node domElement = getDomNode(node);
-        if (domToSoap.containsKey(domElement)) {
+        if (domElement.getUserData(SAAJ_NODE) != null) {
             throw new IllegalStateException("Element " + domElement.getNodeName()
                     + " is already registered");
         }
-        domToSoap.put(domElement, node);
+        domElement.setUserData(SAAJ_NODE, node, null);
     }
 
     /**
@@ -522,7 +588,7 @@
         if (node instanceof javax.xml.soap.Node) {
             return (javax.xml.soap.Node) node;
         }
-        final javax.xml.soap.Node found = domToSoap.get(node);
+        final javax.xml.soap.Node found = (javax.xml.soap.Node) node.getUserData(SAAJ_NODE);
         if (found == null && required) {
             throw new IllegalArgumentException(MessageFormat.format("Cannot find SOAP wrapper for element {0}", node));
         }
@@ -562,6 +628,24 @@
         return node;
     }
 
+
+    private Node createSoapNode(Class nodeType, Node node) {
+        if (SOAPTextImpl.class.isAssignableFrom(nodeType)) {
+            return new SOAPTextImpl(this, (Text) node);
+        } else if (SOAPCommentImpl.class.isAssignableFrom(nodeType)) {
+            return new SOAPCommentImpl(this, (Comment) node);
+        } else if (CDATAImpl.class.isAssignableFrom(nodeType)) {
+            return new CDATAImpl(this, (CDATASection) node);
+        }
+        try {
+            Constructor<Node> constructor = nodeType.getConstructor(SOAPDocumentImpl.class, Element.class);
+            return constructor.newInstance(this, node);
+        } catch (Exception e) {
+            throw new IllegalStateException(e);
+        }
+    }
+
+
     public Document getDomElement() {
         return document;
     }
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/SOAPFactoryImpl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/SOAPFactoryImpl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, 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
@@ -49,6 +49,7 @@
 
     protected abstract SOAPDocumentImpl createDocument();
 
+    @Override
     public SOAPElement createElement(String tagName) throws SOAPException {
          if (tagName == null) {
              log.log(
@@ -60,6 +61,7 @@
                         NameImpl.createFromTagName(tagName));
     }
 
+    @Override
     public SOAPElement createElement(Name name) throws SOAPException {
         // @since SAAJ 1.3
         // If the Name was null it would cause a NullPointerException in earlier release
@@ -71,6 +73,7 @@
         return ElementFactory.createElement(createDocument(), name);
     }
 
+    @Override
     public SOAPElement createElement(QName qname) throws SOAPException {
         if (qname == null) {
             log.log(Level.SEVERE,"SAAJ0567.soap.null.input",
@@ -80,6 +83,7 @@
         return ElementFactory.createElement(createDocument(),qname);
     }
 
+    @Override
     public SOAPElement createElement(
         String localName,
         String prefix,
@@ -96,6 +100,7 @@
         return ElementFactory.createElement(createDocument(), localName, prefix, uri);
     }
 
+    @Override
     public Name createName(String localName, String prefix, String uri)
         throws SOAPException {
         // @since SAAJ 1.3
@@ -110,6 +115,7 @@
         return NameImpl.create(localName, prefix, uri);
     }
 
+    @Override
     public Name createName(String localName) throws SOAPException {
         // @since SAAJ 1.3
         // if localName==null, earlier impl would create Name with localName=null
@@ -125,6 +131,7 @@
 
     // Note: the child elements might still be org.w3c.dom.Element's, but the
     // getChildElements will do the conversion to SOAPElement when called.
+    @Override
     public SOAPElement createElement(Element domElement) throws SOAPException {
         if (domElement == null) {
             return null;
@@ -163,14 +170,17 @@
         return copy;
     }
 
+    @Override
     public Detail createDetail() throws SOAPException {
         throw new UnsupportedOperationException();
     }
 
+    @Override
     public  SOAPFault createFault(String reasonText, QName faultCode) throws SOAPException {
         throw new UnsupportedOperationException();
     }
 
+    @Override
     public SOAPFault createFault() throws SOAPException {
         throw new UnsupportedOperationException();
     }
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/SOAPIOException.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/SOAPIOException.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -64,6 +64,7 @@
         soapException.fillInStackTrace();
     }
 
+    @Override
     public Throwable fillInStackTrace() {
         if (soapException != null) {
             soapException.fillInStackTrace();
@@ -71,26 +72,32 @@
         return this;
     }
 
+    @Override
     public String getLocalizedMessage() {
         return soapException.getLocalizedMessage();
     }
 
+    @Override
     public String getMessage() {
         return soapException.getMessage();
     }
 
+    @Override
     public void printStackTrace() {
         soapException.printStackTrace();
     }
 
+    @Override
     public void printStackTrace(PrintStream s) {
         soapException.printStackTrace(s);
     }
 
+    @Override
     public void printStackTrace(PrintWriter s) {
         soapException.printStackTrace(s);
     }
 
+    @Override
     public String toString() {
         return soapException.toString();
     }
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/SOAPPartImpl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/SOAPPartImpl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -75,6 +75,7 @@
 import java.util.Iterator;
 import java.util.logging.Level;
 import java.util.logging.Logger;
+import javax.xml.soap.MimeHeader;
 
 /**
  * SOAPPartImpl is the first attachment. This contains the XML/SOAP document.
@@ -136,6 +137,7 @@
         return (message != null) ? message.isFastInfoset() : false;
     }
 
+    @Override
     public SOAPEnvelope getEnvelope() throws SOAPException {
 
         // If there is no SOAP envelope already created, then create
@@ -185,38 +187,47 @@
         }
     }
 
+    @Override
     public void removeAllMimeHeaders() {
         headers.removeAllHeaders();
     }
 
+    @Override
     public void removeMimeHeader(String header) {
         headers.removeHeader(header);
     }
 
+    @Override
     public String[] getMimeHeader(String name) {
         return headers.getHeader(name);
     }
 
+    @Override
     public void setMimeHeader(String name, String value) {
         headers.setHeader(name, value);
     }
 
+    @Override
     public void addMimeHeader(String name, String value) {
         headers.addHeader(name, value);
     }
 
-    public Iterator getAllMimeHeaders() {
+    @Override
+    public Iterator<MimeHeader> getAllMimeHeaders() {
         return headers.getAllHeaders();
     }
 
-    public Iterator getMatchingMimeHeaders(String[] names) {
+    @Override
+    public Iterator<MimeHeader> getMatchingMimeHeaders(String[] names) {
         return headers.getMatchingHeaders(names);
     }
 
-    public Iterator getNonMatchingMimeHeaders(String[] names) {
+    @Override
+    public Iterator<MimeHeader> getNonMatchingMimeHeaders(String[] names) {
         return headers.getNonMatchingHeaders(names);
     }
 
+    @Override
     public Source getContent() throws SOAPException {
         if (source != null) {
             InputStream bis = null;
@@ -248,6 +259,7 @@
         return ((Envelope) getEnvelope()).getContent();
     }
 
+    @Override
     public void setContent(Source source) throws SOAPException {
         try {
             if (source instanceof StreamSource) {
@@ -376,18 +388,22 @@
 
     DataHandler getDataHandler() {
         DataSource ds = new DataSource() {
+            @Override
             public OutputStream getOutputStream() throws IOException {
                 throw new IOException("Illegal Operation");
             }
 
+            @Override
             public String getContentType() {
                 return getContentTypeString();
             }
 
+            @Override
             public String getName() {
                 return getContentId();
             }
 
+            @Override
             public InputStream getInputStream() throws IOException {
                 return getContentAsStream();
             }
@@ -395,15 +411,18 @@
         return new DataHandler(ds);
     }
 
+    @Override
     public SOAPDocumentImpl getDocument() {
         handleNewSource();
         return document;
     }
 
+    @Override
     public SOAPPartImpl getSOAPPart() {
         return this;
     }
 
+    @Override
     public DocumentType getDoctype() {
         return document.getDoctype();
     }
@@ -412,10 +431,12 @@
     // same way whether they are called from here or directly from the document.
     // If the document needs any help from this SOAPPart then
     // Make it use a call-back as in doGetDocumentElement() below
+    @Override
     public DOMImplementation getImplementation() {
         return document.getImplementation();
     }
 
+    @Override
     public Element getDocumentElement() {
         // If there is no SOAP envelope already created, then create
         // one from a source if one exists. If there is a newer source
@@ -435,26 +456,32 @@
         }
     }
 
+    @Override
     public Element createElement(String tagName) throws DOMException {
         return document.createElement(tagName);
     }
 
+    @Override
     public DocumentFragment createDocumentFragment() {
         return document.createDocumentFragment();
     }
 
+    @Override
     public org.w3c.dom.Text createTextNode(String data) {
         return document.createTextNode(data);
     }
 
+    @Override
     public Comment createComment(String data) {
         return document.createComment(data);
     }
 
+    @Override
     public CDATASection createCDATASection(String data) throws DOMException {
         return document.createCDATASection(data);
     }
 
+    @Override
     public ProcessingInstruction createProcessingInstruction(
     String target,
     String data)
@@ -462,20 +489,24 @@
         return document.createProcessingInstruction(target, data);
     }
 
+    @Override
     public Attr createAttribute(String name) throws DOMException {
         return document.createAttribute(name);
     }
 
+    @Override
     public EntityReference createEntityReference(String name)
     throws DOMException {
         return document.createEntityReference(name);
     }
 
+    @Override
     public NodeList getElementsByTagName(String tagname) {
         handleNewSource();
         return document.getElementsByTagName(tagname);
     }
 
+    @Override
     public org.w3c.dom.Node importNode(
         org.w3c.dom.Node importedNode,
         boolean deep)
@@ -484,16 +515,19 @@
         return document.importNode(importedNode, deep);
     }
 
+    @Override
     public Element createElementNS(String namespaceURI, String qualifiedName)
     throws DOMException {
         return document.createElementNS(namespaceURI, qualifiedName);
     }
 
+    @Override
     public Attr createAttributeNS(String namespaceURI, String qualifiedName)
     throws DOMException {
         return document.createAttributeNS(namespaceURI, qualifiedName);
     }
 
+    @Override
     public NodeList getElementsByTagNameNS(
         String namespaceURI,
         String localName) {
@@ -501,16 +535,19 @@
         return document.getElementsByTagNameNS(namespaceURI, localName);
     }
 
+    @Override
     public Element getElementById(String elementId) {
         handleNewSource();
         return document.getElementById(elementId);
     }
+    @Override
     public org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild)
         throws DOMException {
         handleNewSource();
         return document.appendChild(newChild);
     }
 
+    @Override
     public org.w3c.dom.Node cloneNode(boolean deep) {
         handleNewSource();
         return document.cloneNode(deep);
@@ -525,75 +562,92 @@
         return newSoapPart;
     }
 
+    @Override
     public NamedNodeMap getAttributes() {
         return document.getDomDocument().getAttributes();
     }
 
+    @Override
     public NodeList getChildNodes() {
         handleNewSource();
         return document.getChildNodes();
     }
 
+    @Override
     public org.w3c.dom.Node getFirstChild() {
         handleNewSource();
         return document.getFirstChild();
     }
 
+    @Override
     public org.w3c.dom.Node getLastChild() {
         handleNewSource();
         return document.getLastChild();
     }
 
+    @Override
     public String getLocalName() {
         return document.getDomDocument().getLocalName();
     }
 
+    @Override
     public String getNamespaceURI() {
         return document.getDomDocument().getNamespaceURI();
     }
 
+    @Override
     public org.w3c.dom.Node getNextSibling() {
         handleNewSource();
         return document.getNextSibling();
     }
 
+    @Override
     public String getNodeName() {
         return document.getDomDocument().getNodeName();
     }
 
+    @Override
     public short getNodeType() {
         return document.getDomDocument().getNodeType();
     }
 
+    @Override
     public String getNodeValue() throws DOMException {
         return document.getNodeValue();
     }
 
+    @Override
     public Document getOwnerDocument() {
         return document.getDomDocument().getOwnerDocument();
     }
 
+    @Override
     public org.w3c.dom.Node getParentNode() {
         return document.getDomDocument().getParentNode();
     }
 
+    @Override
     public String getPrefix() {
         return document.getDomDocument().getPrefix();
     }
 
+    @Override
     public org.w3c.dom.Node getPreviousSibling() {
         return document.getDomDocument().getPreviousSibling();
     }
 
+    @Override
     public boolean hasAttributes() {
         return document.getDomDocument().hasAttributes();
     }
 
+    @Override
     public boolean hasChildNodes() {
         handleNewSource();
         return document.hasChildNodes();
     }
 
+    @Override
     public org.w3c.dom.Node insertBefore(
         org.w3c.dom.Node arg0,
         org.w3c.dom.Node arg1)
@@ -602,21 +656,25 @@
         return document.insertBefore(arg0, arg1);
     }
 
+    @Override
     public boolean isSupported(String arg0, String arg1) {
         return document.getDomDocument().isSupported(arg0, arg1);
     }
 
+    @Override
     public void normalize() {
         handleNewSource();
         document.normalize();
     }
 
+    @Override
     public org.w3c.dom.Node removeChild(org.w3c.dom.Node arg0)
         throws DOMException {
         handleNewSource();
         return document.removeChild(arg0);
     }
 
+    @Override
     public org.w3c.dom.Node replaceChild(
         org.w3c.dom.Node arg0,
         org.w3c.dom.Node arg1)
@@ -625,10 +683,12 @@
         return document.replaceChild(arg0, arg1);
     }
 
+    @Override
     public void setNodeValue(String arg0) throws DOMException {
         document.setNodeValue(arg0);
     }
 
+    @Override
     public void setPrefix(String arg0) throws DOMException {
         document.setPrefix(arg0);
     }
@@ -703,141 +763,173 @@
         this.sourceCharsetEncoding = charset;
     }
 
+    @Override
     public org.w3c.dom.Node renameNode(org.w3c.dom.Node n, String namespaceURI, String qualifiedName)
         throws DOMException {
         handleNewSource();
         return document.renameNode(n, namespaceURI, qualifiedName);
     }
 
+    @Override
     public void normalizeDocument() {
         document.normalizeDocument();
     }
 
+    @Override
     public DOMConfiguration getDomConfig() {
         return document.getDomDocument().getDomConfig();
     }
 
+    @Override
     public org.w3c.dom.Node adoptNode(org.w3c.dom.Node source) throws DOMException {
         handleNewSource();
         return document.adoptNode(source);
     }
 
+    @Override
     public void setDocumentURI(String documentURI) {
         document.setDocumentURI(documentURI);
     }
 
+    @Override
     public String getDocumentURI() {
         return document.getDomDocument().getDocumentURI();
     }
 
+    @Override
     public void  setStrictErrorChecking(boolean strictErrorChecking) {
         document.setStrictErrorChecking(strictErrorChecking);
     }
 
+    @Override
     public String getInputEncoding() {
         return document.getDomDocument().getInputEncoding();
     }
 
+    @Override
     public String getXmlEncoding() {
         return document.getDomDocument().getXmlEncoding();
     }
 
+    @Override
     public boolean getXmlStandalone() {
         return document.getDomDocument().getXmlStandalone();
     }
 
+    @Override
     public void setXmlStandalone(boolean xmlStandalone) throws DOMException {
         document.setXmlStandalone(xmlStandalone);
     }
 
+    @Override
     public String getXmlVersion() {
         return document.getDomDocument().getXmlVersion();
     }
 
+    @Override
     public void setXmlVersion(String xmlVersion) throws DOMException {
         document.setXmlVersion(xmlVersion);
     }
 
+    @Override
     public boolean  getStrictErrorChecking() {
         return document.getDomDocument().getStrictErrorChecking();
     }
 
     // DOM L3 methods from org.w3c.dom.Node
+    @Override
     public String getBaseURI() {
         return document.getDomDocument().getBaseURI();
     }
 
+    @Override
     public short compareDocumentPosition(org.w3c.dom.Node other)
                               throws DOMException {
         return document.compareDocumentPosition(other);
     }
 
+    @Override
     public String getTextContent()
                       throws DOMException {
         return document.getTextContent();
     }
 
+    @Override
     public void setTextContent(String textContent) throws DOMException {
          document.setTextContent(textContent);
     }
 
+    @Override
     public boolean isSameNode(org.w3c.dom.Node other) {
         return document.isSameNode(other);
     }
 
+    @Override
     public String lookupPrefix(String namespaceURI) {
         return document.getDomDocument().lookupPrefix(namespaceURI);
     }
 
+    @Override
     public boolean isDefaultNamespace(String namespaceURI) {
         return document.isDefaultNamespace(namespaceURI);
     }
 
+    @Override
     public String lookupNamespaceURI(String prefix) {
         return document.lookupNamespaceURI(prefix);
     }
 
+    @Override
     public boolean isEqualNode(org.w3c.dom.Node arg) {
         return document.getDomDocument().isEqualNode(arg);
     }
 
+    @Override
     public Object getFeature(String feature,
                   String version) {
         return  document.getFeature(feature,version);
     }
 
+    @Override
     public Object setUserData(String key,
                    Object data,
                   UserDataHandler handler) {
         return document.setUserData(key, data, handler);
     }
 
+    @Override
     public Object getUserData(String key) {
         return document.getDomDocument().getUserData(key);
     }
 
+    @Override
     public void recycleNode() {
         // Nothing seems to be required to be done here
     }
 
+    @Override
     public String getValue() {
         return null;
     }
 
+    @Override
     public void setValue(String value) {
         log.severe("SAAJ0571.soappart.setValue.not.defined");
         throw new IllegalStateException("Setting value of a soap part is not defined");
     }
 
+    @Override
     public void setParentElement(SOAPElement parent) throws SOAPException {
         log.severe("SAAJ0570.soappart.parent.element.not.defined");
         throw new SOAPExceptionImpl("The parent element of a soap part is not defined");
     }
 
+    @Override
     public SOAPElement getParentElement() {
         return null;
     }
 
+    @Override
     public void detachNode() {
         // Nothing seems to be required to be done here
     }
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/StaxLazySourceBridge.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/StaxLazySourceBridge.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -42,38 +42,39 @@
  * @author shih-chang.chen@oracle.com
  */
 public class StaxLazySourceBridge extends StaxBridge {
-        private LazyEnvelopeSource lazySource;
+    private LazyEnvelopeSource lazySource;
 
-        public StaxLazySourceBridge(LazyEnvelopeSource src, SOAPPartImpl soapPart) throws SOAPException {
-                super(soapPart);
-                lazySource = src;
-                final String soapEnvNS = soapPart.getSOAPNamespace();
-                try {
-                        breakpoint = new XMLStreamReaderToXMLStreamWriter.Breakpoint(src.readToBodyStarTag(), saajWriter) {
-                                        public boolean proceedAfterStartElement()  {
-                                                if ("Body".equals(reader.getLocalName()) && soapEnvNS.equals(reader.getNamespaceURI()) ){
-                                                        return false;
-                                                } else
-                                                        return true;
-                                        }
-                                };
-                } catch (XMLStreamException e) {
-                        throw new SOAPException(e);
+    public StaxLazySourceBridge(LazyEnvelopeSource src, SOAPPartImpl soapPart) throws SOAPException {
+        super(soapPart);
+        lazySource = src;
+        final String soapEnvNS = soapPart.getSOAPNamespace();
+        try {
+            breakpoint = new XMLStreamReaderToXMLStreamWriter.Breakpoint(src.readToBodyStarTag(), saajWriter) {
+                @Override
+                public boolean proceedAfterStartElement()  {
+                    if ("Body".equals(reader.getLocalName()) && soapEnvNS.equals(reader.getNamespaceURI()) ){
+                        return false;
+                    } else
+                        return true;
                 }
+            };
+        } catch (XMLStreamException e) {
+            throw new SOAPException(e);
         }
+    }
 
-        @Override
+    @Override
     public XMLStreamReader getPayloadReader() {
         return lazySource.readPayload();
 //              throw new UnsupportedOperationException();
     }
 
-        @Override
+    @Override
     public QName getPayloadQName() {
         return lazySource.getPayloadQName();
     }
 
-        @Override
+    @Override
     public String getPayloadAttributeValue(String attName) {
         if (lazySource.isPayloadStreamReader()) {
             XMLStreamReader reader = lazySource.readPayload();
@@ -84,7 +85,7 @@
         return null;
     }
 
-        @Override
+    @Override
     public String getPayloadAttributeValue(QName attName) {
         if (lazySource.isPayloadStreamReader()) {
             XMLStreamReader reader = lazySource.readPayload();
@@ -95,12 +96,13 @@
         return null;
     }
 
-        public void bridgePayload() throws XMLStreamException {
-                //Assuming out is at Body
-                writePayloadTo(saajWriter);
-        }
+        @Override
+    public void bridgePayload() throws XMLStreamException {
+        //Assuming out is at Body
+        writePayloadTo(saajWriter);
+    }
 
-        public void writePayloadTo(XMLStreamWriter writer) throws XMLStreamException {
+    public void writePayloadTo(XMLStreamWriter writer) throws XMLStreamException {
         lazySource.writePayloadTo(writer);
     }
 }
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/StaxReaderBridge.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/StaxReaderBridge.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -38,41 +38,46 @@
  * @author shih-chang.chen@oracle.com
  */
 public class StaxReaderBridge extends StaxBridge {
-        private XMLStreamReader in;
+    private XMLStreamReader in;
 
-        public StaxReaderBridge(XMLStreamReader reader, SOAPPartImpl soapPart) throws SOAPException {
-                super(soapPart);
-                in = reader;
-                final String soapEnvNS = soapPart.getSOAPNamespace();
-                breakpoint =  new XMLStreamReaderToXMLStreamWriter.Breakpoint(reader, saajWriter) {
-                        boolean seenBody = false;
-                        boolean stopedAtBody = false;
-                    public boolean proceedBeforeStartElement()  {
-                        if (stopedAtBody) return true;
-                        if (seenBody) {
-                                stopedAtBody = true;
-                                return false;
-                        }
-                            if ("Body".equals(reader.getLocalName()) && soapEnvNS.equals(reader.getNamespaceURI()) ){
-                                seenBody = true;
-                            }
-                            return true;
+    public StaxReaderBridge(XMLStreamReader reader, SOAPPartImpl soapPart) throws SOAPException {
+        super(soapPart);
+        in = reader;
+        final String soapEnvNS = soapPart.getSOAPNamespace();
+        breakpoint =  new XMLStreamReaderToXMLStreamWriter.Breakpoint(reader, saajWriter) {
+                boolean seenBody = false;
+                boolean stopedAtBody = false;
+                @Override
+                public boolean proceedBeforeStartElement()  {
+                    if (stopedAtBody) return true;
+                    if (seenBody) {
+                        stopedAtBody = true;
+                        return false;
                     }
-                };
-        }
+                    if ("Body".equals(reader.getLocalName()) && soapEnvNS.equals(reader.getNamespaceURI()) ){
+                        seenBody = true;
+                    }
+                    return true;
+                }
+            };
+    }
 
+    @Override
     public XMLStreamReader getPayloadReader() {
         return in;
     }
 
+    @Override
     public QName getPayloadQName() {
         return (in.getEventType() == XMLStreamConstants.START_ELEMENT) ? in.getName() : null;
     }
 
+    @Override
     public String getPayloadAttributeValue(String attName) {
         return (in.getEventType() == XMLStreamConstants.START_ELEMENT) ? in.getAttributeValue(null, attName) : null;
     }
 
+    @Override
     public String getPayloadAttributeValue(QName attName) {
         return (in.getEventType() == XMLStreamConstants.START_ELEMENT) ? in.getAttributeValue(attName.getNamespaceURI(), attName.getLocalPart()) : null;
     }
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/dynamic/SOAPFactoryDynamicImpl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/dynamic/SOAPFactoryDynamicImpl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -36,10 +36,12 @@
 import com.sun.xml.internal.messaging.saaj.soap.SOAPFactoryImpl;
 
 public class SOAPFactoryDynamicImpl extends SOAPFactoryImpl {
+    @Override
     protected SOAPDocumentImpl createDocument() {
         return null;
     }
 
+    @Override
     public Detail createDetail() throws SOAPException {
         throw new UnsupportedOperationException(
                 "createDetail() not supported for Dynamic Protocol");
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/dynamic/SOAPMessageFactoryDynamicImpl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/dynamic/SOAPMessageFactoryDynamicImpl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, 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
@@ -35,6 +35,7 @@
 import com.sun.xml.internal.messaging.saaj.soap.MessageFactoryImpl;
 
 public class SOAPMessageFactoryDynamicImpl extends MessageFactoryImpl {
+    @Override
     public SOAPMessage createMessage() throws SOAPException {
         throw new UnsupportedOperationException(
                 "createMessage() not supported for Dynamic Protocol");
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/BodyElementImpl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/BodyElementImpl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -29,6 +29,7 @@
 import javax.xml.soap.*;
 
 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
+import org.w3c.dom.Element;
 
 /**
  * All elements of the SOAP-ENV:BODY.
@@ -47,6 +48,11 @@
         super(ownerDoc, qname);
     }
 
+    public BodyElementImpl(SOAPDocumentImpl ownerDoc, Element domElement) {
+        super(ownerDoc, domElement);
+    }
+
+    @Override
     public void setParentElement(SOAPElement element) throws SOAPException {
         if (! (element instanceof SOAPBody)) {
             log.severe("SAAJ0101.impl.parent.of.body.elem.mustbe.body");
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/BodyImpl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/BodyImpl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -30,21 +30,30 @@
 import java.util.logging.Level;
 
 import javax.xml.namespace.QName;
-import javax.xml.soap.*;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 
 import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
-import org.w3c.dom.*;
-import org.w3c.dom.Node;
 
 import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocument;
 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
 import com.sun.xml.internal.messaging.saaj.soap.StaxBridge;
 import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPBodyElement;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFault;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
 
 /**
  * The implementation of SOAP-ENV:BODY or the SOAPBody abstraction.
@@ -72,6 +81,7 @@
     protected abstract SOAPFault createFaultElement();
     protected abstract QName getDefaultFaultCode();
 
+    @Override
     public SOAPFault addFault() throws SOAPException {
         if (hasFault()) {
             log.severe("SAAJ0110.impl.fault.already.exists");
@@ -88,6 +98,7 @@
         return fault;
     }
 
+    @Override
     public SOAPFault addFault(
         Name faultCode,
         String faultString,
@@ -100,6 +111,7 @@
         return fault;
     }
 
+    @Override
    public SOAPFault addFault(
         QName faultCode,
         String faultString,
@@ -112,6 +124,7 @@
         return fault;
     }
 
+    @Override
     public SOAPFault addFault(Name faultCode, String faultString)
         throws SOAPException {
 
@@ -121,6 +134,7 @@
         return fault;
     }
 
+    @Override
     public SOAPFault addFault(QName faultCode, String faultString)
         throws SOAPException {
 
@@ -147,6 +161,7 @@
         return null;
     }
 
+    @Override
     public boolean hasFault() {
         QName payloadQName = getPayloadQName();
         return getFaultQName().equals(payloadQName);
@@ -156,6 +171,7 @@
         return new QName(getNamespaceURI(), "Fault");
     }
 
+    @Override
     public SOAPFault getFault() {
         if (hasFault()) {
             if (fault == null) {
@@ -167,6 +183,7 @@
         return null;
     }
 
+    @Override
     public SOAPBodyElement addBodyElement(Name name) throws SOAPException {
         SOAPBodyElement newBodyElement =
             (SOAPBodyElement) ElementFactory.createNamedElement(
@@ -181,6 +198,7 @@
         return newBodyElement;
     }
 
+    @Override
     public SOAPBodyElement addBodyElement(QName qname) throws SOAPException {
         SOAPBodyElement newBodyElement =
             (SOAPBodyElement) ElementFactory.createNamedElement(
@@ -195,6 +213,7 @@
         return newBodyElement;
     }
 
+    @Override
     public void setParentElement(SOAPElement element) throws SOAPException {
 
         if (!(element instanceof SOAPEnvelope)) {
@@ -204,10 +223,12 @@
         super.setParentElement(element);
     }
 
+    @Override
     protected SOAPElement addElement(Name name) throws SOAPException {
         return addBodyElement(name);
     }
 
+    @Override
     protected SOAPElement addElement(QName name) throws SOAPException {
         return addBodyElement(name);
     }
@@ -226,6 +247,7 @@
     //        return super.replaceChild(newElement, ref);
     //    }
 
+    @Override
     public SOAPBodyElement addDocument(Document document)
         throws SOAPException {
         /*
@@ -252,7 +274,7 @@
             org.w3c.dom.Node replacingNode = ownerDoc.importNode(docFrag, true);
             // Adding replacingNode at the last of the children list of body
             addNode(replacingNode);
-            Iterator<Node> i =
+            Iterator<javax.xml.soap.Node> i =
                 getChildElements(NameImpl.copyElementName(rootElement));
             // Return the child element with the required name which is at the
             // end of the list
@@ -263,6 +285,7 @@
         //*/
     }
 
+    @Override
     protected SOAPElement convertToSoapElement(Element element) {
         final Node soapNode = getSoapDocument().findIfPresent(element);
         if ((soapNode instanceof SOAPBodyElement) &&
@@ -278,6 +301,7 @@
         }
     }
 
+    @Override
     public SOAPElement setElementQName(QName newName) throws SOAPException {
         log.log(Level.SEVERE,
                 "SAAJ0146.impl.invalid.name.change.requested",
@@ -288,9 +312,10 @@
                                 + newName.getLocalPart());
     }
 
+    @Override
     public Document extractContentAsDocument() throws SOAPException {
 
-        Iterator<Node> eachChild = getChildElements();
+        Iterator<javax.xml.soap.Node> eachChild = getChildElements();
         javax.xml.soap.Node firstBodyElement = null;
 
         while (eachChild.hasNext() &&
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/CDATAImpl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/CDATAImpl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -25,325 +25,61 @@
 
 package com.sun.xml.internal.messaging.saaj.soap.impl;
 
-import java.util.logging.Logger;
+import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
+import org.w3c.dom.CDATASection;
+import org.w3c.dom.CharacterData;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Text;
 
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPException;
-
-import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
-import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
-import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
-import org.w3c.dom.CDATASection;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Text;
-import org.w3c.dom.UserDataHandler;
-
-public class CDATAImpl implements CDATASection, javax.xml.soap.Text {
-
-    protected static final Logger log =
-        Logger.getLogger(LogDomainConstants.SOAP_IMPL_DOMAIN,
-                         "com.sun.xml.internal.messaging.saaj.soap.impl.LocalStrings");
+public class CDATAImpl extends TextImpl<CDATASection> implements CDATASection {
 
     static final String cdataUC = "<![CDATA[";
     static final String cdataLC = "<![cdata[";
 
+    public CDATAImpl(SOAPDocumentImpl ownerDoc, String text) {
+        super(ownerDoc, text);
+    }
+
+    public CDATAImpl(SOAPDocumentImpl ownerDoc, CharacterData data) {
+        super(ownerDoc, data);
+    }
+
+    @Override
+    protected CDATASection createN(SOAPDocumentImpl ownerDoc, String text) {
+        CDATASection c = ownerDoc.getDomDocument().createCDATASection(text);
+//        ownerDoc.register(this);
+        return c;
+    }
+
+    @Override
+    protected CDATASection createN(SOAPDocumentImpl ownerDoc, CharacterData data) {
+        CDATASection c = (CDATASection) data;
+        return c;
+    }
+
     @Override
     public Text splitText(int offset) throws DOMException {
-        return cdataSection.splitText(offset);
+        return getDomElement().splitText(offset);
     }
 
     @Override
     public boolean isElementContentWhitespace() {
-        return cdataSection.isElementContentWhitespace();
+        return getDomElement().isElementContentWhitespace();
     }
 
     @Override
     public String getWholeText() {
-        return cdataSection.getWholeText();
+        return getDomElement().getWholeText();
     }
 
     @Override
     public Text replaceWholeText(String content) throws DOMException {
-        return cdataSection.replaceWholeText(content);
+        return getDomElement().replaceWholeText(content);
     }
 
     @Override
-    public String getData() throws DOMException {
-        return cdataSection.getData();
-    }
-
-    @Override
-    public void setData(String data) throws DOMException {
-        cdataSection.setData(data);
-    }
-
-    @Override
-    public int getLength() {
-        return cdataSection.getLength();
-    }
-
-    @Override
-    public String substringData(int offset, int count) throws DOMException {
-        return cdataSection.substringData(offset, count);
-    }
-
-    @Override
-    public void appendData(String arg) throws DOMException {
-        cdataSection.appendData(arg);
-    }
-
-    @Override
-    public void insertData(int offset, String arg) throws DOMException {
-        cdataSection.insertData(offset, arg);
-    }
-
-    @Override
-    public void deleteData(int offset, int count) throws DOMException {
-        cdataSection.deleteData(offset, count);
-    }
-
-    @Override
-    public void replaceData(int offset, int count, String arg) throws DOMException {
-        cdataSection.replaceData(offset, count, arg);
-    }
-
-    @Override
-    public String getNodeName() {
-        return cdataSection.getNodeName();
-    }
-
-    @Override
-    public String getNodeValue() throws DOMException {
-        return cdataSection.getNodeValue();
-    }
-
-    @Override
-    public void setNodeValue(String nodeValue) throws DOMException {
-        cdataSection.setNodeValue(nodeValue);
-    }
-
-    @Override
-    public short getNodeType() {
-        return cdataSection.getNodeType();
-    }
-
-    @Override
-    public Node getParentNode() {
-        return cdataSection.getParentNode();
-    }
-
-    @Override
-    public NodeList getChildNodes() {
-        return cdataSection.getChildNodes();
-    }
-
-    @Override
-    public Node getFirstChild() {
-        return cdataSection.getFirstChild();
-    }
-
-    @Override
-    public Node getLastChild() {
-        return cdataSection.getLastChild();
-    }
-
-    @Override
-    public Node getPreviousSibling() {
-        return cdataSection.getPreviousSibling();
-    }
-
-    @Override
-    public Node getNextSibling() {
-        return cdataSection.getNextSibling();
-    }
-
-    @Override
-    public NamedNodeMap getAttributes() {
-        return cdataSection.getAttributes();
-    }
-
-    @Override
-    public Document getOwnerDocument() {
-        return cdataSection.getOwnerDocument();
-    }
-
-    @Override
-    public Node insertBefore(Node newChild, Node refChild) throws DOMException {
-        return cdataSection.insertBefore(newChild, refChild);
-    }
-
-    @Override
-    public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
-        return cdataSection.replaceChild(newChild, oldChild);
-    }
-
-    @Override
-    public Node removeChild(Node oldChild) throws DOMException {
-        return cdataSection.removeChild(oldChild);
-    }
-
-    @Override
-    public Node appendChild(Node newChild) throws DOMException {
-        return cdataSection.appendChild(newChild);
-    }
-
-    @Override
-    public boolean hasChildNodes() {
-        return cdataSection.hasChildNodes();
-    }
-
-    @Override
-    public Node cloneNode(boolean deep) {
-        return cdataSection.cloneNode(deep);
-    }
-
-    @Override
-    public void normalize() {
-        cdataSection.normalize();
-    }
-
-    @Override
-    public boolean isSupported(String feature, String version) {
-        return cdataSection.isSupported(feature, version);
-    }
-
-    @Override
-    public String getNamespaceURI() {
-        return cdataSection.getNamespaceURI();
-    }
-
-    @Override
-    public String getPrefix() {
-        return cdataSection.getPrefix();
-    }
-
-    @Override
-    public void setPrefix(String prefix) throws DOMException {
-        cdataSection.setPrefix(prefix);
-    }
-
-    @Override
-    public String getLocalName() {
-        return cdataSection.getLocalName();
-    }
-
-    @Override
-    public boolean hasAttributes() {
-        return cdataSection.hasAttributes();
-    }
-
-    @Override
-    public String getBaseURI() {
-        return cdataSection.getBaseURI();
-    }
-
-    @Override
-    public short compareDocumentPosition(Node other) throws DOMException {
-        return cdataSection.compareDocumentPosition(other);
-    }
-
-    @Override
-    public String getTextContent() throws DOMException {
-        return cdataSection.getTextContent();
-    }
-
-    @Override
-    public void setTextContent(String textContent) throws DOMException {
-        cdataSection.setTextContent(textContent);
-    }
-
-    @Override
-    public boolean isSameNode(Node other) {
-        return cdataSection.isSameNode(other);
-    }
-
-    @Override
-    public String lookupPrefix(String namespaceURI) {
-        return cdataSection.lookupPrefix(namespaceURI);
-    }
-
-    @Override
-    public boolean isDefaultNamespace(String namespaceURI) {
-        return cdataSection.isDefaultNamespace(namespaceURI);
-    }
-
-    @Override
-    public String lookupNamespaceURI(String prefix) {
-        return cdataSection.lookupNamespaceURI(prefix);
-    }
-
-    @Override
-    public boolean isEqualNode(Node arg) {
-        return cdataSection.isEqualNode(arg);
-    }
-
-    @Override
-    public Object getFeature(String feature, String version) {
-        return cdataSection.getFeature(feature, version);
-    }
-
-    @Override
-    public Object setUserData(String key, Object data, UserDataHandler handler) {
-        return cdataSection.setUserData(key, data, handler);
-    }
-
-    @Override
-    public Object getUserData(String key) {
-        return cdataSection.getUserData(key);
-    }
-
-    private CDATASection cdataSection;
-
-    public CDATAImpl(SOAPDocumentImpl ownerDoc, String text) {
-        cdataSection = ownerDoc.getDomDocument().createCDATASection(text);
-        ownerDoc.register(this);
-    }
-
-    public String getValue() {
-        String nodeValue = getNodeValue();
-        return (nodeValue.equals("") ? null : nodeValue);
-    }
-
-    public void setValue(String text) {
-        setNodeValue(text);
-    }
-
-    public void setParentElement(SOAPElement parent) throws SOAPException {
-        if (parent == null) {
-            log.severe("SAAJ0145.impl.no.null.to.parent.elem");
-            throw new SOAPException("Cannot pass NULL to setParentElement");
-        }
-        ((ElementImpl) parent).addNode(this);
-    }
-
-    public SOAPElement getParentElement() {
-        return (SOAPElement) getParentNode();
-    }
-
-
-    public void detachNode() {
-        org.w3c.dom.Node parent = getParentNode();
-        if (parent != null) {
-            parent.removeChild(this);
-        }
-    }
-
-    public void recycleNode() {
-        detachNode();
-        // TBD
-        //  - add this to the factory so subsequent
-        //    creations can reuse this object.
-    }
-
     public boolean isComment() {
         return false;
     }
 
-    public CDATASection getDomElement() {
-        return cdataSection;
-    }
 }
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/DetailEntryImpl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/DetailEntryImpl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -30,6 +30,7 @@
 import javax.xml.soap.Name;
 
 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
+import org.w3c.dom.Element;
 
 public abstract class DetailEntryImpl
     extends ElementImpl
@@ -40,4 +41,8 @@
     public DetailEntryImpl(SOAPDocumentImpl ownerDoc, QName qname) {
         super(ownerDoc, qname);
     }
+
+    public DetailEntryImpl(SOAPDocumentImpl ownerDoc, Element domElement) {
+        super(ownerDoc, domElement);
+    }
 }
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/DetailImpl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/DetailImpl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -31,7 +31,6 @@
 import javax.xml.namespace.QName;
 import javax.xml.soap.*;
 
-import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
 import org.w3c.dom.Element;
 
 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
@@ -49,26 +48,31 @@
     protected abstract DetailEntry createDetailEntry(Name name);
     protected abstract DetailEntry createDetailEntry(QName name);
 
+    @Override
     public DetailEntry addDetailEntry(Name name) throws SOAPException {
         DetailEntry entry = createDetailEntry(name);
         addNode(entry);
         return entry;
     }
 
+    @Override
     public DetailEntry addDetailEntry(QName qname) throws SOAPException {
         DetailEntry entry = createDetailEntry(qname);
         addNode(entry);
         return entry;
     }
 
+    @Override
     protected SOAPElement addElement(Name name) throws SOAPException {
         return addDetailEntry(name);
     }
 
+    @Override
     protected SOAPElement addElement(QName name) throws SOAPException {
         return addDetailEntry(name);
     }
 
+    @Override
     protected SOAPElement convertToSoapElement(Element element) {
         final javax.xml.soap.Node soapNode = getSoapDocument().find(element);
         if (soapNode instanceof DetailEntry) {
@@ -82,12 +86,14 @@
         }
     }
 
-    public Iterator getDetailEntries() {
-        return new Iterator<SOAPElement>() {
+    @Override
+    public Iterator<DetailEntry> getDetailEntries() {
+        return new Iterator<DetailEntry>() {
             Iterator<org.w3c.dom.Node> eachNode = getChildElementNodes();
             SOAPElement next = null;
             SOAPElement last = null;
 
+            @Override
             public boolean hasNext() {
                 if (next == null) {
                     while (eachNode.hasNext()) {
@@ -101,15 +107,17 @@
                 return next != null;
             }
 
-            public SOAPElement next() {
+            @Override
+            public DetailEntry next() {
                 if (!hasNext()) {
                     throw new NoSuchElementException();
                 }
                 last = next;
                 next = null;
-                return last;
+                return (DetailEntry) last;
             }
 
+            @Override
             public void remove() {
                 if (last == null) {
                     throw new IllegalStateException();
@@ -121,6 +129,7 @@
         };
     }
 
+    @Override
    protected  boolean isStandardFaultElement() {
        return true;
    }
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/ElementFactory.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/ElementFactory.java	Mon Jul 10 15:54:38 2017 +0200
@@ -106,9 +106,9 @@
         }
         if ("Fault".equalsIgnoreCase(localName)) {
             if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
-                return new Fault1_1Impl(element, ownerDocument);
+                return new Fault1_1Impl(ownerDocument, element);
             } else if (NameImpl.SOAP12_NAMESPACE.equals(namespaceUri)) {
-                return new Fault1_2Impl(element, ownerDocument);
+                return new Fault1_2Impl(ownerDocument, element);
             }
 
         }
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/ElementImpl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/ElementImpl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -27,21 +27,37 @@
 
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.util.*;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import javax.xml.namespace.QName;
-import javax.xml.soap.*;
 
-import org.w3c.dom.*;
 import org.w3c.dom.Node;
 
 import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocument;
 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
 import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
-import com.sun.xml.internal.messaging.saaj.util.*;
+import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
+import com.sun.xml.internal.messaging.saaj.util.NamespaceContextIterator;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPBodyElement;
+import javax.xml.soap.SOAPConstants;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import org.w3c.dom.Attr;
+import org.w3c.dom.CharacterData;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.TypeInfo;
+import org.w3c.dom.UserDataHandler;
 
 public class ElementImpl implements SOAPElement, SOAPBodyElement {
 
@@ -108,7 +124,7 @@
 
     @Override
     public NodeList getElementsByTagName(String name) {
-        return new NodeListImpl(getSoapDocument(), element.getElementsByTagName(name));
+        return new NodeListImpl(soapDocument, element.getElementsByTagName(name));
     }
 
     @Override
@@ -139,21 +155,21 @@
         this.soapDocument = ownerDoc;
         this.element = ownerDoc.getDomDocument().createElementNS(name.getURI(), name.getQualifiedName());
         elementQName = NameImpl.convertToQName(name);
-        getSoapDocument().register(this);
+        soapDocument.register(this);
     }
 
     public ElementImpl(SOAPDocumentImpl ownerDoc, QName name) {
         this.soapDocument = ownerDoc;
         this.element = ownerDoc.getDomDocument().createElementNS(name.getNamespaceURI(), getQualifiedName(name));
         elementQName = name;
-        getSoapDocument().register(this);
+        soapDocument.register(this);
     }
 
     public ElementImpl(SOAPDocumentImpl ownerDoc, Element domElement) {
         this.element = domElement;
         this.soapDocument = ownerDoc;
         this.elementQName = new QName(domElement.getNamespaceURI(), domElement.getLocalName());
-        getSoapDocument().register(this);
+        soapDocument.register(this);
     }
 
     public ElementImpl(
@@ -165,7 +181,7 @@
         this.element = ownerDoc.getDomDocument().createElementNS(uri, qualifiedName);
         elementQName =
             new QName(uri, getLocalPart(qualifiedName), getPrefix(qualifiedName));
-        getSoapDocument().register(this);
+        soapDocument.register(this);
     }
 
     public void ensureNamespaceIsDeclared(String prefix, String uri) {
@@ -178,28 +194,29 @@
         }
     }
 
+    @Override
     public Document getOwnerDocument() {
         return soapDocument;
     }
 
     @Override
     public Node insertBefore(Node newChild, Node refChild) throws DOMException {
-        return element.insertBefore(getSoapDocument().getDomNode(newChild), getSoapDocument().getDomNode(refChild));
+        return soapDocument.findIfPresent(element.insertBefore(soapDocument.getDomNode(newChild), soapDocument.getDomNode(refChild)));
     }
 
     @Override
     public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
-        return element.replaceChild(getSoapDocument().getDomNode(newChild), getSoapDocument().getDomNode(oldChild));
+        return soapDocument.findIfPresent(element.replaceChild(soapDocument.getDomNode(newChild), soapDocument.getDomNode(oldChild)));
     }
 
     @Override
     public Node removeChild(Node oldChild) throws DOMException {
-        return element.removeChild(getSoapDocument().getDomNode(oldChild));
+        return soapDocument.findIfPresent(element.removeChild(soapDocument.getDomNode(oldChild)));
     }
 
     @Override
     public Node appendChild(Node newChild) throws DOMException {
-        return element.appendChild(getSoapDocument().getDomNode(newChild));
+        return soapDocument.findIfPresent(element.appendChild(soapDocument.getDomNode(newChild)));
     }
 
     @Override
@@ -209,7 +226,9 @@
 
     @Override
     public Node cloneNode(boolean deep) {
-        return element.cloneNode(deep);
+        Node elementNSNode = element.cloneNode(deep);
+        soapDocument.registerChildNodes(elementNSNode, deep);
+        return soapDocument.findIfPresent(soapDocument.getDomNode(elementNSNode));
     }
 
     @Override
@@ -254,7 +273,7 @@
 
     @Override
     public short compareDocumentPosition(Node other) throws DOMException {
-        return element.compareDocumentPosition(other);
+        return element.compareDocumentPosition(soapDocument.getDomNode(other));
     }
 
     @Override
@@ -269,7 +288,7 @@
 
     @Override
     public boolean isSameNode(Node other) {
-        return element.isSameNode(other);
+        return element.isSameNode(soapDocument.getDomNode(other));
     }
 
     @Override
@@ -289,7 +308,7 @@
 
     @Override
     public boolean isEqualNode(Node arg) {
-        return element.isEqualNode(arg);
+        return element.isEqualNode(soapDocument.getDomNode(arg));
     }
 
     @Override
@@ -307,14 +326,17 @@
         return element.getUserData(key);
     }
 
+    @Override
     public SOAPElement addChildElement(Name name) throws SOAPException {
         return  addElement(name);
     }
 
+    @Override
     public SOAPElement addChildElement(QName qname) throws SOAPException {
         return  addElement(qname);
     }
 
+    @Override
     public SOAPElement addChildElement(String localName) throws SOAPException {
         String nsUri = getNamespaceURI("");
         Name name = (nsUri == null || nsUri.isEmpty())
@@ -323,6 +345,7 @@
         return addChildElement(name);
     }
 
+    @Override
     public SOAPElement addChildElement(String localName, String prefix)
         throws SOAPException {
         String uri = getNamespaceURI(prefix);
@@ -337,6 +360,7 @@
         return addChildElement(localName, prefix, uri);
     }
 
+    @Override
     public String getNamespaceURI(String prefix) {
 
         if ("xmlns".equals(prefix)) {
@@ -415,12 +439,14 @@
         return null;
     }
 
+    @Override
     public SOAPElement setElementQName(QName newName) throws SOAPException {
         ElementImpl copy =
             new ElementImpl((SOAPDocumentImpl) getOwnerDocument(), newName);
         return replaceElementWithSOAPElement(this,copy);
     }
 
+    @Override
     public QName createQName(String localName, String prefix)
         throws SOAPException {
         String uri = getNamespaceURI(prefix);
@@ -485,6 +511,7 @@
         return new NamespaceContextIterator(this, traverseStack);
     }
 
+    @Override
     public SOAPElement addChildElement(
         String localName,
         String prefix,
@@ -496,6 +523,7 @@
         return convertToSoapElement(newElement);
     }
 
+    @Override
     public SOAPElement addChildElement(SOAPElement element)
         throws SOAPException {
 
@@ -531,7 +559,7 @@
                    log.severe("SAAJ0158.impl.version.mismatch.fault");
                    throw new SOAPExceptionImpl("SOAP Version mismatch encountered when trying to add SOAPFault to SOAPBody");
                }
-               Iterator<Node> it = this.getChildElements();
+               Iterator<javax.xml.soap.Node> it = this.getChildElements();
                if (it.hasNext()) {
                    log.severe("SAAJ0156.impl.adding.fault.error");
                    throw new SOAPExceptionImpl("Cannot add SOAPFault as a child of a non-Empty SOAPBody");
@@ -542,8 +570,7 @@
         // preserve the encodingStyle attr as it may get lost in the import
         String encodingStyle = element.getEncodingStyle();
 
-        final Element domElement = ((ElementImpl) element).getDomElement();
-        final Element importedElement = importElement(domElement);
+        final Element importedElement = importElement(element);
         addNode(importedElement);
 
         final SOAPElement converted = convertToSoapElement(importedElement);
@@ -603,7 +630,7 @@
     }
 
     protected void addNode(org.w3c.dom.Node newElement) throws SOAPException {
-        insertBefore(getSoapDocument().getDomNode(newElement), null);
+        insertBefore(soapDocument.getDomNode(newElement), null);
 
         if (getOwnerDocument() instanceof DocumentFragment)
             return;
@@ -623,7 +650,7 @@
         Node child = getFirstChild();
         while (child != null) {
             if (child instanceof Element) {
-                return (Element) getSoapDocument().find(child);
+                return (Element) soapDocument.find(child);
             }
             child = child.getNextSibling();
         }
@@ -634,7 +661,7 @@
         Node eachChild = getFirstChild();
         while (eachChild != null) {
             if (eachChild instanceof Element) {
-                SOAPElement eachChildSoap = (SOAPElement) getSoapDocument().find(eachChild);
+                SOAPElement eachChildSoap = (SOAPElement) soapDocument.find(eachChild);
                 if (eachChildSoap != null) {
                     if (eachChildSoap.getElementName().equals(name)) {
                         return eachChildSoap;
@@ -658,6 +685,7 @@
         return null;
     }
 
+    @Override
     public SOAPElement addTextNode(String text) throws SOAPException {
         if (text.startsWith(CDATAImpl.cdataUC)
             || text.startsWith(CDATAImpl.cdataLC))
@@ -680,6 +708,7 @@
         return this;
     }
 
+    @Override
     public SOAPElement addAttribute(Name name, String value)
         throws SOAPException {
         addAttributeBare(name, value);
@@ -689,6 +718,7 @@
         return this;
     }
 
+    @Override
     public SOAPElement addAttribute(QName qname, String value)
         throws SOAPException {
         addAttributeBare(qname, value);
@@ -731,6 +761,7 @@
         }
     }
 
+    @Override
     public SOAPElement addNamespaceDeclaration(String prefix, String uri)
         throws SOAPException {
         if (prefix.length() > 0) {
@@ -743,10 +774,12 @@
         return this;
     }
 
+    @Override
     public String getAttributeValue(Name name) {
         return getAttributeValueFrom(this, name);
     }
 
+    @Override
     public String getAttributeValue(QName qname) {
         return getAttributeValueFrom(
                    this,
@@ -756,9 +789,10 @@
                    getQualifiedName(qname));
     }
 
-    public Iterator getAllAttributes() {
+    @Override
+    public Iterator<Name> getAllAttributes() {
         Iterator<Name> i = getAllAttributesFrom(this);
-        ArrayList<Name> list = new ArrayList<Name>();
+        ArrayList<Name> list = new ArrayList<>();
         while (i.hasNext()) {
             Name name = i.next();
             if (!"xmlns".equalsIgnoreCase(name.getPrefix()))
@@ -767,9 +801,10 @@
         return list.iterator();
     }
 
-    public Iterator getAllAttributesAsQNames() {
+    @Override
+    public Iterator<QName> getAllAttributesAsQNames() {
         Iterator<Name> i = getAllAttributesFrom(this);
-        ArrayList<QName> list = new ArrayList<QName>();
+        ArrayList<QName> list = new ArrayList<>();
         while (i.hasNext()) {
             Name name = i.next();
             if (!"xmlns".equalsIgnoreCase(name.getPrefix())) {
@@ -780,11 +815,13 @@
     }
 
 
-    public Iterator getNamespacePrefixes() {
+    @Override
+    public Iterator<String> getNamespacePrefixes() {
         return doGetNamespacePrefixes(false);
     }
 
-    public Iterator getVisibleNamespacePrefixes() {
+    @Override
+    public Iterator<String> getVisibleNamespacePrefixes() {
         return doGetNamespacePrefixes(true);
     }
 
@@ -805,11 +842,13 @@
                 }
             }
 
+            @Override
             public boolean hasNext() {
                 findNext();
                 return next != null;
             }
 
+            @Override
             public String next() {
                 findNext();
                 if (next == null) {
@@ -821,6 +860,7 @@
                 return last;
             }
 
+            @Override
             public void remove() {
                 if (last == null) {
                     throw new IllegalStateException();
@@ -832,18 +872,22 @@
         };
     }
 
+    @Override
     public Name getElementName() {
         return NameImpl.convertToName(elementQName);
     }
 
+    @Override
     public QName getElementQName() {
         return elementQName;
     }
 
+    @Override
     public boolean removeAttribute(Name name) {
         return removeAttribute(name.getURI(), name.getLocalName());
     }
 
+    @Override
     public boolean removeAttribute(QName name) {
         return removeAttribute(name.getNamespaceURI(), name.getLocalPart());
     }
@@ -860,6 +904,7 @@
         return true;
     }
 
+    @Override
     public boolean removeNamespaceDeclaration(String prefix) {
         org.w3c.dom.Attr declaration = getNamespaceAttr(prefix);
         if (declaration == null) {
@@ -873,12 +918,13 @@
         return true;
     }
 
-    public Iterator<Node> getChildElements() {
+    @Override
+    public Iterator<javax.xml.soap.Node> getChildElements() {
         return getChildElementsFrom(this);
     }
 
     protected SOAPElement convertToSoapElement(Element element) {
-        final Node soapNode = getSoapDocument().findIfPresent(element);
+        final Node soapNode = soapDocument.findIfPresent(element);
         if (soapNode instanceof SOAPElement) {
             return (SOAPElement) soapNode;
         } else {
@@ -888,6 +934,36 @@
         }
     }
 
+    protected TextImpl convertToSoapText(CharacterData characterData) {
+        final Node soapNode = getSoapDocument().findIfPresent(characterData);
+        if (soapNode instanceof TextImpl) {
+            return (TextImpl) soapNode;
+        } else {
+            TextImpl t = null;
+            switch (characterData.getNodeType()) {
+                case CDATA_SECTION_NODE:
+                    t = new CDATAImpl(getSoapDocument(), characterData.getData());
+                    break;
+                case COMMENT_NODE:
+                    t = new SOAPCommentImpl(getSoapDocument(), characterData.getData());
+                    break;
+                case TEXT_NODE:
+                    t = new SOAPTextImpl(getSoapDocument(), characterData.getData());
+                    break;
+            }
+            Node parent = getSoapDocument().find(characterData.getParentNode());
+            if (parent != null) {
+                parent.replaceChild(t, characterData);
+            } // XXX else throw an exception?
+
+            return t;
+
+//            return replaceElementWithSOAPElement(
+//                element,
+//                (ElementImpl) createElement(NameImpl.copyElementName(element)));
+        }
+    }
+
     protected SOAPElement replaceElementWithSOAPElement(
         Element element,
         ElementImpl copy) {
@@ -898,13 +974,13 @@
             copy.addAttributeBare(name, getAttributeValueFrom(element, name));
         }
 
-        Iterator<Node> eachChild = getChildElementsFrom(element);
+        Iterator<Node> eachChild = getChildElementsFromDOM(element);
         while (eachChild.hasNext()) {
             Node nextChild = eachChild.next();
             copy.insertBefore(nextChild, null);
         }
 
-        Node parent = getSoapDocument().find(element.getParentNode());
+        Node parent = soapDocument.find(element.getParentNode());
         if (parent != null) {
             parent.replaceChild(copy, element);
         } // XXX else throw an exception?
@@ -912,18 +988,71 @@
         return copy;
     }
 
+    private Iterator<Node> getChildElementsFromDOM(final Element el) {
+        return new Iterator<Node>() {
+            Node next = el.getFirstChild();
+            Node nextNext = null;
+            Node last = null;
+            Node soapElement = getSoapDocument().findIfPresent(el);
+
+            @Override
+            public boolean hasNext() {
+                if (next != null) {
+                    return true;
+                }
+                if (nextNext != null) {
+                    next = nextNext;
+                }
+
+                return next != null;
+            }
+
+            public Node next() {
+                if (hasNext()) {
+                    last = next;
+                    next = null;
+
+                    if ((soapElement instanceof ElementImpl)
+                            && (last instanceof Element)) {
+                        last =
+                                ((ElementImpl) soapElement).convertToSoapElement(
+                                        (Element) last);
+                    } else if ((soapElement instanceof ElementImpl) && (last instanceof CharacterData)) {
+                        last = ((ElementImpl) soapElement).convertToSoapText(
+                                        (CharacterData) last);
+                    }
+
+                    nextNext = last.getNextSibling();
+                    return last;
+                }
+                throw new NoSuchElementException();
+            }
+
+            @Override
+            public void remove() {
+                if (last == null) {
+                    throw new IllegalStateException();
+                }
+                Node target = last;
+                last = null;
+                el.removeChild(target);
+            }
+        };
+    }
+
     protected Iterator<Node> getChildElementNodes() {
         return new Iterator<Node>() {
-            Iterator<Node> eachNode = getChildElements();
+            Iterator<javax.xml.soap.Node> eachNode = getChildElements();
             Node next = null;
             Node last = null;
 
+            @Override
             public boolean hasNext() {
                 if (next == null) {
                     while (eachNode.hasNext()) {
                         Node node = eachNode.next();
                         if (node instanceof Element) {
-                            next = getSoapDocument().findIfPresent(node);
+                            next = soapDocument.findIfPresent(node);
                             break;
                         }
                     }
@@ -931,15 +1060,17 @@
                 return next != null;
             }
 
-            public Node next() {
+            @Override
+            public javax.xml.soap.Node next() {
                 if (hasNext()) {
                     last = next;
                     next = null;
-                    return last;
+                    return (javax.xml.soap.Node) last;
                 }
                 throw new NoSuchElementException();
             }
 
+            @Override
             public void remove() {
                 if (last == null) {
                     throw new IllegalStateException();
@@ -951,20 +1082,23 @@
         };
     }
 
-    public Iterator getChildElements(final Name name) {
+    @Override
+    public Iterator<javax.xml.soap.Node> getChildElements(final Name name) {
        return getChildElements(name.getURI(), name.getLocalName());
     }
 
-    public Iterator getChildElements(final QName qname) {
+    @Override
+    public Iterator<javax.xml.soap.Node> getChildElements(final QName qname) {
         return getChildElements(qname.getNamespaceURI(), qname.getLocalPart());
     }
 
-    private Iterator<Node> getChildElements(final String nameUri, final String nameLocal) {
-        return new Iterator<Node>() {
+    private Iterator<javax.xml.soap.Node> getChildElements(final String nameUri, final String nameLocal) {
+        return new Iterator<javax.xml.soap.Node>() {
             Iterator<Node> eachElement = getChildElementNodes();
             Node next = null;
             Node last = null;
 
+            @Override
             public boolean hasNext() {
                 if (next == null) {
                     while (eachElement.hasNext()) {
@@ -982,15 +1116,17 @@
                 return next != null;
             }
 
-            public Node next() {
+            @Override
+            public javax.xml.soap.Node next() {
                 if (!hasNext()) {
                     throw new NoSuchElementException();
                 }
                 last = next;
                 next = null;
-                return last;
+                return (javax.xml.soap.Node) last;
             }
 
+            @Override
             public void remove() {
                 if (last == null) {
                     throw new IllegalStateException();
@@ -1002,6 +1138,7 @@
         };
     }
 
+    @Override
     public void removeContents() {
         Node currentChild = getFirstChild();
 
@@ -1020,6 +1157,7 @@
         }
     }
 
+    @Override
     public void setEncodingStyle(String encodingStyle) throws SOAPException {
         if (!"".equals(encodingStyle)) {
             try {
@@ -1037,6 +1175,7 @@
         tryToFindEncodingStyleAttributeName();
     }
 
+    @Override
     public String getEncodingStyle() {
         String encodingStyle = encodingStyleAttribute.getValue();
         if (encodingStyle != null)
@@ -1058,11 +1197,13 @@
     }
 
     // Node methods
+    @Override
     public String getValue() {
         javax.xml.soap.Node valueNode = getValueNode();
         return valueNode == null ? null : valueNode.getValue();
     }
 
+    @Override
     public void setValue(String value) {
         Node valueNode = getValueNodeStrict();
         if (valueNode != null) {
@@ -1092,7 +1233,7 @@
     }
 
     protected javax.xml.soap.Node getValueNode() {
-        Iterator<Node> i = getChildElements();
+        Iterator<javax.xml.soap.Node> i = getChildElements();
         while (i.hasNext()) {
             Node n = i.next();
             if (n.getNodeType() == org.w3c.dom.Node.TEXT_NODE ||
@@ -1101,12 +1242,13 @@
                 normalize();
                 // Should remove the normalization step when this gets fixed in
                 // DOM/Xerces.
-                return getSoapDocument().find(n);
+                return soapDocument.find(n);
             }
         }
         return null;
     }
 
+    @Override
     public void setParentElement(SOAPElement element) throws SOAPException {
         if (element == null) {
             log.severe("SAAJ0106.impl.no.null.to.parent.elem");
@@ -1138,12 +1280,13 @@
         encodingStyleAttribute.setName(encodingStyleAttributeName);
     }
 
+    @Override
     public SOAPElement getParentElement() {
         Node parentNode = getParentNode();
         if (parentNode instanceof SOAPDocument) {
             return null;
         }
-        return (SOAPElement) getSoapDocument().find(parentNode);
+        return (SOAPElement) soapDocument.find(parentNode);
     }
 
     protected String getSOAPNamespace() {
@@ -1167,6 +1310,7 @@
         return soapNamespace;
     }
 
+    @Override
     public void detachNode() {
         Node parent = getParentNode();
         if (parent != null) {
@@ -1184,6 +1328,7 @@
         }
     }
 
+    @Override
     public void recycleNode() {
         detachNode();
         // TBD
@@ -1260,10 +1405,12 @@
             int attributeIndex = 0;
             String currentName;
 
+            @Override
             public boolean hasNext() {
                 return attributeIndex < attributesLength;
             }
 
+            @Override
             public Name next() {
                 if (!hasNext()) {
                     throw new NoSuchElementException();
@@ -1283,6 +1430,7 @@
                 }
             }
 
+            @Override
             public void remove() {
                 if (currentName == null) {
                     throw new IllegalStateException();
@@ -1331,13 +1479,14 @@
         return attribute == null ? null : attribute.getValue();
     }
 
-    protected Iterator<Node> getChildElementsFrom(final Element element) {
-        return new Iterator<Node>() {
+    protected Iterator<javax.xml.soap.Node> getChildElementsFrom(final Element element) {
+        return new Iterator<javax.xml.soap.Node>() {
             Node next = element.getFirstChild();
             Node nextNext = null;
             Node last = null;
-            Node soapElement = getSoapDocument().findIfPresent(element);
+            Node soapElement = soapDocument.findIfPresent(element);
 
+            @Override
             public boolean hasNext() {
                 if (next != null) {
                     return true;
@@ -1349,7 +1498,8 @@
                 return next != null;
             }
 
-            public Node next() {
+            @Override
+            public javax.xml.soap.Node next() {
                 if (hasNext()) {
                     last = next;
                     next = null;
@@ -1362,11 +1512,12 @@
                     }
 
                     nextNext = last.getNextSibling();
-                    return getSoapDocument().findIfPresent(last);
+                    return (javax.xml.soap.Node) soapDocument.findIfPresent(last);
                 }
                 throw new NoSuchElementException();
             }
 
+            @Override
             public void remove() {
                 if (last == null) {
                     throw new IllegalStateException();
@@ -1428,6 +1579,7 @@
     //TODO: This is a temporary SAAJ workaround for optimizing XWS
     // should be removed once the corresponding JAXP bug is fixed
     // It appears the bug will be fixed in JAXP 1.4 (not by Appserver 9 timeframe)
+    @Override
     public void setAttributeNS(
         String namespaceURI,String qualifiedName, String value) {
         int index = qualifiedName.indexOf(':');
@@ -1483,7 +1635,7 @@
 
     @Override
     public NodeList getElementsByTagNameNS(String namespaceURI, String localName) throws DOMException {
-        return new NodeListImpl(getSoapDocument(), element.getElementsByTagNameNS(namespaceURI, localName));
+        return new NodeListImpl(soapDocument, element.getElementsByTagNameNS(namespaceURI, localName));
     }
 
     @Override
@@ -1538,37 +1690,37 @@
 
     @Override
     public Node getParentNode() {
-        return getSoapDocument().find(element.getParentNode());
+        return soapDocument.find(element.getParentNode());
     }
 
     @Override
     public NodeList getChildNodes() {
-        return new NodeListImpl(getSoapDocument(), element.getChildNodes());
+        return new NodeListImpl(soapDocument, element.getChildNodes());
     }
 
     @Override
     public Node getFirstChild() {
-        return getSoapDocument().findIfPresent(element.getFirstChild());
+        return soapDocument.findIfPresent(element.getFirstChild());
     }
 
     @Override
     public Node getLastChild() {
-        return getSoapDocument().findIfPresent(element.getLastChild());
+        return soapDocument.findIfPresent(element.getLastChild());
     }
 
     @Override
     public Node getPreviousSibling() {
-        return getSoapDocument().findIfPresent(element.getPreviousSibling());
+        return soapDocument.findIfPresent(element.getPreviousSibling());
     }
 
     @Override
     public Node getNextSibling() {
-        return getSoapDocument().findIfPresent(element.getNextSibling());
+        return soapDocument.findIfPresent(element.getNextSibling());
     }
 
     @Override
     public NamedNodeMap getAttributes() {
-        return element.getAttributes();
+        return new NamedNodeMapImpl(element.getAttributes(), soapDocument);
     }
 
     public Element getDomElement() {
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/EnvelopeImpl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/EnvelopeImpl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -100,6 +100,7 @@
     protected abstract NameImpl getHeaderName(String prefix);
     protected abstract NameImpl getBodyName(String prefix);
 
+    @Override
     public SOAPHeader addHeader() throws SOAPException {
         return addHeader(null);
     }
@@ -140,6 +141,7 @@
         header = hdr;
     }
 
+    @Override
     public SOAPHeader getHeader() throws SOAPException {
         lookForHeader();
         return header;
@@ -152,6 +154,7 @@
         body = bodyChildElement;
     }
 
+    @Override
     public SOAPBody addBody() throws SOAPException {
         return addBody(null);
     }
@@ -176,6 +179,7 @@
         return body;
     }
 
+    @Override
     protected SOAPElement addElement(Name name) throws SOAPException {
         if (getBodyName(null).equals(name)) {
             return addBody(name.getPrefix());
@@ -187,6 +191,7 @@
         return super.addElement(name);
     }
 
+    @Override
     protected SOAPElement addElement(QName name) throws SOAPException {
         if (getBodyName(null).equals(NameImpl.convertToName(name))) {
             return addBody(name.getPrefix());
@@ -198,15 +203,18 @@
         return super.addElement(name);
     }
 
+    @Override
     public SOAPBody getBody() throws SOAPException {
         lookForBody();
         return body;
     }
 
+    @Override
     public Source getContent() {
         return new DOMSource(getOwnerDocument());
     }
 
+    @Override
     public Name createName(String localName, String prefix, String uri)
         throws SOAPException {
 
@@ -241,6 +249,7 @@
         return NameImpl.create(localName, prefix, namespace);
     }
 
+    @Override
     public Name createName(String localName) throws SOAPException {
         return NameImpl.createFromUnqualifiedName(localName);
     }
@@ -257,6 +266,7 @@
         charset = value;
     }
 
+    @Override
     public void output(OutputStream out) throws IOException {
         try {
 //            materializeBody();
@@ -301,6 +311,7 @@
     /**
      * Serialize to FI if boolean parameter set.
      */
+    @Override
     public void output(OutputStream out, boolean isFastInfoset)
         throws IOException
     {
@@ -353,6 +364,7 @@
     //    }
 
 
+    @Override
      public SOAPElement setElementQName(QName newName) throws SOAPException {
         log.log(Level.SEVERE,
                 "SAAJ0146.impl.invalid.name.change.requested",
@@ -389,6 +401,7 @@
                 final DOMStreamReader reader = new DOMStreamReader(this);
                 XMLStreamReaderToXMLStreamWriter writingBridge =  new XMLStreamReaderToXMLStreamWriter();
                 writingBridge.bridge( new XMLStreamReaderToXMLStreamWriter.Breakpoint(reader, writer) {
+                        @Override
                         public boolean proceedAfterStartElement()  {
                                 if ("Body".equals(reader.getLocalName()) && soapEnvNS.equals(reader.getNamespaceURI()) ){
                                         return false;
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/FaultElementImpl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/FaultElementImpl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -54,6 +54,7 @@
 
     protected abstract boolean isStandardFaultElement();
 
+    @Override
     public SOAPElement setElementQName(QName newName) throws SOAPException {
             log.log(Level.SEVERE,
                     "SAAJ0146.impl.invalid.name.change.requested",
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/HeaderElementImpl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/HeaderElementImpl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -30,6 +30,7 @@
 
 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
 import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
+import org.w3c.dom.Element;
 
 public abstract class HeaderElementImpl
     extends ElementImpl
@@ -47,6 +48,10 @@
         super(ownerDoc, qname);
     }
 
+    public HeaderElementImpl(SOAPDocumentImpl ownerDoc, Element domElement) {
+        super(ownerDoc, domElement);
+    }
+
     protected abstract NameImpl getActorAttributeName();
     protected abstract NameImpl getRoleAttributeName();
     protected abstract NameImpl getMustunderstandAttributeName();
@@ -58,6 +63,7 @@
     protected abstract String getActorOrRole();
 
 
+    @Override
     public void setParentElement(SOAPElement element) throws SOAPException {
         if (!(element instanceof SOAPHeader)) {
             log.severe("SAAJ0130.impl.header.elem.parent.mustbe.header");
@@ -67,6 +73,7 @@
         super.setParentElement(element);
     }
 
+    @Override
     public void setActor(String actorUri) {
         try {
             removeAttribute(getActorAttributeName());
@@ -76,6 +83,7 @@
     }
 
     //SOAP 1.2 supports Role
+    @Override
     public void setRole(String roleUri) throws SOAPException {
         // runtime exception thrown if called for SOAP 1.1
         removeAttribute(getRoleAttributeName());
@@ -85,6 +93,7 @@
 
     Name actorAttNameWithoutNS = NameImpl.createFromTagName("actor");
 
+    @Override
     public String getActor() {
         String actor = getAttributeValue(getActorAttributeName());
         return actor;
@@ -92,12 +101,14 @@
 
     Name roleAttNameWithoutNS = NameImpl.createFromTagName("role");
 
+    @Override
     public String getRole() {
         // runtime exception thrown for 1.1
         String role = getAttributeValue(getRoleAttributeName());
         return role;
     }
 
+    @Override
     public void setMustUnderstand(boolean mustUnderstand) {
         try {
             removeAttribute(getMustunderstandAttributeName());
@@ -108,6 +119,7 @@
         }
     }
 
+    @Override
     public boolean getMustUnderstand() {
         String mu = getAttributeValue(getMustunderstandAttributeName());
 
@@ -117,6 +129,7 @@
         return false;
     }
 
+    @Override
     public void setRelay(boolean relay) throws SOAPException {
         // runtime exception thrown for 1.1
         removeAttribute(getRelayAttributeName());
@@ -125,6 +138,7 @@
             getRelayLiteralValue(relay));
     }
 
+    @Override
     public boolean getRelay() {
         String mu = getAttributeValue(getRelayAttributeName());
         if (mu != null)
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/HeaderImpl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/HeaderImpl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -25,19 +25,25 @@
 
 package com.sun.xml.internal.messaging.saaj.soap.impl;
 
-import java.util.*;
 import java.util.logging.Level;
 
 import javax.xml.namespace.QName;
-import javax.xml.soap.*;
 
-import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
 import org.w3c.dom.Element;
 
 import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocument;
 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
 import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPHeaderElement;
 
 public abstract class HeaderImpl extends ElementImpl implements SOAPHeader {
     protected static final boolean MUST_UNDERSTAND_ONLY = false;
@@ -58,6 +64,7 @@
     protected abstract NameImpl getUpgradeName();
     protected abstract NameImpl getSupportedEnvelopeName();
 
+    @Override
     public SOAPHeaderElement addHeaderElement(Name name) throws SOAPException {
         SOAPElement newHeaderElement =
             ElementFactory.createNamedElement(
@@ -81,6 +88,7 @@
         return (SOAPHeaderElement) newHeaderElement;
     }
 
+    @Override
     public SOAPHeaderElement addHeaderElement(QName name) throws SOAPException {
         SOAPElement newHeaderElement =
             ElementFactory.createNamedElement(
@@ -104,19 +112,23 @@
         return (SOAPHeaderElement) newHeaderElement;
     }
 
+    @Override
     protected SOAPElement addElement(Name name) throws SOAPException {
         return addHeaderElement(name);
     }
 
+    @Override
     protected SOAPElement addElement(QName name) throws SOAPException {
         return addHeaderElement(name);
     }
 
-    public Iterator examineHeaderElements(String actor) {
+    @Override
+    public Iterator<SOAPHeaderElement> examineHeaderElements(String actor) {
         return getHeaderElementsForActor(actor, false, false);
     }
 
-    public Iterator extractHeaderElements(String actor) {
+    @Override
+    public Iterator<SOAPHeaderElement> extractHeaderElements(String actor) {
         return getHeaderElementsForActor(actor, true, false);
     }
 
@@ -135,9 +147,9 @@
         String actor,
         boolean detach,
         boolean mustUnderstand) {
-        List<SOAPHeaderElement> elementList = new ArrayList<SOAPHeaderElement>();
+        List<SOAPHeaderElement> elementList = new ArrayList<>();
 
-        Iterator<org.w3c.dom.Node> eachChild = getChildElements();
+        Iterator<javax.xml.soap.Node> eachChild = getChildElements();
 
         org.w3c.dom.Node currentChild = iterate(eachChild);
         while (currentChild != null) {
@@ -181,6 +193,7 @@
         return each.hasNext() ? each.next() : null;
     }
 
+    @Override
     public void setParentElement(SOAPElement element) throws SOAPException {
         if (!(element instanceof SOAPEnvelope)) {
             log.severe("SAAJ0133.impl.header.parent.mustbe.envelope");
@@ -193,6 +206,7 @@
     // namespace qualified. Holds for both SOAP versions.
     // TODO - This check needs to be made for other addChildElement() methods
     // as well.
+    @Override
     public SOAPElement addChildElement(String localName) throws SOAPException {
 
         SOAPElement element = super.addChildElement(localName);
@@ -205,19 +219,23 @@
         return element;
     }
 
-    public Iterator examineAllHeaderElements() {
+    @Override
+    public Iterator<SOAPHeaderElement> examineAllHeaderElements() {
         return getHeaderElements(null, false, MUST_UNDERSTAND_ONLY);
     }
 
-    public Iterator examineMustUnderstandHeaderElements(String actor) {
+    @Override
+    public Iterator<SOAPHeaderElement> examineMustUnderstandHeaderElements(String actor) {
         return getHeaderElements(actor, false, true);
 
     }
 
-    public Iterator extractAllHeaderElements() {
+    @Override
+    public Iterator<SOAPHeaderElement> extractAllHeaderElements() {
         return getHeaderElements(null, true, false);
     }
 
+    @Override
     public SOAPHeaderElement addUpgradeHeaderElement(Iterator supportedSoapUris)
         throws SOAPException {
         if (supportedSoapUris == null) {
@@ -241,18 +259,19 @@
                 NameImpl.createFromUnqualifiedName("qname"),
                 ns + ":Envelope");
             subElement.addNamespaceDeclaration(
-                ns,
-                (String) supportedSoapUris.next());
+                ns, (String) supportedSoapUris.next());
             i ++;
         }
         return upgradeHeaderElement;
     }
 
+    @Override
     public SOAPHeaderElement addUpgradeHeaderElement(String supportedSoapUri)
         throws SOAPException {
         return addUpgradeHeaderElement(new String[] {supportedSoapUri});
     }
 
+    @Override
     public SOAPHeaderElement addUpgradeHeaderElement(String[] supportedSoapUris)
         throws SOAPException {
 
@@ -280,6 +299,7 @@
         return upgradeHeaderElement;
     }
 
+    @Override
     protected SOAPElement convertToSoapElement(Element element) {
         final org.w3c.dom.Node soapNode = getSoapDocument().findIfPresent(element);
         if (soapNode instanceof SOAPHeaderElement) {
@@ -298,6 +318,7 @@
         }
     }
 
+    @Override
     public SOAPElement setElementQName(QName newName) throws SOAPException {
        log.log(Level.SEVERE,
                 "SAAJ0146.impl.invalid.name.change.requested",
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/LocalStrings.properties	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/LocalStrings.properties	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2013, 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
@@ -46,7 +46,7 @@
 SAAJ0123.impl.no.reserved.xmlns=SAAJ0123: Cannot declare reserved xmlns prefix
 SAAJ0124.impl.qualified.name.cannot.be.xmlns=SAAJ0124: Qualified name cannot be xmlns
 #SAAJ0125.impl.URI.cannot.be.null=SAAJ0125: URI cannot be null
-SAAJ0126.impl.cannot.locate.ns=SAAJ0126: Unable to locate namespace for prefix {0}
+#SAAJ0126.impl.cannot.locate.ns=SAAJ0126: Unable to locate namespace for prefix {0}
 SAAJ0127.impl.no.null.for.parent.elem=SAAJ0127: Cannot pass NULL to setParentElement
 
 SAAJ0130.impl.header.elem.parent.mustbe.header=SAAJ0130: Parent of a SOAPHeaderElement has to be a SOAPHeader
@@ -60,7 +60,7 @@
 SAAJ0142.impl.reason.or.text.not.supported=SAAJ0142: Fault/Reason/Text not supported by this SOAP version, try SOAP 1.2 or later
 SAAJ0143.impl.node.not.supported=SAAJ0143: Fault/Node not supported by this SOAP version, try SOAP 1.2 or later
 SAAJ0144.impl.role.not.supported=SAAJ0144: Fault/Role not supported by this SOAP version, try SOAP 1.2 or later
-SAAJ0145.impl.no.null.to.parent.elem=SAAJ0145: Cannot pass NULL to setParentElement
+#SAAJ0145.impl.no.null.to.parent.elem=SAAJ0145: Cannot pass NULL to setParentElement
 SAAJ0146.impl.invalid.name.change.requested=SAAJ0146: Cannot change name of element {0} to {1}
 SAAJ0147.impl.invalid.uri.change.requested=SAAJ0147: Cannot change the URI for prefix {0} from {1} to {2} in setElementQName
 SAAJ0148.impl.invalid.prefix.for.uri=Non-empty namespace URI: {0} for an empty prefix in SetElementQName
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/NamedNodeMapImpl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -0,0 +1,94 @@
+/*
+ * 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.xml.internal.messaging.saaj.soap.impl;
+
+import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+/**
+ * {@link NamedNodeMap} wrapper, finding SOAP elements automatically when possible.
+ *
+ * @author Roman Grigoriadi
+ */
+public class NamedNodeMapImpl implements NamedNodeMap {
+
+    private final NamedNodeMap namedNodeMap;
+
+    private final SOAPDocumentImpl soapDocument;
+
+    /**
+     * Create wrapper.
+     *
+     * @param namedNodeMap node map to wrap
+     * @param soapDocument soap document to find soap elements
+     */
+    public NamedNodeMapImpl(NamedNodeMap namedNodeMap, SOAPDocumentImpl soapDocument) {
+        this.namedNodeMap = namedNodeMap;
+        this.soapDocument = soapDocument;
+    }
+
+    @Override
+    public Node getNamedItem(String name) {
+        return soapDocument.findIfPresent(namedNodeMap.getNamedItem(name));
+    }
+
+    @Override
+    public Node setNamedItem(Node arg) throws DOMException {
+        return namedNodeMap.setNamedItem(arg);
+    }
+
+    @Override
+    public Node removeNamedItem(String name) throws DOMException {
+        return namedNodeMap.removeNamedItem(name);
+    }
+
+    @Override
+    public Node item(int index) {
+        return namedNodeMap.item(index);
+    }
+
+    @Override
+    public int getLength() {
+        return namedNodeMap.getLength();
+    }
+
+    @Override
+    public Node getNamedItemNS(String namespaceURI, String localName) throws DOMException {
+        return namedNodeMap.getNamedItemNS(namespaceURI, localName);
+    }
+
+    @Override
+    public Node setNamedItemNS(Node arg) throws DOMException {
+        return namedNodeMap.setNamedItemNS(arg);
+    }
+
+    @Override
+    public Node removeNamedItemNS(String namespaceURI, String localName) throws DOMException {
+        return namedNodeMap.removeNamedItemNS(namespaceURI, localName);
+    }
+}
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/SOAPCommentImpl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/SOAPCommentImpl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -25,327 +25,64 @@
 
 package com.sun.xml.internal.messaging.saaj.soap.impl;
 
-import java.util.ResourceBundle;
-import java.util.logging.Logger;
-
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPException;
-
-import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
+import org.w3c.dom.CharacterData;
 import org.w3c.dom.Comment;
 import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
 import org.w3c.dom.Text;
 
 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
-import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
-import org.w3c.dom.UserDataHandler;
+import static com.sun.xml.internal.messaging.saaj.soap.impl.TextImpl.log;
 
-public class SOAPCommentImpl
-    implements javax.xml.soap.Text, org.w3c.dom.Comment {
+public class SOAPCommentImpl extends TextImpl<Comment> implements Comment {
 
-    protected static final Logger log =
-        Logger.getLogger(LogDomainConstants.SOAP_IMPL_DOMAIN,
-                         "com.sun.xml.internal.messaging.saaj.soap.impl.LocalStrings");
-    protected static ResourceBundle rb =
-        log.getResourceBundle();
+    public SOAPCommentImpl(SOAPDocumentImpl ownerDoc, String text) {
+        super(ownerDoc, text);
+    }
 
-    @Override
-    public String getData() throws DOMException {
-        return comment.getData();
+    public SOAPCommentImpl(SOAPDocumentImpl ownerDoc, CharacterData data) {
+        super(ownerDoc, data);
     }
 
     @Override
-    public void setData(String data) throws DOMException {
-        comment.setData(data);
+    protected Comment createN(SOAPDocumentImpl ownerDoc, String text) {
+        Comment c = ownerDoc.getDomDocument().createComment(text);
+//        ownerDoc.register(this);
+        return c;
     }
 
     @Override
-    public int getLength() {
-        return comment.getLength();
+    protected Comment createN(SOAPDocumentImpl ownerDoc, CharacterData data) {
+        Comment c = (Comment) data;
+        return c;
     }
 
     @Override
-    public String substringData(int offset, int count) throws DOMException {
-        return comment.substringData(offset, count);
-    }
-
-    @Override
-    public void appendData(String arg) throws DOMException {
-        comment.appendData(arg);
-    }
-
-    @Override
-    public void insertData(int offset, String arg) throws DOMException {
-        comment.insertData(offset, arg);
-    }
-
-    @Override
-    public void deleteData(int offset, int count) throws DOMException {
-        comment.deleteData(offset, count);
-    }
-
-    @Override
-    public void replaceData(int offset, int count, String arg) throws DOMException {
-        comment.replaceData(offset, count, arg);
-    }
-
-    @Override
-    public String getNodeName() {
-        return comment.getNodeName();
-    }
-
-    @Override
-    public String getNodeValue() throws DOMException {
-        return comment.getNodeValue();
-    }
-
-    @Override
-    public void setNodeValue(String nodeValue) throws DOMException {
-        comment.setNodeValue(nodeValue);
-    }
-
-    @Override
-    public short getNodeType() {
-        return comment.getNodeType();
-    }
-
-    @Override
-    public Node getParentNode() {
-        return comment.getParentNode();
-    }
-
-    @Override
-    public NodeList getChildNodes() {
-        return comment.getChildNodes();
-    }
-
-    @Override
-    public Node getFirstChild() {
-        return comment.getFirstChild();
-    }
-
-    @Override
-    public Node getLastChild() {
-        return comment.getLastChild();
-    }
-
-    @Override
-    public Node getPreviousSibling() {
-        return comment.getPreviousSibling();
-    }
-
-    @Override
-    public Node getNextSibling() {
-        return comment.getNextSibling();
-    }
-
-    @Override
-    public NamedNodeMap getAttributes() {
-        return comment.getAttributes();
-    }
-
-    @Override
-    public Document getOwnerDocument() {
-        return comment.getOwnerDocument();
-    }
-
-    @Override
-    public Node insertBefore(Node newChild, Node refChild) throws DOMException {
-        return comment.insertBefore(newChild, refChild);
-    }
-
-    @Override
-    public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
-        return comment.replaceChild(newChild, oldChild);
-    }
-
-    @Override
-    public Node removeChild(Node oldChild) throws DOMException {
-        return comment.removeChild(oldChild);
-    }
-
-    @Override
-    public Node appendChild(Node newChild) throws DOMException {
-        return comment.appendChild(newChild);
-    }
-
-    @Override
-    public boolean hasChildNodes() {
-        return comment.hasChildNodes();
-    }
-
-    @Override
-    public Node cloneNode(boolean deep) {
-        return comment.cloneNode(deep);
-    }
-
-    @Override
-    public void normalize() {
-        comment.normalize();
-    }
-
-    @Override
-    public boolean isSupported(String feature, String version) {
-        return comment.isSupported(feature, version);
-    }
-
-    @Override
-    public String getNamespaceURI() {
-        return comment.getNamespaceURI();
-    }
-
-    @Override
-    public String getPrefix() {
-        return comment.getPrefix();
-    }
-
-    @Override
-    public void setPrefix(String prefix) throws DOMException {
-        comment.setPrefix(prefix);
-    }
-
-    @Override
-    public String getLocalName() {
-        return comment.getLocalName();
-    }
-
-    @Override
-    public boolean hasAttributes() {
-        return comment.hasAttributes();
-    }
-
-    @Override
-    public String getBaseURI() {
-        return comment.getBaseURI();
-    }
-
-    @Override
-    public short compareDocumentPosition(Node other) throws DOMException {
-        return comment.compareDocumentPosition(other);
-    }
-
-    @Override
-    public String getTextContent() throws DOMException {
-        return comment.getTextContent();
-    }
-
-    @Override
-    public void setTextContent(String textContent) throws DOMException {
-        comment.setTextContent(textContent);
-    }
-
-    @Override
-    public boolean isSameNode(Node other) {
-        return comment.isSameNode(other);
-    }
-
-    @Override
-    public String lookupPrefix(String namespaceURI) {
-        return comment.lookupPrefix(namespaceURI);
-    }
-
-    @Override
-    public boolean isDefaultNamespace(String namespaceURI) {
-        return comment.isDefaultNamespace(namespaceURI);
-    }
-
-    @Override
-    public String lookupNamespaceURI(String prefix) {
-        return comment.lookupNamespaceURI(prefix);
-    }
-
-    @Override
-    public boolean isEqualNode(Node arg) {
-        return comment.isEqualNode(arg);
-    }
-
-    @Override
-    public Object getFeature(String feature, String version) {
-        return comment.getFeature(feature, version);
-    }
-
-    @Override
-    public Object setUserData(String key, Object data, UserDataHandler handler) {
-        return comment.setUserData(key, data, handler);
-    }
-
-    @Override
-    public Object getUserData(String key) {
-        return comment.getUserData(key);
-    }
-
-    private Comment comment;
-
-    public SOAPCommentImpl(SOAPDocumentImpl ownerDoc, String text) {
-        comment = ownerDoc.getDomDocument().createComment(text);
-        ownerDoc.register(this);
-    }
-
-    public String getValue() {
-        String nodeValue = getNodeValue();
-        return (nodeValue.equals("") ? null : nodeValue);
-    }
-
-    public void setValue(String text) {
-        setNodeValue(text);
-    }
-
-
-    public void setParentElement(SOAPElement element) throws SOAPException {
-        if (element == null) {
-            log.severe("SAAJ0112.impl.no.null.to.parent.elem");
-            throw new SOAPException("Cannot pass NULL to setParentElement");
-        }
-        ((ElementImpl) element).addNode(this);
-    }
-
-    public SOAPElement getParentElement() {
-        return (SOAPElement) getParentNode();
-    }
-
-    public void detachNode() {
-        org.w3c.dom.Node parent = getParentNode();
-        if (parent != null) {
-            parent.removeChild(this);
-        }
-    }
-
-    public void recycleNode() {
-        detachNode();
-        // TBD
-        //  - add this to the factory so subsequent
-        //    creations can reuse this object.
-    }
-
     public boolean isComment() {
         return true;
     }
 
+    @Override
     public Text splitText(int offset) throws DOMException {
         log.severe("SAAJ0113.impl.cannot.split.text.from.comment");
         throw new UnsupportedOperationException("Cannot split text from a Comment Node.");
     }
 
+    @Override
     public Text replaceWholeText(String content) throws DOMException {
         log.severe("SAAJ0114.impl.cannot.replace.wholetext.from.comment");
         throw new UnsupportedOperationException("Cannot replace Whole Text from a Comment Node.");
     }
 
+    @Override
     public String getWholeText() {
         //TODO: maybe we have to implement this in future.
         throw new UnsupportedOperationException("Not Supported");
     }
 
+    @Override
     public boolean isElementContentWhitespace() {
         //TODO: maybe we have to implement this in future.
         throw new UnsupportedOperationException("Not Supported");
     }
 
-    public Comment getDomElement() {
-        return comment;
-    }
 }
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/SOAPTextImpl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/SOAPTextImpl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -25,316 +25,55 @@
 
 package com.sun.xml.internal.messaging.saaj.soap.impl;
 
-import java.util.logging.Logger;
+import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
+import org.w3c.dom.CharacterData;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Text;
 
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPException;
+public class SOAPTextImpl extends TextImpl<Text> implements Text {
 
-import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
-import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Text;
-import org.w3c.dom.UserDataHandler;
+    public SOAPTextImpl(SOAPDocumentImpl ownerDoc, String text) {
+        super(ownerDoc, text);
+    }
 
-public class SOAPTextImpl
-    implements javax.xml.soap.Text, org.w3c.dom.Text {
+    public SOAPTextImpl(SOAPDocumentImpl ownerDoc, CharacterData data) {
+        super(ownerDoc, data);
+    }
+
+    @Override
+    protected Text createN(SOAPDocumentImpl ownerDoc, String text) {
+        Text t = ownerDoc.getDomDocument().createTextNode(text);
+//        ownerDoc.register(this);
+        return t;
+    }
+
+    @Override
+    protected Text createN(SOAPDocumentImpl ownerDoc, CharacterData data) {
+        Text t = (Text) data;
+        return t;
+    }
 
     @Override
     public Text splitText(int offset) throws DOMException {
-        return textNode.splitText(offset);
+        return getDomElement().splitText(offset);
     }
 
     @Override
     public boolean isElementContentWhitespace() {
-        return textNode.isElementContentWhitespace();
+        return getDomElement().isElementContentWhitespace();
     }
 
     @Override
     public String getWholeText() {
-        return textNode.getWholeText();
+        return getDomElement().getWholeText();
     }
 
     @Override
     public Text replaceWholeText(String content) throws DOMException {
-        return textNode.replaceWholeText(content);
+        return getDomElement().replaceWholeText(content);
     }
 
     @Override
-    public String getData() throws DOMException {
-        return textNode.getData();
-    }
-
-    @Override
-    public void setData(String data) throws DOMException {
-        textNode.setData(data);
-    }
-
-    @Override
-    public int getLength() {
-        return textNode.getLength();
-    }
-
-    @Override
-    public String substringData(int offset, int count) throws DOMException {
-        return textNode.substringData(offset, count);
-    }
-
-    @Override
-    public void appendData(String arg) throws DOMException {
-        textNode.appendData(arg);
-    }
-
-    @Override
-    public void insertData(int offset, String arg) throws DOMException {
-        textNode.insertData(offset, arg);
-    }
-
-    @Override
-    public void deleteData(int offset, int count) throws DOMException {
-        textNode.deleteData(offset, count);
-    }
-
-    @Override
-    public void replaceData(int offset, int count, String arg) throws DOMException {
-        textNode.replaceData(offset, count, arg);
-    }
-
-    @Override
-    public String getNodeName() {
-        return textNode.getNodeName();
-    }
-
-    @Override
-    public String getNodeValue() throws DOMException {
-        return textNode.getNodeValue();
-    }
-
-    @Override
-    public void setNodeValue(String nodeValue) throws DOMException {
-        textNode.setNodeValue(nodeValue);
-    }
-
-    @Override
-    public short getNodeType() {
-        return textNode.getNodeType();
-    }
-
-    @Override
-    public Node getParentNode() {
-        return textNode.getParentNode();
-    }
-
-    @Override
-    public NodeList getChildNodes() {
-        return textNode.getChildNodes();
-    }
-
-    @Override
-    public Node getFirstChild() {
-        return textNode.getFirstChild();
-    }
-
-    @Override
-    public Node getLastChild() {
-        return textNode.getLastChild();
-    }
-
-    @Override
-    public Node getPreviousSibling() {
-        return textNode.getPreviousSibling();
-    }
-
-    @Override
-    public Node getNextSibling() {
-        return textNode.getNextSibling();
-    }
-
-    @Override
-    public NamedNodeMap getAttributes() {
-        return textNode.getAttributes();
-    }
-
-    @Override
-    public Document getOwnerDocument() {
-        return textNode.getOwnerDocument();
-    }
-
-    @Override
-    public Node insertBefore(Node newChild, Node refChild) throws DOMException {
-        return textNode.insertBefore(newChild, refChild);
-    }
-
-    @Override
-    public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
-        return textNode.replaceChild(newChild, oldChild);
-    }
-
-    @Override
-    public Node removeChild(Node oldChild) throws DOMException {
-        return textNode.removeChild(oldChild);
-    }
-
-    @Override
-    public Node appendChild(Node newChild) throws DOMException {
-        return textNode.appendChild(newChild);
-    }
-
-    @Override
-    public boolean hasChildNodes() {
-        return textNode.hasChildNodes();
-    }
-
-    @Override
-    public Node cloneNode(boolean deep) {
-        return textNode.cloneNode(deep);
-    }
-
-    @Override
-    public void normalize() {
-        textNode.normalize();
-    }
-
-    @Override
-    public boolean isSupported(String feature, String version) {
-        return textNode.isSupported(feature, version);
-    }
-
-    @Override
-    public String getNamespaceURI() {
-        return textNode.getNamespaceURI();
-    }
-
-    @Override
-    public String getPrefix() {
-        return textNode.getPrefix();
-    }
-
-    @Override
-    public void setPrefix(String prefix) throws DOMException {
-        textNode.setPrefix(prefix);
-    }
-
-    @Override
-    public String getLocalName() {
-        return textNode.getLocalName();
-    }
-
-    @Override
-    public boolean hasAttributes() {
-        return textNode.hasAttributes();
-    }
-
-    @Override
-    public String getBaseURI() {
-        return textNode.getBaseURI();
-    }
-
-    @Override
-    public short compareDocumentPosition(Node other) throws DOMException {
-        return textNode.compareDocumentPosition(other);
-    }
-
-    @Override
-    public String getTextContent() throws DOMException {
-        return textNode.getTextContent();
-    }
-
-    @Override
-    public void setTextContent(String textContent) throws DOMException {
-        textNode.setTextContent(textContent);
-    }
-
-    @Override
-    public boolean isSameNode(Node other) {
-        return textNode.isSameNode(other);
-    }
-
-    @Override
-    public String lookupPrefix(String namespaceURI) {
-        return textNode.lookupPrefix(namespaceURI);
-    }
-
-    @Override
-    public boolean isDefaultNamespace(String namespaceURI) {
-        return textNode.isDefaultNamespace(namespaceURI);
-    }
-
-    @Override
-    public String lookupNamespaceURI(String prefix) {
-        return textNode.lookupNamespaceURI(prefix);
-    }
-
-    @Override
-    public boolean isEqualNode(Node arg) {
-        return textNode.isEqualNode(arg);
-    }
-
-    @Override
-    public Object getFeature(String feature, String version) {
-        return textNode.getFeature(feature, version);
-    }
-
-    @Override
-    public Object setUserData(String key, Object data, UserDataHandler handler) {
-        return textNode.setUserData(key, data, handler);
-    }
-
-    @Override
-    public Object getUserData(String key) {
-        return textNode.getUserData(key);
-    }
-
-    protected static final Logger log =
-        Logger.getLogger(LogDomainConstants.SOAP_IMPL_DOMAIN,
-                         "com.sun.xml.internal.messaging.saaj.soap.impl.LocalStrings");
-
-    private Text textNode;
-
-    public SOAPTextImpl(SOAPDocumentImpl ownerDoc, String text) {
-        textNode = ownerDoc.getDomDocument().createTextNode(text);
-        ownerDoc.register(this);
-    }
-
-    public String getValue() {
-        String nodeValue = getNodeValue();
-        return (nodeValue.equals("") ? null : nodeValue);
-    }
-
-    public void setValue(String text) {
-        setNodeValue(text);
-    }
-
-    public void setParentElement(SOAPElement parent) throws SOAPException {
-        if (parent == null) {
-            log.severe("SAAJ0126.impl.cannot.locate.ns");
-            throw new SOAPException("Cannot pass NULL to setParentElement");
-        }
-        ((ElementImpl) parent).addNode(this);
-    }
-
-    public SOAPElement getParentElement() {
-        return (SOAPElement) getParentNode();
-    }
-
-
-    public void detachNode() {
-        org.w3c.dom.Node parent = getParentNode();
-        if (parent != null) {
-            parent.removeChild(getDomElement());
-        }
-    }
-
-    public void recycleNode() {
-        detachNode();
-        // TBD
-        //  - add this to the factory so subsequent
-        //    creations can reuse this object.
-    }
-
     public boolean isComment() {
         String txt = getNodeValue();
         if (txt == null) {
@@ -343,7 +82,4 @@
         return txt.startsWith("<!--") && txt.endsWith("-->");
     }
 
-    public Text getDomElement() {
-        return textNode;
-    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/TextImpl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -0,0 +1,342 @@
+/*
+ * 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.xml.internal.messaging.saaj.soap.impl;
+
+import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
+import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
+import java.util.logging.Logger;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.Text;
+import org.w3c.dom.CharacterData;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.UserDataHandler;
+
+/**
+ *
+ * @author lukas
+ * @param <T>
+ */
+public abstract class TextImpl<T extends CharacterData> implements Text, CharacterData {
+
+    protected static final Logger log
+            = Logger.getLogger(LogDomainConstants.SOAP_IMPL_DOMAIN,
+                    "com.sun.xml.internal.messaging.saaj.soap.impl.LocalStrings");
+    private final T domNode;
+
+    private final SOAPDocumentImpl soapDocument;
+
+    protected TextImpl(SOAPDocumentImpl ownerDoc, String text) {
+        this.soapDocument = ownerDoc;
+        domNode = createN(ownerDoc, text);
+        ownerDoc.register(this);
+    }
+
+    protected TextImpl(SOAPDocumentImpl ownerDoc, CharacterData data) {
+        this.soapDocument = ownerDoc;
+        domNode = createN(ownerDoc, data);
+        ownerDoc.register(this);
+    }
+
+    protected abstract T createN(SOAPDocumentImpl ownerDoc, CharacterData data);
+
+    protected abstract T createN(SOAPDocumentImpl ownerDoc, String text);
+
+    public T getDomElement() {
+        return domNode;
+    }
+
+    @Override
+    public String getValue() {
+        String nodeValue = getNodeValue();
+        return (nodeValue.equals("") ? null : nodeValue);
+    }
+
+    @Override
+    public void setValue(String text) {
+        setNodeValue(text);
+    }
+
+    @Override
+    public void setParentElement(SOAPElement parent) throws SOAPException {
+        if (parent == null) {
+            log.severe("SAAJ0112.impl.no.null.to.parent.elem");
+            throw new SOAPException("Cannot pass NULL to setParentElement");
+        }
+        ((ElementImpl) parent).addNode(this);
+    }
+
+    @Override
+    public SOAPElement getParentElement() {
+        return (SOAPElement) getParentNode();
+    }
+
+    @Override
+    public void detachNode() {
+        org.w3c.dom.Node parent = getParentNode();
+        if (parent != null) {
+             parent.removeChild(getDomElement());
+        }
+    }
+
+    @Override
+    public void recycleNode() {
+        detachNode();
+        // TBD
+        //  - add this to the factory so subsequent
+        //    creations can reuse this object.
+    }
+
+    @Override
+    public String getNodeName() {
+        return domNode.getNodeName();
+    }
+
+    @Override
+    public String getNodeValue() throws DOMException {
+        return domNode.getNodeValue();
+    }
+
+    @Override
+    public void setNodeValue(String nodeValue) throws DOMException {
+        domNode.setNodeValue(nodeValue);
+    }
+
+    @Override
+    public short getNodeType() {
+        return domNode.getNodeType();
+    }
+
+    @Override
+    public Node getParentNode() {
+        return domNode.getParentNode();
+    }
+
+    @Override
+    public NodeList getChildNodes() {
+        return domNode.getChildNodes();
+    }
+
+    @Override
+    public Node getFirstChild() {
+        return domNode.getFirstChild();
+    }
+
+    @Override
+    public Node getLastChild() {
+        return domNode.getLastChild();
+    }
+
+    @Override
+    public Node getPreviousSibling() {
+        return domNode.getPreviousSibling();
+    }
+
+    @Override
+    public Node getNextSibling() {
+        return domNode.getNextSibling();
+    }
+
+    @Override
+    public NamedNodeMap getAttributes() {
+        return domNode.getAttributes();
+    }
+
+    @Override
+    public Document getOwnerDocument() {
+        return domNode.getOwnerDocument();
+    }
+
+    @Override
+    public Node insertBefore(Node newChild, Node refChild) throws DOMException {
+        return domNode.insertBefore(newChild, refChild);
+    }
+
+    @Override
+    public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
+        return domNode.replaceChild(newChild, oldChild);
+    }
+
+    @Override
+    public Node removeChild(Node oldChild) throws DOMException {
+        return domNode.removeChild(oldChild);
+    }
+
+    @Override
+    public Node appendChild(Node newChild) throws DOMException {
+        return domNode.appendChild(newChild);
+    }
+
+    @Override
+    public boolean hasChildNodes() {
+        return domNode.hasChildNodes();
+    }
+
+    @Override
+    public Node cloneNode(boolean deep) {
+        return domNode.cloneNode(deep);
+    }
+
+    @Override
+    public void normalize() {
+        domNode.normalize();
+    }
+
+    @Override
+    public boolean isSupported(String feature, String version) {
+        return domNode.isSupported(feature, version);
+    }
+
+    @Override
+    public String getNamespaceURI() {
+        return domNode.getNamespaceURI();
+    }
+
+    @Override
+    public String getPrefix() {
+        return domNode.getPrefix();
+    }
+
+    @Override
+    public void setPrefix(String prefix) throws DOMException {
+        domNode.setPrefix(prefix);
+    }
+
+    @Override
+    public String getLocalName() {
+        return domNode.getLocalName();
+    }
+
+    @Override
+    public boolean hasAttributes() {
+        return domNode.hasAttributes();
+    }
+
+    @Override
+    public String getBaseURI() {
+        return domNode.getBaseURI();
+    }
+
+    @Override
+    public short compareDocumentPosition(Node other) throws DOMException {
+        return domNode.compareDocumentPosition(other);
+    }
+
+    @Override
+    public String getTextContent() throws DOMException {
+        return domNode.getTextContent();
+    }
+
+    @Override
+    public void setTextContent(String textContent) throws DOMException {
+        domNode.setTextContent(textContent);;
+    }
+
+    @Override
+    public boolean isSameNode(Node other) {
+        return domNode.isSameNode(other);
+    }
+
+    @Override
+    public String lookupPrefix(String namespaceURI) {
+        return domNode.lookupPrefix(namespaceURI);
+    }
+
+    @Override
+    public boolean isDefaultNamespace(String namespaceURI) {
+        return domNode.isDefaultNamespace(namespaceURI);
+    }
+
+    @Override
+    public String lookupNamespaceURI(String prefix) {
+        return domNode.lookupNamespaceURI(prefix);
+    }
+
+    @Override
+    public boolean isEqualNode(Node arg) {
+        return domNode.isEqualNode(arg);
+    }
+
+    @Override
+    public Object getFeature(String feature, String version) {
+        return domNode.getFeature(feature, version);
+    }
+
+    @Override
+    public Object setUserData(String key, Object data, UserDataHandler handler) {
+        return domNode.setUserData(key, data, handler);
+    }
+
+    @Override
+    public Object getUserData(String key) {
+        return domNode.getUserData(key);
+    }
+
+    @Override
+    public String getData() throws DOMException {
+        return domNode.getData();
+    }
+
+    @Override
+    public void setData(String data) throws DOMException {
+        domNode.setData(data);
+    }
+
+    @Override
+    public int getLength() {
+        return domNode.getLength();
+    }
+
+    @Override
+    public String substringData(int offset, int count) throws DOMException {
+        return domNode.substringData(offset, count);
+    }
+
+    @Override
+    public void appendData(String arg) throws DOMException {
+        domNode.appendData(arg);
+    }
+
+    @Override
+    public void insertData(int offset, String arg) throws DOMException {
+        domNode.insertData(offset, arg);
+    }
+
+    @Override
+    public void deleteData(int offset, int count) throws DOMException {
+        domNode.deleteData(offset, count);
+    }
+
+    @Override
+    public void replaceData(int offset, int count, String arg) throws DOMException {
+        domNode.replaceData(offset, count, arg);
+    }
+
+}
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/Body1_1Impl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/Body1_1Impl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -54,32 +54,38 @@
         throw new UnsupportedOperationException("Not supported in SOAP 1.1");
     }
 
+    @Override
     protected NameImpl getFaultName(String name) {
         // Ignore name
         return NameImpl.createFault1_1Name(null);
     }
 
+    @Override
     protected SOAPBodyElement createBodyElement(Name name) {
         return new BodyElement1_1Impl(
             ((SOAPDocument) getOwnerDocument()).getDocument(),
             name);
     }
 
+    @Override
     protected SOAPBodyElement createBodyElement(QName name) {
         return new BodyElement1_1Impl(
             ((SOAPDocument) getOwnerDocument()).getDocument(),
             name);
     }
 
+    @Override
     protected QName getDefaultFaultCode() {
         return new QName(SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE, "Server");
     }
 
+    @Override
     protected boolean isFault(SOAPElement child) {
         // SOAP 1.1 faults always use the default name
         return child.getElementName().equals(getFaultName(null));
     }
 
+    @Override
     protected SOAPFault createFaultElement() {
         return new Fault1_1Impl(
             ((SOAPDocument) getOwnerDocument()).getDocument(), getPrefix());
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/BodyElement1_1Impl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/BodyElement1_1Impl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -36,6 +36,7 @@
 
 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
 import com.sun.xml.internal.messaging.saaj.soap.impl.BodyElementImpl;
+import org.w3c.dom.Element;
 
 public class BodyElement1_1Impl extends BodyElementImpl {
 
@@ -45,6 +46,12 @@
     public BodyElement1_1Impl(SOAPDocumentImpl ownerDoc, QName qname) {
         super(ownerDoc, qname);
     }
+
+    public BodyElement1_1Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
+        super(ownerDoc, domElement);
+    }
+
+    @Override
     public SOAPElement setElementQName(QName newName) throws SOAPException {
         BodyElementImpl copy =
             new BodyElement1_1Impl((SOAPDocumentImpl) getOwnerDocument(), newName);
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/Detail1_1Impl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/Detail1_1Impl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -51,11 +51,13 @@
         super(ownerDoc, domElement);
     }
 
+    @Override
     protected DetailEntry createDetailEntry(Name name) {
         return new DetailEntry1_1Impl(
             (SOAPDocumentImpl) getOwnerDocument(),
             name);
     }
+    @Override
     protected DetailEntry createDetailEntry(QName name) {
         return new DetailEntry1_1Impl(
             (SOAPDocumentImpl) getOwnerDocument(),
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/DetailEntry1_1Impl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/DetailEntry1_1Impl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -36,6 +36,7 @@
 
 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
 import com.sun.xml.internal.messaging.saaj.soap.impl.DetailEntryImpl;
+import org.w3c.dom.Element;
 
 public class DetailEntry1_1Impl extends DetailEntryImpl {
 
@@ -45,6 +46,12 @@
     public DetailEntry1_1Impl(SOAPDocumentImpl ownerDoc, QName qname) {
         super(ownerDoc, qname);
     }
+
+    public DetailEntry1_1Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
+        super(ownerDoc, domElement);
+    }
+
+    @Override
     public SOAPElement setElementQName(QName newName) throws SOAPException {
         DetailEntryImpl copy =
             new DetailEntry1_1Impl((SOAPDocumentImpl) getOwnerDocument(), newName);
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/Envelope1_1Impl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/Envelope1_1Impl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -58,10 +58,12 @@
         super(ownerDoc, domElement);
     }
 
+    @Override
     protected NameImpl getBodyName(String prefix) {
         return NameImpl.createBody1_1Name(prefix);
     }
 
+    @Override
     protected NameImpl getHeaderName(String prefix) {
         return NameImpl.createHeader1_1Name(prefix);
     }
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/Fault1_1Impl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/Fault1_1Impl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -60,37 +60,48 @@
        super(ownerDocument, NameImpl.createFault1_1Name(prefix));
     }
 
-    public Fault1_1Impl(Element domElement, SOAPDocumentImpl ownerDoc) {
+    public Fault1_1Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
         super(ownerDoc, domElement);
     }
 
+    public Fault1_1Impl(SOAPDocumentImpl ownerDoc) {
+        super(ownerDoc, NameImpl.createFault1_1Name(null));
+    }
+
+    @Override
     protected NameImpl getDetailName() {
         return NameImpl.createDetail1_1Name();
     }
 
+    @Override
     protected NameImpl getFaultCodeName() {
         return NameImpl.createFromUnqualifiedName("faultcode");
     }
 
+    @Override
     protected NameImpl getFaultStringName() {
         return NameImpl.createFromUnqualifiedName("faultstring");
     }
 
+    @Override
     protected NameImpl getFaultActorName() {
         return NameImpl.createFromUnqualifiedName("faultactor");
     }
 
+    @Override
     protected DetailImpl createDetail() {
         return new Detail1_1Impl(
                        ((SOAPDocument) getOwnerDocument()).getDocument());
     }
 
+    @Override
     protected FaultElementImpl createSOAPFaultElement(String localName) {
         return new FaultElement1_1Impl(
                        ((SOAPDocument) getOwnerDocument()).getDocument(),
                        localName);
     }
 
+    @Override
     protected void checkIfStandardFaultCode(String faultCode, String uri)
         throws SOAPException {
         // SOAP 1.1 doesn't seem to mandate using faultcode from a particular
@@ -98,16 +109,19 @@
         // Also need to be backward compatible.
     }
 
+    @Override
     protected void finallySetFaultCode(String faultcode) throws SOAPException {
         this.faultCodeElement.addTextNode(faultcode);
     }
 
+    @Override
     public String getFaultCode() {
         if (this.faultCodeElement == null)
             findFaultCodeElement();
         return this.faultCodeElement.getValue();
     }
 
+    @Override
     public Name getFaultCodeAsName() {
 
         String faultcodeString = getFaultCode();
@@ -132,6 +146,7 @@
         return NameImpl.createFromQualifiedName(faultcodeString, nsName);
     }
 
+    @Override
     public QName getFaultCodeAsQName() {
         String faultcodeString = getFaultCode();
         if (faultcodeString == null) {
@@ -142,6 +157,7 @@
         return convertCodeToQName(faultcodeString, this.faultCodeElement);
     }
 
+    @Override
     public void setFaultString(String faultString) throws SOAPException {
 
         if (this.faultStringElement == null)
@@ -158,6 +174,7 @@
         this.faultStringElement.addTextNode(faultString);
     }
 
+    @Override
     public String getFaultString() {
         if (this.faultStringElement == null)
             findFaultStringElement();
@@ -165,6 +182,7 @@
 
     }
 
+    @Override
     public Locale getFaultStringLocale() {
         if (this.faultStringElement == null)
             findFaultStringElement();
@@ -178,6 +196,7 @@
         return null;
     }
 
+    @Override
     public void setFaultString(String faultString, Locale locale)
         throws SOAPException {
         setFaultString(faultString);
@@ -186,6 +205,7 @@
             localeToXmlLang(locale));
     }
 
+    @Override
     protected boolean isStandardFaultElement(String localName) {
         if (localName.equalsIgnoreCase("detail") ||
             localName.equalsIgnoreCase("faultcode") ||
@@ -196,6 +216,7 @@
         return false;
     }
 
+    @Override
     public void appendFaultSubcode(QName subcode) {
         log.log(
             Level.SEVERE,
@@ -204,6 +225,7 @@
         throw new UnsupportedOperationException("Not supported in SOAP 1.1");
     }
 
+    @Override
     public void removeAllFaultSubcodes() {
         log.log(
             Level.SEVERE,
@@ -212,7 +234,8 @@
         throw new UnsupportedOperationException("Not supported in SOAP 1.1");
     }
 
-    public Iterator getFaultSubcodes() {
+    @Override
+    public Iterator<QName> getFaultSubcodes() {
         log.log(
             Level.SEVERE,
             "SAAJ0303.ver1_1.msg.op.unsupported.in.SOAP1.1",
@@ -220,6 +243,7 @@
         throw new UnsupportedOperationException("Not supported in SOAP 1.1");
     }
 
+    @Override
     public String getFaultReasonText(Locale locale) {
         log.log(
             Level.SEVERE,
@@ -228,7 +252,8 @@
         throw new UnsupportedOperationException("Not supported in SOAP 1.1");
     }
 
-    public Iterator getFaultReasonTexts() {
+    @Override
+    public Iterator<String> getFaultReasonTexts() {
         log.log(
             Level.SEVERE,
             "SAAJ0303.ver1_1.msg.op.unsupported.in.SOAP1.1",
@@ -236,7 +261,8 @@
         throw new UnsupportedOperationException("Not supported in SOAP 1.1");
     }
 
-    public Iterator getFaultReasonLocales() {
+    @Override
+    public Iterator<Locale> getFaultReasonLocales() {
         log.log(
             Level.SEVERE,
             "SAAJ0303.ver1_1.msg.op.unsupported.in.SOAP1.1",
@@ -244,6 +270,7 @@
         throw new UnsupportedOperationException("Not supported in SOAP 1.1");
     }
 
+    @Override
     public void addFaultReasonText(String text, java.util.Locale locale)
         throws SOAPException {
         log.log(
@@ -253,6 +280,7 @@
         throw new UnsupportedOperationException("Not supported in SOAP 1.1");
     }
 
+    @Override
     public String getFaultRole() {
         log.log(
             Level.SEVERE,
@@ -261,6 +289,7 @@
         throw new UnsupportedOperationException("Not supported in SOAP 1.1");
     }
 
+    @Override
     public void setFaultRole(String uri) {
         log.log(
             Level.SEVERE,
@@ -269,6 +298,7 @@
         throw new UnsupportedOperationException("Not supported in SOAP 1.1");
     }
 
+    @Override
     public String getFaultNode() {
         log.log(
             Level.SEVERE,
@@ -277,6 +307,7 @@
         throw new UnsupportedOperationException("Not supported in SOAP 1.1");
     }
 
+    @Override
     public void setFaultNode(String uri) {
         log.log(
             Level.SEVERE,
@@ -285,10 +316,12 @@
         throw new UnsupportedOperationException("Not supported in SOAP 1.1");
     }
 
+    @Override
     protected QName getDefaultFaultCode() {
         return new QName(SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE, "Server");
     }
 
+    @Override
     public SOAPElement addChildElement(SOAPElement element)
         throws SOAPException {
         String localName = element.getLocalName();
@@ -301,18 +334,21 @@
         return super.addChildElement(element);
     }
 
+    @Override
     protected FaultElementImpl createSOAPFaultElement(QName qname) {
          return new FaultElement1_1Impl(
                        ((SOAPDocument) getOwnerDocument()).getDocument(),
                        qname);
     }
 
+    @Override
     protected FaultElementImpl createSOAPFaultElement(Name qname) {
          return new FaultElement1_1Impl(
                        ((SOAPDocument) getOwnerDocument()).getDocument(),
                        (NameImpl)qname);
     }
 
+    @Override
     public void setFaultCode(String faultCode, String prefix, String uri)
         throws SOAPException {
         if (prefix == null || "".equals(prefix)) {
@@ -370,6 +406,7 @@
         return false;
     }
 
+    @Override
      public void setFaultActor(String faultActor) throws SOAPException {
         if (this.faultActorElement == null)
             findFaultActorElement();
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/FaultElement1_1Impl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/FaultElement1_1Impl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -59,6 +59,7 @@
               NameImpl.createFaultElement1_1Name(localName, prefix));
     }
 
+    @Override
     protected boolean isStandardFaultElement() {
         String localName = elementQName.getLocalPart();
         if (localName.equalsIgnoreCase("faultcode") ||
@@ -69,6 +70,7 @@
         return false;
     }
 
+    @Override
     public SOAPElement setElementQName(QName newName) throws SOAPException {
         if (!isStandardFaultElement()) {
             FaultElement1_1Impl copy =
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/Header1_1Impl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/Header1_1Impl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -56,6 +56,7 @@
         super(ownerDoc, domElement);
     }
 
+    @Override
     protected NameImpl getNotUnderstoodName() {
         log.log(
             Level.SEVERE,
@@ -64,6 +65,7 @@
         throw new UnsupportedOperationException("Not supported by SOAP 1.1");
     }
 
+    @Override
     protected NameImpl getUpgradeName() {
         return NameImpl.create(
             "Upgrade",
@@ -71,6 +73,7 @@
             SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE);
     }
 
+    @Override
     protected NameImpl getSupportedEnvelopeName() {
         return NameImpl.create(
             "SupportedEnvelope",
@@ -78,6 +81,7 @@
             SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE);
     }
 
+    @Override
     public SOAPHeaderElement addNotUnderstoodHeaderElement(QName name)
         throws SOAPException {
         log.log(
@@ -87,11 +91,13 @@
         throw new UnsupportedOperationException("Not supported by SOAP 1.1");
     }
 
+    @Override
     protected SOAPHeaderElement createHeaderElement(Name name) {
         return new HeaderElement1_1Impl(
             ((SOAPDocument) getOwnerDocument()).getDocument(),
             name);
     }
+    @Override
     protected SOAPHeaderElement createHeaderElement(QName name) {
         return new HeaderElement1_1Impl(
             ((SOAPDocument) getOwnerDocument()).getDocument(),
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/HeaderElement1_1Impl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/HeaderElement1_1Impl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -41,6 +41,7 @@
 import com.sun.xml.internal.messaging.saaj.soap.impl.HeaderElementImpl;
 import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
 import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
+import org.w3c.dom.Element;
 
 public class HeaderElement1_1Impl extends HeaderElementImpl {
 
@@ -55,17 +56,24 @@
         super(ownerDoc, qname);
     }
 
+    public HeaderElement1_1Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
+        super(ownerDoc, domElement);
+    }
+
+    @Override
     public SOAPElement setElementQName(QName newName) throws SOAPException {
         HeaderElementImpl copy =
             new HeaderElement1_1Impl((SOAPDocumentImpl) getOwnerDocument(), newName);
         return replaceElementWithSOAPElement(this,copy);
     }
 
+    @Override
     protected NameImpl getActorAttributeName() {
         return NameImpl.create("actor", null, NameImpl.SOAP11_NAMESPACE);
     }
 
     // role not supported by SOAP 1.1
+    @Override
     protected NameImpl getRoleAttributeName() {
         log.log(
             Level.SEVERE,
@@ -74,15 +82,18 @@
         throw new UnsupportedOperationException("Role not supported by SOAP 1.1");
     }
 
+    @Override
     protected NameImpl getMustunderstandAttributeName() {
         return NameImpl.create("mustUnderstand", null, NameImpl.SOAP11_NAMESPACE);
     }
 
     // mustUnderstand attribute has literal value "1" or "0"
+    @Override
     protected String getMustunderstandLiteralValue(boolean mustUnderstand) {
         return (mustUnderstand == true ? "1" : "0");
     }
 
+    @Override
     protected boolean getMustunderstandAttributeValue(String mu) {
         if ("1".equals(mu) || "true".equalsIgnoreCase(mu))
             return true;
@@ -90,6 +101,7 @@
     }
 
     // relay not supported by SOAP 1.1
+    @Override
     protected NameImpl getRelayAttributeName() {
         log.log(
             Level.SEVERE,
@@ -98,6 +110,7 @@
         throw new UnsupportedOperationException("Relay not supported by SOAP 1.1");
     }
 
+    @Override
     protected String getRelayLiteralValue(boolean relayAttr) {
         log.log(
             Level.SEVERE,
@@ -106,6 +119,7 @@
         throw new UnsupportedOperationException("Relay not supported by SOAP 1.1");
     }
 
+    @Override
     protected boolean getRelayAttributeValue(String mu) {
         log.log(
             Level.SEVERE,
@@ -114,6 +128,7 @@
         throw new UnsupportedOperationException("Relay not supported by SOAP 1.1");
     }
 
+    @Override
     protected String getActorOrRole() {
         return getActor();
     }
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/Message1_1Impl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/Message1_1Impl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -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
@@ -76,6 +76,7 @@
             super(headers,ct,stat,reader);
     }
 
+    @Override
     public SOAPPart getSOAPPart() {
         if (soapPartImpl == null) {
             soapPartImpl = new SOAPPart1_1Impl(this);
@@ -83,10 +84,12 @@
         return soapPartImpl;
     }
 
+    @Override
     protected boolean isCorrectSoapVersion(int contentTypeId) {
         return (contentTypeId & SOAP1_1_FLAG) != 0;
     }
 
+    @Override
     public String getAction() {
         log.log(
             Level.SEVERE,
@@ -95,6 +98,7 @@
         throw new UnsupportedOperationException("Operation not supported by SOAP 1.1");
     }
 
+    @Override
     public void setAction(String type) {
         log.log(
             Level.SEVERE,
@@ -103,6 +107,7 @@
         throw new UnsupportedOperationException("Operation not supported by SOAP 1.1");
     }
 
+    @Override
     public String getCharset() {
         log.log(
             Level.SEVERE,
@@ -111,6 +116,7 @@
         throw new UnsupportedOperationException("Operation not supported by SOAP 1.1");
     }
 
+    @Override
     public void setCharset(String charset) {
         log.log(
             Level.SEVERE,
@@ -119,10 +125,12 @@
         throw new UnsupportedOperationException("Operation not supported by SOAP 1.1");
     }
 
+    @Override
     protected String getExpectedContentType() {
         return isFastInfoset ? "application/fastinfoset" : "text/xml";
     }
 
+    @Override
    protected String getExpectedAcceptHeader() {
        String accept = "text/xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2";
        return acceptFastInfoset ? ("application/fastinfoset, " + accept) : accept;
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/SOAPFactory1_1Impl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/SOAPFactory1_1Impl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -39,14 +39,17 @@
 import com.sun.xml.internal.messaging.saaj.soap.SOAPFactoryImpl;
 
 public class SOAPFactory1_1Impl extends SOAPFactoryImpl {
+    @Override
     protected SOAPDocumentImpl createDocument() {
         return (new SOAPPart1_1Impl()).getDocument();
     }
 
+    @Override
     public Detail createDetail() throws SOAPException {
         return new Detail1_1Impl(createDocument());
     }
 
+    @Override
     public SOAPFault createFault(String reasonText, QName faultCode)
         throws SOAPException {
         if (faultCode == null) {
@@ -55,14 +58,15 @@
         if (reasonText == null) {
             throw new IllegalArgumentException("reasonText argument for createFault was passed NULL");
         }
-        Fault1_1Impl fault = new Fault1_1Impl(createDocument(), null);
+        Fault1_1Impl fault = new Fault1_1Impl(createDocument());
         fault.setFaultCode(faultCode);
         fault.setFaultString(reasonText);
         return fault;
     }
 
+    @Override
     public SOAPFault createFault() throws SOAPException {
-        Fault1_1Impl fault = new Fault1_1Impl(createDocument(), null);
+        Fault1_1Impl fault = new Fault1_1Impl(createDocument());
         fault.setFaultCode(fault.getDefaultFaultCode());
         fault.setFaultString("Fault string, and possibly fault code, not set");
         return fault;
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/SOAPMessageFactory1_1Impl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/SOAPMessageFactory1_1Impl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -40,16 +40,19 @@
 
 public class SOAPMessageFactory1_1Impl extends MessageFactoryImpl {
 
+    @Override
     public SOAPMessage createMessage() throws SOAPException {
         return new Message1_1Impl();
     }
 
+    @Override
     public SOAPMessage createMessage(boolean isFastInfoset,
         boolean acceptFastInfoset) throws SOAPException
     {
         return new Message1_1Impl(isFastInfoset, acceptFastInfoset);
     }
 
+    @Override
     public SOAPMessage createMessage(MimeHeaders headers, InputStream in) throws IOException, SOAPExceptionImpl {
 
         if (headers == null) {
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/SOAPPart1_1Impl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/SOAPPart1_1Impl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -54,10 +54,12 @@
         super(message);
     }
 
+    @Override
     protected String getContentType() {
         return isFastInfoset() ? "application/fastinfoset" : "text/xml";
     }
 
+    @Override
     protected Envelope createEnvelopeFromSource() throws SOAPException {
         // Record the presence of xml declaration before the envelope gets
         // created.
@@ -80,11 +82,13 @@
         return envelope;
     }
 
+    @Override
     protected Envelope createEmptyEnvelope(String prefix)
         throws SOAPException {
         return new Envelope1_1Impl(getDocument(), prefix, true, true);
     }
 
+    @Override
     protected SOAPPartImpl duplicateType() {
         return new SOAPPart1_1Impl();
     }
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Body1_2Impl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Body1_2Impl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -57,25 +57,30 @@
         super(ownerDoc, domElement);
     }
 
+    @Override
     protected NameImpl getFaultName(String name) {
         return NameImpl.createFault1_2Name(name, null);
     }
 
+    @Override
     protected SOAPBodyElement createBodyElement(Name name) {
         return new BodyElement1_2Impl(
             ((SOAPDocument) getOwnerDocument()).getDocument(),
             name);
     }
+    @Override
     protected SOAPBodyElement createBodyElement(QName name) {
         return new BodyElement1_2Impl(
             ((SOAPDocument) getOwnerDocument()).getDocument(),
             name);
     }
 
+    @Override
     protected QName getDefaultFaultCode() {
         return SOAPConstants.SOAP_RECEIVER_FAULT;
     }
 
+    @Override
     public SOAPFault addFault() throws SOAPException {
         if (hasAnyChildElement()) {
             log.severe("SAAJ0402.ver1_2.only.fault.allowed.in.body");
@@ -89,6 +94,7 @@
      * Override setEncodingStyle of ElementImpl to restrict adding encodingStyle
      * attribute to SOAP Body (SOAP 1.2 spec, part 1, section 5.1.1)
      */
+    @Override
     public void setEncodingStyle(String encodingStyle) throws SOAPException {
         log.severe("SAAJ0401.ver1_2.no.encodingstyle.in.body");
         throw new SOAPExceptionImpl("encodingStyle attribute cannot appear on Body");
@@ -98,6 +104,7 @@
      * Override addAttribute of ElementImpl to restrict adding encodingStyle
      * attribute to SOAP Body (SOAP 1.2 spec, part 1, section 5.1.1)
      */
+    @Override
     public SOAPElement addAttribute(Name name, String value)
         throws SOAPException {
         if (name.getLocalName().equals("encodingStyle")
@@ -108,6 +115,7 @@
         return super.addAttribute(name, value);
     }
 
+    @Override
     public SOAPElement addAttribute(QName name, String value)
         throws SOAPException {
         if (name.getLocalPart().equals("encodingStyle")
@@ -118,6 +126,7 @@
         return super.addAttribute(name, value);
     }
 
+    @Override
     protected boolean isFault(SOAPElement child) {
         return (child.getElementName().getURI().equals(
                     SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE) &&
@@ -125,6 +134,7 @@
                     "Fault"));
     }
 
+    @Override
     protected SOAPFault createFaultElement() {
         return new Fault1_2Impl(
             ((SOAPDocument) getOwnerDocument()).getDocument(), getPrefix());
@@ -135,6 +145,7 @@
      * SOAP message MUST contain a single Fault element as the only
      * child element of the SOAP Body.
      */
+    @Override
     public SOAPBodyElement addBodyElement(Name name) throws SOAPException {
         if (hasFault()) {
             log.severe("SAAJ0402.ver1_2.only.fault.allowed.in.body");
@@ -144,6 +155,7 @@
         return super.addBodyElement(name);
     }
 
+    @Override
     public SOAPBodyElement addBodyElement(QName name) throws SOAPException {
         if (hasFault()) {
             log.severe("SAAJ0402.ver1_2.only.fault.allowed.in.body");
@@ -153,6 +165,7 @@
         return super.addBodyElement(name);
     }
 
+    @Override
     protected SOAPElement addElement(Name name) throws SOAPException {
         if (hasFault()) {
             log.severe("SAAJ0402.ver1_2.only.fault.allowed.in.body");
@@ -162,6 +175,7 @@
         return super.addElement(name);
     }
 
+    @Override
     protected SOAPElement addElement(QName name) throws SOAPException {
         if (hasFault()) {
             log.severe("SAAJ0402.ver1_2.only.fault.allowed.in.body");
@@ -171,6 +185,7 @@
         return super.addElement(name);
     }
 
+    @Override
     public SOAPElement addChildElement(Name name) throws SOAPException {
         if (hasFault()) {
             log.severe("SAAJ0402.ver1_2.only.fault.allowed.in.body");
@@ -180,6 +195,7 @@
         return super.addChildElement(name);
     }
 
+    @Override
     public SOAPElement addChildElement(QName name) throws SOAPException {
         if (hasFault()) {
             log.severe("SAAJ0402.ver1_2.only.fault.allowed.in.body");
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/BodyElement1_2Impl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/BodyElement1_2Impl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -36,6 +36,7 @@
 
 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
 import com.sun.xml.internal.messaging.saaj.soap.impl.BodyElementImpl;
+import org.w3c.dom.Element;
 
 public class BodyElement1_2Impl extends BodyElementImpl {
 
@@ -47,6 +48,11 @@
         super(ownerDoc, qname);
     }
 
+    public BodyElement1_2Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
+        super(ownerDoc, domElement);
+    }
+
+    @Override
     public SOAPElement setElementQName(QName newName) throws SOAPException {
         BodyElementImpl copy =
             new BodyElement1_2Impl((SOAPDocumentImpl) getOwnerDocument(), newName);
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Detail1_2Impl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Detail1_2Impl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -59,12 +59,14 @@
         super(ownerDoc, domElement);
     }
 
+    @Override
     protected DetailEntry createDetailEntry(Name name) {
         return new DetailEntry1_2Impl(
             ((SOAPDocument) getOwnerDocument()).getDocument(),
             name);
     }
 
+    @Override
     protected DetailEntry createDetailEntry(QName name) {
         return new DetailEntry1_2Impl(
             ((SOAPDocument) getOwnerDocument()).getDocument(),
@@ -75,11 +77,13 @@
      * Override setEncodingStyle of ElementImpl to restrict adding encodingStyle
      * attribute to SOAP Detail (SOAP 1.2 spec, part 1, section 5.1.1)
      */
+    @Override
     public void setEncodingStyle(String encodingStyle) throws SOAPException {
         log.severe("SAAJ0403.ver1_2.no.encodingStyle.in.detail");
         throw new SOAPExceptionImpl("EncodingStyle attribute cannot appear in Detail");
     }
 
+    @Override
     public SOAPElement addAttribute(Name name, String value)
         throws SOAPException {
         if (name.getLocalName().equals("encodingStyle")
@@ -89,6 +93,7 @@
         return super.addAttribute(name, value);
     }
 
+    @Override
     public SOAPElement addAttribute(QName name, String value)
         throws SOAPException {
         if (name.getLocalPart().equals("encodingStyle")
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/DetailEntry1_2Impl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/DetailEntry1_2Impl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -36,6 +36,7 @@
 
 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
 import com.sun.xml.internal.messaging.saaj.soap.impl.DetailEntryImpl;
+import org.w3c.dom.Element;
 
 public class DetailEntry1_2Impl extends DetailEntryImpl {
 
@@ -47,6 +48,11 @@
         super(ownerDoc, qname);
     }
 
+    public DetailEntry1_2Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
+        super(ownerDoc, domElement);
+    }
+
+    @Override
     public SOAPElement setElementQName(QName newName) throws SOAPException {
         DetailEntryImpl copy =
             new DetailEntry1_2Impl((SOAPDocumentImpl) getOwnerDocument(), newName);
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Envelope1_2Impl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Envelope1_2Impl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -68,10 +68,12 @@
             createBody);
     }
 
+    @Override
     protected NameImpl getBodyName(String prefix) {
         return NameImpl.createBody1_2Name(prefix);
     }
 
+    @Override
     protected NameImpl getHeaderName(String prefix) {
         return NameImpl.createHeader1_2Name(prefix);
     }
@@ -80,6 +82,7 @@
      * Override setEncodingStyle of ElementImpl to restrict adding encodingStyle
      * attribute to SOAP Envelope (SOAP 1.2 spec, part 1, section 5.1.1)
      */
+    @Override
     public void setEncodingStyle(String encodingStyle) throws SOAPException {
         log.severe("SAAJ0404.ver1_2.no.encodingStyle.in.envelope");
         throw new SOAPExceptionImpl("encodingStyle attribute cannot appear on Envelope");
@@ -89,6 +92,7 @@
      * Override addAttribute of ElementImpl to restrict adding encodingStyle
      * attribute to SOAP Envelope (SOAP 1.2 spec, part 1, section 5.1.1)
      */
+    @Override
     public SOAPElement addAttribute(Name name, String value)
         throws SOAPException {
         if (name.getLocalName().equals("encodingStyle")
@@ -98,6 +102,7 @@
         return super.addAttribute(name, value);
     }
 
+    @Override
     public SOAPElement addAttribute(QName name, String value)
         throws SOAPException {
         if (name.getLocalPart().equals("encodingStyle")
@@ -112,6 +117,7 @@
      * Override addChildElement method to ensure that no element
      * is added after body in SOAP 1.2.
      */
+    @Override
     public SOAPElement addChildElement(Name name) throws SOAPException {
         // check if body already exists
         if (getBody() != null) {
@@ -122,6 +128,7 @@
         return super.addChildElement(name);
     }
 
+    @Override
     public SOAPElement addChildElement(QName name) throws SOAPException {
         // check if body already exists
         if (getBody() != null) {
@@ -142,6 +149,7 @@
      *
      */
 
+    @Override
     public SOAPElement addTextNode(String text) throws SOAPException {
         log.log(
             Level.SEVERE,
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Fault1_2Impl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Fault1_2Impl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -29,12 +29,10 @@
 */
 package com.sun.xml.internal.messaging.saaj.soap.ver1_2;
 
-import java.util.*;
 import java.util.logging.Logger;
 import java.util.logging.Level;
 
 import javax.xml.namespace.QName;
-import javax.xml.soap.*;
 
 import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocument;
@@ -42,6 +40,14 @@
 import com.sun.xml.internal.messaging.saaj.soap.impl.*;
 import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
 import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPConstants;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
 import org.w3c.dom.Element;
 
 
@@ -69,22 +75,30 @@
         super(ownerDocument, NameImpl.createFault1_2Name(null, prefix));
     }
 
-    public Fault1_2Impl(Element domElement, SOAPDocumentImpl ownerDoc) {
+    public Fault1_2Impl(SOAPDocumentImpl ownerDocument) {
+        super(ownerDocument, NameImpl.createFault1_2Name(null, null));
+    }
+
+    public Fault1_2Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
         super(ownerDoc, domElement);
     }
 
+    @Override
     protected NameImpl getDetailName() {
         return NameImpl.createSOAP12Name("Detail", getPrefix());
     }
 
+    @Override
     protected NameImpl getFaultCodeName() {
         return NameImpl.createSOAP12Name("Code", getPrefix());
     }
 
+    @Override
     protected NameImpl getFaultStringName() {
         return getFaultReasonName();
     }
 
+    @Override
     protected NameImpl getFaultActorName() {
         return getFaultRoleName();
     }
@@ -109,17 +123,20 @@
         return NameImpl.createXmlName("lang");
     }
 
+    @Override
     protected DetailImpl createDetail() {
         return new Detail1_2Impl(
                        ((SOAPDocument) getOwnerDocument()).getDocument());
     }
 
+    @Override
     protected FaultElementImpl createSOAPFaultElement(String localName) {
         return new FaultElement1_2Impl(
                        ((SOAPDocument) getOwnerDocument()).getDocument(),
                        localName);
     }
 
+    @Override
     protected void checkIfStandardFaultCode(String faultCode, String uri)
         throws SOAPException {
         QName qname = new QName(uri, faultCode);
@@ -136,6 +153,7 @@
         throw new SOAPExceptionImpl(qname + " is not a standard Code value");
     }
 
+    @Override
     protected void finallySetFaultCode(String faultcode) throws SOAPException {
         SOAPElement value = this.faultCodeElement.addChildElement(valueName);
         value.addTextNode(faultcode);
@@ -145,13 +163,14 @@
         findFaultStringElement();
     }
 
-    public Iterator getFaultReasonTexts() throws SOAPException {
+    @Override
+    public Iterator<String> getFaultReasonTexts() throws SOAPException {
         // Fault Reason has similar semantics as faultstring
         if (this.faultStringElement == null)
             findReasonElement();
         Iterator eachTextElement =
             this.faultStringElement.getChildElements(textName);
-        List<String> texts = new ArrayList<String>();
+        List<String> texts = new ArrayList<>();
         while (eachTextElement.hasNext()) {
             SOAPElement textElement = (SOAPElement) eachTextElement.next();
             Locale thisLocale = getLocale(textElement);
@@ -168,6 +187,7 @@
         return texts.iterator();
     }
 
+    @Override
     public void addFaultReasonText(String text, java.util.Locale locale)
         throws SOAPException {
 
@@ -214,6 +234,7 @@
         }
     }
 
+    @Override
     public String getFaultReasonText(Locale locale) throws SOAPException {
 
         if (locale == null)
@@ -234,13 +255,14 @@
         return null;
     }
 
-    public Iterator getFaultReasonLocales() throws SOAPException {
+    @Override
+    public Iterator<Locale> getFaultReasonLocales() throws SOAPException {
         // Fault Reason has similar semantics as faultstring
         if (this.faultStringElement == null)
             findReasonElement();
         Iterator eachTextElement =
             this.faultStringElement.getChildElements(textName);
-        List<Locale> localeSet = new ArrayList<Locale>();
+        List<Locale> localeSet = new ArrayList<>();
         while (eachTextElement.hasNext()) {
             SOAPElement textElement = (SOAPElement) eachTextElement.next();
             Locale thisLocale = getLocale(textElement);
@@ -257,6 +279,7 @@
         return localeSet.iterator();
     }
 
+    @Override
     public Locale getFaultStringLocale() {
         Locale locale = null;
         try {
@@ -288,6 +311,7 @@
         return null;
     }
 
+    @Override
     public String getFaultNode() {
         SOAPElement faultNode = findAndConvertChildElement(getFaultNodeName());
         if (faultNode == null) {
@@ -296,6 +320,7 @@
         return faultNode.getValue();
     }
 
+    @Override
     public void setFaultNode(String uri) throws SOAPException {
         SOAPElement faultNode = findAndConvertChildElement(getFaultNodeName());
         if (faultNode != null) {
@@ -314,10 +339,12 @@
         addNode(faultNode);
     }
 
+    @Override
     public String getFaultRole() {
         return getFaultActor();
     }
 
+    @Override
     public void setFaultRole(String uri) throws SOAPException {
         if (this.faultActorElement == null)
             findFaultActorElement();
@@ -333,6 +360,7 @@
         addNode(this.faultActorElement);
     }
 
+    @Override
     public String getFaultCode() {
         if (this.faultCodeElement == null)
             findFaultCodeElement();
@@ -341,6 +369,7 @@
         return ((SOAPElement) codeValues.next()).getValue();
     }
 
+    @Override
     public QName getFaultCodeAsQName() {
         String faultcode = getFaultCode();
         if (faultcode == null) {
@@ -355,6 +384,7 @@
             (SOAPElement) valueElements.next());
     }
 
+    @Override
     public Name getFaultCodeAsName() {
         String faultcode = getFaultCode();
         if (faultcode == null) {
@@ -370,6 +400,7 @@
                 (SOAPElement) valueElements.next()));
     }
 
+    @Override
     public String getFaultString() {
         String reason = null;
         try {
@@ -380,10 +411,12 @@
         return reason;
     }
 
+    @Override
     public void setFaultString(String faultString) throws SOAPException {
         addFaultReasonText(faultString, Locale.getDefault());
     }
 
+    @Override
     public void setFaultString(
         String faultString,
         Locale locale)
@@ -391,6 +424,7 @@
         addFaultReasonText(faultString, locale);
     }
 
+    @Override
     public void appendFaultSubcode(QName subcode) throws SOAPException {
         if (subcode == null) {
             return;
@@ -426,6 +460,7 @@
         subcodeValueElement.addTextNode(prefix + ":" + subcode.getLocalPart());
     }
 
+    @Override
     public void removeAllFaultSubcodes() {
         if (this.faultCodeElement == null)
             findFaultCodeElement();
@@ -437,10 +472,11 @@
         }
     }
 
-    public Iterator getFaultSubcodes() {
+    @Override
+    public Iterator<QName> getFaultSubcodes() {
         if (this.faultCodeElement == null)
             findFaultCodeElement();
-        final List<QName> subcodeList = new ArrayList<QName>();
+        final List<QName> subcodeList = new ArrayList<>();
         SOAPElement currentCodeElement = this.faultCodeElement;
         Iterator subcodeElements =
             currentCodeElement.getChildElements(subcodeName);
@@ -457,14 +493,17 @@
         return new Iterator<QName>() {
             Iterator<QName> subCodeIter = subcodeList.iterator();
 
+            @Override
             public boolean hasNext() {
                 return subCodeIter.hasNext();
             }
 
+            @Override
             public QName next() {
                 return subCodeIter.next();
             }
 
+            @Override
             public void remove() {
                 throw new UnsupportedOperationException(
                     "Method remove() not supported on SubCodes Iterator");
@@ -480,11 +519,13 @@
      * Override setEncodingStyle of ElementImpl to restrict adding encodingStyle
      * attribute to SOAP Fault (SOAP 1.2 spec, part 1, section 5.1.1)
      */
+    @Override
     public void setEncodingStyle(String encodingStyle) throws SOAPException {
         log.severe("SAAJ0407.ver1_2.no.encodingStyle.in.fault");
         throw new SOAPExceptionImpl("encodingStyle attribute cannot appear on Fault");
     }
 
+    @Override
     public SOAPElement addAttribute(Name name, String value)
         throws SOAPException {
         if (name.getLocalName().equals("encodingStyle")
@@ -494,6 +535,7 @@
         return super.addAttribute(name, value);
     }
 
+    @Override
     public SOAPElement addAttribute(QName name, String value)
         throws SOAPException {
         if (name.getLocalPart().equals("encodingStyle")
@@ -503,6 +545,7 @@
         return super.addAttribute(name, value);
     }
 
+    @Override
     public SOAPElement addTextNode(String text) throws SOAPException {
         log.log(
             Level.SEVERE,
@@ -511,6 +554,7 @@
         throw new SOAPExceptionImpl("Adding text to SOAP 1.2 Fault is not legal");
     }
 
+    @Override
     public SOAPElement addChildElement(SOAPElement element)
         throws SOAPException {
         String localName = element.getLocalName();
@@ -533,6 +577,7 @@
             return super.addChildElement(element);
     }
 
+    @Override
     protected boolean isStandardFaultElement(String localName) {
         if (localName.equalsIgnoreCase("code") ||
             localName.equalsIgnoreCase("reason") ||
@@ -544,22 +589,26 @@
         return false;
     }
 
+    @Override
     protected QName getDefaultFaultCode() {
         return SOAPConstants.SOAP_SENDER_FAULT;
     }
 
+    @Override
      protected FaultElementImpl createSOAPFaultElement(QName qname) {
          return new FaultElement1_2Impl(
                        ((SOAPDocument) getOwnerDocument()).getDocument(),
                        qname);
     }
 
+    @Override
     protected FaultElementImpl createSOAPFaultElement(Name qname) {
          return new FaultElement1_2Impl(
                        ((SOAPDocument) getOwnerDocument()).getDocument(),
                        (NameImpl)qname);
     }
 
+    @Override
      public void setFaultActor(String faultActor) throws SOAPException {
         this.setFaultRole(faultActor);
     }
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/FaultElement1_2Impl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/FaultElement1_2Impl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -38,6 +38,7 @@
 import com.sun.xml.internal.messaging.saaj.soap.impl.FaultElementImpl;
 import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
 import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
+import org.w3c.dom.Element;
 
 public class FaultElement1_2Impl extends FaultElementImpl {
 
@@ -53,6 +54,11 @@
         super(ownerDoc, NameImpl.createSOAP12Name(localName));
     }
 
+    public FaultElement1_2Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
+        super(ownerDoc, domElement);
+    }
+
+    @Override
     protected boolean isStandardFaultElement() {
         String localName = elementQName.getLocalPart();
         if (localName.equalsIgnoreCase("code") ||
@@ -64,6 +70,7 @@
         return false;
     }
 
+    @Override
     public SOAPElement setElementQName(QName newName) throws SOAPException {
         if (!isStandardFaultElement()) {
             FaultElement1_2Impl copy =
@@ -74,11 +81,13 @@
         }
     }
 
+    @Override
     public void setEncodingStyle(String encodingStyle) throws SOAPException {
         log.severe("SAAJ0408.ver1_2.no.encodingStyle.in.fault.child");
         throw new SOAPExceptionImpl("encodingStyle attribute cannot appear on a Fault child element");
     }
 
+    @Override
     public SOAPElement addAttribute(Name name, String value)
         throws SOAPException {
         if (name.getLocalName().equals("encodingStyle")
@@ -88,6 +97,7 @@
         return super.addAttribute(name, value);
     }
 
+    @Override
     public SOAPElement addAttribute(QName name, String value)
         throws SOAPException {
         if (name.getLocalPart().equals("encodingStyle")
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Header1_2Impl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Header1_2Impl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -59,18 +59,22 @@
         super(ownerDoc, domElement);
     }
 
+    @Override
     protected NameImpl getNotUnderstoodName() {
         return NameImpl.createNotUnderstood1_2Name(null);
     }
 
+    @Override
     protected NameImpl getUpgradeName() {
         return NameImpl.createUpgrade1_2Name(null);
     }
 
+    @Override
     protected NameImpl getSupportedEnvelopeName() {
         return NameImpl.createSupportedEnvelope1_2Name(null);
     }
 
+    @Override
     public SOAPHeaderElement addNotUnderstoodHeaderElement(final QName sourceName)
         throws SOAPException {
 
@@ -102,6 +106,7 @@
         return notunderstoodHeaderElement;
     }
 
+    @Override
     public SOAPElement addTextNode(String text) throws SOAPException {
         log.log(
             Level.SEVERE,
@@ -110,6 +115,7 @@
         throw new SOAPExceptionImpl("Adding text to SOAP 1.2 Header is not legal");
     }
 
+    @Override
     protected SOAPHeaderElement createHeaderElement(Name name)
         throws SOAPException {
         String uri = name.getURI();
@@ -122,6 +128,7 @@
             name);
     }
 
+    @Override
     protected SOAPHeaderElement createHeaderElement(QName name)
         throws SOAPException {
         String uri = name.getNamespaceURI();
@@ -134,11 +141,13 @@
             name);
     }
 
+    @Override
     public void setEncodingStyle(String encodingStyle) throws SOAPException {
         log.severe("SAAJ0409.ver1_2.no.encodingstyle.in.header");
         throw new SOAPExceptionImpl("encodingStyle attribute cannot appear on Header");
     }
 
+    @Override
     public SOAPElement addAttribute(Name name, String value)
         throws SOAPException {
         if (name.getLocalName().equals("encodingStyle")
@@ -149,6 +158,7 @@
         return super.addAttribute(name, value);
     }
 
+    @Override
     public SOAPElement addAttribute(QName name, String value)
         throws SOAPException {
         if (name.getLocalPart().equals("encodingStyle")
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/HeaderElement1_2Impl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/HeaderElement1_2Impl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, 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
@@ -37,6 +37,7 @@
 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
 import com.sun.xml.internal.messaging.saaj.soap.impl.HeaderElementImpl;
 import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
+import org.w3c.dom.Element;
 
 public class HeaderElement1_2Impl extends HeaderElementImpl {
 
@@ -47,51 +48,65 @@
         super(ownerDoc, qname);
     }
 
+    public HeaderElement1_2Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
+        super(ownerDoc, domElement);
+    }
+
+    @Override
     public SOAPElement setElementQName(QName newName) throws SOAPException {
         HeaderElementImpl copy =
             new HeaderElement1_2Impl((SOAPDocumentImpl)getOwnerDocument(), newName);
         return replaceElementWithSOAPElement(this,copy);
     }
 
+    @Override
     protected NameImpl getRoleAttributeName() {
         return NameImpl.create("role", null, NameImpl.SOAP12_NAMESPACE);
     }
 
     // Actor equivalent to Role in SOAP 1.2
+    @Override
     protected NameImpl getActorAttributeName() {
         return getRoleAttributeName();
     }
 
+    @Override
     protected NameImpl getMustunderstandAttributeName() {
         return NameImpl.create("mustUnderstand", null, NameImpl.SOAP12_NAMESPACE);
     }
 
     // mustUnderstand attribute has literal value "true" or "false"
+    @Override
     protected String getMustunderstandLiteralValue(boolean mustUnderstand) {
         return (mustUnderstand == true ? "true" : "false");
     }
 
+    @Override
     protected boolean getMustunderstandAttributeValue(String mu) {
         if (mu.equals("true") || mu.equals("1"))
             return true;
         return false;
     }
 
+    @Override
    protected NameImpl getRelayAttributeName() {
         return NameImpl.create("relay", null, NameImpl.SOAP12_NAMESPACE);
     }
 
     //relay attribute has literal value "true" or "false"
+    @Override
     protected String getRelayLiteralValue(boolean relay) {
         return (relay == true ? "true" : "false");
     }
 
+    @Override
     protected boolean getRelayAttributeValue(String relay) {
         if (relay.equals("true") || relay.equals("1"))
             return true;
         return false;
     }
 
+    @Override
     protected String getActorOrRole() {
         return getRole();
     }
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Message1_2Impl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Message1_2Impl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -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
@@ -69,6 +69,7 @@
             super(headers,ct,stat,reader);
     }
 
+    @Override
     public SOAPPart getSOAPPart()  {
         if (soapPartImpl == null)
             soapPartImpl = new SOAPPart1_2Impl(this);
@@ -76,14 +77,17 @@
         return soapPartImpl;
     }
 
+    @Override
     protected boolean isCorrectSoapVersion(int contentTypeId) {
         return (contentTypeId & SOAP1_2_FLAG) != 0;
     }
 
+    @Override
     protected String getExpectedContentType() {
         return isFastInfoset ? "application/soap+fastinfoset" : "application/soap+xml";
     }
 
+    @Override
    protected String getExpectedAcceptHeader() {
        String accept = "application/soap+xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2";
        return acceptFastInfoset ? ("application/soap+fastinfoset, " + accept) : accept;
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/SOAPFactory1_2Impl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/SOAPFactory1_2Impl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -39,14 +39,17 @@
 import com.sun.xml.internal.messaging.saaj.soap.SOAPFactoryImpl;
 
 public class SOAPFactory1_2Impl extends SOAPFactoryImpl {
+    @Override
     protected SOAPDocumentImpl createDocument() {
         return (new SOAPPart1_2Impl()).getDocument();
     }
 
+    @Override
     public Detail createDetail() throws SOAPException {
         return new Detail1_2Impl(createDocument());
     }
 
+    @Override
     public SOAPFault createFault(String reasonText, QName faultCode)
         throws SOAPException {
          if (faultCode == null) {
@@ -55,14 +58,15 @@
         if (reasonText == null) {
             throw new IllegalArgumentException("reasonText argument for createFault was passed NULL");
         }
-        Fault1_2Impl fault = new Fault1_2Impl(createDocument(), null);
+        Fault1_2Impl fault = new Fault1_2Impl(createDocument());
         fault.setFaultCode(faultCode);
         fault.setFaultString(reasonText);
         return fault;
     }
 
+    @Override
     public SOAPFault createFault() throws SOAPException {
-        Fault1_2Impl fault = new Fault1_2Impl(createDocument(), null);
+        Fault1_2Impl fault = new Fault1_2Impl(createDocument());
         fault.setFaultCode(fault.getDefaultFaultCode());
         fault.setFaultString("Fault string, and possibly fault code, not set");
         return fault;
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/SOAPMessageFactory1_2Impl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/SOAPMessageFactory1_2Impl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -40,16 +40,19 @@
 
 public class SOAPMessageFactory1_2Impl extends MessageFactoryImpl {
 
+    @Override
     public SOAPMessage createMessage() throws SOAPException {
         return new Message1_2Impl();
     }
 
+    @Override
     public SOAPMessage createMessage(boolean isFastInfoset,
         boolean acceptFastInfoset) throws SOAPException
     {
         return new Message1_2Impl(isFastInfoset, acceptFastInfoset);
     }
 
+    @Override
     public SOAPMessage createMessage(MimeHeaders headers, InputStream in) throws IOException, SOAPExceptionImpl {
 
         if (headers == null) {
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/SOAPPart1_2Impl.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/SOAPPart1_2Impl.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -53,14 +53,17 @@
         super(message);
     }
 
+    @Override
     protected String getContentType() {
         return "application/soap+xml";
     }
 
+    @Override
     protected Envelope createEmptyEnvelope(String prefix) throws SOAPException {
         return new Envelope1_2Impl(getDocument(), prefix, true, true);
     }
 
+    @Override
     protected Envelope createEnvelopeFromSource() throws SOAPException {
         XMLDeclarationParser parser = lookForXmlDecl();
         Source tmp = source;
@@ -82,6 +85,7 @@
 
     }
 
+    @Override
     protected SOAPPartImpl duplicateType() {
         return new SOAPPart1_2Impl();
     }
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/ByteInputStream.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/ByteInputStream.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -53,6 +53,7 @@
         return count;
     }
 
+    @Override
     public void close() throws IOException {
         reset();
     }
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/JAXMStreamSource.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/JAXMStreamSource.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -75,10 +75,12 @@
         this.reader = new CharArrayReader(cout.toCharArray(), 0, cout.size());
     }
 
+    @Override
     public InputStream getInputStream() {
         return in;
     }
 
+    @Override
     public Reader getReader() {
         return reader;
     }
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/NamespaceContextIterator.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/NamespaceContextIterator.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -89,11 +89,13 @@
         }
     }
 
+    @Override
     public boolean hasNext() {
         findNext();
         return next != null;
     }
 
+    @Override
     public Object next() {
         return getNext();
     }
@@ -112,6 +114,7 @@
         return last;
     }
 
+    @Override
     public void remove() {
         if (last == null) {
             throw new IllegalStateException();
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/RejectDoctypeSaxFilter.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/RejectDoctypeSaxFilter.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -96,6 +96,7 @@
      * Override setProperty() to capture any LexicalHandler that is set for
      * forwarding of events.
      */
+    @Override
     public void setProperty(String name, Object value)
     throws SAXNotRecognizedException, SAXNotSupportedException {
         if (LEXICAL_HANDLER_PROP.equals(name)) {
@@ -109,38 +110,45 @@
     // Beginning of SAX LexicalHandler callbacks...
     //
 
+    @Override
     public void startDTD(String name, String publicId, String systemId)
     throws SAXException {
         throw new SAXException("Document Type Declaration is not allowed");
     }
 
+    @Override
     public void endDTD() throws SAXException {
     }
 
+    @Override
     public void startEntity(String name) throws SAXException {
         if (lexicalHandler != null) {
             lexicalHandler.startEntity(name);
         }
     }
 
+    @Override
     public void endEntity(String name) throws SAXException {
         if (lexicalHandler != null) {
             lexicalHandler.endEntity(name);
         }
     }
 
+    @Override
     public void startCDATA() throws SAXException {
         if (lexicalHandler != null) {
             lexicalHandler.startCDATA();
         }
     }
 
+    @Override
     public void endCDATA() throws SAXException {
         if (lexicalHandler != null) {
             lexicalHandler.endCDATA();
         }
     }
 
+    @Override
     public void comment(char[] ch, int start, int length) throws SAXException {
         if (lexicalHandler != null) {
             lexicalHandler.comment(ch, start, length);
@@ -151,6 +159,7 @@
     // End of SAX LexicalHandler callbacks
     //
 
+    @Override
     public void startElement(String namespaceURI, String localName,
     String qName, Attributes atts)   throws SAXException{
         if(atts != null ){
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/TeeInputStream.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/TeeInputStream.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -46,44 +46,53 @@
         this.source = source;
     }
 
+    @Override
     public int read() throws IOException {
         int result = source.read();
         copySink.write(result);
         return result;
     }
 
+    @Override
     public int available() throws IOException {
         return source.available();
     }
 
+    @Override
     public void close() throws IOException {
         source.close();
     }
 
+    @Override
     public synchronized void mark(int readlimit) {
         source.mark(readlimit);
     }
 
+    @Override
     public boolean markSupported() {
         return source.markSupported();
     }
 
+    @Override
     public int read(byte[] b, int off, int len) throws IOException {
         int result = source.read(b, off, len);
         copySink.write(b, off, len);
         return result;
     }
 
+    @Override
     public int read(byte[] b) throws IOException {
         int result = source.read(b);
         copySink.write(b);
         return result;
     }
 
+    @Override
     public synchronized void reset() throws IOException {
         source.reset();
     }
 
+    @Override
     public long skip(long n) throws IOException {
         return source.skip(n);
     }
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/stax/LazyEnvelopeStaxReader.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/stax/LazyEnvelopeStaxReader.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -59,11 +59,13 @@
         }
     }
 
+    @Override
     public Object getProperty(String name) throws IllegalArgumentException {
         if (usePayloadReaderDelegate) return payloadReader.getProperty(name);
         return super.getProperty(name);
     }
 
+    @Override
     public int next() throws XMLStreamException {
 //        boolean previouslyUsingPayloadReader = usePayloadReaderDelegate;
         //call checkReaderStatus to advance to payloadReader if needed
@@ -78,22 +80,26 @@
         return getEventType();
     }
 
+    @Override
     public void require(int type, String namespaceURI, String localName)
             throws XMLStreamException {
         if (usePayloadReaderDelegate) payloadReader.require(type, namespaceURI, localName);
         else super.require(type, namespaceURI, localName);
     }
 
+    @Override
     public String getElementText() throws XMLStreamException {
         if (usePayloadReaderDelegate) return payloadReader.getElementText();
         return super.getElementText();
     }
 
+    @Override
     public int nextTag() throws XMLStreamException {
         if (usePayloadReaderDelegate) return payloadReader.nextTag();
         return super.nextTag();
     }
 
+    @Override
     public boolean hasNext() throws XMLStreamException {
         checkReaderStatus(false);
         boolean hasNext;
@@ -139,116 +145,139 @@
         }
     }
 
+    @Override
     public void close() throws XMLStreamException {
         if (usePayloadReaderDelegate) payloadReader.close();
         else super.close();
     }
 
+    @Override
     public String getNamespaceURI(String prefix) {
         if (usePayloadReaderDelegate) return payloadReader.getNamespaceURI(prefix);
         return super.getNamespaceURI(prefix);
     }
 
+    @Override
     public boolean isStartElement() {
         if (usePayloadReaderDelegate) return payloadReader.isStartElement();
         return super.isStartElement();
     }
 
+    @Override
     public boolean isEndElement() {
         if (usePayloadReaderDelegate) return payloadReader.isEndElement();
         return super.isEndElement();
     }
 
+    @Override
     public boolean isCharacters() {
         if (usePayloadReaderDelegate) return payloadReader.isCharacters();
         return super.isEndElement();
     }
 
+    @Override
     public boolean isWhiteSpace() {
         if (usePayloadReaderDelegate) return payloadReader.isWhiteSpace();
         return super.isWhiteSpace();
     }
 
+    @Override
     public String getAttributeValue(String namespaceURI, String localName) {
         if (usePayloadReaderDelegate) return payloadReader.getAttributeValue(namespaceURI, localName);
         return super.getAttributeValue(namespaceURI, localName);
     }
 
+    @Override
     public int getAttributeCount() {
         if (usePayloadReaderDelegate) return payloadReader.getAttributeCount();
         return super.getAttributeCount();
     }
 
+    @Override
     public QName getAttributeName(int index) {
         if (usePayloadReaderDelegate) return payloadReader.getAttributeName(index);
         return super.getAttributeName(index);
     }
 
+    @Override
     public String getAttributeNamespace(int index) {
         if (usePayloadReaderDelegate) return payloadReader.getAttributeNamespace(index);
         return super.getAttributeNamespace(index);
     }
 
+    @Override
     public String getAttributeLocalName(int index) {
         if (usePayloadReaderDelegate) return payloadReader.getAttributeLocalName(index);
         return super.getAttributeLocalName(index);
     }
 
+    @Override
     public String getAttributePrefix(int index) {
         if (usePayloadReaderDelegate) return payloadReader.getAttributePrefix(index);
         return super.getAttributePrefix(index);
     }
 
+    @Override
     public String getAttributeType(int index) {
         if (usePayloadReaderDelegate) return payloadReader.getAttributeType(index);
         return super.getAttributeType(index);
     }
 
+    @Override
     public String getAttributeValue(int index) {
         if (usePayloadReaderDelegate) return payloadReader.getAttributeValue(index);
         return super.getAttributeValue(index);
     }
 
+    @Override
     public boolean isAttributeSpecified(int index) {
         if (usePayloadReaderDelegate) return payloadReader.isAttributeSpecified(index);
         return super.isAttributeSpecified(index);
     }
 
+    @Override
     public int getNamespaceCount() {
         if (usePayloadReaderDelegate) return payloadReader.getNamespaceCount();
         return super.getNamespaceCount();
     }
 
+    @Override
     public String getNamespacePrefix(int index) {
         if (usePayloadReaderDelegate) return payloadReader.getNamespacePrefix(index);
         return super.getNamespacePrefix(index);
     }
 
+    @Override
     public String getNamespaceURI(int index) {
         if (usePayloadReaderDelegate) return payloadReader.getNamespaceURI(index);
         return super.getNamespaceURI(index);
     }
 
+    @Override
     public NamespaceContext getNamespaceContext() {
         if (usePayloadReaderDelegate) return payloadReader.getNamespaceContext();
         return super.getNamespaceContext();
     }
 
+    @Override
     public int getEventType() {
         if (usePayloadReaderDelegate) return payloadReader.getEventType();
         return super.getEventType();
     }
 
+    @Override
     public String getText() {
         if (usePayloadReaderDelegate) return payloadReader.getText();
         return super.getText();
     }
 
+    @Override
     public char[] getTextCharacters() {
         if (usePayloadReaderDelegate) return payloadReader.getTextCharacters();
         return super.getTextCharacters();
     }
 
+    @Override
     public int getTextCharacters(int sourceStart, char[] target,
             int targetStart, int length) throws XMLStreamException {
         if (usePayloadReaderDelegate) return payloadReader.getTextCharacters(sourceStart, target, targetStart,
@@ -256,81 +285,97 @@
         return super.getTextCharacters(sourceStart, target, targetStart, length);
     }
 
+    @Override
     public int getTextStart() {
         if (usePayloadReaderDelegate) return payloadReader.getTextStart();
         return super.getTextStart();
     }
 
+    @Override
     public int getTextLength() {
         if (usePayloadReaderDelegate) return payloadReader.getTextLength();
         return super.getTextLength();
     }
 
+    @Override
     public String getEncoding() {
         if (usePayloadReaderDelegate) return payloadReader.getEncoding();
         return super.getEncoding();
     }
 
+    @Override
     public boolean hasText() {
         if (usePayloadReaderDelegate) return payloadReader.hasText();
         return super.hasText();
     }
 
+    @Override
     public Location getLocation() {
         if (usePayloadReaderDelegate) return payloadReader.getLocation();
         return super.getLocation();
     }
 
+    @Override
     public QName getName() {
         if (usePayloadReaderDelegate) return payloadReader.getName();
         return super.getName();
     }
 
+    @Override
     public String getLocalName() {
         if (usePayloadReaderDelegate) return payloadReader.getLocalName();
         return super.getLocalName();
     }
 
+    @Override
     public boolean hasName() {
         if (usePayloadReaderDelegate) return payloadReader.hasName();
         return super.hasName();
     }
 
+    @Override
     public String getNamespaceURI() {
         if (usePayloadReaderDelegate) return payloadReader.getNamespaceURI();
         return super.getNamespaceURI();
     }
 
+    @Override
     public String getPrefix() {
         if (usePayloadReaderDelegate) return payloadReader.getPrefix();
         return super.getPrefix();
     }
 
+    @Override
     public String getVersion() {
         if (usePayloadReaderDelegate) return payloadReader.getVersion();
         return super.getVersion();
     }
 
+    @Override
     public boolean isStandalone() {
         if (usePayloadReaderDelegate) return payloadReader.isStandalone();
         return super.isStandalone();
     }
 
+    @Override
     public boolean standaloneSet() {
         if (usePayloadReaderDelegate) return payloadReader.standaloneSet();
         return super.standaloneSet();
     }
 
+    @Override
     public String getCharacterEncodingScheme() {
         if (usePayloadReaderDelegate) return payloadReader.getCharacterEncodingScheme();
         return super.getCharacterEncodingScheme();
     }
 
+    @Override
     public String getPITarget() {
         if (usePayloadReaderDelegate) return payloadReader.getPITarget();
         return super.getPITarget();
     }
 
+    @Override
     public String getPIData() {
         if (usePayloadReaderDelegate) return payloadReader.getPIData();
         return super.getPIData();
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/stax/SaajStaxWriter.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/stax/SaajStaxWriter.java	Mon Jul 10 15:54:38 2017 +0200
@@ -335,24 +335,30 @@
     @Override
     public NamespaceContext getNamespaceContext() {
         return new NamespaceContext() {
+            @Override
             public String getNamespaceURI(final String prefix) {
                 return currentElement.getNamespaceURI(prefix);
             }
+            @Override
             public String getPrefix(final String namespaceURI) {
                 return currentElement.lookupPrefix(namespaceURI);
             }
+            @Override
             public Iterator getPrefixes(final String namespaceURI) {
                 return new Iterator<String>() {
                     String prefix = getPrefix(namespaceURI);
+                    @Override
                     public boolean hasNext() {
                         return (prefix != null);
                     }
+                    @Override
                     public String next() {
                         if (!hasNext()) throw new java.util.NoSuchElementException();
                         String next = prefix;
                         prefix = null;
                         return next;
                     }
+                    @Override
                     public void remove() {}
                 };
             }
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/stax/SaajStaxWriterEx.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/stax/SaajStaxWriterEx.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -67,6 +67,7 @@
         super(msg, uri);
     }
 
+    @Override
     public void writeStartElement(String prefix, String ln, String ns) throws XMLStreamException {
         if (xopNS.equals(ns) && Include.equals(ln)) {
             state = State.xopInclude;
@@ -108,31 +109,41 @@
     @Override
     public NamespaceContextEx getNamespaceContext() {
         return new NamespaceContextEx() {
+            @Override
             public String getNamespaceURI(String prefix) {
                 return currentElement.getNamespaceURI(prefix);
             }
+            @Override
             public String getPrefix(String namespaceURI) {
                 return currentElement.lookupPrefix(namespaceURI);
             }
+            @Override
             public Iterator getPrefixes(final String namespaceURI) {
                 return new Iterator<String>() {
                     String prefix = getPrefix(namespaceURI);
+                    @Override
                     public boolean hasNext() {
                         return (prefix != null);
                     }
+                    @Override
                     public String next() {
                         if (prefix == null) throw new java.util.NoSuchElementException();
                         String next = prefix;
                         prefix = null;
                         return next;
                     }
+                    @Override
                     public void remove() {}
                 };
             }
+            @Override
             public Iterator<Binding> iterator() {
                 return new Iterator<Binding>() {
+                    @Override
                     public boolean hasNext() { return false; }
+                    @Override
                     public Binding next() { return null; }
+                    @Override
                     public void remove() {}
                 };
             }
@@ -208,6 +219,7 @@
         return hrefOrCid;
     }
 
+    @Override
     public AttachmentMarshaller getAttachmentMarshaller() {
         return new AttachmentMarshaller() {
             @Override
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/message/saaj/SAAJMessageHeaders.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/message/saaj/SAAJMessageHeaders.java	Mon Jul 10 15:54:38 2017 +0200
@@ -25,6 +25,18 @@
 
 package com.sun.xml.internal.ws.api.message.saaj;
 
+import com.sun.xml.internal.ws.api.SOAPVersion;
+import com.sun.xml.internal.ws.api.WSBinding;
+import com.sun.xml.internal.ws.api.message.Header;
+import com.sun.xml.internal.ws.api.message.MessageHeaders;
+import com.sun.xml.internal.ws.binding.SOAPBindingImpl;
+import com.sun.xml.internal.ws.message.saaj.SAAJHeader;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPHeaderElement;
+import javax.xml.soap.SOAPMessage;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -34,21 +46,6 @@
 import java.util.Map;
 import java.util.Set;
 
-import javax.xml.namespace.QName;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPHeader;
-import javax.xml.soap.SOAPHeaderElement;
-import javax.xml.soap.SOAPMessage;
-
-import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
-import com.sun.xml.internal.messaging.saaj.soap.impl.HeaderImpl;
-import com.sun.xml.internal.ws.api.SOAPVersion;
-import com.sun.xml.internal.ws.api.WSBinding;
-import com.sun.xml.internal.ws.api.message.Header;
-import com.sun.xml.internal.ws.api.message.MessageHeaders;
-import com.sun.xml.internal.ws.binding.SOAPBindingImpl;
-import com.sun.xml.internal.ws.message.saaj.SAAJHeader;
-
 public class SAAJMessageHeaders implements MessageHeaders {
     SOAPMessage sm;
     Map<SOAPHeaderElement, Header> nonSAAJHeaders;
@@ -236,12 +233,11 @@
         if (soapHeader == null) {
             return null;
         }
-        SOAPDocumentImpl soapDocument = ((HeaderImpl)soapHeader).getSoapDocument();
         SOAPHeaderElement headerElem = find(nsUri, localName);
         if (headerElem == null) {
             return null;
         }
-        headerElem = (SOAPHeaderElement) soapDocument.find(soapHeader.removeChild(headerElem));
+        headerElem = (SOAPHeaderElement) soapHeader.removeChild(headerElem);
 
         //it might have been a nonSAAJHeader - remove from that map
         removeNonSAAJHeader(headerElem);
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/server/SDDocumentSource.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/server/SDDocumentSource.java	Mon Jul 10 15:54:38 2017 +0200
@@ -35,6 +35,7 @@
 import javax.xml.stream.XMLStreamReader;
 import java.io.IOException;
 import java.io.InputStream;
+import java.lang.reflect.Method;
 import java.net.MalformedURLException;
 import java.net.URL;
 
@@ -89,8 +90,14 @@
      */
     public abstract URL getSystemId();
 
-    public static SDDocumentSource create(final Class<?> implClass, final String url) {
-        return create(url, implClass);
+    public static SDDocumentSource create(final Class<?> implClass, final String wsdlLocation) {
+        ClassLoader cl = implClass.getClassLoader();
+        URL url = cl.getResource(wsdlLocation);
+        if (url != null) {
+            return create(url);
+        } else {
+            return create(wsdlLocation, implClass);
+        }
     }
 
     /**
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/streaming/XMLStreamReaderFactory.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/streaming/XMLStreamReaderFactory.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, 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
@@ -28,6 +28,7 @@
 import com.sun.istack.internal.NotNull;
 import com.sun.istack.internal.Nullable;
 import com.sun.xml.internal.ws.streaming.XMLReaderException;
+import com.sun.xml.internal.ws.util.MrJarUtil;
 import com.sun.xml.internal.ws.util.xml.XmlUtil;
 import org.xml.sax.InputSource;
 
@@ -79,7 +80,7 @@
 
                     // this system property can be used to disable the pooling altogether,
                     // in case someone hits an issue with pooling in the production system.
-                    if(!getProperty(XMLStreamReaderFactory.class.getName()+".noPool")) {
+                    if(!MrJarUtil.getNoPoolProperty(XMLStreamReaderFactory.class.getName())) {
                         f = Zephyr.newInstance(xif);
                     }
 
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/streaming/XMLStreamWriterFactory.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/streaming/XMLStreamWriterFactory.java	Mon Jul 10 15:54:38 2017 +0200
@@ -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
@@ -30,6 +30,7 @@
 import com.sun.xml.internal.ws.encoding.HasEncoding;
 import com.sun.xml.internal.ws.encoding.SOAPBindingCodec;
 import com.sun.xml.internal.ws.streaming.XMLReaderException;
+import com.sun.xml.internal.ws.util.MrJarUtil;
 import com.sun.xml.internal.ws.util.xml.XMLStreamWriterFilter;
 
 import javax.xml.stream.XMLOutputFactory;
@@ -85,7 +86,7 @@
 
             // this system property can be used to disable the pooling altogether,
             // in case someone hits an issue with pooling in the production system.
-            if (!Boolean.getBoolean(XMLStreamWriterFactory.class.getName()+".noPool")) {
+            if (!MrJarUtil.getNoPoolProperty(XMLStreamWriterFactory.class.getName())) {
                 try {
                     Class<?> clazz = xof.createXMLStreamWriter(new StringWriter()).getClass();
                     if (clazz.getName().startsWith("com.sun.xml.internal.stream.")) {
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/model/RuntimeModeler.java	Wed Jun 14 11:19:42 2017 +0200
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/model/RuntimeModeler.java	Mon Jul 10 15:54:38 2017 +0200
@@ -1180,7 +1180,7 @@
                     if(p == null)
                         resRpcParams.put(resRpcParams.size()+10000, param);
                     else
-                        resRpcParams.put(param.getIndex(), param);
+                        resRpcParams.put(p.getIndex(), param);