From bd03217234fa3bdd5ad7437932b8d733517b1533 Mon Sep 17 00:00:00 2001 From: brianmdelaney Date: Fri, 3 Jan 2020 17:51:20 -0700 Subject: [PATCH] Re-apply source fix for JDK-8186441 In 2017, Aleks Efimov put in a fix for to the javaee/metro-saaj repository to fix a problem where namespace declarations were getting added to parent elements incorrectly (JDK-8186441). This fix seems to have gotten lost in the eclipse-ee4j/metro-jax-ws repository, so this change is just to re-apply the fix. For details see: http://openjdk.5641.n7.nabble.com/10-RFR-8186441-Change-of-behavior-in-the-getMessage-method-of-the-SOAPMessageContextImpl-class-td320585.html and the original pull request: https://github.com/javaee/metro-saaj/pull/92/commits/8267e08a8a26138f0223bb86dfe599e69f0af28d Signed-off-by: Brian Delaney --- .../com/sun/xml/ws/api/message/saaj/SaajStaxWriter.java | 4 ++-- .../java/com/sun/xml/ws/message/saaj/SAAJFactoryTest.java | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/jaxws-ri/runtime/rt/src/main/java/com/sun/xml/ws/api/message/saaj/SaajStaxWriter.java b/jaxws-ri/runtime/rt/src/main/java/com/sun/xml/ws/api/message/saaj/SaajStaxWriter.java index 48fa5ebbc..89cbe28e4 100644 --- a/jaxws-ri/runtime/rt/src/main/java/com/sun/xml/ws/api/message/saaj/SaajStaxWriter.java +++ b/jaxws-ri/runtime/rt/src/main/java/com/sun/xml/ws/api/message/saaj/SaajStaxWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2019 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -484,7 +484,7 @@ public SOAPElement flushTo(final SOAPElement target) throws XMLStreamException { } // add namespace declarations for (NamespaceDeclaration namespace : this.namespaceDeclarations) { - target.addNamespaceDeclaration(namespace.prefix, namespace.namespaceUri); + newElement.addNamespaceDeclaration(namespace.prefix, namespace.namespaceUri); } // add attribute declarations for (AttributeDeclaration attribute : this.attributeDeclarations) { diff --git a/jaxws-ri/runtime/rt/src/test/java/com/sun/xml/ws/message/saaj/SAAJFactoryTest.java b/jaxws-ri/runtime/rt/src/test/java/com/sun/xml/ws/message/saaj/SAAJFactoryTest.java index 19e73d353..1dbec0624 100644 --- a/jaxws-ri/runtime/rt/src/test/java/com/sun/xml/ws/message/saaj/SAAJFactoryTest.java +++ b/jaxws-ri/runtime/rt/src/test/java/com/sun/xml/ws/message/saaj/SAAJFactoryTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2019 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -139,7 +139,7 @@ public void testResetDefaultNamespaceToGlobalWithJDK() throws Exception { XMLStreamReader envelope = inputFactory.createXMLStreamReader(new StringReader("\n" + "" + "" + - "" + + "" + "" + "hogehoge" + "fugafuga" + @@ -193,7 +193,7 @@ public void testResetDefaultNamespaceToGlobalWithWoodstax() throws Exception { XMLStreamReader envelope = inputFactory.createXMLStreamReader(new StringReader("\n" + "" + "" + - "" + + "" + "" + "hogehoge" + "fugafuga" +