diff --git a/.hgtags b/.hgtags index 69a48cfa61aa80dc9a371bd712fbe5eccf683e9c..6ba9ffd5dfa7e156d81532d916d7f56c54856a8f 100644 --- a/.hgtags +++ b/.hgtags @@ -664,6 +664,8 @@ d2d8b67021a0f41e0eabd711bfd87a943dc0a8d5 jdk8u112-b14 60767ec3909b3d0cb26dd7b3f952c62053719dda jdk8u112-b15 5dd7e4bae5c2f1ee4f80c5570e7e3e2f715f7a32 jdk8u112-b16 41fac11792c1ee6945f56721ee558a7424395a81 jdk8u112-b31 +548a51660ee94aeb77b2432594aeb87f87c21697 jdk8u112-b32 +a334b0815d34948188537a177a32cee27007ea2c jdk8u112-b33 ab5ff8f1e52c5e3ca02e988f4d978af63ceca5b8 jdk8u121-b00 5f0839ac7e0d25dd1ae705df496b12ca76c26d59 jdk8u121-b01 f91e3aa155b3c6774afb456db15fb358313d5771 jdk8u121-b02 @@ -678,6 +680,12 @@ d66de7e2f672a1ff6947846818412fa899456972 jdk8u121-b10 ec72a941be0a50ab77f5375cf710bc06e4f118d3 jdk8u121-b11 9561afc12df843ef21ecd9d7b3633371e7a2bfc4 jdk8u121-b12 2974746e56192cdd14fc2dd43179bcf28e4faf4a jdk8u121-b13 +4f69f3363a2ecee8d3df2b046266a76c2a805139 jdk8u121-b31 +ec26e3331158912f86268ef473e64514c70cbd52 jdk8u121-b32 +cb2c7c89dd09edcda4cb7bd0db623c813d3e5dbc jdk8u121-b33 +90f36d39acdc5be0665722538749c59583e3b83d jdk8u121-b34 +cec5310dcc2b876dd53a057035cb63dd22f63257 jdk8u121-b35 +a5c94735ad3fb33f353abc23e25915db2ff7a36e jdk8u121-b36 032874d46bf95478cb86690b3c91d335c0764b0b jdk8u131-b00 bea5b22daf5ddd941f3bcbf7a4e5fc5244ceb788 jdk8u131-b01 a01d217a232906e82f80e5bc3db4d60c4c74716e jdk8u131-b02 @@ -690,6 +698,10 @@ f5d0aadb4d1ca74eda4e98cc0030f1618ef4c870 jdk8u131-b07 40d00399869d8a28cfecf360234f340e9e0ad3b1 jdk8u131-b09 c0091a673d766ce2e76a945bab6de325fe78dd88 jdk8u131-b10 3ab471c4760a808e39406303ff33a25a542b9c75 jdk8u131-b11 +d50ccb38def5968145fd3f6e0579416bb027e85c jdk8u131-b31 +e54624a8ebe3639d3b2360adb9ae0fa32f1bef57 jdk8u131-b32 +15006e8dc79bd0005d264bff0b1677a109cf5a02 jdk8u131-b33 +e6e35f065443533c81db69022a272927b0b20f69 jdk8u131-b34 a160009bbe1417d85f1c0eec890fdb17391b3637 jdk8u141-b00 e95a13de2d36050302a1af422967f5260fc8eabd jdk8u141-b01 936085d9aff0554a3bdab2fcbbec1d1864e656a2 jdk8u141-b02 @@ -710,8 +722,14 @@ c92d704420d707d3016d8ee3a4239d1c57692ddd jdk8u141-b10 c6bc194fedb63b20c45c793405d215d206fb4654 jdk8u141-b13 d630e23b8e36c2863225d7ae107c73a38d3e6102 jdk8u141-b14 2ea94405100763c772ab3989200115d7a23c7532 jdk8u141-b15 +55899d2b99b0725d74eebc510a116423329ad6f0 jdk8u141-b31 +a3c4020f84aeb0dba467534239951f8818bdfb84 jdk8u141-b32 b64b1dfdbe7cfe3859f1023c0f1fb0216bce4ae7 jdk8u144-b00 d2744852f3e64f7b0ba54f3a64ed5e2107e6ee68 jdk8u144-b01 +a05113a4c91c59f44b9894e12aeda07a7534ff7e jdk8u144-b31 +c4f7f2878c4bc54dcc12eddbbcd90d4c7a5dddfe jdk8u144-b32 +785d45a4c0b715ff0131abda873e3c2f85874ac3 jdk8u144-b33 +71dee2264dddd5a2c90d8c6f3a3f4ffd8da02551 jdk8u144-b34 072e084bceeedeb75467e40ca77786ac9ef5227a jdk8u151-b00 5b0fa6e004312a5910a6a70e4fbc0f00a678e650 jdk8u151-b01 bd40efd56b4544ff9048d2f7be4cf108b281a6f3 jdk8u151-b02 diff --git a/src/share/classes/sun/management/MemoryPoolImpl.java b/src/share/classes/sun/management/MemoryPoolImpl.java index 1a91b8f28d6e57ac996435af073e9b3a2b8674b3..881207ae63ec6828428009cd15dc0624de893a55 100644 --- a/src/share/classes/sun/management/MemoryPoolImpl.java +++ b/src/share/classes/sun/management/MemoryPoolImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2008, 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 @@ -304,8 +304,7 @@ class MemoryPoolImpl implements MemoryPoolMXBean { getCount()); } void triggerAction() { - // Should not reach here - throw new AssertionError("Should not reach here"); + // do nothing } void clearAction() { // do nothing @@ -332,8 +331,7 @@ class MemoryPoolImpl implements MemoryPoolMXBean { gcSensor.getCount()); } void triggerAction() { - // Should not reach here - throw new AssertionError("Should not reach here"); + // do nothing } void clearAction() { // do nothing diff --git a/test/javax/xml/ws/8172297/Main.java b/test/javax/xml/ws/8172297/Main.java new file mode 100644 index 0000000000000000000000000000000000000000..14b376c8c986ccf6d91752e4fafe16966d22420b --- /dev/null +++ b/test/javax/xml/ws/8172297/Main.java @@ -0,0 +1,157 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8172297 + * @summary Test that carriage-return and new-line characters + * are preserved in webservice parameters + * @compile ws/HelloWorld.java ws/HelloWorldImpl.java Main.java + * @run testng/othervm Main + */ + +import java.io.IOException; +import java.net.ServerSocket; +import java.net.URL; +import java.util.concurrent.CountDownLatch; + +import javax.xml.namespace.QName; +import javax.xml.ws.Endpoint; +import javax.xml.ws.Service; + +import org.testng.Assert; +import org.testng.annotations.Test; + +import ws.HelloWorld; +import ws.HelloWorldImpl; + +public class Main { + + @Test + public void runTest() throws Exception { + // + CountDownLatch serverInitSignal = new CountDownLatch(1); + CountDownLatch testDoneSignal = new CountDownLatch(1); + + WebserviceRunner serverThread = new WebserviceRunner(serverInitSignal, testDoneSignal); + (new Thread(serverThread)).start(); + + serverInitSignal.await(); + + boolean paramModified = runClientCode(serverThread.getPort()); + + testDoneSignal.countDown(); + + Assert.assertFalse(paramModified, "WS parameter was modified during round trip."); + } + + /* + * Connects to launched web service endpoint, sends message with CR/NL symbols and + * checks if it was modified during the round trip client/server communication. + */ + private boolean runClientCode(int port) throws Exception { + System.out.println("Launching WS client connection on " + port + " port"); + URL url = new URL("http://localhost:" + port + "/ws/hello?wsdl"); + QName qname = new QName("http://ws/", "HelloWorldImplService"); + Service service = Service.create(url, qname); + + HelloWorld hello = (HelloWorld) service.getPort(HelloWorld.class); + + logStringContent("Client input parameter", WS_PARAM_VALUE); + + String response = hello.getHelloWorldAsString(WS_PARAM_VALUE); + logStringContent("Client response parameter", response); + + return !WS_PARAM_VALUE.equals(response); + } + + /* + * Outputs the parameter value with newline and carriage-return symbols + * replaced with #CR and #NL text abbreviations. + */ + private static void logStringContent(String description, String parameter) { + String readableContent = parameter.replaceAll("\r", "#CR") + .replaceAll("\n", "#NL"); + System.out.println(description + ": '" + readableContent + "'"); + } + + /* Web service parameter value with newline and carriage-return symbols */ + private final static String WS_PARAM_VALUE = "\r\r\n\r\r CarriageReturn and " + +"NewLine \r\n\n Test \r\r\r\r"; + + /* + * Web service server thread that publishes WS on vacant port and waits + * for client to finalize testing + */ + class WebserviceRunner implements Runnable { + // Latch used to signalize when WS endpoint is initialized + private final CountDownLatch initSignal; + // Latch used to signalize when client completed testing + private final CountDownLatch doneSignal; + // Port where WS endpoint is published + private volatile int port = 0; + + // Constructor + WebserviceRunner(CountDownLatch initSignal, CountDownLatch doneSignal) { + this.initSignal = initSignal; + this.doneSignal = doneSignal; + } + + // Returns port of the published endpoint + public int getPort() { + return port; + } + + /* + * Publish web service on vacant port and waits for the client to + * complete testing. + */ + public void run() { + try { + // Find vacant port number + ServerSocket ss = new ServerSocket(0); + port = ss.getLocalPort(); + ss.close(); + + // Publish WebService + System.out.println("Publishing WebService on " + port + " port"); + Endpoint ep = Endpoint.publish("http://localhost:" + port + "/ws/hello", new HelloWorldImpl()); + + // Notify main thread that WS endpoint is published + initSignal.countDown(); + + // Wait for main thread to complete testing + System.out.println("Waiting for done signal from test client."); + doneSignal.await(); + + // Terminate WS endpoint + System.out.println("Got done signal from the client. Stopping WS endpoint."); + ep.stop(); + } catch (IOException ioe) { + System.out.println("Failed to get vacant port number:" + ioe); + } catch (InterruptedException ie) { + System.out.println("Failed to wait for test completion:" + ie); + } + } + } +} diff --git a/test/javax/xml/ws/8172297/ws/HelloWorld.java b/test/javax/xml/ws/8172297/ws/HelloWorld.java new file mode 100644 index 0000000000000000000000000000000000000000..cffce45d851e388a438a5612b509d14e97c0149a --- /dev/null +++ b/test/javax/xml/ws/8172297/ws/HelloWorld.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package ws; + +import javax.jws.WebMethod; +import javax.jws.WebService; +import javax.jws.soap.SOAPBinding; +import javax.jws.soap.SOAPBinding.Style; +import javax.jws.soap.SOAPBinding.Use; + +//Web service endpoint interface +@WebService +@SOAPBinding(style = Style.DOCUMENT, use = Use.LITERAL) +public interface HelloWorld { + + @WebMethod + String getHelloWorldAsString(String name); +} diff --git a/test/javax/xml/ws/8172297/ws/HelloWorldImpl.java b/test/javax/xml/ws/8172297/ws/HelloWorldImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..fc7f71d588ba94d752455f7dccb4d936db725f9f --- /dev/null +++ b/test/javax/xml/ws/8172297/ws/HelloWorldImpl.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package ws; + +import javax.jws.WebService; + +// Simple web service implementation that echoes its parameter +@WebService(endpointInterface = "ws.HelloWorld") +public class HelloWorldImpl implements HelloWorld { + + @Override + public String getHelloWorldAsString(String name) { + System.out.println("Server-side parameter value: '" + + name.replaceAll("\r", "#CR") + .replaceAll("\n", "#NL") + "'"); + return name; + } +}