From 3702851396621f8cd37424d6f51bad83102f3c52 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Fri, 16 Feb 2024 03:32:09 +0000 Subject: [PATCH 1/8] 8318603: Parallelize sun/java2d/marlin/ClipShapeTest.java Backport-of: 6c7029ffd48186353fc1d2a03915386b5f386ae2 --- test/jdk/sun/java2d/marlin/ClipShapeTest.java | 43 ++++++++++++++----- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/test/jdk/sun/java2d/marlin/ClipShapeTest.java b/test/jdk/sun/java2d/marlin/ClipShapeTest.java index 65de6e750c9..3bdbd416e63 100644 --- a/test/jdk/sun/java2d/marlin/ClipShapeTest.java +++ b/test/jdk/sun/java2d/marlin/ClipShapeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -52,20 +52,43 @@ import javax.imageio.ImageWriter; import javax.imageio.stream.ImageOutputStream; -/** - * @test +/* + * @test id=Poly * @bug 8191814 - * @summary Verifies that Marlin rendering generates the same - * images with and without clipping optimization with all possible - * stroke (cap/join) and/or dashes or fill modes (EO rules) - * for paths made of either 9 lines, 4 quads, 2 cubics (random) - * Note: Use the argument -slow to run more intensive tests (too much time) - * + * @summary Runs the test with "-poly" option * @run main/othervm/timeout=300 -Dsun.java2d.renderer=sun.java2d.marlin.DMarlinRenderingEngine ClipShapeTest -poly + */ + +/* + * @test id=PolyDoDash + * @bug 8191814 + * @summary Runs the test with "-poly -doDash" options * @run main/othervm/timeout=300 -Dsun.java2d.renderer=sun.java2d.marlin.DMarlinRenderingEngine ClipShapeTest -poly -doDash + */ + +/* + * @test id=Cubic + * @bug 8191814 + * @summary Runs the test with "-cubic" option * @run main/othervm/timeout=300 -Dsun.java2d.renderer=sun.java2d.marlin.DMarlinRenderingEngine ClipShapeTest -cubic + */ + +/* + * @test id=CubicDoDash + * @bug 8191814 + * @summary Runs the test with "-cubic -doDash" options * @run main/othervm/timeout=300 -Dsun.java2d.renderer=sun.java2d.marlin.DMarlinRenderingEngine ClipShapeTest -cubic -doDash -*/ + */ + +/** + * Verifies that Marlin rendering generates the same images with and without + * clipping optimization with all possible stroke (cap/join) and/or dashes or + * fill modes (EO rules) for paths made of either 9 lines, 4 quads, 2 cubics + * (random). + *

+ * Note: Use the argument {@code -slow} to run more intensive tests (too much + * time). + */ public final class ClipShapeTest { // test options: From d120458c3a429916d107e688886054a3a364bd53 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Fri, 16 Feb 2024 12:09:13 +0000 Subject: [PATCH 2/8] 8290203: ProblemList vmTestbase/nsk/jvmti/scenarios/capability/CM03/cm03t001/TestDescription.java on linux-all Backport-of: ce36f6ea855a7ede02df969e6bb599ac36ac04fe --- test/hotspot/jtreg/ProblemList.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index 68c9ae5d4c8..029be404306 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -148,6 +148,7 @@ vmTestbase/nsk/jvmti/AttachOnDemand/attach045/TestDescription.java 8202971 gener vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/TestDescription.java 8219652 aix-ppc64 vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/TestDescription.java 8219652 aix-ppc64 vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab001/TestDescription.java 8219652 aix-ppc64 +vmTestbase/nsk/jvmti/scenarios/capability/CM03/cm03t001/TestDescription.java 8073470 linux-all vmTestbase/gc/lock/jni/jnilock002/TestDescription.java 8192647 generic-all From 370a47cd692d22ae54dbf34fe013550dd9f80fdc Mon Sep 17 00:00:00 2001 From: Jaikiran Pai Date: Fri, 16 Feb 2024 20:59:34 +0000 Subject: [PATCH 3/8] 8305906: HttpClient may use incorrect key when finding pooled HTTP/2 connection for IPv6 address Reviewed-by: phh Backport-of: 3ccb3c0e09f9a414229d3f76031f3fc8f271c936 --- .../internal/net/http/Http2ClientImpl.java | 4 +- .../internal/net/http/Http2Connection.java | 14 +- .../net/httpclient/HttpServerAdapters.java | 15 +- .../httpclient/http2/ConnectionReuseTest.java | 206 ++++++++++++++++++ 4 files changed, 227 insertions(+), 12 deletions(-) create mode 100644 test/jdk/java/net/httpclient/http2/ConnectionReuseTest.java diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/Http2ClientImpl.java b/src/java.net.http/share/classes/jdk/internal/net/http/Http2ClientImpl.java index 6bd9bad2da5..9f74a70d318 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/Http2ClientImpl.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/Http2ClientImpl.java @@ -93,9 +93,7 @@ class Http2ClientImpl { */ CompletableFuture getConnectionFor(HttpRequestImpl req, Exchange exchange) { - URI uri = req.uri(); - InetSocketAddress proxy = req.proxy(); - String key = Http2Connection.keyFor(uri, proxy); + String key = Http2Connection.keyFor(req); synchronized (this) { Http2Connection connection = connections.get(key); diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java b/src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java index 59c88e9f099..1aa19eeb16d 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java @@ -402,7 +402,7 @@ private Http2Connection(HttpRequestImpl request, this(connection, h2client, 1, - keyFor(request.uri(), request.proxy())); + keyFor(request)); Log.logTrace("Connection send window size {0} ", windowController.connectionWindowSize()); @@ -534,15 +534,13 @@ static String keyFor(HttpConnection connection) { return keyString(isSecure, proxyAddr, addr.getHostString(), addr.getPort()); } - static String keyFor(URI uri, InetSocketAddress proxy) { - boolean isSecure = uri.getScheme().equalsIgnoreCase("https"); - - String host = uri.getHost(); - int port = uri.getPort(); - return keyString(isSecure, proxy, host, port); + static String keyFor(final HttpRequestImpl request) { + final InetSocketAddress targetAddr = request.getAddress(); + final InetSocketAddress proxy = request.proxy(); + final boolean secure = request.secure(); + return keyString(secure, proxy, targetAddr.getHostString(), targetAddr.getPort()); } - // Compute the key for an HttpConnection in the Http2ClientImpl pool: // The key string follows one of the three forms below: // {C,S}:H:host:port diff --git a/test/jdk/java/net/httpclient/HttpServerAdapters.java b/test/jdk/java/net/httpclient/HttpServerAdapters.java index 3029d374028..8396c65fc5f 100644 --- a/test/jdk/java/net/httpclient/HttpServerAdapters.java +++ b/test/jdk/java/net/httpclient/HttpServerAdapters.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -227,6 +227,7 @@ public static abstract class HttpTestExchange implements AutoCloseable { public abstract URI getRequestURI(); public abstract String getRequestMethod(); public abstract void close(); + public abstract InetSocketAddress getRemoteAddress(); public void serverPush(URI uri, HttpHeaders headers, byte[] body) { ByteArrayInputStream bais = new ByteArrayInputStream(body); serverPush(uri, headers, bais); @@ -284,6 +285,12 @@ void doFilter(Filter.Chain chain) throws IOException { } @Override public void close() { exchange.close(); } + + @Override + public InetSocketAddress getRemoteAddress() { + return exchange.getRemoteAddress(); + } + @Override public URI getRequestURI() { return exchange.getRequestURI(); } @Override @@ -339,6 +346,12 @@ void doFilter(Filter.Chain filter) throws IOException { } @Override public void close() { exchange.close();} + + @Override + public InetSocketAddress getRemoteAddress() { + return exchange.getRemoteAddress(); + } + @Override public URI getRequestURI() { return exchange.getRequestURI(); } @Override diff --git a/test/jdk/java/net/httpclient/http2/ConnectionReuseTest.java b/test/jdk/java/net/httpclient/http2/ConnectionReuseTest.java new file mode 100644 index 00000000000..e60f2033deb --- /dev/null +++ b/test/jdk/java/net/httpclient/http2/ConnectionReuseTest.java @@ -0,0 +1,206 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.IOException; +import java.io.OutputStream; +import java.net.InetSocketAddress; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.net.http.HttpResponse.BodyHandlers; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Stream; + +import javax.net.ssl.SSLContext; + +import jdk.test.lib.net.IPSupport; +import jdk.test.lib.net.SimpleSSLContext; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Assumptions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import static java.net.http.HttpClient.Builder.NO_PROXY; +import static java.net.http.HttpClient.Version.HTTP_2; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +/* + * @test + * @bug 8305906 + * @summary verify that the HttpClient pools and reuses a connection for HTTP/2 requests + * @library /test/lib server/ ../ + * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters + * ReferenceTracker jdk.test.lib.net.IPSupport + * @modules java.net.http/jdk.internal.net.http.common + * java.net.http/jdk.internal.net.http.frame + * java.net.http/jdk.internal.net.http.hpack + * java.logging + * java.base/sun.net.www.http + * java.base/sun.net.www + * java.base/sun.net + * + * @run junit/othervm ConnectionReuseTest + * @run junit/othervm -Djava.net.preferIPv6Addresses=true ConnectionReuseTest + */ +public class ConnectionReuseTest implements HttpServerAdapters { + + private static SSLContext sslContext; + private static HttpTestServer http2_Server; // h2 server over HTTP + private static HttpTestServer https2_Server; // h2 server over HTTPS + + @BeforeAll + public static void beforeAll() throws Exception { + if (IPSupport.preferIPv6Addresses()) { + IPSupport.printPlatformSupport(System.err); // for debug purposes + // this test is run with -Djava.net.preferIPv6Addresses=true, so skip (all) tests + // if IPv6 isn't supported on this host + Assumptions.assumeTrue(IPSupport.hasIPv6(), "Skipping tests - IPv6 is not supported"); + } + sslContext = new SimpleSSLContext().get(); + assertNotNull(sslContext, "Unexpected null sslContext"); + + http2_Server = HttpTestServer.of( + new Http2TestServer("localhost", false, 0)); + http2_Server.addHandler(new Handler(), "/"); + http2_Server.start(); + System.out.println("Started HTTP v2 server at " + http2_Server.serverAuthority()); + + https2_Server = HttpTestServer.of( + new Http2TestServer("localhost", true, sslContext)); + https2_Server.addHandler(new Handler(), "/"); + https2_Server.start(); + System.out.println("Started HTTPS v2 server at " + https2_Server.serverAuthority()); + } + + @AfterAll + public static void afterAll() { + if (https2_Server != null) { + System.out.println("Stopping server " + https2_Server); + https2_Server.stop(); + } + if (http2_Server != null) { + System.out.println("Stopping server " + http2_Server); + http2_Server.stop(); + } + } + + private static Stream requestURIs() throws Exception { + final List arguments = new ArrayList<>(); + // h2 over HTTPS + arguments.add(Arguments.of(new URI("https://" + https2_Server.serverAuthority() + "/"))); + // h2 over HTTP + arguments.add(Arguments.of(new URI("http://" + http2_Server.serverAuthority() + "/"))); + if (IPSupport.preferIPv6Addresses()) { + if (http2_Server.getAddress().getAddress().isLoopbackAddress()) { + // h2 over HTTP, use the short form of the host, in the request URI + arguments.add(Arguments.of(new URI("http://[::1]:" + + http2_Server.getAddress().getPort() + "/"))); + } + } + return arguments.stream(); + } + + /** + * Uses a single instance of a HttpClient and issues multiple requests to {@code requestURI} + * and expects that each of the request internally uses the same connection + */ + @ParameterizedTest + @MethodSource("requestURIs") + public void testConnReuse(final URI requestURI) throws Throwable { + final HttpClient.Builder builder = HttpClient.newBuilder() + .proxy(NO_PROXY).sslContext(sslContext); + final HttpRequest req = HttpRequest.newBuilder().uri(requestURI) + .GET().version(HTTP_2).build(); + final ReferenceTracker tracker = ReferenceTracker.INSTANCE; + Throwable testFailure = null; + HttpClient client = tracker.track(builder.build()); + try { + String clientConnAddr = null; + for (int i = 1; i <= 5; i++) { + System.out.println("Issuing request(" + i + ") " + req); + final HttpResponse resp = client.send(req, BodyHandlers.ofString()); + assertEquals(200, resp.statusCode(), "unexpected response code"); + final String respBody = resp.body(); + System.out.println("Server side handler responded to a request from " + respBody); + assertNotEquals(Handler.UNKNOWN_CLIENT_ADDR, respBody, + "server handler couldn't determine client address in request"); + if (i == 1) { + // for the first request we just keep track of the client connection address + // that got used for this request + clientConnAddr = respBody; + } else { + // verify that the client connection used to issue the request is the same + // as the previous request's client connection + assertEquals(clientConnAddr, respBody, "HttpClient unexpectedly used a" + + " different connection for request(" + i + ")"); + } + } + } catch (Throwable t) { + testFailure = t; + } finally { + // dereference the client to allow the tracker to verify the resources + // have been released + client = null; + // wait for the client to be shutdown + final AssertionError trackerFailure = tracker.check(2000); + if (testFailure != null) { + if (trackerFailure != null) { + // add the failure reported by the tracker as a suppressed + // exception and throw the original test failure + testFailure.addSuppressed(trackerFailure); + } + throw testFailure; + } + if (trackerFailure != null) { + // the test itself didn't fail but the tracker check failed. + // fail the test with this exception + throw trackerFailure; + } + } + } + + private static final class Handler implements HttpTestHandler { + + private static final String UNKNOWN_CLIENT_ADDR = "unknown"; + + @Override + public void handle(final HttpTestExchange t) throws IOException { + final InetSocketAddress clientAddr = t.getRemoteAddress(); + System.out.println("Handling request " + t.getRequestURI() + " from " + clientAddr); + // we write out the client address into the response body + final byte[] responseBody = clientAddr == null + ? UNKNOWN_CLIENT_ADDR.getBytes(StandardCharsets.UTF_8) + : clientAddr.toString().getBytes(StandardCharsets.UTF_8); + t.sendResponseHeaders(200, responseBody.length); + try (final OutputStream os = t.getResponseBody()) { + os.write(responseBody); + } + } + } +} From ac3c4f0d1e9b45e0ed17897b78d660ac00add464 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Sat, 17 Feb 2024 00:34:53 +0000 Subject: [PATCH 4/8] 8324347: Enable "maybe-uninitialized" warning for FreeType 2.13.1 Backport-of: 781f368d421a94857929e4168974f43e890637d8 --- make/modules/java.desktop/lib/Awt2dLibraries.gmk | 2 -- 1 file changed, 2 deletions(-) diff --git a/make/modules/java.desktop/lib/Awt2dLibraries.gmk b/make/modules/java.desktop/lib/Awt2dLibraries.gmk index f3df643dbb8..3bbff03638b 100644 --- a/make/modules/java.desktop/lib/Awt2dLibraries.gmk +++ b/make/modules/java.desktop/lib/Awt2dLibraries.gmk @@ -416,7 +416,6 @@ else LIBFREETYPE_LIBS := -lfreetype endif - # gcc_ftobjs.c := maybe-uninitialized required for GCC 7 builds. $(eval $(call SetupJdkLibrary, BUILD_LIBFREETYPE, \ NAME := freetype, \ OPTIMIZATION := HIGHEST, \ @@ -425,7 +424,6 @@ else EXTRA_HEADER_DIRS := $(BUILD_LIBFREETYPE_HEADER_DIRS), \ DISABLED_WARNINGS_microsoft := 4018 4267 4244 4312 4819, \ DISABLED_WARNINGS_gcc := implicit-fallthrough cast-function-type bad-function-cast dangling-pointer stringop-overflow, \ - DISABLED_WARNINGS_gcc_ftobjs.c := maybe-uninitialized, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ $(call SET_SHARED_LIBRARY_ORIGIN), \ )) From 66e4ec4987de3e324feba2aff1fec790553acab2 Mon Sep 17 00:00:00 2001 From: Amos Shi Date: Mon, 19 Feb 2024 08:23:46 +0000 Subject: [PATCH 5/8] 8274122: java/io/File/createTempFile/SpecialTempFile.java fails in Windows 11 Reviewed-by: mbaesken Backport-of: 4a142c3b0831d60b3d5540f58973e8ad3d1304bf --- test/jdk/ProblemList.txt | 1 - .../File/createTempFile/SpecialTempFile.java | 20 +++++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index 069ba66c962..c8506ad1cc7 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -551,7 +551,6 @@ javax/management/monitor/DerivedGaugeMonitorTest.java 8042211 generic-al # jdk_io java/io/pathNames/GeneralWin32.java 8180264 windows-all -java/io/File/createTempFile/SpecialTempFile.java 8274122 windows11 ############################################################################ diff --git a/test/jdk/java/io/File/createTempFile/SpecialTempFile.java b/test/jdk/java/io/File/createTempFile/SpecialTempFile.java index a2fa85524a0..736e721d641 100644 --- a/test/jdk/java/io/File/createTempFile/SpecialTempFile.java +++ b/test/jdk/java/io/File/createTempFile/SpecialTempFile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, 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 @@ -24,7 +24,11 @@ /* * @test * @bug 8013827 8011950 8017212 8025128 + * @library /test/lib + * @modules java.base/jdk.internal.util * @summary Check whether File.createTempFile can handle special parameters + * @build jdk.test.lib.OSVersion jdk.test.lib.Platform + @run main SpecialTempFile * @author Dan Xu */ @@ -32,10 +36,11 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; -public class SpecialTempFile { +import jdk.test.lib.Platform; +import jdk.test.lib.OSVersion; +public class SpecialTempFile { private static void test(String name, String[] prefix, String[] suffix, boolean exceptionExpected) throws IOException { @@ -48,7 +53,7 @@ private static void test(String name, String[] prefix, String[] suffix, final String exceptionMsg = "Unable to create temporary file"; String[] dirs = { null, "." }; - Path testPath = Paths.get(System.getProperty("test.dir", ".")); + Path testPath = Path.of(System.getProperty("test.dir", ".")); for (int i = 0; i < prefix.length; i++) { boolean exceptionThrown = false; File f = null; @@ -99,12 +104,15 @@ public static void main(String[] args) throws Exception { test("SlashedName", slashPre, slashSuf, true); // Windows tests - if (!System.getProperty("os.name").startsWith("Windows")) + if (!Platform.isWindows()) return; // Test JDK-8013827 String[] resvPre = { "LPT1.package.zip", "com7.4.package.zip" }; String[] resvSuf = { ".temp", ".temp" }; - test("ReservedName", resvPre, resvSuf, true); + boolean exceptionExpected = + !(System.getProperty("os.name").endsWith("11") || + new OSVersion(10, 0).compareTo(OSVersion.current()) > 0); + test("ReservedName", resvPre, resvSuf, exceptionExpected); } } From 8ba5662bce6a0e05eccbb4ef9e0d7af39e89f8d3 Mon Sep 17 00:00:00 2001 From: Amos Shi Date: Mon, 19 Feb 2024 08:24:02 +0000 Subject: [PATCH 6/8] 8315602: Open source swing security manager test Backport-of: fd6442c079748dcaff3bb565dc35b108b68a61bd --- test/jdk/javax/swing/text/rtf/bug4178276.java | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 test/jdk/javax/swing/text/rtf/bug4178276.java diff --git a/test/jdk/javax/swing/text/rtf/bug4178276.java b/test/jdk/javax/swing/text/rtf/bug4178276.java new file mode 100644 index 00000000000..fc6ea8e2963 --- /dev/null +++ b/test/jdk/javax/swing/text/rtf/bug4178276.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 1999, 2023, 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 4178276 + * @key headful + * @summary RTFEditorkit.write(...) doesn't throw NPE when used in SecurityManager + * @run main/othervm/secure=allow bug4178276 + */ + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.nio.charset.StandardCharsets; +import javax.swing.text.Document; +import javax.swing.text.rtf.RTFEditorKit; + +public class bug4178276 { + + public static void main(String[] argv) throws Exception { + System.setSecurityManager(new SecurityManager()); + + String test="{\\rtf1\\ansi\\deff0\\deftab720{\\fonttbl{\\f0\\f swiss MS Sans Serif;}}{\\colortbl\\red0\\green0\\blue0;}\\qc\\plain\\f0 Test 1 \\par \\ql\\plain\\f0 Test 2 \\par \\qr\\plain\\f0 Test 3 \\par \\qj\\plain\\f0 Test 4}"; + RTFEditorKit c = new RTFEditorKit(); + Document doc = c.createDefaultDocument(); + try { + c.read(new ByteArrayInputStream(test.getBytes( + StandardCharsets.ISO_8859_1)), doc, 0); + ByteArrayOutputStream sw = new ByteArrayOutputStream(); + c.write(sw, doc, 0, 0); + } catch (Exception e) { + throw new RuntimeException("Unexpected NPE exception...", e); + } + } +} From f4600808e6863b07f67fb099f7b5cfd53c6b43aa Mon Sep 17 00:00:00 2001 From: Andrew Lu Date: Mon, 19 Feb 2024 09:34:41 +0000 Subject: [PATCH 7/8] 8318468: compiler/tiered/LevelTransitionTest.java fails with -XX:CompileThreshold=100 -XX:TieredStopAtLevel=1 Backport-of: 61d0db3838932d4030b05ffb04ee2b0215ea686e --- test/hotspot/jtreg/compiler/tiered/LevelTransitionTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/hotspot/jtreg/compiler/tiered/LevelTransitionTest.java b/test/hotspot/jtreg/compiler/tiered/LevelTransitionTest.java index b18b304a9bc..336c9eb5cb1 100644 --- a/test/hotspot/jtreg/compiler/tiered/LevelTransitionTest.java +++ b/test/hotspot/jtreg/compiler/tiered/LevelTransitionTest.java @@ -204,7 +204,8 @@ private ExtendedTestCase(String methodName) { } private static class CompileMethodHolder { - private final int iter = 10; + // Make sure that loop backedge is never taken to prevent unexpected OSR compilations. + private final int iter = 1; private int field = 42; /** From e2802a9b218aa71f7023e8f5b871b522920dea6d Mon Sep 17 00:00:00 2001 From: Darragh Clarke Date: Mon, 19 Feb 2024 09:38:09 +0000 Subject: [PATCH 8/8] 8308336: Test java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java failed: java.net.BindException: Address already in use Backport-of: a48bcf367120fc7cde88b19097dabe9c86c90bb7 --- .../HttpURLConnectionExpectContinueTest.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test/jdk/java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java b/test/jdk/java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java index 073b56d0ea0..b21a47ed1be 100644 --- a/test/jdk/java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java +++ b/test/jdk/java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java @@ -27,8 +27,11 @@ * @summary Verify that expect 100-continue doesn't hang * @library /test/lib * @run junit/othervm HttpURLConnectionExpectContinueTest + * @run junit/othervm -Djava.net.preferIPv4Stack=true HttpURLConnectionExpectContinueTest + * @run junit/othervm -Djava.net.preferIPv6Addresses=true HttpURLConnectionExpectContinueTest */ +import jdk.test.lib.net.URIBuilder; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -73,7 +76,7 @@ public void startServerSocket() throws Exception { control.serverSocket = new ServerSocket(); control.serverSocket.setReuseAddress(true); - control.serverSocket.bind(new InetSocketAddress("127.0.0.1", 54321)); + control.serverSocket.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0)); Runnable runnable = () -> { while (!control.stop) { try { @@ -419,8 +422,12 @@ public void testFixedLengthRequestWithDoubleExpect100ContinueResponse() throws E } // Creates a connection with all the common settings used in each test - private HttpURLConnection createConnection() throws IOException { - URL url = new URL("http://localhost:" + control.serverSocket.getLocalPort()); + private HttpURLConnection createConnection() throws Exception { + URL url = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(control.serverSocket.getLocalPort()) + .toURL(); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoOutput(true);