From a01bf3180fe943be81529408b9208ee992336be1 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Mon, 2 Jun 2025 10:03:02 +0000 Subject: [PATCH 01/31] 8275303: sun/java2d/pipe/InterpolationQualityTest.java fails with D3D basic render driver Reviewed-by: aph Backport-of: bc0379ea1a22a2631b49ecd6a331352bec81c1c6 --- jdk/src/windows/native/sun/java2d/d3d/D3DBadHardware.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jdk/src/windows/native/sun/java2d/d3d/D3DBadHardware.h b/jdk/src/windows/native/sun/java2d/d3d/D3DBadHardware.h index 83aedad8f74..78164472aa9 100644 --- a/jdk/src/windows/native/sun/java2d/d3d/D3DBadHardware.h +++ b/jdk/src/windows/native/sun/java2d/d3d/D3DBadHardware.h @@ -54,6 +54,9 @@ static const ADAPTER_INFO badHardware[] = { // All Intel Chips. { 0x8086, ALL_DEVICEIDS, NO_VERSION, OS_ALL }, + // Microsoft Basic Render Driver (as maybe used in VMs such as VirtualBox) + { 0x1414, 0x008c, NO_VERSION, OS_ALL }, + // ATI Mobility Radeon X1600, X1400, X1450, X1300, X1350 // Reason: workaround for 6613066, 6687166 // X1300 (four sub ids) From 6f0f298a77e881e1ea7a222240514ae3fc19ade2 Mon Sep 17 00:00:00 2001 From: Dmitry Cherepanov Date: Mon, 2 Jun 2025 13:43:21 +0000 Subject: [PATCH 02/31] 8340387: Update OS detection code to recognize Windows Server 2025 Reviewed-by: phh Backport-of: 34cddfbedd20d5804cab8044fbc402564e98eb9c --- hotspot/src/os/windows/vm/os_windows.cpp | 5 ++++- jdk/src/windows/native/java/lang/java_props_md.c | 9 +++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/hotspot/src/os/windows/vm/os_windows.cpp b/hotspot/src/os/windows/vm/os_windows.cpp index 3c6145cfbc0..0ac1a76d1e5 100644 --- a/hotspot/src/os/windows/vm/os_windows.cpp +++ b/hotspot/src/os/windows/vm/os_windows.cpp @@ -1833,7 +1833,10 @@ void os::win32::print_windows_version(outputStream* st) { // - 2016 GA 10/2016 build: 14393 // - 2019 GA 11/2018 build: 17763 // - 2022 GA 08/2021 build: 20348 - if (build_number > 20347) { + // - 2025 Preview build : 26040 + if (build_number > 26039) { + st->print("Server 2025"); + } else if (build_number > 20347) { st->print("Server 2022"); } else if (build_number > 17762) { st->print("Server 2019"); diff --git a/jdk/src/windows/native/java/lang/java_props_md.c b/jdk/src/windows/native/java/lang/java_props_md.c index 4768b060763..912c6fba0bc 100644 --- a/jdk/src/windows/native/java/lang/java_props_md.c +++ b/jdk/src/windows/native/java/lang/java_props_md.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -480,6 +480,8 @@ GetJavaProperties(JNIEnv* env) * where (buildNumber > 17762) * Windows Server 2022 10 0 (!VER_NT_WORKSTATION) * where (buildNumber > 20347) + * Windows Server 2025 10 0 (!VER_NT_WORKSTATION) + * where (buildNumber > 26039) * * This mapping will presumably be augmented as new Windows * versions are released. @@ -563,7 +565,10 @@ GetJavaProperties(JNIEnv* env) case 0: /* Windows server 2019 GA 10/2018 build number is 17763 */ /* Windows server 2022 build number is 20348 */ - if (buildNumber > 20347) { + /* Windows server 2025 Preview build is 26040 */ + if (buildNumber > 26039) { + sprops.os_name = "Windows Server 2025"; + } else if (buildNumber > 20347) { sprops.os_name = "Windows Server 2022"; } else if (buildNumber > 17676) { sprops.os_name = "Windows Server 2019"; From bf1754263cffbe07fc1e84d38b839177b173cc16 Mon Sep 17 00:00:00 2001 From: Andrew John Hughes Date: Wed, 4 Jun 2025 11:57:08 +0000 Subject: [PATCH 03/31] 8358328: Bump update version of OpenJDK: 8u472 Reviewed-by: sgehwolf --- .jcheck/conf | 2 +- common/autoconf/version-numbers | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.jcheck/conf b/.jcheck/conf index 93774730e78..125b39dfc71 100644 --- a/.jcheck/conf +++ b/.jcheck/conf @@ -1,7 +1,7 @@ [general] project=jdk8u jbs=JDK -version=openjdk8u462 +version=openjdk8u472 [checks] error=author,committer,reviewers,merge,issues,executable,symlink,message,hg-tag,whitespace diff --git a/common/autoconf/version-numbers b/common/autoconf/version-numbers index 73a0ffbd699..c47387c23f4 100644 --- a/common/autoconf/version-numbers +++ b/common/autoconf/version-numbers @@ -26,7 +26,7 @@ JDK_MAJOR_VERSION=1 JDK_MINOR_VERSION=8 JDK_MICRO_VERSION=0 -JDK_UPDATE_VERSION=462 +JDK_UPDATE_VERSION=472 LAUNCHER_NAME=openjdk PRODUCT_NAME=OpenJDK PRODUCT_SUFFIX="Runtime Environment" From 4f9234206475401978f3cc33286cbc41f2c8bc1b Mon Sep 17 00:00:00 2001 From: Taizo Kurashige Date: Tue, 10 Jun 2025 14:07:36 +0000 Subject: [PATCH 04/31] 8351624: [8u] Xerces-J version wrong in THIRD_PARTY_README after JDK-7150324 Reviewed-by: sgehwolf --- THIRD_PARTY_README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/THIRD_PARTY_README b/THIRD_PARTY_README index f9aea78d649..2b296592728 100644 --- a/THIRD_PARTY_README +++ b/THIRD_PARTY_README @@ -3083,7 +3083,7 @@ included with JRE 8, JDK 8, and OpenJDK 8. Apache Jakarta BCEL 5.1 Apache Santuario XML Security for Java 2.1.3 Apache Xalan-Java 2.7.2 - Apache Xerces Java 2.10.0 + Apache Xerces Java 2.7.1 Apache XML Resolver 1.1 From 51b6307937d9584f8690e4916444e479eeafff28 Mon Sep 17 00:00:00 2001 From: Thomas Fitzsimmons Date: Mon, 16 Jun 2025 23:04:07 +0000 Subject: [PATCH 05/31] 8339414: Fix JDK-8202369 incorrect backport for 8u Reviewed-by: andrew --- .../native/java/net/Inet4AddressImpl.c | 30 ++++++++----------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/jdk/src/solaris/native/java/net/Inet4AddressImpl.c b/jdk/src/solaris/native/java/net/Inet4AddressImpl.c index e30851df576..8b2e3cdce93 100644 --- a/jdk/src/solaris/native/java/net/Inet4AddressImpl.c +++ b/jdk/src/solaris/native/java/net/Inet4AddressImpl.c @@ -332,37 +332,33 @@ Java_java_net_Inet4AddressImpl_getHostByAddr(JNIEnv *env, jobject this, */ JNIEXPORT jstring JNICALL Java_java_net_Inet4AddressImpl_getLocalHostName(JNIEnv *env, jobject this) { - char hostname[NI_MAXHOST+1]; + char hostname[NI_MAXHOST + 1]; hostname[0] = '\0'; if (JVM_GetHostName(hostname, sizeof(hostname))) { - /* Something went wrong, maybe networking is not setup? */ strcpy(hostname, "localhost"); } else { +#if defined(__solaris__) + // try to resolve hostname via nameservice + // if it is known but getnameinfo fails, hostname will still be the + // value from gethostname struct addrinfo hints, *res; - int error; + // make sure string is null-terminated hostname[NI_MAXHOST] = '\0'; memset(&hints, 0, sizeof(hints)); hints.ai_flags = AI_CANONNAME; hints.ai_family = AF_INET; - error = getaddrinfo(hostname, NULL, &hints, &res); - - if (error == 0) {/* host is known to name service */ - getnameinfo(res->ai_addr, - res->ai_addrlen, - hostname, - NI_MAXHOST, - NULL, - 0, - NI_NAMEREQD); - - /* if getnameinfo fails hostname is still the value - from gethostname */ - + if (getaddrinfo(hostname, NULL, &hints, &res) == 0) { + getnameinfo(res->ai_addr, res->ai_addrlen, hostname, NI_MAXHOST, + NULL, 0, NI_NAMEREQD); freeaddrinfo(res); } +#else + // make sure string is null-terminated + hostname[NI_MAXHOST] = '\0'; +#endif } return (*env)->NewStringUTF(env, hostname); } From f08dd7fb6abfb94d72625859c1357ad094cd4d2b Mon Sep 17 00:00:00 2001 From: SendaoYan Date: Tue, 24 Jun 2025 14:07:01 +0000 Subject: [PATCH 06/31] 8352302: Test sun/security/tools/jarsigner/TimestampCheck.java is failing Reviewed-by: phh Backport-of: 577ede73d8e916bac9050d3bee80d2f18cc833a7 --- jdk/test/sun/security/tools/jarsigner/TimestampCheck.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/test/sun/security/tools/jarsigner/TimestampCheck.java b/jdk/test/sun/security/tools/jarsigner/TimestampCheck.java index 6e3d418f978..abf576ec8d0 100644 --- a/jdk/test/sun/security/tools/jarsigner/TimestampCheck.java +++ b/jdk/test/sun/security/tools/jarsigner/TimestampCheck.java @@ -1037,7 +1037,7 @@ static void prepare() throws Exception { } gencert("tsold", "-ext eku:critical=ts -startdate -40d -validity 500"); - gencert("tsbefore2019", "-ext eku:critical=ts -startdate 2018/01/01 -validity 3000"); + gencert("tsbefore2019", "-ext eku:critical=ts -startdate 2018/01/01 -validity 5000"); gencert("tsweak", "-ext eku:critical=ts"); gencert("tsdisabled", "-ext eku:critical=ts"); From 5a6e681faecd7ea2df0a278f58075f6e38e62cce Mon Sep 17 00:00:00 2001 From: SendaoYan Date: Tue, 24 Jun 2025 14:08:10 +0000 Subject: [PATCH 07/31] 8228658: test GetTotalSafepointTime.java fails on fast Linux machines with Total safepoint time 0 ms Reviewed-by: phh Backport-of: c4e0c2656caaba67128f75d733b4452def9a7afc --- .../GetTotalSafepointTime.java | 50 +++++++------------ 1 file changed, 18 insertions(+), 32 deletions(-) diff --git a/jdk/test/sun/management/HotspotRuntimeMBean/GetTotalSafepointTime.java b/jdk/test/sun/management/HotspotRuntimeMBean/GetTotalSafepointTime.java index 4dccc8871b4..9933203716d 100644 --- a/jdk/test/sun/management/HotspotRuntimeMBean/GetTotalSafepointTime.java +++ b/jdk/test/sun/management/HotspotRuntimeMBean/GetTotalSafepointTime.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, 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,47 +39,33 @@ public class GetTotalSafepointTime { private static HotspotRuntimeMBean mbean = (HotspotRuntimeMBean)ManagementFactoryHelper.getHotspotRuntimeMBean(); - private static final long NUM_THREAD_DUMPS = 100; - // Careful with these values. private static final long MIN_VALUE_FOR_PASS = 1; - private static final long MAX_VALUE_FOR_PASS = Long.MAX_VALUE; - private static boolean trace = false; + // Thread.getAllStackTraces() should cause safepoints. + // If this test is failing because it doesn't, + // MIN_VALUE_FOR_PASS should be reset to 0 + public static long executeThreadDumps(long initial_value) { + long value; + do { + Thread.getAllStackTraces(); + value = mbean.getTotalSafepointTime(); + } while (value == initial_value); + return value; + } public static void main(String args[]) throws Exception { - if (args.length > 0 && args[0].equals("trace")) { - trace = true; - } - - // Thread.getAllStackTraces() should cause safepoints. - // If this test is failing because it doesn't, - // MIN_VALUE_FOR_PASS should be reset to 0 - for (int i = 0; i < NUM_THREAD_DUMPS; i++) { - Thread.getAllStackTraces(); - } - - long value = mbean.getTotalSafepointTime(); + long value = executeThreadDumps(0); + System.out.println("Total safepoint time (ms): " + value); - if (trace) { - System.out.println("Total safepoint time (ms): " + value); - } - - if (value < MIN_VALUE_FOR_PASS || value > MAX_VALUE_FOR_PASS) { + if (value < MIN_VALUE_FOR_PASS) { throw new RuntimeException("Total safepoint time " + "illegal value: " + value + " ms " + - "(MIN = " + MIN_VALUE_FOR_PASS + "; " + - "MAX = " + MAX_VALUE_FOR_PASS + ")"); + "(MIN = " + MIN_VALUE_FOR_PASS + ")"); } - for (int i = 0; i < 2 * NUM_THREAD_DUMPS; i++) { - Thread.getAllStackTraces(); - } - long value2 = mbean.getTotalSafepointTime(); - - if (trace) { - System.out.println("Total safepoint time2 (ms): " + value2); - } + long value2 = executeThreadDumps(value); + System.out.println("Total safepoint time (ms): " + value2); if (value2 <= value) { throw new RuntimeException("Total safepoint time " + From fd6236376fd2d94bb589a985ddd5b7d323c03a07 Mon Sep 17 00:00:00 2001 From: SendaoYan Date: Tue, 24 Jun 2025 14:09:13 +0000 Subject: [PATCH 08/31] 8205653: test/jdk/sun/management/jmxremote/bootstrap/RmiRegistrySslTest.java and RmiSslBootstrapTest.sh fail with handshake_failure Test failure due to unsupported DSA keys Reviewed-by: phh Backport-of: 136331b7f064d6d61abf3c09ba7106dc9a22a531 --- .../management_ssltest11_ok.properties.in | 6 +++--- .../management_ssltest15_ok.properties.in | 6 ++++++ .../jmxremote/bootstrap/ssl/Readme.txt | 5 ++--- .../jmxremote/bootstrap/ssl/keystore | Bin 1295 -> 2579 bytes .../jmxremote/bootstrap/ssl/truststore | Bin 888 -> 1186 bytes 5 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 jdk/test/sun/management/jmxremote/bootstrap/management_ssltest15_ok.properties.in diff --git a/jdk/test/sun/management/jmxremote/bootstrap/management_ssltest11_ok.properties.in b/jdk/test/sun/management/jmxremote/bootstrap/management_ssltest11_ok.properties.in index a9bbc864c67..b74bb0d1b18 100644 --- a/jdk/test/sun/management/jmxremote/bootstrap/management_ssltest11_ok.properties.in +++ b/jdk/test/sun/management/jmxremote/bootstrap/management_ssltest11_ok.properties.in @@ -1,6 +1,6 @@ -com.sun.management.jmxremote.ssl.enabled.cipher.suites=SSL_RSA_WITH_RC4_128_SHA,SSL_RSA_WITH_RC4_128_MD5 -com.sun.management.jmxremote.ssl.enabled.protocols=SSLv2Hello,SSLv3,TLSv1 +com.sun.management.jmxremote.ssl.enabled.cipher.suites=TLS_AES_128_GCM_SHA256,TLS_AES_256_GCM_SHA384 +com.sun.management.jmxremote.ssl.enabled.protocols=SSLv2Hello,SSLv3,TLSv1,TLSv1.1,TLSv1.2,TLSv1.3 com.sun.management.jmxremote.ssl.need.client.auth=true com.sun.management.jmxremote.ssl.config.file=@TEST-SRC@/jmxremote_ssltest11_ok.ssl com.sun.management.jmxremote.authenticate=false -javax.rmi.ssl.client.enabledCipherSuites=SSL_RSA_WITH_RC4_128_SHA,SSL_RSA_WITH_RC4_128_MD5 +javax.rmi.ssl.client.enabledCipherSuites=TLS_AES_128_GCM_SHA256,TLS_AES_256_GCM_SHA384 diff --git a/jdk/test/sun/management/jmxremote/bootstrap/management_ssltest15_ok.properties.in b/jdk/test/sun/management/jmxremote/bootstrap/management_ssltest15_ok.properties.in new file mode 100644 index 00000000000..37aca8ad55d --- /dev/null +++ b/jdk/test/sun/management/jmxremote/bootstrap/management_ssltest15_ok.properties.in @@ -0,0 +1,6 @@ +com.sun.management.jmxremote.ssl.enabled.cipher.suites=TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA +com.sun.management.jmxremote.ssl.enabled.protocols=SSLv2Hello,SSLv3,TLSv1 +com.sun.management.jmxremote.ssl.need.client.auth=true +com.sun.management.jmxremote.ssl.config.file=@TEST-SRC@/jmxremote_ssltest11_ok.ssl +com.sun.management.jmxremote.authenticate=false +javax.rmi.ssl.client.enabledCipherSuites=TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA diff --git a/jdk/test/sun/management/jmxremote/bootstrap/ssl/Readme.txt b/jdk/test/sun/management/jmxremote/bootstrap/ssl/Readme.txt index 48b5478ab32..133b3db62c8 100644 --- a/jdk/test/sun/management/jmxremote/bootstrap/ssl/Readme.txt +++ b/jdk/test/sun/management/jmxremote/bootstrap/ssl/Readme.txt @@ -1,11 +1,10 @@ The trustore and keystore are to be generated as follows: -1. keytool -genkey -alias duke -keystore keystore -validity 36500 +1. keytool -genkey -alias duke -keyalg RSA -keysize 2048 -validity 36500 -keystore keystore -storepass password - use password 'password' for the keystore and key passwords - leave all values at default - the certificate validity will be 100 years (should be enough for now) 2. keytool -export -keystore keystore -alias duke -file duke.crt -3. keytool -import -keystore truststore -alias duke -file duke.crt +3. keytool -import -alias duke -file duke.crt -keystore truststore -storepass trustword - use password 'trustword' for the keystore and key passwords - leave all values at default - diff --git a/jdk/test/sun/management/jmxremote/bootstrap/ssl/keystore b/jdk/test/sun/management/jmxremote/bootstrap/ssl/keystore index f756c3b0ef182eb5aed6151343b2d8bac2f998d9..807a2f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%*WbF^CimoI#<3Pf%_*gOw5FU|^YKYhvCTs9L|Iu`ec7g8^>6yN zJa~|87xZRA&BAK=H`7l>`fXfwx0prP{-MbK-#kiTXub!lSlhAjoI>gH2!S%KkrUHA4hl~cPg)Ps_5a%^CGcYo=Ft9K&G%|~l;5RY^3K$xhLIvpTo+ic}!1SvF3lK&i zN1my%k>PKBaHDLgkY><*uQ_^eo;?31xIM_`y$i!(Is1lffohqqu?|XszawpXBYy2a z`gNDVx6`vjbFMd9H^`dge@aW(o;@>Q>5}>LU$9gQC>`?Oz4H3M?Z>2lScgA9wqltm zKg;jtZss$WDKSgVz39PsoJo{ndO|?Is51ANO_O#u zEqdL;{UJi;E68czA1-LUHrw{z={>7s%yxwDtemob_b;ngO+UkZxNX^+(gP#I`*vN4 z^nX^!F3{Mp#Z#$nDF-VoJKt-mOZo)tLhG^>D73!c%7W~=4GW5^A^{0|57wf z`uIDkic!V-%#x4$Rs>GyT+w|0Vbs(4Y?Hdv;u@+$RZ|#!tpA<&)M9RIWdH|Juz1&c zNu3vL|F8O8HBy{!)O6=t=G9ug+@sI;w0i&dS+%JDHU~dvx6$l-Qn6l9FB==%wk})d z++piJX=7kKbBj3hJ&}kfn?kr5>QCHP`+oSIw({D#HpOlGOb@b`D=bah>Lwt6Zja2z zFURg}n6pZ%tk>UY@;1i(!dK@7#(aI@@_DhMfxLk%Fy+efv52vV)R;wjFWO-8f`7}c z-y%m-i|=-6=%A!@W_<<&9VU@*nN$37;$qr@hkF12KHL<$XP4X`CK2J+MQpQH<$gFh lJ$%w^FR!$V({?Rw-)Z6-#F`Ux>qt}Kw0oNNlUm=_0s!xn2I>F+ diff --git a/jdk/test/sun/management/jmxremote/bootstrap/ssl/truststore b/jdk/test/sun/management/jmxremote/bootstrap/ssl/truststore index 3918d41f5933b9d7c9cebb209f4e4bc011170fbb..7c131cfd7ff32af588c44e3980a5ef64514c8866 100644 GIT binary patch literal 1186 zcmV;T1YP?uf&`ud0Ru3C1Xl(LDuzgg_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L{@WbkQnRAD&`=pJ5 z@yspa%=bhho@@%?W~e`LU+w$hd)mrt>)I5z?K3^dUaqh-ZL6Dr{JA|cAHN*Cw_(mI zsj^;wqsiMC_X}U07Z~&Ph0Eu~iU#rqvcQxp%f}+dB2r@(>Ah%!$qW81w|T9y0Z7FE^hfT8wL5MaTbaqqEPJ*6Pa%Kx``rL*VMa6n From 8a5c3db33936c703f50a0cab593a8474e7abafb7 Mon Sep 17 00:00:00 2001 From: Long Yang Date: Thu, 26 Jun 2025 09:37:12 +0000 Subject: [PATCH 09/31] 8312065: Socket.connect does not timeout when profiling Reviewed-by: phh Backport-of: 1ce12c4f33d3d6905703d95df2574f4037dfd57d --- jdk/src/aix/native/java/net/aix_close.c | 55 ++++++------ jdk/src/solaris/native/java/net/bsd_close.c | 57 ++++++------ jdk/src/solaris/native/java/net/linux_close.c | 57 ++++++------ jdk/test/java/net/Socket/B8312065.java | 88 +++++++++++++++++++ jdk/test/java/net/Socket/B8312065.sh | 46 ++++++++++ jdk/test/java/net/Socket/NativeThread.java | 37 ++++++++ jdk/test/java/net/Socket/libNativeThread.c | 70 +++++++++++++++ 7 files changed, 327 insertions(+), 83 deletions(-) create mode 100644 jdk/test/java/net/Socket/B8312065.java create mode 100644 jdk/test/java/net/Socket/B8312065.sh create mode 100644 jdk/test/java/net/Socket/NativeThread.java create mode 100644 jdk/test/java/net/Socket/libNativeThread.c diff --git a/jdk/src/aix/native/java/net/aix_close.c b/jdk/src/aix/native/java/net/aix_close.c index 90d57b42f07..5bf798aba10 100644 --- a/jdk/src/aix/native/java/net/aix_close.c +++ b/jdk/src/aix/native/java/net/aix_close.c @@ -55,6 +55,7 @@ #include #include +#include "jvm.h" /* * Stack allocated by thread when doing blocking operation @@ -376,61 +377,61 @@ int NET_SocketClose(int fd) { /************** Basic I/O operations here ***************/ /* - * Macro to perform a blocking IO operation. Restarts - * automatically if interrupted by signal (other than - * our wakeup signal) + * Macro to perform a blocking IO operation. + * If interrupted by signal (other than our wakeup signal), and if RETRY is true, + * then restarts automatically */ -#define BLOCKING_IO_RETURN_INT(FD, FUNC) { \ - int ret; \ - threadEntry_t self; \ - fdEntry_t *fdEntry = getFdEntry(FD); \ - if (fdEntry == NULL) { \ - errno = EBADF; \ - return -1; \ - } \ - do { \ - startOp(fdEntry, &self); \ - ret = FUNC; \ - endOp(fdEntry, &self); \ - } while (ret == -1 && errno == EINTR); \ - return ret; \ +#define BLOCKING_IO_RETURN_INT(FD, FUNC, RETRY) { \ + int ret; \ + threadEntry_t self; \ + fdEntry_t *fdEntry = getFdEntry(FD); \ + if (fdEntry == NULL) { \ + errno = EBADF; \ + return -1; \ + } \ + do { \ + startOp(fdEntry, &self); \ + ret = FUNC; \ + endOp(fdEntry, &self); \ + } while ((RETRY) && ret == -1 && errno == EINTR); \ + return ret; \ } int NET_Read(int s, void* buf, size_t len) { - BLOCKING_IO_RETURN_INT( s, recv(s, buf, len, 0) ); + BLOCKING_IO_RETURN_INT( s, recv(s, buf, len, 0), JNI_TRUE ); } int NET_NonBlockingRead(int s, void* buf, size_t len) { - BLOCKING_IO_RETURN_INT(s, recv(s, buf, len, MSG_NONBLOCK)); + BLOCKING_IO_RETURN_INT(s, recv(s, buf, len, MSG_NONBLOCK), JNI_TRUE ); } int NET_ReadV(int s, const struct iovec * vector, int count) { - BLOCKING_IO_RETURN_INT( s, readv(s, vector, count) ); + BLOCKING_IO_RETURN_INT( s, readv(s, vector, count), JNI_TRUE ); } int NET_RecvFrom(int s, void *buf, int len, unsigned int flags, struct sockaddr *from, int *fromlen) { socklen_t socklen = *fromlen; - BLOCKING_IO_RETURN_INT( s, recvfrom(s, buf, len, flags, from, &socklen) ); + BLOCKING_IO_RETURN_INT( s, recvfrom(s, buf, len, flags, from, &socklen), JNI_TRUE ); *fromlen = socklen; } int NET_Send(int s, void *msg, int len, unsigned int flags) { - BLOCKING_IO_RETURN_INT( s, send(s, msg, len, flags) ); + BLOCKING_IO_RETURN_INT( s, send(s, msg, len, flags), JNI_TRUE ); } int NET_WriteV(int s, const struct iovec * vector, int count) { - BLOCKING_IO_RETURN_INT( s, writev(s, vector, count) ); + BLOCKING_IO_RETURN_INT( s, writev(s, vector, count), JNI_TRUE ); } int NET_SendTo(int s, const void *msg, int len, unsigned int flags, const struct sockaddr *to, int tolen) { - BLOCKING_IO_RETURN_INT( s, sendto(s, msg, len, flags, to, tolen) ); + BLOCKING_IO_RETURN_INT( s, sendto(s, msg, len, flags, to, tolen), JNI_TRUE ); } int NET_Accept(int s, struct sockaddr *addr, int *addrlen) { socklen_t socklen = *addrlen; - BLOCKING_IO_RETURN_INT( s, accept(s, addr, &socklen) ); + BLOCKING_IO_RETURN_INT( s, accept(s, addr, &socklen), JNI_TRUE ); *addrlen = socklen; } @@ -490,13 +491,13 @@ int NET_Connect(int s, struct sockaddr *addr, int addrlen) { #ifndef USE_SELECT int NET_Poll(struct pollfd *ufds, unsigned int nfds, int timeout) { - BLOCKING_IO_RETURN_INT( ufds[0].fd, poll(ufds, nfds, timeout) ); + BLOCKING_IO_RETURN_INT( ufds[0].fd, poll(ufds, nfds, timeout), JNI_FALSE ); } #else int NET_Select(int s, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout) { BLOCKING_IO_RETURN_INT( s-1, - select(s, readfds, writefds, exceptfds, timeout) ); + select(s, readfds, writefds, exceptfds, timeout), JNI_TRUE ); } #endif diff --git a/jdk/src/solaris/native/java/net/bsd_close.c b/jdk/src/solaris/native/java/net/bsd_close.c index 89a20707c40..a6050e1f9ac 100644 --- a/jdk/src/solaris/native/java/net/bsd_close.c +++ b/jdk/src/solaris/native/java/net/bsd_close.c @@ -39,6 +39,7 @@ #include #include #include +#include "jvm.h" /* * Stack allocated by thread when doing blocking operation @@ -347,55 +348,55 @@ int NET_SocketClose(int fd) { /************** Basic I/O operations here ***************/ /* - * Macro to perform a blocking IO operation. Restarts - * automatically if interrupted by signal (other than - * our wakeup signal) + * Macro to perform a blocking IO operation. + * If interrupted by signal (other than our wakeup signal), and if RETRY is true, + * then restarts automatically */ -#define BLOCKING_IO_RETURN_INT(FD, FUNC) { \ - int ret; \ - threadEntry_t self; \ - fdEntry_t *fdEntry = getFdEntry(FD); \ - if (fdEntry == NULL) { \ - errno = EBADF; \ - return -1; \ - } \ - do { \ - startOp(fdEntry, &self); \ - ret = FUNC; \ - endOp(fdEntry, &self); \ - } while (ret == -1 && errno == EINTR); \ - return ret; \ +#define BLOCKING_IO_RETURN_INT(FD, FUNC, RETRY) { \ + int ret; \ + threadEntry_t self; \ + fdEntry_t *fdEntry = getFdEntry(FD); \ + if (fdEntry == NULL) { \ + errno = EBADF; \ + return -1; \ + } \ + do { \ + startOp(fdEntry, &self); \ + ret = FUNC; \ + endOp(fdEntry, &self); \ + } while ((RETRY) && ret == -1 && errno == EINTR); \ + return ret; \ } int NET_Read(int s, void* buf, size_t len) { - BLOCKING_IO_RETURN_INT( s, recv(s, buf, len, 0) ); + BLOCKING_IO_RETURN_INT( s, recv(s, buf, len, 0), JNI_TRUE ); } int NET_NonBlockingRead(int s, void* buf, size_t len) { - BLOCKING_IO_RETURN_INT( s, recv(s, buf, len, MSG_DONTWAIT)); + BLOCKING_IO_RETURN_INT( s, recv(s, buf, len, MSG_DONTWAIT), JNI_TRUE ); } int NET_ReadV(int s, const struct iovec * vector, int count) { - BLOCKING_IO_RETURN_INT( s, readv(s, vector, count) ); + BLOCKING_IO_RETURN_INT( s, readv(s, vector, count), JNI_TRUE ); } int NET_RecvFrom(int s, void *buf, int len, unsigned int flags, struct sockaddr *from, int *fromlen) { /* casting int *fromlen -> socklen_t* Both are ints */ - BLOCKING_IO_RETURN_INT( s, recvfrom(s, buf, len, flags, from, (socklen_t *)fromlen) ); + BLOCKING_IO_RETURN_INT( s, recvfrom(s, buf, len, flags, from, (socklen_t *)fromlen), JNI_TRUE ); } int NET_Send(int s, void *msg, int len, unsigned int flags) { - BLOCKING_IO_RETURN_INT( s, send(s, msg, len, flags) ); + BLOCKING_IO_RETURN_INT( s, send(s, msg, len, flags), JNI_TRUE ); } int NET_WriteV(int s, const struct iovec * vector, int count) { - BLOCKING_IO_RETURN_INT( s, writev(s, vector, count) ); + BLOCKING_IO_RETURN_INT( s, writev(s, vector, count), JNI_TRUE ); } int NET_SendTo(int s, const void *msg, int len, unsigned int flags, const struct sockaddr *to, int tolen) { - BLOCKING_IO_RETURN_INT( s, sendto(s, msg, len, flags, to, tolen) ); + BLOCKING_IO_RETURN_INT( s, sendto(s, msg, len, flags, to, tolen), JNI_TRUE ); } int NET_Accept(int s, struct sockaddr *addr, int *addrlen) { @@ -403,22 +404,22 @@ int NET_Accept(int s, struct sockaddr *addr, int *addrlen) { int error = accept(s, addr, &len); if (error != -1) *addrlen = (int)len; - BLOCKING_IO_RETURN_INT( s, error ); + BLOCKING_IO_RETURN_INT( s, error, JNI_FALSE ); } int NET_Connect(int s, struct sockaddr *addr, int addrlen) { - BLOCKING_IO_RETURN_INT( s, connect(s, addr, addrlen) ); + BLOCKING_IO_RETURN_INT( s, connect(s, addr, addrlen), JNI_TRUE ); } #ifndef USE_SELECT int NET_Poll(struct pollfd *ufds, unsigned int nfds, int timeout) { - BLOCKING_IO_RETURN_INT( ufds[0].fd, poll(ufds, nfds, timeout) ); + BLOCKING_IO_RETURN_INT( ufds[0].fd, poll(ufds, nfds, timeout), JNI_FALSE ); } #else int NET_Select(int s, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout) { BLOCKING_IO_RETURN_INT( s-1, - select(s, readfds, writefds, exceptfds, timeout) ); + select(s, readfds, writefds, exceptfds, timeout), JNI_TRUE ); } #endif diff --git a/jdk/src/solaris/native/java/net/linux_close.c b/jdk/src/solaris/native/java/net/linux_close.c index f4c53a0d012..c7a148c7462 100644 --- a/jdk/src/solaris/native/java/net/linux_close.c +++ b/jdk/src/solaris/native/java/net/linux_close.c @@ -37,6 +37,7 @@ #include #include #include +#include "jvm.h" /* * Stack allocated by thread when doing blocking operation @@ -343,77 +344,77 @@ int NET_SocketClose(int fd) { /************** Basic I/O operations here ***************/ /* - * Macro to perform a blocking IO operation. Restarts - * automatically if interrupted by signal (other than - * our wakeup signal) + * Macro to perform a blocking IO operation. + * If interrupted by signal (other than our wakeup signal), and if RETRY is true, + * then restarts automatically */ -#define BLOCKING_IO_RETURN_INT(FD, FUNC) { \ - int ret; \ - threadEntry_t self; \ - fdEntry_t *fdEntry = getFdEntry(FD); \ - if (fdEntry == NULL) { \ - errno = EBADF; \ - return -1; \ - } \ - do { \ - startOp(fdEntry, &self); \ - ret = FUNC; \ - endOp(fdEntry, &self); \ - } while (ret == -1 && errno == EINTR); \ - return ret; \ +#define BLOCKING_IO_RETURN_INT(FD, FUNC, RETRY) { \ + int ret; \ + threadEntry_t self; \ + fdEntry_t *fdEntry = getFdEntry(FD); \ + if (fdEntry == NULL) { \ + errno = EBADF; \ + return -1; \ + } \ + do { \ + startOp(fdEntry, &self); \ + ret = FUNC; \ + endOp(fdEntry, &self); \ + } while ((RETRY) && ret == -1 && errno == EINTR); \ + return ret; \ } int NET_Read(int s, void* buf, size_t len) { - BLOCKING_IO_RETURN_INT( s, recv(s, buf, len, 0) ); + BLOCKING_IO_RETURN_INT( s, recv(s, buf, len, 0), JNI_TRUE ); } int NET_NonBlockingRead(int s, void* buf, size_t len) { - BLOCKING_IO_RETURN_INT( s, recv(s, buf, len, MSG_DONTWAIT) ); + BLOCKING_IO_RETURN_INT( s, recv(s, buf, len, MSG_DONTWAIT), JNI_TRUE ); } int NET_ReadV(int s, const struct iovec * vector, int count) { - BLOCKING_IO_RETURN_INT( s, readv(s, vector, count) ); + BLOCKING_IO_RETURN_INT( s, readv(s, vector, count), JNI_TRUE ); } int NET_RecvFrom(int s, void *buf, int len, unsigned int flags, struct sockaddr *from, int *fromlen) { socklen_t socklen = *fromlen; - BLOCKING_IO_RETURN_INT( s, recvfrom(s, buf, len, flags, from, &socklen) ); + BLOCKING_IO_RETURN_INT( s, recvfrom(s, buf, len, flags, from, &socklen), JNI_TRUE ); *fromlen = socklen; } int NET_Send(int s, void *msg, int len, unsigned int flags) { - BLOCKING_IO_RETURN_INT( s, send(s, msg, len, flags) ); + BLOCKING_IO_RETURN_INT( s, send(s, msg, len, flags), JNI_TRUE ); } int NET_WriteV(int s, const struct iovec * vector, int count) { - BLOCKING_IO_RETURN_INT( s, writev(s, vector, count) ); + BLOCKING_IO_RETURN_INT( s, writev(s, vector, count), JNI_TRUE ); } int NET_SendTo(int s, const void *msg, int len, unsigned int flags, const struct sockaddr *to, int tolen) { - BLOCKING_IO_RETURN_INT( s, sendto(s, msg, len, flags, to, tolen) ); + BLOCKING_IO_RETURN_INT( s, sendto(s, msg, len, flags, to, tolen), JNI_TRUE ); } int NET_Accept(int s, struct sockaddr *addr, int *addrlen) { socklen_t socklen = *addrlen; - BLOCKING_IO_RETURN_INT( s, accept(s, addr, &socklen) ); + BLOCKING_IO_RETURN_INT( s, accept(s, addr, &socklen), JNI_TRUE ); *addrlen = socklen; } int NET_Connect(int s, struct sockaddr *addr, int addrlen) { - BLOCKING_IO_RETURN_INT( s, connect(s, addr, addrlen) ); + BLOCKING_IO_RETURN_INT( s, connect(s, addr, addrlen), JNI_TRUE ); } #ifndef USE_SELECT int NET_Poll(struct pollfd *ufds, unsigned int nfds, int timeout) { - BLOCKING_IO_RETURN_INT( ufds[0].fd, poll(ufds, nfds, timeout) ); + BLOCKING_IO_RETURN_INT( ufds[0].fd, poll(ufds, nfds, timeout), JNI_FALSE ); } #else int NET_Select(int s, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout) { BLOCKING_IO_RETURN_INT( s-1, - select(s, readfds, writefds, exceptfds, timeout) ); + select(s, readfds, writefds, exceptfds, timeout), JNI_TRUE ); } #endif diff --git a/jdk/test/java/net/Socket/B8312065.java b/jdk/test/java/net/Socket/B8312065.java new file mode 100644 index 00000000000..442e0c1fcd9 --- /dev/null +++ b/jdk/test/java/net/Socket/B8312065.java @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2023, Alibaba Group Holding Limited. 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 8312065 + * @summary Socket.connect does not timeout as expected when profiling (i.e. keep receiving signal) + * @requires (os.family != "windows") + * @build B8312065 + * @run shell B8312065.sh + */ + +import sun.misc.Signal; + +import java.net.InetSocketAddress; +import java.net.Socket; +import java.net.SocketTimeoutException; +import java.util.concurrent.TimeUnit; + +public class B8312065 { + public static void main(String[] args) throws Exception { + System.loadLibrary("NativeThread"); + + // Setup SIGPIPE handler + Signal.handle(new Signal("PIPE"), System.out::println); + + long osThreadId = NativeThread.getID(); + + int timeoutMillis = 2000; + int n = 10; + Thread t = new Thread(() -> { + // Send SIGPIPE to the thread every second + for (int i = 0; i < n; i++) { + if (NativeThread.signal(osThreadId, NativeThread.SIGPIPE) != 0) { + System.out.println("Test FAILED: failed to send signal"); + System.exit(1); + } + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + System.out.println("Test FAILED: unexpected interrupt"); + System.exit(1); + } + } + System.out.println("Test FAILED: Socket.connect blocked " + n + " seconds, " + + "expected around " + timeoutMillis / 1000 + " seconds"); + System.exit(1); + }); + t.setDaemon(true); + t.start(); + + long startTime = System.nanoTime(); + + try { + Socket socket = new Socket(); + // There is no good way to mock SocketTimeoutException, just assume 192.168.255.255 is not in use + socket.connect(new InetSocketAddress("192.168.255.255", 8080), timeoutMillis); + } catch (SocketTimeoutException e) { + long duration = TimeUnit.MILLISECONDS.convert(System.nanoTime() - startTime, TimeUnit.NANOSECONDS); + if (duration >= timeoutMillis) { + System.out.println("Test passed"); + } else { + System.out.println("Test FAILED: duration " + duration + " ms, expected >= " + timeoutMillis + " ms"); + System.exit(1); + } + } + } +} diff --git a/jdk/test/java/net/Socket/B8312065.sh b/jdk/test/java/net/Socket/B8312065.sh new file mode 100644 index 00000000000..d12596e5b6c --- /dev/null +++ b/jdk/test/java/net/Socket/B8312065.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +set -ex + +if [ "x$TESTGCC" = "x" ]; then + TESTGCC=$(readlink -f $(which gcc)) +fi + +if [ "x$TESTGCC" = "x" ]; then + echo "WARNING: gcc not found. Cannot execute test." 2>&1 + exit 1; +fi + +if [ "x$TESTROOT" = "x" ]; then + echo "TESTROOT pointintg to top level sources is not set. that is fatal" + exit 2; +fi + +if [ "x$TESTJAVA" = "x" ]; then + TESTJAVA=$(dirname $(dirname $(readlink -f $(which java)))) +fi + +JDK_TOPDIR="${TESTROOT}/.." +JAVA="${TESTJAVA}/bin/java" +TEST_ENV_SH="${JDK_TOPDIR}/../hotspot/test/test_env.sh" + +ls -l "${TEST_ENV_SH}" +set +e + . "${TEST_ENV_SH}" +set -e + +"${TESTGCC}" \ + -fPIC \ + -shared \ + ${CFLAGBITS} \ + -o ${TESTCLASSES}/libNativeThread.so \ + -I${JDK_TOPDIR}/src/share/bin \ + -I${JDK_TOPDIR}/src/share/javavm/export \ + -I${JDK_TOPDIR}/src/macosx/javavm/export \ + -I${JDK_TOPDIR}/src/solaris/bin \ + ${TESTSRC}/libNativeThread.c + +"${JAVA}" -Dtest.jdk=${TESTJAVA} \ + -Dtest.nativepath=${TESTCLASSES} \ + -Djava.library.path=${TESTCLASSES} \ + -cp ${TESTCLASSPATH}:${TESTCLASSES} B8312065 diff --git a/jdk/test/java/net/Socket/NativeThread.java b/jdk/test/java/net/Socket/NativeThread.java new file mode 100644 index 00000000000..5ab00ef855e --- /dev/null +++ b/jdk/test/java/net/Socket/NativeThread.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2020, 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. + */ + +public class NativeThread { + + public static final int SIGPIPE; + + static { + SIGPIPE = getSIGPIPE(); + } + + public static native long getID(); + + public static native int signal(long threadId, int sig); + + private static native int getSIGPIPE(); +} diff --git a/jdk/test/java/net/Socket/libNativeThread.c b/jdk/test/java/net/Socket/libNativeThread.c new file mode 100644 index 00000000000..8d2204cea7f --- /dev/null +++ b/jdk/test/java/net/Socket/libNativeThread.c @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2020, 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. + */ +#include +#include +#include +#if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(_AIX) +#include +#endif + +/* + * Class: NativeThread + * Method: getID + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_NativeThread_getID(JNIEnv *env, jclass class) +{ + #if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(_AIX) + return (jlong)pthread_self(); + #else + return 0; + #endif +} + +/* + * Class: NativeThread + * Method: signal + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_NativeThread_signal(JNIEnv *env, jclass class, jlong thread, jint sig) +{ + #if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(_AIX) + return pthread_kill((pthread_t)thread, sig); + #else + return 0; + #endif +} + +/* + * Class: NativeThread + * Method: getSIGPIPE + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_NativeThread_getSIGPIPE(JNIEnv *env, jclass class) +{ + #if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(_AIX) + return SIGPIPE; + #else + return 0; + #endif +} From eb64e7f801c15f47b04db589d4ebb9be100e1d1b Mon Sep 17 00:00:00 2001 From: Ao Qi Date: Thu, 26 Jun 2025 10:35:43 +0000 Subject: [PATCH 10/31] 8044051: Test jdk/lambda/vm/InterfaceAccessFlagsTest.java gets IOException during compilation Create the gen-separate directory in the current directory to improve robustness Backport-of: 9b8b6695108762063f96a275d9567bed72b88126 --- jdk/test/jdk/lambda/separate/Compiler.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jdk/test/jdk/lambda/separate/Compiler.java b/jdk/test/jdk/lambda/separate/Compiler.java index 48e25d4e03a..c0478301123 100644 --- a/jdk/test/jdk/lambda/separate/Compiler.java +++ b/jdk/test/jdk/lambda/separate/Compiler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, 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,7 +54,7 @@ public enum Flags { private static final AtomicInteger counter = new AtomicInteger(); private static final String targetDir = System.getProperty("lambda.separate.targetDirectory", - System.getProperty("java.io.tmpdir") + File.separator + "gen-separate"); + "." + File.separator + "gen-separate"); private static final File root = new File(targetDir); private static ConcurrentHashMap cache = new ConcurrentHashMap<>(); @@ -189,7 +189,7 @@ private File compileOne(Type type) { StandardLocation.CLASS_OUTPUT, Arrays.asList(destDir)); } catch (IOException e) { throw new RuntimeException( - "IOException encountered during compilation"); + "IOException encountered during compilation: " + e.getMessage(), e); } Boolean result = ct.call(); if (result == Boolean.FALSE) { From d0281bedf07a51f6b8b93ba156b615d76f561c63 Mon Sep 17 00:00:00 2001 From: Antonio Vieiro Date: Mon, 7 Jul 2025 15:58:58 +0000 Subject: [PATCH 11/31] 8358538: Update GHA Windows runner to 2025 Reviewed-by: sgehwolf Backport-of: 0927ca70e66ef27b38cbf5c0dd2851c796218067 --- .github/workflows/submit.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/submit.yml b/.github/workflows/submit.yml index c62e2694268..5ba35158328 100644 --- a/.github/workflows/submit.yml +++ b/.github/workflows/submit.yml @@ -676,7 +676,7 @@ jobs: windows_x64_build: name: Windows x64 - runs-on: "windows-2019" + runs-on: "windows-2025" needs: prerequisites if: needs.prerequisites.outputs.should_run != 'false' && needs.prerequisites.outputs.platform_windows_x64 != 'false' @@ -854,7 +854,7 @@ jobs: windows_x86_build: name: Windows x86 - runs-on: "windows-2019" + runs-on: "windows-2025" needs: prerequisites if: needs.prerequisites.outputs.should_run != 'false' && needs.prerequisites.outputs.platform_windows_x86 != 'false' @@ -1028,7 +1028,7 @@ jobs: windows_x64_test: name: Windows x64 - runs-on: "windows-2019" + runs-on: "windows-2025" needs: - prerequisites - windows_x64_build @@ -1189,7 +1189,7 @@ jobs: windows_x86_test: name: Windows x86 - runs-on: "windows-2019" + runs-on: "windows-2025" needs: - prerequisites - windows_x86_build From 35d219b4d4864cb05e145feaf3f5a1aeeb158c8a Mon Sep 17 00:00:00 2001 From: SendaoYan Date: Tue, 8 Jul 2025 08:36:55 +0000 Subject: [PATCH 12/31] 8081734: ConcurrentHashMap/ConcurrentAssociateTest.java, times out 90% of time on sparc with 256 cpu. Backport-of: 6e48caf2507d4a45e1861ee699a32a5e459d70c2 --- .../concurrent/ConcurrentHashMap/ConcurrentAssociateTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jdk/test/java/util/concurrent/ConcurrentHashMap/ConcurrentAssociateTest.java b/jdk/test/java/util/concurrent/ConcurrentHashMap/ConcurrentAssociateTest.java index b0a1ecc8be8..9430813d020 100644 --- a/jdk/test/java/util/concurrent/ConcurrentHashMap/ConcurrentAssociateTest.java +++ b/jdk/test/java/util/concurrent/ConcurrentHashMap/ConcurrentAssociateTest.java @@ -120,7 +120,8 @@ private static void testOnce(String desc, BiConsumer runners = IntStream.range(0, ps) .mapToObj(i -> sr.get()) .map(CompletableFuture::runAsync); From 16949879ae5d8decf8613db2765dd58fd9a140ad Mon Sep 17 00:00:00 2001 From: SendaoYan Date: Tue, 22 Jul 2025 14:15:09 +0000 Subject: [PATCH 13/31] 8335978: [8u] incorrect include file name in semaphore.inline.hpp Reviewed-by: phh --- hotspot/src/share/vm/runtime/semaphore.inline.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/runtime/semaphore.inline.hpp b/hotspot/src/share/vm/runtime/semaphore.inline.hpp index e1cd4c9f6e7..458bfca8014 100644 --- a/hotspot/src/share/vm/runtime/semaphore.inline.hpp +++ b/hotspot/src/share/vm/runtime/semaphore.inline.hpp @@ -25,7 +25,7 @@ #ifndef SHARE_VM_RUNTIME_SEMAPHORE_INLINE_HPP #define SHARE_VM_RUNTIME_SEMAPHORE_INLINE_HPP -#include "runtime/interfaceSupport.inline.hpp" +#include "runtime/interfaceSupport.hpp" #include "runtime/semaphore.hpp" #include "runtime/thread.inline.hpp" From 8234312bb061930df0479d04f2350eea80b72dbd Mon Sep 17 00:00:00 2001 From: Zhengyu Gu Date: Tue, 5 Aug 2025 19:23:49 +0000 Subject: [PATCH 14/31] 8185348: Major performance regression in GetMethodDeclaringClass and other JVMTI Method functions Reviewed-by: phh --- hotspot/src/share/vm/oops/method.cpp | 3 --- hotspot/src/share/vm/prims/jniCheck.cpp | 5 +++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/hotspot/src/share/vm/oops/method.cpp b/hotspot/src/share/vm/oops/method.cpp index 9e58c012681..7a63f3632e5 100644 --- a/hotspot/src/share/vm/oops/method.cpp +++ b/hotspot/src/share/vm/oops/method.cpp @@ -1903,9 +1903,6 @@ bool Method::is_method_id(jmethodID mid) { Method* Method::checked_resolve_jmethod_id(jmethodID mid) { if (mid == NULL) return NULL; - if (!Method::is_method_id(mid)) { - return NULL; - } Method* o = resolve_jmethod_id(mid); if (o == NULL || o == JNIMethodBlock::_free_method || !((Metadata*)o)->is_method()) { return NULL; diff --git a/hotspot/src/share/vm/prims/jniCheck.cpp b/hotspot/src/share/vm/prims/jniCheck.cpp index 593ca8a1e34..bf8fd91b8db 100644 --- a/hotspot/src/share/vm/prims/jniCheck.cpp +++ b/hotspot/src/share/vm/prims/jniCheck.cpp @@ -468,6 +468,11 @@ Method* jniCheck::validate_jmethod_id(JavaThread* thr, jmethodID method_id) { if (moop == NULL) { ReportJNIFatalError(thr, fatal_wrong_class_or_method); } + // jmethodIDs are supposed to be weak handles in the class loader data, + // but that can be expensive so check it last + else if (!Method::is_method_id(method_id)) { + ReportJNIFatalError(thr, fatal_non_weak_method); + } return moop; } From 7b9b1e17adb757515ce3f7b6e9587e78fdfd7fe2 Mon Sep 17 00:00:00 2001 From: Severin Gehwolf Date: Fri, 8 Aug 2025 08:07:57 +0000 Subject: [PATCH 15/31] 8363965: GHA: Switch cross-compiling sysroots to Debian bookworm Reviewed-by: shade, andrew Backport-of: 3ff903a37cc0bbe4cb5e2a6b08faa48fde71445f --- .github/workflows/submit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/submit.yml b/.github/workflows/submit.yml index 5ba35158328..147e07f64ea 100644 --- a/.github/workflows/submit.yml +++ b/.github/workflows/submit.yml @@ -405,7 +405,7 @@ jobs: --verbose --include=fakeroot,symlinks,build-essential,libx11-dev,libxext-dev,libxrender-dev,libxrandr-dev,libxtst-dev,libxt-dev,libcups2-dev,libfontconfig1-dev,libasound2-dev,libfreetype6-dev,libpng-dev,libffi-dev --resolve-deps - bullseye + bookworm ~/sysroot-${{ matrix.debian-arch }} http://httpredir.debian.org/debian/ if: matrix.debian-arch != '' && steps.cache-sysroot.outputs.cache-hit != 'true' From 1b94cbfabcb238da175846372ad26cc3434e77ba Mon Sep 17 00:00:00 2001 From: Andrew John Hughes Date: Wed, 13 Aug 2025 11:07:14 +0000 Subject: [PATCH 16/31] 8345414: Google CAInterop test failures Reviewed-by: sgehwolf Backport-of: e61f97d3ac3ae1cc3f807abcc10d3f405ab69852 --- .../certification/CAInterop.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/jdk/test/security/infra/java/security/cert/CertPathValidator/certification/CAInterop.java b/jdk/test/security/infra/java/security/cert/CertPathValidator/certification/CAInterop.java index ec1a14ae724..27e125c6b0b 100644 --- a/jdk/test/security/infra/java/security/cert/CertPathValidator/certification/CAInterop.java +++ b/jdk/test/security/infra/java/security/cert/CertPathValidator/certification/CAInterop.java @@ -612,20 +612,20 @@ private CATestURLs getTestURLs(String alias) { "https://revoked.sfig2.catest.starfieldtech.com"); case "globalsigneccrootcar4": - return new CATestURLs("https://good.gsr4.demo.pki.goog", - "https://revoked.gsr4.demo.pki.goog"); + return new CATestURLs("https://good.gsr4.demosite.pki.goog", + "https://revoked.gsr4.demosite.pki.goog"); case "gtsrootcar1": - return new CATestURLs("https://good.gtsr1.demo.pki.goog", - "https://revoked.gtsr1.demo.pki.goog"); + return new CATestURLs("https://good.gtsr1.demosite.pki.goog", + "https://revoked.gtsr1.demosite.pki.goog"); case "gtsrootcar2": - return new CATestURLs("https://good.gtsr2.demo.pki.goog", - "https://revoked.gtsr2.demo.pki.goog"); + return new CATestURLs("https://good.gtsr2.demosite.pki.goog", + "https://revoked.gtsr2.demosite.pki.goog"); case "gtsrootecccar3": - return new CATestURLs("https://good.gtsr3.demo.pki.goog", - "https://revoked.gtsr3.demo.pki.goog"); + return new CATestURLs("https://good.gtsr3.demosite.pki.goog", + "https://revoked.gtsr3.demosite.pki.goog"); case "gtsrootecccar4": - return new CATestURLs("https://good.gtsr4.demo.pki.goog", - "https://revoked.gtsr4.demo.pki.goog"); + return new CATestURLs("https://good.gtsr4.demosite.pki.goog", + "https://revoked.gtsr4.demosite.pki.goog"); case "microsoftecc2017": return new CATestURLs("https://acteccroot2017.pki.microsoft.com", From 89b85a8f5b0f8e4f7763cf9b4d15e051d6e9f43f Mon Sep 17 00:00:00 2001 From: Severin Gehwolf Date: Wed, 13 Aug 2025 13:55:35 +0000 Subject: [PATCH 17/31] 7102969: currency.properties supercede not working correctly 8157138: Error while fetching currency instance by Currency.getInstance(currencycode) Reviewed-by: andrew Backport-of: 93f4f6c1b50c17bf713a2cfa806e64a8d73d6770 --- .../GenerateCurrencyData.java | 47 +-- jdk/src/share/classes/java/util/Currency.java | 301 +++++++++++++----- .../classes/java/util/CurrencyData.properties | 7 +- .../java/util/Currency/ISO4217-list-one.txt | 2 +- .../java/util/Currency/PropertiesTest.java | 76 ++++- jdk/test/java/util/Currency/PropertiesTest.sh | 12 +- .../java/util/Currency/currency.properties | 2 +- 7 files changed, 347 insertions(+), 100 deletions(-) diff --git a/jdk/make/src/classes/build/tools/generatecurrencydata/GenerateCurrencyData.java b/jdk/make/src/classes/build/tools/generatecurrencydata/GenerateCurrencyData.java index c16222b795d..d599d9744fd 100644 --- a/jdk/make/src/classes/build/tools/generatecurrencydata/GenerateCurrencyData.java +++ b/jdk/make/src/classes/build/tools/generatecurrencydata/GenerateCurrencyData.java @@ -120,7 +120,7 @@ public class GenerateCurrencyData { private static final int maxOtherCurrencies = 128; private static int otherCurrenciesCount = 0; - private static StringBuffer otherCurrencies = new StringBuffer(); + private static String[] otherCurrencies = new String[maxOtherCurrencies]; private static int[] otherCurrenciesDefaultFractionDigits = new int[maxOtherCurrencies]; private static int[] otherCurrenciesNumericCode= new int[maxOtherCurrencies]; @@ -323,10 +323,7 @@ private static void buildOtherTables() { if (otherCurrenciesCount == maxOtherCurrencies) { throw new RuntimeException("too many other currencies"); } - if (otherCurrencies.length() > 0) { - otherCurrencies.append('-'); - } - otherCurrencies.append(currencyCode); + otherCurrencies[otherCurrenciesCount] = currencyCode; otherCurrenciesDefaultFractionDigits[otherCurrenciesCount] = getDefaultFractionDigits(currencyCode); otherCurrenciesNumericCode[otherCurrenciesCount] = getNumericCode(currencyCode); otherCurrenciesCount++; @@ -355,35 +352,41 @@ private static void writeOutput() throws IOException { out.writeInt(Integer.parseInt(dataVersion)); writeIntArray(mainTable, mainTable.length); out.writeInt(specialCaseCount); - writeLongArray(specialCaseCutOverTimes, specialCaseCount); - writeStringArray(specialCaseOldCurrencies, specialCaseCount); - writeStringArray(specialCaseNewCurrencies, specialCaseCount); - writeIntArray(specialCaseOldCurrenciesDefaultFractionDigits, specialCaseCount); - writeIntArray(specialCaseNewCurrenciesDefaultFractionDigits, specialCaseCount); - writeIntArray(specialCaseOldCurrenciesNumericCode, specialCaseCount); - writeIntArray(specialCaseNewCurrenciesNumericCode, specialCaseCount); + writeSpecialCaseEntries(); out.writeInt(otherCurrenciesCount); - out.writeUTF(otherCurrencies.toString()); - writeIntArray(otherCurrenciesDefaultFractionDigits, otherCurrenciesCount); - writeIntArray(otherCurrenciesNumericCode, otherCurrenciesCount); + writeOtherCurrencies(); } private static void writeIntArray(int[] ia, int count) throws IOException { - for (int i = 0; i < count; i ++) { + for (int i = 0; i < count; i++) { out.writeInt(ia[i]); } } - private static void writeLongArray(long[] la, int count) throws IOException { - for (int i = 0; i < count; i ++) { - out.writeLong(la[i]); + private static void writeSpecialCaseEntries() throws IOException { + for (int index = 0; index < specialCaseCount; index++) { + out.writeLong(specialCaseCutOverTimes[index]); + String str = (specialCaseOldCurrencies[index] != null) + ? specialCaseOldCurrencies[index] : ""; + out.writeUTF(str); + str = (specialCaseNewCurrencies[index] != null) + ? specialCaseNewCurrencies[index] : ""; + out.writeUTF(str); + out.writeInt(specialCaseOldCurrenciesDefaultFractionDigits[index]); + out.writeInt(specialCaseNewCurrenciesDefaultFractionDigits[index]); + out.writeInt(specialCaseOldCurrenciesNumericCode[index]); + out.writeInt(specialCaseNewCurrenciesNumericCode[index]); } } - private static void writeStringArray(String[] sa, int count) throws IOException { - for (int i = 0; i < count; i ++) { - String str = (sa[i] != null) ? sa[i] : ""; + private static void writeOtherCurrencies() throws IOException { + for (int index = 0; index < otherCurrenciesCount; index++) { + String str = (otherCurrencies[index] != null) + ? otherCurrencies[index] : ""; out.writeUTF(str); + out.writeInt(otherCurrenciesDefaultFractionDigits[index]); + out.writeInt(otherCurrenciesNumericCode[index]); } } + } diff --git a/jdk/src/share/classes/java/util/Currency.java b/jdk/src/share/classes/java/util/Currency.java index 09d97f89fac..5305a3a38cc 100644 --- a/jdk/src/share/classes/java/util/Currency.java +++ b/jdk/src/share/classes/java/util/Currency.java @@ -147,33 +147,13 @@ public final class Currency implements Serializable { // - bits 0-4: final char for currency code for simple country, or ID of special case // - special case IDs: // - 0: country has no currency - // - other: index into sc* arrays + 1 - // - scCutOverTimes: cut-over time in millis as returned by - // System.currentTimeMillis for special case countries that are changing - // currencies; Long.MAX_VALUE for countries that are not changing currencies - // - scOldCurrencies: old currencies for special case countries - // - scNewCurrencies: new currencies for special case countries that are - // changing currencies; null for others - // - scOldCurrenciesDFD: default fraction digits for old currencies - // - scNewCurrenciesDFD: default fraction digits for new currencies, 0 for - // countries that are not changing currencies - // - otherCurrencies: concatenation of all currency codes that are not the - // main currency of a simple country, separated by "-" - // - otherCurrenciesDFD: decimal format digits for currencies in otherCurrencies, same order + // - other: index into specialCasesList static int formatVersion; static int dataVersion; static int[] mainTable; - static long[] scCutOverTimes; - static String[] scOldCurrencies; - static String[] scNewCurrencies; - static int[] scOldCurrenciesDFD; - static int[] scNewCurrenciesDFD; - static int[] scOldCurrenciesNumericCode; - static int[] scNewCurrenciesNumericCode; - static String otherCurrencies; - static int[] otherCurrenciesDFD; - static int[] otherCurrenciesNumericCode; + static List specialCasesList; + static List otherCurrenciesList; // handy constants - must match definitions in GenerateCurrencyData // magic number @@ -208,7 +188,7 @@ public final class Currency implements Serializable { private static final int NUMERIC_CODE_SHIFT = 10; // Currency data format version - private static final int VALID_FORMAT_VERSION = 2; + private static final int VALID_FORMAT_VERSION = 3; static { AccessController.doPrivileged(new PrivilegedAction() { @@ -231,17 +211,9 @@ public Void run() { dataVersion = dis.readInt(); mainTable = readIntArray(dis, A_TO_Z * A_TO_Z); int scCount = dis.readInt(); - scCutOverTimes = readLongArray(dis, scCount); - scOldCurrencies = readStringArray(dis, scCount); - scNewCurrencies = readStringArray(dis, scCount); - scOldCurrenciesDFD = readIntArray(dis, scCount); - scNewCurrenciesDFD = readIntArray(dis, scCount); - scOldCurrenciesNumericCode = readIntArray(dis, scCount); - scNewCurrenciesNumericCode = readIntArray(dis, scCount); + specialCasesList = readSpecialCases(dis, scCount); int ocCount = dis.readInt(); - otherCurrencies = dis.readUTF(); - otherCurrenciesDFD = readIntArray(dis, ocCount); - otherCurrenciesNumericCode = readIntArray(dis, ocCount); + otherCurrenciesList = readOtherCurrencies(dis, ocCount); } } catch (IOException e) { throw new InternalError(e); @@ -324,6 +296,7 @@ private static Currency getInstance(String currencyCode, int defaultFractionDigi // Currency code not internally generated, need to verify first // A currency code must have 3 characters and exist in the main table // or in the list of other currencies. + boolean found = false; if (currencyCode.length() != 3) { throw new IllegalArgumentException(); } @@ -335,17 +308,23 @@ private static Currency getInstance(String currencyCode, int defaultFractionDigi && currencyCode.charAt(2) - 'A' == (tableEntry & SIMPLE_CASE_COUNTRY_FINAL_CHAR_MASK)) { defaultFractionDigits = (tableEntry & SIMPLE_CASE_COUNTRY_DEFAULT_DIGITS_MASK) >> SIMPLE_CASE_COUNTRY_DEFAULT_DIGITS_SHIFT; numericCode = (tableEntry & NUMERIC_CODE_MASK) >> NUMERIC_CODE_SHIFT; - } else { - // Check for '-' separately so we don't get false hits in the table. - if (currencyCode.charAt(2) == '-') { - throw new IllegalArgumentException(); + found = true; + } else { //special case + int[] fractionAndNumericCode = SpecialCaseEntry.findEntry(currencyCode); + if (fractionAndNumericCode != null) { + defaultFractionDigits = fractionAndNumericCode[0]; + numericCode = fractionAndNumericCode[1]; + found = true; } - int index = otherCurrencies.indexOf(currencyCode); - if (index == -1) { + } + + if (!found) { + OtherCurrencyEntry ocEntry = OtherCurrencyEntry.findEntry(currencyCode); + if (ocEntry == null) { throw new IllegalArgumentException(); } - defaultFractionDigits = otherCurrenciesDFD[index / 4]; - numericCode = otherCurrenciesNumericCode[index / 4]; + defaultFractionDigits = ocEntry.fraction; + numericCode = ocEntry.numericCode; } } @@ -405,13 +384,17 @@ public static Currency getInstance(Locale locale) { if (tableEntry == COUNTRY_WITHOUT_CURRENCY_ENTRY) { return null; } else { - int index = (tableEntry & SPECIAL_CASE_COUNTRY_INDEX_MASK) - SPECIAL_CASE_COUNTRY_INDEX_DELTA; - if (scCutOverTimes[index] == Long.MAX_VALUE || System.currentTimeMillis() < scCutOverTimes[index]) { - return getInstance(scOldCurrencies[index], scOldCurrenciesDFD[index], - scOldCurrenciesNumericCode[index]); + int index = SpecialCaseEntry.toIndex(tableEntry); + SpecialCaseEntry scEntry = specialCasesList.get(index); + if (scEntry.cutOverTime == Long.MAX_VALUE + || System.currentTimeMillis() < scEntry.cutOverTime) { + return getInstance(scEntry.oldCurrency, + scEntry.oldCurrencyFraction, + scEntry.oldCurrencyNumericCode); } else { - return getInstance(scNewCurrencies[index], scNewCurrenciesDFD[index], - scNewCurrenciesNumericCode[index]); + return getInstance(scEntry.newCurrency, + scEntry.newCurrencyFraction, + scEntry.newCurrencyNumericCode); } } } @@ -446,14 +429,29 @@ public static Set getAvailableCurrencies() { sb.append(c2); sb.append(finalChar); available.add(getInstance(sb.toString(), defaultFractionDigits, numericCode)); + } else if ((tableEntry & COUNTRY_TYPE_MASK) == SPECIAL_CASE_COUNTRY_MASK + && tableEntry != INVALID_COUNTRY_ENTRY + && tableEntry != COUNTRY_WITHOUT_CURRENCY_ENTRY) { + int index = SpecialCaseEntry.toIndex(tableEntry); + SpecialCaseEntry scEntry = specialCasesList.get(index); + + if (scEntry.cutOverTime == Long.MAX_VALUE + || System.currentTimeMillis() < scEntry.cutOverTime) { + available.add(getInstance(scEntry.oldCurrency, + scEntry.oldCurrencyFraction, + scEntry.oldCurrencyNumericCode)); + } else { + available.add(getInstance(scEntry.newCurrency, + scEntry.newCurrencyFraction, + scEntry.newCurrencyNumericCode)); + } } } } // Now add other currencies - StringTokenizer st = new StringTokenizer(otherCurrencies, "-"); - while (st.hasMoreElements()) { - available.add(getInstance((String)st.nextElement())); + for (OtherCurrencyEntry entry : otherCurrenciesList) { + available.add(getInstance(entry.currencyCode)); } } } @@ -659,22 +657,55 @@ private static int[] readIntArray(DataInputStream dis, int count) throws IOExcep return ret; } - private static long[] readLongArray(DataInputStream dis, int count) throws IOException { - long[] ret = new long[count]; + private static List readSpecialCases(DataInputStream dis, + int count) + throws IOException { + + List list = new ArrayList<>(count); + long cutOverTime; + String oldCurrency; + String newCurrency; + int oldCurrencyFraction; + int newCurrencyFraction; + int oldCurrencyNumericCode; + int newCurrencyNumericCode; + for (int i = 0; i < count; i++) { - ret[i] = dis.readLong(); + cutOverTime = dis.readLong(); + oldCurrency = dis.readUTF(); + newCurrency = dis.readUTF(); + oldCurrencyFraction = dis.readInt(); + newCurrencyFraction = dis.readInt(); + oldCurrencyNumericCode = dis.readInt(); + newCurrencyNumericCode = dis.readInt(); + SpecialCaseEntry sc = new SpecialCaseEntry(cutOverTime, + oldCurrency, newCurrency, + oldCurrencyFraction, newCurrencyFraction, + oldCurrencyNumericCode, newCurrencyNumericCode); + list.add(sc); } - - return ret; + return list; } - private static String[] readStringArray(DataInputStream dis, int count) throws IOException { - String[] ret = new String[count]; + private static List readOtherCurrencies(DataInputStream dis, + int count) + throws IOException { + + List list = new ArrayList<>(count); + String currencyCode; + int fraction; + int numericCode; + for (int i = 0; i < count; i++) { - ret[i] = dis.readUTF(); + currencyCode = dis.readUTF(); + fraction = dis.readInt(); + numericCode = dis.readInt(); + OtherCurrencyEntry oc = new OtherCurrencyEntry(currencyCode, + fraction, + numericCode); + list.add(oc); } - - return ret; + return list; } /** @@ -732,21 +763,27 @@ private static void replaceCurrencyData(Pattern pattern, String ctry, String cur return; } - int index; - for (index = 0; index < scOldCurrencies.length; index++) { - if (scOldCurrencies[index].equals(code)) { - break; - } + int index = SpecialCaseEntry.indexOf(code, fraction, numeric); + + /* if a country switches from simple case to special case or + * one special case to other special case which is not present + * in the sc arrays then insert the new entry in special case arrays + */ + if (index == -1 && (ctry.charAt(0) != code.charAt(0) + || ctry.charAt(1) != code.charAt(1))) { + + specialCasesList.add(new SpecialCaseEntry(code, fraction, numeric)); + index = specialCasesList.size() - 1; } - if (index == scOldCurrencies.length) { + if (index == -1) { // simple case - entry |= (fraction << SIMPLE_CASE_COUNTRY_DEFAULT_DIGITS_SHIFT) | - (code.charAt(2) - 'A'); + entry |= (fraction << SIMPLE_CASE_COUNTRY_DEFAULT_DIGITS_SHIFT) + | (code.charAt(2) - 'A'); } else { // special case - entry |= SPECIAL_CASE_COUNTRY_MASK | - (index + SPECIAL_CASE_COUNTRY_INDEX_DELTA); + entry = SPECIAL_CASE_COUNTRY_MASK + | (index + SPECIAL_CASE_COUNTRY_INDEX_DELTA); } setMainTableEntry(ctry.charAt(0), ctry.charAt(1), entry); } @@ -780,4 +817,126 @@ private static void info(String message, Throwable t) { } } } + + /* Used to represent a special case currency entry + * - cutOverTime: cut-over time in millis as returned by + * System.currentTimeMillis for special case countries that are changing + * currencies; Long.MAX_VALUE for countries that are not changing currencies + * - oldCurrency: old currencies for special case countries + * - newCurrency: new currencies for special case countries that are + * changing currencies; null for others + * - oldCurrencyFraction: default fraction digits for old currencies + * - newCurrencyFraction: default fraction digits for new currencies, 0 for + * countries that are not changing currencies + * - oldCurrencyNumericCode: numeric code for old currencies + * - newCurrencyNumericCode: numeric code for new currencies, 0 for countries + * that are not changing currencies + */ + private static class SpecialCaseEntry { + + final private long cutOverTime; + final private String oldCurrency; + final private String newCurrency; + final private int oldCurrencyFraction; + final private int newCurrencyFraction; + final private int oldCurrencyNumericCode; + final private int newCurrencyNumericCode; + + private SpecialCaseEntry(long cutOverTime, String oldCurrency, String newCurrency, + int oldCurrencyFraction, int newCurrencyFraction, + int oldCurrencyNumericCode, int newCurrencyNumericCode) { + this.cutOverTime = cutOverTime; + this.oldCurrency = oldCurrency; + this.newCurrency = newCurrency; + this.oldCurrencyFraction = oldCurrencyFraction; + this.newCurrencyFraction = newCurrencyFraction; + this.oldCurrencyNumericCode = oldCurrencyNumericCode; + this.newCurrencyNumericCode = newCurrencyNumericCode; + } + + private SpecialCaseEntry(String currencyCode, int fraction, + int numericCode) { + this(Long.MAX_VALUE, currencyCode, "", fraction, 0, numericCode, 0); + } + + //get the index of the special case entry + private static int indexOf(String code, int fraction, int numeric) { + int size = specialCasesList.size(); + for (int index = 0; index < size; index++) { + SpecialCaseEntry scEntry = specialCasesList.get(index); + if (scEntry.oldCurrency.equals(code) + && scEntry.oldCurrencyFraction == fraction + && scEntry.oldCurrencyNumericCode == numeric + && scEntry.cutOverTime == Long.MAX_VALUE) { + return index; + } + } + return -1; + } + + // get the fraction and numericCode of the sc currencycode + private static int[] findEntry(String code) { + int[] fractionAndNumericCode = null; + int size = specialCasesList.size(); + for (int index = 0; index < size; index++) { + SpecialCaseEntry scEntry = specialCasesList.get(index); + if (scEntry.oldCurrency.equals(code) && (scEntry.cutOverTime == Long.MAX_VALUE + || System.currentTimeMillis() < scEntry.cutOverTime)) { + //consider only when there is no new currency or cutover time is not passed + fractionAndNumericCode = new int[2]; + fractionAndNumericCode[0] = scEntry.oldCurrencyFraction; + fractionAndNumericCode[1] = scEntry.oldCurrencyNumericCode; + break; + } else if (scEntry.newCurrency.equals(code) + && System.currentTimeMillis() >= scEntry.cutOverTime) { + //consider only if the cutover time is passed + fractionAndNumericCode = new int[2]; + fractionAndNumericCode[0] = scEntry.newCurrencyFraction; + fractionAndNumericCode[1] = scEntry.newCurrencyNumericCode; + break; + } + } + return fractionAndNumericCode; + } + + // convert the special case entry to sc arrays index + private static int toIndex(int tableEntry) { + return (tableEntry & SPECIAL_CASE_COUNTRY_INDEX_MASK) - SPECIAL_CASE_COUNTRY_INDEX_DELTA; + } + + } + + /* Used to represent Other currencies + * - currencyCode: currency codes that are not the main currency + * of a simple country + * - otherCurrenciesDFD: decimal format digits for other currencies + * - otherCurrenciesNumericCode: numeric code for other currencies + */ + private static class OtherCurrencyEntry { + + final private String currencyCode; + final private int fraction; + final private int numericCode; + + private OtherCurrencyEntry(String currencyCode, int fraction, + int numericCode) { + this.currencyCode = currencyCode; + this.fraction = fraction; + this.numericCode = numericCode; + } + + //get the instance of the other currency code + private static OtherCurrencyEntry findEntry(String code) { + int size = otherCurrenciesList.size(); + for (int index = 0; index < size; index++) { + OtherCurrencyEntry ocEntry = otherCurrenciesList.get(index); + if (ocEntry.currencyCode.equalsIgnoreCase(code)) { + return ocEntry; + } + } + return null; + } + + } + } diff --git a/jdk/src/share/classes/java/util/CurrencyData.properties b/jdk/src/share/classes/java/util/CurrencyData.properties index 79becc3e6d0..4b87809f4b7 100644 --- a/jdk/src/share/classes/java/util/CurrencyData.properties +++ b/jdk/src/share/classes/java/util/CurrencyData.properties @@ -26,7 +26,8 @@ # Version of the currency data format. # 1: initial # 2: Change in minor unit (allowing 4-9 digits) -formatVersion=2 +# 3: Change in the order of special case and other currency entries +formatVersion=3 # Version of the currency code information in this class. # It is a serial number that accompanies with each amendment. @@ -192,7 +193,7 @@ HR=EUR # CUBA CU=CUP # Cura\u00e7ao -CW=XCG +CW=ANG;2025-04-01-04-00-00;XCG # CYPRUS CY=EUR # CZECHIA @@ -507,7 +508,7 @@ SR=SRD # SVALBARD AND JAN MAYEN SJ=NOK # Sint Maarten (Dutch part) -SX=XCG +SX=ANG;2025-04-01-04-00-00;XCG # ESWATINI SZ=SZL # SWEDEN diff --git a/jdk/test/java/util/Currency/ISO4217-list-one.txt b/jdk/test/java/util/Currency/ISO4217-list-one.txt index 1ad1fcb097a..aa8c2725899 100644 --- a/jdk/test/java/util/Currency/ISO4217-list-one.txt +++ b/jdk/test/java/util/Currency/ISO4217-list-one.txt @@ -5,7 +5,7 @@ # # Version -FILEVERSION=2 +FILEVERSION=3 DATAVERSION=179 # ISO 4217 currency data diff --git a/jdk/test/java/util/Currency/PropertiesTest.java b/jdk/test/java/util/Currency/PropertiesTest.java index 96127bf19fe..fe35f2e6161 100644 --- a/jdk/test/java/util/Currency/PropertiesTest.java +++ b/jdk/test/java/util/Currency/PropertiesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, 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,6 +25,7 @@ import java.text.*; import java.util.*; import java.util.regex.*; +import java.util.stream.Collectors; public class PropertiesTest { public static void main(String[] args) throws Exception { @@ -32,9 +33,14 @@ public static void main(String[] args) throws Exception { dump(args[1]); } else if (args.length == 4 && args[0].equals("-c")) { compare(args[1], args[2], args[3]); + } else if (args.length == 1 && args[0].equals("bug7102969")) { + bug7102969(); + } else if (args.length == 1 && args[0].equals("bug8157138")) { + bug8157138(); } else { System.err.println("Usage: java PropertiesTest -d "); System.err.println(" java PropertiesTest -c "); + System.err.println(" java PropertiesTest bug[JBS bug id number] e.g. bug7102969"); System.exit(-1); } } @@ -174,6 +180,74 @@ private static void compare(String beforeFile, String afterFile, String propsFil } } + private static void bug7102969() { + + // check the correct overriding of special case entries + Currency cur = Currency.getInstance(new Locale("", "JP")); + if (!cur.getCurrencyCode().equals("ABC")) { + throw new RuntimeException("[Expected: ABC as currency code of JP, found: " + + cur.getCurrencyCode() + "]"); + } + + /* check if the currency instance is returned by + * getAvailableCurrencies() method + */ + if (!Currency.getAvailableCurrencies().contains(cur)) { + throw new RuntimeException("[The Currency instance [" + + cur.getCurrencyCode() + ", " + + cur.getNumericCode() + ", " + + cur.getDefaultFractionDigits() + + "] is not available in the currencies list]"); + } + + } + + private static void bug8157138() { + + /* check the currencies which exist only as a special case are + * accessible i.e. it should not throw IllegalArgumentException + */ + try { + Currency.getInstance("MAD"); + } catch (IllegalArgumentException ex) { + throw new RuntimeException("Test Failed: " + + "special case currency instance MAD not found" + + " via Currency.getInstance(\"MAD\")"); + } + + try { + Currency.getInstance("ABC"); + } catch (IllegalArgumentException ex) { + throw new RuntimeException("Test Failed: " + + "special case currency instance ABC not found" + + " via Currency.getInstance(\"ABC\")"); + } + + /* check the currency value is returned by getAvailableCurrencies() + * method + */ + List list = Currency.getAvailableCurrencies().stream() + .filter(cur -> cur.getCurrencyCode().equals("MAD")) + .collect(Collectors.toList()); + + if (list.isEmpty()) { + throw new RuntimeException("Test Failed: " + + "special case currency instance MAD not found" + + " in Currency.getAvailableCurrencies() list"); + } + + list = Currency.getAvailableCurrencies().stream() + .filter(cur -> cur.getCurrencyCode().equals("ABC")) + .collect(Collectors.toList()); + + if (list.isEmpty()) { + throw new RuntimeException("Test Failed: " + + "special case currency instance ABC not found" + + " in Currency.getAvailableCurrencies() list"); + } + + } + private static boolean isPastCutoverDate(String s) throws IndexOutOfBoundsException, NullPointerException, ParseException { String dateString = s.substring(s.lastIndexOf(',')+1, s.length()).trim(); diff --git a/jdk/test/java/util/Currency/PropertiesTest.sh b/jdk/test/java/util/Currency/PropertiesTest.sh index aa4f8d15b6e..80fd1be06fe 100644 --- a/jdk/test/java/util/Currency/PropertiesTest.sh +++ b/jdk/test/java/util/Currency/PropertiesTest.sh @@ -23,7 +23,7 @@ # # @test -# @bug 6332666 6863624 7180362 8003846 8074350 8074351 +# @bug 6332666 6863624 7180362 8003846 8074350 8074351 7102969 8157138 # @summary tests the capability of replacing the currency data with user # specified currency properties file # @build PropertiesTest @@ -124,6 +124,16 @@ echo '' sh -xc "${WRITABLEJDK}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} PropertiesTest -d dump3" if [ $? != 0 ]; then failures=`expr $failures + 1`; fi +# run bug7102969 test +echo '' +${WRITABLEJDK}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} PropertiesTest bug7102969 +if [ $? != 0 ]; then failures=`expr $failures + 1`; fi + +# run bug8157138 test +echo '' +${WRITABLEJDK}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} PropertiesTest bug8157138 +if [ $? != 0 ]; then failures=`expr $failures + 1`; fi + # Cleanup rm -f ${PROPLOCATION}${FS}currency.properties if [ $COPIED -eq 1 ] diff --git a/jdk/test/java/util/Currency/currency.properties b/jdk/test/java/util/Currency/currency.properties index d8e874d819a..57b293542b8 100644 --- a/jdk/test/java/util/Currency/currency.properties +++ b/jdk/test/java/util/Currency/currency.properties @@ -6,7 +6,7 @@ CL=CLF,990,4 CM=IED,111,2, 2004-01-01T00:70:00 ES=ESD,877,2 -JP=JPZ,123,2 +JP=ABC,999,0 MA=MAA,555,5 MC=MCC,555,6 MD=MDD,555,7 From 2821dcef9484b0a551d1c6b4ab014892ab07b55a Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Mon, 18 Aug 2025 09:42:47 +0000 Subject: [PATCH 18/31] 8365560: [8u] ppc64le MaxRAM default is too low at 4GiB Reviewed-by: stuefe --- hotspot/src/cpu/ppc/vm/c2_globals_ppc.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/src/cpu/ppc/vm/c2_globals_ppc.hpp b/hotspot/src/cpu/ppc/vm/c2_globals_ppc.hpp index 58e4f3887cb..50f55925763 100644 --- a/hotspot/src/cpu/ppc/vm/c2_globals_ppc.hpp +++ b/hotspot/src/cpu/ppc/vm/c2_globals_ppc.hpp @@ -83,7 +83,7 @@ define_pd_global(intx, ReservedCodeCacheSize, 256*M); define_pd_global(intx, CodeCacheExpansionSize, 64*K); // Ergonomics related flags -define_pd_global(uint64_t,MaxRAM, 4ULL*G); +define_pd_global(uint64_t,MaxRAM, 128ULL*G); define_pd_global(uintx, CodeCacheMinBlockLength, 4); define_pd_global(uintx, CodeCacheMinimumUseSpace, 400*K); From cc30193d1bd7ab9217f2c7b6d08de612c558cd96 Mon Sep 17 00:00:00 2001 From: yaqsun <62052878+yaqsun@users.noreply.github.com> Date: Tue, 26 Aug 2025 08:37:02 +0000 Subject: [PATCH 19/31] 8185500: [TESTBUG] Add keywords headful/printer in java/awt and javax tests. 8186259: IOExceptionIfEncodedURLTest.sh versus IOExceptionIfEncodedURLTest.java Add new keyword 'printer'. Some minor test fixes to show headless exception. Add some @requires windows. Reviewed-by: serb Backport-of: 34afeced211cd7115e2529b043c1e57dfa1291fe --- jdk/test/TEST.ROOT | 6 ++- .../DefaultMenuBar/DefaultMenuBarTest.java | 5 ++- .../ScreenMenu/ScreenMenuMemoryLeakTest.java | 9 ++-- .../DesktopGtkLoadTest.java | 4 +- .../Dialog/CloseDialog/CloseDialogTest.java | 3 +- .../DisplayChangedTest.java | 24 +++++------ .../EmbeddedFrameGrabTest.java | 21 ++++------ .../LoopRobustness/LoopRobustness.html | 3 +- .../awt/EventQueue/6980209/bug6980209.java | 14 ++++--- .../FocusEmbeddedFrameTest.java | 20 +++++---- .../java/awt/FontClass/HelvLtOblTest.java | 5 ++- .../FontClass/SurrogateTest/SuppCharTest.java | 5 ++- .../ExceptionOnSetExtendedStateTest.java | 16 +++---- .../MaximizedByPlatform.java | 10 +++-- .../NormalToIconifiedTest.java | 3 +- .../SetMaximizedBounds.java | 5 ++- .../Frame/WindowDragTest/WindowDragTest.java | 21 +++++----- .../DefaultPolicyChange_Swing.java | 21 +++++----- .../java/awt/MenuBar/8007006/bug8007006.java | 5 ++- .../FullscreenEnterEventTest.java | 6 ++- .../FullScreenAfterSplash.java | 4 +- .../IOExceptionIfEncodedURLTest.java | 12 +----- .../IOExceptionIfEncodedURLTest.sh | 3 +- .../MultiResolutionDragImageTest.java | 3 +- .../HTMLDataFlavors/HTMLDataFlavorTest.java | 22 +++++----- .../event/KeyEvent/8020209/bug8020209.java | 5 ++- .../DeadKey/DeadKeyMacOSXInputText.java | 6 ++- .../event/KeyEvent/DeadKey/deadKeyMacOSX.java | 5 ++- .../awt/font/TextLayout/TestSinhalaChar.java | 4 +- .../java/awt/im/6396526/IMLookAndFeel.java | 11 ++--- jdk/test/java/awt/im/8041990/bug8041990.java | 16 +++---- .../awt/image/MultiResolutionImageTest.java | 4 +- .../MultiResolutionToolkitImageTest.java | 4 +- .../AltPlusNumberKeyCombinationsTest.java | 19 ++++----- .../awt/print/PrinterJob/CheckPrivilege.java | 3 +- .../awt/print/PrinterJob/ExceptionTest.java | 1 + .../ImagePrinting/NullClipARGB.java | 3 +- .../java/awt/print/PrinterJob/Margins.java | 3 +- .../java/awt/print/PrinterJob/PaintText.java | 3 +- .../awt/print/PrinterJob/PrintCrashTest.java | 4 +- .../awt/print/PrinterJob/PrintTextPane.java | 15 +++---- .../awt/print/PrinterJob/PrtException.java | 16 +++---- jdk/test/javax/print/CheckDupFlavor.java | 6 ++- jdk/test/javax/print/PrintSE/PrintSE.sh | 7 +++- .../javax/print/attribute/AttributeTest.java | 6 ++- .../print/attribute/GetCopiesSupported.java | 16 +++---- .../print/attribute/SidesPageRangesTest.java | 9 ++-- .../attribute/SupportedPrintableAreas.java | 5 ++- .../swing/JComboBox/8019180/Test8019180.java | 5 ++- .../swing/JComponent/4337267/bug4337267.java | 5 ++- .../swing/JComponent/8043610/bug8043610.java | 18 ++++---- .../swing/JDialog/6639507/bug6639507.java | 15 ++++--- .../JFileChooser/6713352/bug6713352.java | 16 +++---- .../JFileChooser/6817933/Test6817933.java | 6 ++- .../JFileChooser/8013442/Test8013442.java | 5 ++- .../swing/JFrame/8016356/bug8016356.java | 17 ++++---- .../NSTexturedJFrame/NSTexturedJFrame.java | 4 +- .../swing/JInternalFrame/Test6325652.java | 5 ++- .../javax/swing/JMenu/6538132/bug6538132.java | 22 ++++++---- .../JMenuItem/8152981/MenuItemIconTest.java | 6 ++- .../ActionListenerCalledTwiceTest.java | 3 +- .../swing/JPopupMenu/6217905/bug6217905.java | 23 +++++----- .../swing/JPopupMenu/7154841/bug7154841.java | 17 ++++---- .../swing/JTabbedPane/7170310/bug7170310.java | 6 ++- .../swing/JTextArea/6940863/bug6940863.java | 7 +++- .../swing/Security/6938813/bug6938813.java | 3 +- .../ToolTipManager/7123767/bug7123767.java | 42 +++++++++---------- .../plaf/aqua/CustomComboBoxFocusTest.java | 20 +++++---- .../BasicComboPopup/8154069/Bug8154069.java | 5 ++- .../basic/BasicHTML/4960629/bug4960629.java | 18 ++++---- .../plaf/basic/BasicLabelUI/bug7172652.java | 21 ++++++---- .../8041642/ScrollBarThumbVisibleTest.java | 16 +++---- .../WrongAltProcessing.java | 15 ++++--- .../swing/system/6799345/TestShutdown.java | 18 ++++---- .../javax/swing/text/FlowView/LayoutTest.java | 18 ++++---- .../swing/text/View/8015853/bug8015853.java | 5 ++- .../javax/swing/text/html/Test4783068.java | 12 +++--- .../IAEforEmptyFrameTest.java | 6 ++- 78 files changed, 453 insertions(+), 347 deletions(-) diff --git a/jdk/test/TEST.ROOT b/jdk/test/TEST.ROOT index b2d2ba1bcc3..b6aa2e693a3 100644 --- a/jdk/test/TEST.ROOT +++ b/jdk/test/TEST.ROOT @@ -10,9 +10,11 @@ # randomness tests. # # A "headful" test requires a graphical environment to meaningfully -# run. Tests that are not headful are "headless." +# run. Tests that are not headful are "headless". +# A test flagged with key "printer" requires a printer to succeed, else +# throws a PrinterException or the like. -keys=2d dnd i18n intermittent randomness headful jfr +keys=2d dnd headful i18n intermittent printer randomness jfr # Tests that must run in othervm mode othervm.dirs=java/awt java/beans java/rmi javax/accessibility javax/imageio javax/sound javax/print javax/management com/sun/awt sun/awt sun/java2d sun/pisces sun/rmi diff --git a/jdk/test/com/apple/eawt/DefaultMenuBar/DefaultMenuBarTest.java b/jdk/test/com/apple/eawt/DefaultMenuBar/DefaultMenuBarTest.java index 0ca31c4f6b7..943b494a3b3 100644 --- a/jdk/test/com/apple/eawt/DefaultMenuBar/DefaultMenuBarTest.java +++ b/jdk/test/com/apple/eawt/DefaultMenuBar/DefaultMenuBarTest.java @@ -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 @@ -21,8 +21,9 @@ * questions. */ -/* +/** * @test + * @key headful * @bug 8007267 * @summary [macosx] com.apple.eawt.Application.setDefaultMenuBar is not working * @requires (os.family == "mac") diff --git a/jdk/test/com/apple/laf/ScreenMenu/ScreenMenuMemoryLeakTest.java b/jdk/test/com/apple/laf/ScreenMenu/ScreenMenuMemoryLeakTest.java index 8aabcae42c7..9971967bbb6 100644 --- a/jdk/test/com/apple/laf/ScreenMenu/ScreenMenuMemoryLeakTest.java +++ b/jdk/test/com/apple/laf/ScreenMenu/ScreenMenuMemoryLeakTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -20,13 +20,16 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -/* + +/** * @test + * @key headful * @bug 8158325 * @summary Memory leak in com.apple.laf.ScreenMenu: removed JMenuItems are still referenced * @requires (os.family == "mac") * @run main/timeout=300/othervm -Xmx16m ScreenMenuMemoryLeakTest */ + import java.awt.EventQueue; import java.lang.ref.WeakReference; import java.lang.reflect.InvocationTargetException; @@ -102,4 +105,4 @@ private static void removeMenuItemFromMenu() { Objects.requireNonNull(menuItem, "The menu item should still be available at this point"); sMenu.remove(menuItem); } -} \ No newline at end of file +} diff --git a/jdk/test/java/awt/Desktop/DesktopGtkLoadTest/DesktopGtkLoadTest.java b/jdk/test/java/awt/Desktop/DesktopGtkLoadTest/DesktopGtkLoadTest.java index 8a463554ad2..61bd013b9d3 100644 --- a/jdk/test/java/awt/Desktop/DesktopGtkLoadTest/DesktopGtkLoadTest.java +++ b/jdk/test/java/awt/Desktop/DesktopGtkLoadTest/DesktopGtkLoadTest.java @@ -21,7 +21,9 @@ * questions. */ -/* @test +/** + * @test + * @key headful * @bug 8157827 * @summary AWT_Desktop/Automated/Exceptions/BasicTest loads incorrect GTK * version when jdk.gtk.version=3 diff --git a/jdk/test/java/awt/Dialog/CloseDialog/CloseDialogTest.java b/jdk/test/java/awt/Dialog/CloseDialog/CloseDialogTest.java index 0a6288d896d..694d6e3fbd7 100644 --- a/jdk/test/java/awt/Dialog/CloseDialog/CloseDialogTest.java +++ b/jdk/test/java/awt/Dialog/CloseDialog/CloseDialogTest.java @@ -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 @@ -30,6 +30,7 @@ /** * @test + * @key headful * @bug 8043705 * @summary Can't exit color chooser dialog when running as an applet * @run main CloseDialogTest diff --git a/jdk/test/java/awt/EmbeddedFrame/DisplayChangedTest/DisplayChangedTest.java b/jdk/test/java/awt/EmbeddedFrame/DisplayChangedTest/DisplayChangedTest.java index 04f2f24b414..5f347c8f0d5 100644 --- a/jdk/test/java/awt/EmbeddedFrame/DisplayChangedTest/DisplayChangedTest.java +++ b/jdk/test/java/awt/EmbeddedFrame/DisplayChangedTest/DisplayChangedTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, 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 @@ -21,21 +21,17 @@ * questions. */ -/* - @test - @bug 4980592 - @summary switching user in XP causes an NPE in - sun.awt.windows.WWindowPeer.displayChanged - @requires (os.family == "windows") - @author son@sparc.spb.su: area=embedded - @run main DisplayChangedTest - */ /** - * DisplayChangedTest.java - * - * summary: switching user in XP causes an NPE in - * sun.awt.windows.WWindowPeer.displayChanged + * @test + * @key headful + * @bug 4980592 + * @summary switching user in XP causes an NPE in + * sun.awt.windows.WWindowPeer.displayChanged + * @requires (os.family == "windows") + * @author son@sparc.spb.su: area=embedded + * @run main DisplayChangedTest */ + import java.awt.Frame; import java.awt.Dialog; import java.awt.TextArea; diff --git a/jdk/test/java/awt/EmbeddedFrame/EmbeddedFrameGrabTest/EmbeddedFrameGrabTest.java b/jdk/test/java/awt/EmbeddedFrame/EmbeddedFrameGrabTest/EmbeddedFrameGrabTest.java index 1613a804263..cce03537750 100644 --- a/jdk/test/java/awt/EmbeddedFrame/EmbeddedFrameGrabTest/EmbeddedFrameGrabTest.java +++ b/jdk/test/java/awt/EmbeddedFrame/EmbeddedFrameGrabTest/EmbeddedFrameGrabTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, 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 @@ -21,19 +21,16 @@ * questions. */ -/* - @test - @bug 6345002 - @summary grab problems with EmbeddedFrame - @requires (os.family == "windows") - @author Oleg.Semenov@sun.com area=EmbeddedFrame - @run main EmbeddedFrameGrabTest - */ /** - * EmbeddedFrameGrabTest.java - * - * summary: grab problems with EmbeddedFrame + * @test + * @key headful + * @bug 6345003 + * @summary grab problems with EmbeddedFrame + * @requires (os.family == "windows") + * @author Oleg.Semenov@sun.com area=EmbeddedFrame + * @run main EmbeddedFrameGrabTest */ + import java.awt.Frame; import java.awt.peer.FramePeer; import javax.swing.JComboBox; diff --git a/jdk/test/java/awt/EventDispatchThread/LoopRobustness/LoopRobustness.html b/jdk/test/java/awt/EventDispatchThread/LoopRobustness/LoopRobustness.html index 3e8611d2e02..31e7015c17a 100644 --- a/jdk/test/java/awt/EventDispatchThread/LoopRobustness/LoopRobustness.html +++ b/jdk/test/java/awt/EventDispatchThread/LoopRobustness/LoopRobustness.html @@ -1,5 +1,5 @@ {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B} - 10.0.17763.0 + 10.0.19041.0 diff --git a/.github/workflows/submit.yml b/.github/workflows/submit.yml index 147e07f64ea..ee31fda329d 100644 --- a/.github/workflows/submit.yml +++ b/.github/workflows/submit.yml @@ -798,7 +798,7 @@ jobs: 'install --productId Microsoft.VisualStudio.Product.Community --channelId VisualStudio.15.Release --add Microsoft.VisualStudio.Workload.NativeDesktop --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 - --add Microsoft.VisualStudio.Component.Windows10SDK.17763 + --add Microsoft.VisualStudio.Component.Windows10SDK.19041 --quiet --wait' - name: Fix OpenJDK permissions From 7fea4115570935878cc8b13704c6af0ad63a3a75 Mon Sep 17 00:00:00 2001 From: SendaoYan Date: Wed, 27 Aug 2025 08:29:26 +0000 Subject: [PATCH 21/31] 8365811: test/jdk/java/net/CookieHandler/B6644726.java failure - "Should have 5 cookies. Got only 4, expires probably didn't parse correctly" Reviewed-by: sgehwolf Backport-of: b453eb63c641e1e69b4aef57a220ebe45b9d1693 --- jdk/test/java/net/CookieHandler/B6644726.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/jdk/test/java/net/CookieHandler/B6644726.java b/jdk/test/java/net/CookieHandler/B6644726.java index b1caa182d73..cc31f64c1b0 100644 --- a/jdk/test/java/net/CookieHandler/B6644726.java +++ b/jdk/test/java/net/CookieHandler/B6644726.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, 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,8 +46,8 @@ private static void testCookieStore() throws Exception { // Let's test the default path lst.add("myCookie1=foo"); // Then some alternate expires format - lst.add("myCookie2=bar; path=/dir; expires=Tue, 19 Aug 2025 16:00:00 GMT"); - lst.add("myCookie3=test; path=/dir; expires=Tue Aug 19 2025 16:00:00 GMT-0100"); + lst.add("myCookie2=bar; path=/dir; expires=Fri, 19 Aug 4242 16:00:00 GMT"); + lst.add("myCookie3=test; path=/dir; expires=Fri Aug 19 4242 16:00:00 GMT-0100"); // Then Netscape draft cookies and domains lst.add("myCookie4=test; domain=.sun.com; path=/dir/foo"); HashMap> map = new HashMap>(); @@ -64,7 +64,8 @@ private static void testCookieStore() throws Exception { List cookies = cs.getCookies(); // There should be 5 cookies if all dates parsed correctly if (cookies.size() != 5) { - fail("Should have 5 cookies. Got only "+ cookies.size() + ", expires probably didn't parse correctly"); + fail("unexpected cookies: " + cookies + ", should have 5 cookies. Got only " + + cookies.size() + ", expires probably didn't parse correctly"); } // Check Path for first Cookie for (HttpCookie c : cookies) { From f362183b50937f7e7ab34427f2ab2c8fab895e20 Mon Sep 17 00:00:00 2001 From: SendaoYan Date: Thu, 28 Aug 2025 08:37:58 +0000 Subject: [PATCH 22/31] 8056283: @ignore tools/javac/defaultMethods/Assertions.java until JDK-8047675 is fixed Backport-of: d66c4567eea47bd74037b49acbd85d71a2cf239a --- langtools/test/tools/javac/defaultMethods/Assertions.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/langtools/test/tools/javac/defaultMethods/Assertions.java b/langtools/test/tools/javac/defaultMethods/Assertions.java index 61882bacebc..7e4649d3a5b 100644 --- a/langtools/test/tools/javac/defaultMethods/Assertions.java +++ b/langtools/test/tools/javac/defaultMethods/Assertions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2014, 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 @@ /* * @test * @bug 8025141 + * @ignore 8047675 test fails if run with assertions enabled in jtreg * @summary Interfaces must not contain non-public fields, ensure $assertionsDisabled * is not generated into an interface * @compile Assertions.java From 1d7e10189fecbe673f5873f298a6d825bfbc1888 Mon Sep 17 00:00:00 2001 From: SendaoYan Date: Thu, 28 Aug 2025 08:38:22 +0000 Subject: [PATCH 23/31] 8041924: [TESTBUG] sun/net/www/http/ChunkedOutputStream/checkError.java fails on some systems Reviewed-by: phh Backport-of: 6461c37c9a106cbf07731ef414873ca9dbe5c698 --- .../http/ChunkedOutputStream/CheckError.java | 131 +++++++++ .../http/ChunkedOutputStream/checkError.java | 251 ------------------ 2 files changed, 131 insertions(+), 251 deletions(-) create mode 100644 jdk/test/sun/net/www/http/ChunkedOutputStream/CheckError.java delete mode 100644 jdk/test/sun/net/www/http/ChunkedOutputStream/checkError.java diff --git a/jdk/test/sun/net/www/http/ChunkedOutputStream/CheckError.java b/jdk/test/sun/net/www/http/ChunkedOutputStream/CheckError.java new file mode 100644 index 00000000000..1fd7d2f3e7b --- /dev/null +++ b/jdk/test/sun/net/www/http/ChunkedOutputStream/CheckError.java @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2004, 2016, 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 5054016 + * @summary get the failure immediately when writing individual chunks over socket fail + */ + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.URL; +import static java.lang.System.out; + +public class CheckError { + + static int BUFFER_SIZE = 8192; // 8k + static int TOTAL_BYTES = 1 * 1024 * 1024; // 1M + + public static void main(String[] args) throws Exception { + + HTTPServer server = new HTTPServer(); + server.start(); + int port = server.getPort(); + out.println("Server listening on " + port); + + + URL url = new URL("http://localhost:" + port); + HttpURLConnection conn = (HttpURLConnection)url.openConnection(); + conn.setRequestMethod("POST"); + conn.setDoOutput(true); + conn.setChunkedStreamingMode(1024); + + out.println("sending " + TOTAL_BYTES + " bytes"); + + int byteAtOnce; + int sendingBytes = TOTAL_BYTES; + byte[] buffer = getBuffer(BUFFER_SIZE); + try (OutputStream toServer = conn.getOutputStream()) { + while (sendingBytes > 0) { + if (sendingBytes > BUFFER_SIZE) { + byteAtOnce = BUFFER_SIZE; + } else { + byteAtOnce = sendingBytes; + } + toServer.write(buffer, 0, byteAtOnce); + sendingBytes -= byteAtOnce; + out.print((TOTAL_BYTES - sendingBytes) + " was sent. "); + toServer.flush(); + // gives the server thread time to read, and eventually close; + Thread.sleep(500); + } + } catch (IOException expected) { + // Expected IOException due to server.close() + out.println("PASSED. Caught expected: " + expected); + return; + } + + // Expected IOException not received. FAIL + throw new RuntimeException("Failed: Expected IOException not received"); + } + + static byte[] getBuffer(int size) { + byte[] buffer = new byte[size]; + for (int i = 0; i < size; i++) + buffer[i] = (byte)i; + return buffer; + } + + static class HTTPServer extends Thread { + + final ServerSocket serverSocket; + + HTTPServer() throws IOException { + serverSocket = new ServerSocket(0); + } + + int getPort() { + return serverSocket.getLocalPort(); + } + + public void run() { + try (Socket client = serverSocket.accept()) { + + InputStream in = client.getInputStream(); + BufferedReader reader = new BufferedReader(new InputStreamReader(in)); + String line; + do { + line = reader.readLine(); + out.println("Server: " + line); + } while (line != null && line.length() > 0); + + System.out.println("Server: receiving some data"); + // just read some data, then close the connection + in.read(new byte[1024]); + + in.close(); + client.close(); + out.println("Server closed socket"); + } catch (IOException e) { + e.printStackTrace(); + } + } + } +} diff --git a/jdk/test/sun/net/www/http/ChunkedOutputStream/checkError.java b/jdk/test/sun/net/www/http/ChunkedOutputStream/checkError.java deleted file mode 100644 index 4575f91e93b..00000000000 --- a/jdk/test/sun/net/www/http/ChunkedOutputStream/checkError.java +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Copyright (c) 2004, 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 5054016 - * @run main/othervm/timeout=300 checkError - * @summary get the failure immediately when writing individual chunks over socket fail - */ - -import java.io.*; -import java.net.*; -import java.util.StringTokenizer; - - -public class checkError { - static final int TEST_PASSED = 95; - static final int TEST_FAILED = 97; - - static int testStatus = TEST_PASSED; - - static String serverName = "localhost"; - static int bufferSize = 8192; // 8k - static int totalBytes = 1048576; // 1M - - static int j = 0; - - static public Object threadStarting = new Object(); - static public Object threadWaiting = new Object(); - - - public static void main(String[] args) throws Exception { - HttpURLConnection conn = null; - OutputStream toServer = null; - byte[] buffer = null; - HTTPServer server = null; - synchronized(threadWaiting) { - System.out.println("HTTP-client>Starting default Http-server"); - synchronized(threadStarting) { - server = new HTTPServer(); - server.start(); - try { - System.out.println("waiting server to be start"); - threadStarting.wait(); - } catch (InterruptedException e) { - } - } - int port = server.getPort(); - URL url = new URL("http://" + serverName + ":" + port); - conn = (HttpURLConnection )url.openConnection(); - conn.setRequestMethod("POST"); - conn.setDoOutput(true); - - System.out.println("assigning 1024 to the chunk length"); - conn.setChunkedStreamingMode(1024); - conn.connect(); - - toServer = conn.getOutputStream(); - buffer = getThickBuffer(bufferSize); - System.out.println("sending " + totalBytes + " bytes"); - } - - int byteAtOnce = 0; - int sendingBytes = totalBytes; - try { - while (sendingBytes > 0) { - if (sendingBytes > bufferSize) { - byteAtOnce = bufferSize; - } else { - byteAtOnce = sendingBytes; - } - toServer.write(buffer, 0, byteAtOnce); - sendingBytes -= byteAtOnce; - // System.out.println((totalBytes - sendingBytes) + " was sent"); - toServer.flush(); - } - } catch (OutOfMemoryError e) { - e.printStackTrace(); - System.out.println("***ERR***> UNEXPECTED error: " + e); - testStatus = TEST_FAILED; - testExit(); - } catch (IOException e) { - // e.printStackTrace(); - // this is the expected IOException - // due to server.close() - testStatus = TEST_PASSED; - testExit(); - } finally { - toServer.close(); - } - - // we have not received the expected IOException - // test fail - testStatus = TEST_FAILED; - testExit(); - - } - - static void testExit() { - if (testStatus == TEST_FAILED) { - throw new RuntimeException("Test Failed: haven't received the expected IOException"); - } else { - System.out.println("TEST PASSED"); - } - System.exit(testStatus); - } - - static byte[] getThickBuffer(int size) { - - byte[] buffer = new byte[size]; - - for (int i = 0; i < size; i++) { - if (j > 9) - j = 0; - String s = Integer.toString(j); - buffer[i] = (byte )s.charAt(0); - j++; - } - - return buffer; - } -} - - -class HTTPServer extends Thread { - - static volatile boolean isCompleted; - - Socket client; - ServerSocket serverSocket; - - int getPort() { - return serverSocket.getLocalPort(); - } - - public void run() { - - synchronized(checkError.threadStarting) { - - try { - serverSocket = new ServerSocket(0, 100); - } catch (Exception e) { - e.printStackTrace(); - checkError.testStatus = checkError.TEST_FAILED; - return; - } - checkError.threadStarting.notify(); - } - - try { - client = serverSocket.accept(); - } catch (Exception e) { - e.printStackTrace(); - checkError.testStatus = checkError.TEST_FAILED; - return; - } - - System.out.println("Server started"); - - BufferedReader in = null; - PrintStream out = null; - InputStreamReader reader = null; - String version = null; - String line; - String method; - - synchronized(checkError.threadWaiting) { - try { - reader = new InputStreamReader(client.getInputStream()); - in = new BufferedReader(reader); - line = in.readLine(); - - } catch (Exception e) { - e.printStackTrace(); - checkError.testStatus = checkError.TEST_FAILED; - return; - } - StringTokenizer st = new StringTokenizer(line); - method = st.nextToken(); - String fileName = st.nextToken(); - - // save version for replies - if (st.hasMoreTokens()) version = st.nextToken(); - - System.out.println("HTTP version: " + version); - - } - - try { - - while (line != null && line.length() > 0) { - line = in.readLine(); - System.out.println(line); - } - } catch (IOException e) { - e.printStackTrace(); - checkError.testStatus = checkError.TEST_FAILED; - return; - } - - if (method.equals("POST")) { - System.out.println("receiving data"); - byte[] buf = new byte[1024]; - try { - //reading bytes until chunk whose size is zero, - // see 19.4.6 Introduction of Transfer-Encoding in RFC2616 - int count = 0; - while (count <=5) { - count++; - in.readLine(); - } - - System.out.println("Server socket is closed"); - in.close(); - client.close(); - serverSocket.close(); - - } catch (IOException e) { - e.printStackTrace(); - checkError.testStatus = checkError.TEST_FAILED; - return; - } catch (OutOfMemoryError e) { - e.printStackTrace(); - checkError.testStatus = checkError.TEST_FAILED; - return; - } - - } - } - -} From bb19ce35ff190c77d0dc030286bfbec0473b6b81 Mon Sep 17 00:00:00 2001 From: Taizo Kurashige Date: Thu, 28 Aug 2025 17:58:29 +0000 Subject: [PATCH 24/31] 8160767: [TEST_BUG] java/awt/Frame/MaximizedToIconified/MaximizedToIconified.java Reviewed-by: phh Backport-of: b46b19cb58d8b43e57cd81a0588d4e18ad6afa9a --- .../MaximizedToIconified.java | 401 +++--------------- 1 file changed, 48 insertions(+), 353 deletions(-) diff --git a/jdk/test/java/awt/Frame/MaximizedToIconified/MaximizedToIconified.java b/jdk/test/java/awt/Frame/MaximizedToIconified/MaximizedToIconified.java index 1cb281368a0..ebf14432945 100644 --- a/jdk/test/java/awt/Frame/MaximizedToIconified/MaximizedToIconified.java +++ b/jdk/test/java/awt/Frame/MaximizedToIconified/MaximizedToIconified.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2018, 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 @@ -22,17 +22,16 @@ */ /* - @test - @key headful - @bug 4977491 - @summary State changes should always be reported as events - @author anthony.petrov@...: area=awt.toplevel - @library ../../regtesthelpers - @build Util - @run main MaximizedToIconified -*/ + * @test + * @key headful + * @bug 4977491 8160767 + * @summary State changes should always be reported as events + * @library ../../../../lib/testlibrary + * @build ExtendedRobot + * @run main MaximizedToIconified + */ -/** +/* * MaximizedToIconified.java * * summary: Invoking setExtendedState(ICONIFIED) on a maximized @@ -40,395 +39,91 @@ * states in the newState of the state change event. */ -import java.awt.*; -import java.awt.event.*; -import java.util.*; -import test.java.awt.regtesthelpers.Util; - +import java.awt.Frame; +import java.awt.Toolkit; +import java.awt.event.WindowEvent; +import java.awt.event.WindowStateListener; public class MaximizedToIconified { static volatile int lastFrameState = Frame.NORMAL; static volatile boolean failed = false; static volatile Toolkit myKit; + private static ExtendedRobot robot; - private static void checkState(Frame f, int state) { - f.setExtendedState(state); - Util.waitForIdle(null); + private static void checkState(Frame frame, int state) { + frame.setExtendedState(state); + robot.waitForIdle(); + robot.delay(100); - System.out.println("state = " + state + "; getExtendedState() = " + f.getExtendedState()); + System.out.println("state = " + state + "; getExtendedState() = " + frame.getExtendedState()); if (failed) { - MaximizedToIconified.fail("getOldState() != previous getNewState() in WINDOW_STATE_CHANGED event."); + frame.dispose(); + throw new RuntimeException("getOldState() != previous getNewState() in WINDOW_STATE_CHANGED event."); } - if (lastFrameState != f.getExtendedState()) { - MaximizedToIconified.fail("getExtendedState() != last getNewState() in WINDOW_STATE_CHANGED event."); + if (lastFrameState != frame.getExtendedState()) { + frame.dispose(); + throw new RuntimeException("getExtendedState() != last getNewState() in WINDOW_STATE_CHANGED event."); } - if (f.getExtendedState() != state) { - MaximizedToIconified.fail("getExtendedState() != " + state + " as expected."); + if (frame.getExtendedState() != state) { + frame.dispose(); + throw new RuntimeException("getExtendedState() != " + state + " as expected."); } - // Plain return means the check passed } - private static void examineStates(Frame f_arg, int states[]) { - Frame f = f_arg; + private static void examineStates(int states[]) { - if (f == null) { - f = new Frame("test"); - f.setSize(200, 200); - f.setVisible(true); - } + Frame frame = new Frame("test"); + frame.setSize(200, 200); + frame.setVisible(true); - Util.waitForIdle(null); + robot.waitForIdle(); - f.addWindowStateListener(new WindowStateListener() { + frame.addWindowStateListener(new WindowStateListener() { public void windowStateChanged(WindowEvent e) { - System.out.println("last = " + lastFrameState + "; getOldState() = " + e.getOldState() + "; getNewState() = " + e.getNewState()); + System.out.println("last = " + lastFrameState + "; getOldState() = " + e.getOldState() + + "; getNewState() = " + e.getNewState()); if (e.getOldState() == lastFrameState) { lastFrameState = e.getNewState(); } else { - System.out.println("Wrong getOldState(): expected = " + lastFrameState + "; received = " + e.getOldState()); + System.out.println("Wrong getOldState(): expected = " + lastFrameState + "; received = " + + e.getOldState()); failed = true; } } }); - for (int state: states) { + for (int state : states) { if (myKit.isFrameStateSupported(state)) { - checkState(f, state); + checkState(frame, state); } else { System.out.println("Frame state = " + state + " is NOT supported by the native system. The state is skipped."); } } - if (f_arg == null) { - f.dispose(); + if (frame != null) { + frame.dispose(); } } - private static void init() - { - String[] instructions = - { - "This is an AUTOMATIC test, simply wait until it is done.", - "The result (passed or failed) will be shown in the", - "message window below." - }; - Sysout.createDialog( ); - Sysout.printInstructions( instructions ); + private static void doTest() { myKit = Toolkit.getDefaultToolkit(); // NOTE! Compound states (like MAXIMIZED_BOTH | ICONIFIED) CANNOT be used, // because Toolkit.isFrameStateSupported() method reports these states // as not supported. And such states will simply be skipped. - examineStates(null, new int[] {Frame.MAXIMIZED_BOTH, Frame.ICONIFIED, Frame.NORMAL}); - examineStates(null, new int[] {Frame.ICONIFIED, Frame.MAXIMIZED_BOTH, Frame.NORMAL}); - - - MaximizedToIconified.pass(); - - }//End init() - - - - /***************************************************** - * Standard Test Machinery Section - * DO NOT modify anything in this section -- it's a - * standard chunk of code which has all of the - * synchronisation necessary for the test harness. - * By keeping it the same in all tests, it is easier - * to read and understand someone else's test, as - * well as insuring that all tests behave correctly - * with the test harness. - * There is a section following this for test- - * classes - ******************************************************/ - private static boolean theTestPassed = false; - private static boolean testGeneratedInterrupt = false; - private static String failureMessage = ""; - - private static Thread mainThread = null; - - private static int sleepTime = 300000; - - // Not sure about what happens if multiple of this test are - // instantiated in the same VM. Being static (and using - // static vars), it aint gonna work. Not worrying about - // it for now. - public static void main( String args[] ) throws InterruptedException - { - mainThread = Thread.currentThread(); - try - { - init(); - } - catch( TestPassedException e ) - { - //The test passed, so just return from main and harness will - // interepret this return as a pass - return; - } - //At this point, neither test pass nor test fail has been - // called -- either would have thrown an exception and ended the - // test, so we know we have multiple threads. - - //Test involves other threads, so sleep and wait for them to - // called pass() or fail() - try - { - Thread.sleep( sleepTime ); - //Timed out, so fail the test - throw new RuntimeException( "Timed out after " + sleepTime/1000 + " seconds" ); - } - catch (InterruptedException e) - { - //The test harness may have interrupted the test. If so, rethrow the exception - // so that the harness gets it and deals with it. - if( ! testGeneratedInterrupt ) throw e; - - //reset flag in case hit this code more than once for some reason (just safety) - testGeneratedInterrupt = false; - - if ( theTestPassed == false ) - { - throw new RuntimeException( failureMessage ); - } - } - - }//main + examineStates(new int[] {Frame.MAXIMIZED_BOTH, Frame.ICONIFIED, Frame.NORMAL}); + examineStates(new int[] {Frame.ICONIFIED, Frame.MAXIMIZED_BOTH, Frame.NORMAL}); - public static synchronized void setTimeoutTo( int seconds ) - { - sleepTime = seconds * 1000; } - public static synchronized void pass() + public static void main( String args[] ) throws Exception { - Sysout.println( "The test passed." ); - Sysout.println( "The test is over, hit Ctl-C to stop Java VM" ); - //first check if this is executing in main thread - if ( mainThread == Thread.currentThread() ) - { - //Still in the main thread, so set the flag just for kicks, - // and throw a test passed exception which will be caught - // and end the test. - theTestPassed = true; - throw new TestPassedException(); - } - theTestPassed = true; - testGeneratedInterrupt = true; - mainThread.interrupt(); - }//pass() + robot = new ExtendedRobot(); + doTest(); - public static synchronized void fail() - { - //test writer didn't specify why test failed, so give generic - fail( "it just plain failed! :-)" ); } - public static synchronized void fail( String whyFailed ) - { - Sysout.println( "The test failed: " + whyFailed ); - Sysout.println( "The test is over, hit Ctl-C to stop Java VM" ); - //check if this called from main thread - if ( mainThread == Thread.currentThread() ) - { - //If main thread, fail now 'cause not sleeping - throw new RuntimeException( whyFailed ); - } - theTestPassed = false; - testGeneratedInterrupt = true; - failureMessage = whyFailed; - mainThread.interrupt(); - }//fail() - -}// class MaximizedToIconified - -//This exception is used to exit from any level of call nesting -// when it's determined that the test has passed, and immediately -// end the test. -class TestPassedException extends RuntimeException -{ } - -//*********** End Standard Test Machinery Section ********** - - -//************ Begin classes defined for the test **************** - -// if want to make listeners, here is the recommended place for them, then instantiate -// them in init() - -/* Example of a class which may be written as part of a test -class NewClass implements anInterface - { - static int newVar = 0; - - public void eventDispatched(AWTEvent e) - { - //Counting events to see if we get enough - eventCount++; - - if( eventCount == 20 ) - { - //got enough events, so pass - - MaximizedToIconified.pass(); - } - else if( tries == 20 ) - { - //tried too many times without getting enough events so fail - - MaximizedToIconified.fail(); - } - - }// eventDispatched() - - }// NewClass class - -*/ - - -//************** End classes defined for the test ******************* - - - - -/**************************************************** - Standard Test Machinery - DO NOT modify anything below -- it's a standard - chunk of code whose purpose is to make user - interaction uniform, and thereby make it simpler - to read and understand someone else's test. - ****************************************************/ - -/** - This is part of the standard test machinery. - It creates a dialog (with the instructions), and is the interface - for sending text messages to the user. - To print the instructions, send an array of strings to Sysout.createDialog - WithInstructions method. Put one line of instructions per array entry. - To display a message for the tester to see, simply call Sysout.println - with the string to be displayed. - This mimics System.out.println but works within the test harness as well - as standalone. - */ - -class Sysout -{ - private static TestDialog dialog; - - public static void createDialogWithInstructions( String[] instructions ) - { - dialog = new TestDialog( new Frame(), "Instructions" ); - dialog.printInstructions( instructions ); - dialog.setVisible(true); - println( "Any messages for the tester will display here." ); - } - - public static void createDialog( ) - { - dialog = new TestDialog( new Frame(), "Instructions" ); - String[] defInstr = { "Instructions will appear here. ", "" } ; - dialog.printInstructions( defInstr ); - dialog.setVisible(true); - println( "Any messages for the tester will display here." ); - } - - - public static void printInstructions( String[] instructions ) - { - dialog.printInstructions( instructions ); - } - - - public static void println( String messageIn ) - { - dialog.displayMessage( messageIn ); - System.out.println(messageIn); - } - -}// Sysout class - -/** - This is part of the standard test machinery. It provides a place for the - test instructions to be displayed, and a place for interactive messages - to the user to be displayed. - To have the test instructions displayed, see Sysout. - To have a message to the user be displayed, see Sysout. - Do not call anything in this dialog directly. - */ -class TestDialog extends Dialog -{ - - TextArea instructionsText; - TextArea messageText; - int maxStringLength = 80; - - //DO NOT call this directly, go through Sysout - public TestDialog( Frame frame, String name ) - { - super( frame, name ); - int scrollBoth = TextArea.SCROLLBARS_BOTH; - instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth ); - add( "North", instructionsText ); - - messageText = new TextArea( "", 5, maxStringLength, scrollBoth ); - add("Center", messageText); - - pack(); - - setVisible(true); - }// TestDialog() - - //DO NOT call this directly, go through Sysout - public void printInstructions( String[] instructions ) - { - //Clear out any current instructions - instructionsText.setText( "" ); - - //Go down array of instruction strings - - String printStr, remainingStr; - for( int i=0; i < instructions.length; i++ ) - { - //chop up each into pieces maxSringLength long - remainingStr = instructions[ i ]; - while( remainingStr.length() > 0 ) - { - //if longer than max then chop off first max chars to print - if( remainingStr.length() >= maxStringLength ) - { - //Try to chop on a word boundary - int posOfSpace = remainingStr. - lastIndexOf( ' ', maxStringLength - 1 ); - - if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1; - - printStr = remainingStr.substring( 0, posOfSpace + 1 ); - remainingStr = remainingStr.substring( posOfSpace + 1 ); - } - //else just print - else - { - printStr = remainingStr; - remainingStr = ""; - } - - instructionsText.append( printStr + "\n" ); - - }// while - - }// for - - }//printInstructions() - - //DO NOT call this directly, go through Sysout - public void displayMessage( String messageIn ) - { - messageText.append( messageIn + "\n" ); - System.out.println(messageIn); - } - -}// TestDialog class From 3f2b6ffee4b2a077f5fc8e00d58bce906a80cca0 Mon Sep 17 00:00:00 2001 From: Severin Gehwolf Date: Mon, 1 Sep 2025 08:19:47 +0000 Subject: [PATCH 25/31] 8361212: Remove AffirmTrust root CAs Reviewed-by: andrew Backport-of: 5173435bfd0db5db0113a6209f2f827b16598596 --- jdk/make/data/cacerts/affirmtrustcommercialca | 27 ------ jdk/make/data/cacerts/affirmtrustnetworkingca | 27 ------ jdk/make/data/cacerts/affirmtrustpremiumca | 38 -------- jdk/make/data/cacerts/affirmtrustpremiumeccca | 20 ----- .../security/validator/EntrustTLSPolicy.java | 16 +--- .../certification/CAInterop.java | 54 ------------ .../security/lib/cacerts/VerifyCACerts.java | 14 +-- .../distrust/Entrust.java | 15 ++-- .../entrust/affirmtrustcommercialca-chain.pem | 77 ---------------- .../entrust/affirmtrustnetworkingca-chain.pem | 76 ---------------- .../entrust/affirmtrustpremiumca-chain.pem | 88 ------------------- .../entrust/affirmtrustpremiumeccca-chain.pem | 63 ------------- 12 files changed, 12 insertions(+), 503 deletions(-) delete mode 100644 jdk/make/data/cacerts/affirmtrustcommercialca delete mode 100644 jdk/make/data/cacerts/affirmtrustnetworkingca delete mode 100644 jdk/make/data/cacerts/affirmtrustpremiumca delete mode 100644 jdk/make/data/cacerts/affirmtrustpremiumeccca delete mode 100644 jdk/test/sun/security/ssl/X509TrustManagerImpl/distrust/chains/entrust/affirmtrustcommercialca-chain.pem delete mode 100644 jdk/test/sun/security/ssl/X509TrustManagerImpl/distrust/chains/entrust/affirmtrustnetworkingca-chain.pem delete mode 100644 jdk/test/sun/security/ssl/X509TrustManagerImpl/distrust/chains/entrust/affirmtrustpremiumca-chain.pem delete mode 100644 jdk/test/sun/security/ssl/X509TrustManagerImpl/distrust/chains/entrust/affirmtrustpremiumeccca-chain.pem diff --git a/jdk/make/data/cacerts/affirmtrustcommercialca b/jdk/make/data/cacerts/affirmtrustcommercialca deleted file mode 100644 index 5caddfd3a0a..00000000000 --- a/jdk/make/data/cacerts/affirmtrustcommercialca +++ /dev/null @@ -1,27 +0,0 @@ -Owner: CN=AffirmTrust Commercial, O=AffirmTrust, C=US -Issuer: CN=AffirmTrust Commercial, O=AffirmTrust, C=US -Serial number: 7777062726a9b17c -Valid from: Fri Jan 29 14:06:06 GMT 2010 until: Tue Dec 31 14:06:06 GMT 2030 -Signature algorithm name: SHA256withRSA -Subject Public Key Algorithm: 2048-bit RSA key -Version: 3 ------BEGIN CERTIFICATE----- -MII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ApYvHLKac0khsUlHRUe072o0EclNmsxZt9YC -nlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8= ------END CERTIFICATE----- diff --git a/jdk/make/data/cacerts/affirmtrustnetworkingca b/jdk/make/data/cacerts/affirmtrustnetworkingca deleted file mode 100644 index c773326d4b9..00000000000 --- a/jdk/make/data/cacerts/affirmtrustnetworkingca +++ /dev/null @@ -1,27 +0,0 @@ -Owner: CN=AffirmTrust Networking, O=AffirmTrust, C=US -Issuer: CN=AffirmTrust Networking, O=AffirmTrust, C=US -Serial number: 7c4f04391cd4992d -Valid from: Fri Jan 29 14:08:24 GMT 2010 until: Tue Dec 31 14:08:24 GMT 2030 -Signature algorithm name: SHA1withRSA -Subject Public Key Algorithm: 2048-bit RSA key -Version: 3 ------BEGIN CERTIFICATE----- -MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UE -BhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVz -dCBOZXR3b3JraW5nMB4XDTEwMDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDEL -MAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZp -cm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC -AQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SEHi3y -YJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbua -kCNrmreIdIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRL -QESxG9fhwoXA3hA/Pe24/PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp -6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gbh+0t+nvujArjqWaJGctB+d1ENmHP4ndG -yH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNVHQ4EFgQUBx/S55zawm6i -QLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwDQYJ -KoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfO -tDIuUFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzu -QY0x2+c06lkh1QF612S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZ -Lgo/bNjR9eUJtGxUAArgFU2HdW23WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4u -olu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9/ZFvgrG+CJPbFEfxojfHRZ48 -x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s= ------END CERTIFICATE----- diff --git a/jdk/make/data/cacerts/affirmtrustpremiumca b/jdk/make/data/cacerts/affirmtrustpremiumca deleted file mode 100644 index 275b495a25e..00000000000 --- a/jdk/make/data/cacerts/affirmtrustpremiumca +++ /dev/null @@ -1,38 +0,0 @@ -Owner: CN=AffirmTrust Premium, O=AffirmTrust, C=US -Issuer: CN=AffirmTrust Premium, O=AffirmTrust, C=US -Serial number: 6d8c1446b1a60aee -Valid from: Fri Jan 29 14:10:36 GMT 2010 until: Mon Dec 31 14:10:36 GMT 2040 -Signature algorithm name: SHA384withRSA -Subject Public Key Algorithm: 4096-bit RSA key -Version: 3 ------BEGIN CERTIFICATE----- -MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UE -BhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVz -dCBQcmVtaXVtMB4XDTEwMDEyOTE0MTAzNloXDTQwMTIzMTE0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nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B -8OWycvpEgjNC6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQ -MKSOyARiqcTtNd56l+0OOF6SL5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc -0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK+4w1IX2COPKpVJEZNZOUbWo6xbLQ -u4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmVBtWVyuEklut89pMF -u+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFgIxpH -YoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8 -GKa1qF60g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaO -RtGdFNrHF+QFlozEJLUbzxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6e -KeC2uAloGRwYQw== ------END CERTIFICATE----- diff --git a/jdk/make/data/cacerts/affirmtrustpremiumeccca b/jdk/make/data/cacerts/affirmtrustpremiumeccca deleted file mode 100644 index d0fcc1e7793..00000000000 --- a/jdk/make/data/cacerts/affirmtrustpremiumeccca +++ /dev/null @@ -1,20 +0,0 @@ -Owner: CN=AffirmTrust Premium ECC, O=AffirmTrust, C=US -Issuer: CN=AffirmTrust Premium ECC, O=AffirmTrust, C=US -Serial number: 7497258ac73f7a54 -Valid from: Fri Jan 29 14:20:24 GMT 2010 until: Mon Dec 31 14:20:24 GMT 2040 -Signature algorithm name: SHA384withECDSA -Subject Public Key Algorithm: 384-bit EC (secp384r1) key -Version: 3 ------BEGIN CERTIFICATE----- -MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMC -VVMxFDASBgNVBAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQ -cmVtaXVtIEVDQzAeFw0xMDAxMjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJ -BgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1UcnVzdDEgMB4GA1UEAwwXQWZmaXJt -VHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQNMF4bFZ0D -0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQN8O9 -ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0G -A1UdDgQWBBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4G -A1UdDwEB/wQEAwIBBjAKBggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/Vs -aobgxCd05DhT1wV/GzTjxi+zygk8N53X57hG8f2h4nECMEJZh0PUUd+60wkyWs6I -flc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKMeQ== ------END CERTIFICATE----- diff --git a/jdk/src/share/classes/sun/security/validator/EntrustTLSPolicy.java b/jdk/src/share/classes/sun/security/validator/EntrustTLSPolicy.java index 7a67199a1a3..51b6450072e 100644 --- a/jdk/src/share/classes/sun/security/validator/EntrustTLSPolicy.java +++ b/jdk/src/share/classes/sun/security/validator/EntrustTLSPolicy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, 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,19 +75,7 @@ final class EntrustTLSPolicy { // OU=(c) 1999 Entrust.net Limited, // OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.), // O=Entrust.net - "6DC47172E01CBCB0BF62580D895FE2B8AC9AD4F873801E0C10B9C837D21EB177", - // cacerts alias: affirmtrustcommercialca - // DN: CN=AffirmTrust Commercial, O=AffirmTrust, C=US - "0376AB1D54C5F9803CE4B2E201A0EE7EEF7B57B636E8A93C9B8D4860C96F5FA7", - // cacerts alias: affirmtrustnetworkingca - // DN: CN=AffirmTrust Networking, O=AffirmTrust, C=US - "0A81EC5A929777F145904AF38D5D509F66B5E2C58FCDB531058B0E17F3F0B41B", - // cacerts alias: affirmtrustpremiumca - // DN: CN=AffirmTrust Premium, O=AffirmTrust, C=US - "70A73F7F376B60074248904534B11482D5BF0E698ECC498DF52577EBF2E93B9A", - // cacerts alias: affirmtrustpremiumeccca - // DN: CN=AffirmTrust Premium ECC, O=AffirmTrust, C=US - "BD71FDF6DA97E4CF62D1647ADD2581B07D79ADF8397EB4ECBA9C5E8488821423" + "6DC47172E01CBCB0BF62580D895FE2B8AC9AD4F873801E0C10B9C837D21EB177" ))); // Any TLS Server certificate that is anchored by one of the Entrust diff --git a/jdk/test/security/infra/java/security/cert/CertPathValidator/certification/CAInterop.java b/jdk/test/security/infra/java/security/cert/CertPathValidator/certification/CAInterop.java index 27e125c6b0b..a107406e587 100644 --- a/jdk/test/security/infra/java/security/cert/CertPathValidator/certification/CAInterop.java +++ b/jdk/test/security/infra/java/security/cert/CertPathValidator/certification/CAInterop.java @@ -376,46 +376,6 @@ * @run main/othervm -Djava.security.debug=certpath CAInterop certignarootca CRL */ -/* - * @test id=affirmtrustcommercialca - * @bug 8040012 - * @summary Interoperability tests with AffirmTrust Commercial CA - * @library /test/lib - * @build jtreg.SkippedException ValidatePathWithURL CAInterop - * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop affirmtrustcommercialca OCSP - * @run main/othervm -Djava.security.debug=certpath CAInterop affirmtrustcommercialca CRL - */ - -/* - * @test id=affirmtrustnetworkingca - * @bug 8040012 - * @summary Interoperability tests with AffirmTrust Networking CA - * @library /test/lib - * @build jtreg.SkippedException ValidatePathWithURL CAInterop - * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop affirmtrustnetworkingca OCSP - * @run main/othervm -Djava.security.debug=certpath CAInterop affirmtrustnetworkingca CRL - */ - -/* - * @test id=affirmtrustpremiumca - * @bug 8040012 - * @summary Interoperability tests with AffirmTrust Premium CA - * @library /test/lib - * @build jtreg.SkippedException ValidatePathWithURL CAInterop - * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop affirmtrustpremiumca OCSP - * @run main/othervm -Djava.security.debug=certpath CAInterop affirmtrustpremiumca CRL - */ - -/* - * @test id=affirmtrustpremiumeccca - * @bug 8040012 - * @summary Interoperability tests with AffirmTrust Premium ECC CA - * @library /test/lib - * @build jtreg.SkippedException ValidatePathWithURL CAInterop - * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop affirmtrustpremiumeccca OCSP - * @run main/othervm -Djava.security.debug=certpath CAInterop affirmtrustpremiumeccca CRL - */ - /* * @test id=teliarootcav2 * @bug 8317373 @@ -677,20 +637,6 @@ private CATestURLs getTestURLs(String alias) { return new CATestURLs("https://juolukka.cover.telia.fi:10600", "https://juolukka.cover.telia.fi:10601"); - // These are listed at https://www.affirmtrust.com/resources/ - case "affirmtrustcommercialca": - return new CATestURLs("https://validcommercial.affirmtrust.com", - "https://revokedcommercial.affirmtrust.com"); - case "affirmtrustnetworkingca": - return new CATestURLs("https://validnetworking.affirmtrust.com", - "https://revokednetworking.affirmtrust.com"); - case "affirmtrustpremiumca": - return new CATestURLs("https://validpremium.affirmtrust.com", - "https://revokedpremium.affirmtrust.com"); - case "affirmtrustpremiumeccca": - return new CATestURLs("https://validpremiumecc.affirmtrust.com", - "https://revokedpremiumecc.affirmtrust.com"); - case "emsignrootcag1": return new CATestURLs("https://testovg1.emsign.com/RootOVG1.html", "https://testovg1r.emsign.com/RootOVG1MR.html"); diff --git a/jdk/test/sun/security/lib/cacerts/VerifyCACerts.java b/jdk/test/sun/security/lib/cacerts/VerifyCACerts.java index dbd69e0bfe9..8a24197f1b2 100644 --- a/jdk/test/sun/security/lib/cacerts/VerifyCACerts.java +++ b/jdk/test/sun/security/lib/cacerts/VerifyCACerts.java @@ -28,7 +28,7 @@ * 8223499 8225392 8232019 8234245 8233223 8225068 8225069 8243321 8243320 * 8243559 8225072 8258630 8259312 8256421 8225081 8225082 8225083 8245654 * 8305975 8304760 8307134 8295894 8314960 8317373 8317374 8318759 8319187 - * 8321408 8316138 8341057 8303770 8350498 8359170 + * 8321408 8316138 8341057 8303770 8350498 8359170 8361212 * @summary Check root CA entries in cacerts file */ import java.io.ByteArrayInputStream; @@ -54,12 +54,12 @@ public class VerifyCACerts { + File.separator + "security" + File.separator + "cacerts"; // The numbers of certs now. - private static final int COUNT = 113; + private static final int COUNT = 109; // SHA-256 of cacerts, can be generated with // shasum -a 256 cacerts | sed -e 's/../&:/g' | tr '[:lower:]' '[:upper:]' | cut -c1-95 private static final String CHECKSUM - = "1E:63:88:DF:34:AD:7E:61:3F:06:BD:C4:DC:FE:05:52:9B:0D:86:6E:64:DA:E8:25:7C:C0:15:8F:31:C0:2C:78"; + = "F2:0C:60:47:49:FA:13:2A:03:A4:52:20:AD:46:7C:D0:3F:3D:A7:59:D6:27:E9:9B:CC:D4:5A:04:8D:2A:DE:9F"; // map of cert alias to SHA-256 fingerprint @SuppressWarnings("serial") @@ -198,14 +198,6 @@ public class VerifyCACerts { "43:DF:57:74:B0:3E:7F:EF:5F:E4:0D:93:1A:7B:ED:F1:BB:2E:6B:42:73:8C:4E:6D:38:41:10:3D:3A:A7:F3:39"); put("entrustevca [jdk]", "73:C1:76:43:4F:1B:C6:D5:AD:F4:5B:0E:76:E7:27:28:7C:8D:E5:76:16:C1:E6:E6:14:1A:2B:2C:BC:7D:8E:4C"); - put("affirmtrustnetworkingca [jdk]", - "0A:81:EC:5A:92:97:77:F1:45:90:4A:F3:8D:5D:50:9F:66:B5:E2:C5:8F:CD:B5:31:05:8B:0E:17:F3:F0:B4:1B"); - put("affirmtrustpremiumca [jdk]", - "70:A7:3F:7F:37:6B:60:07:42:48:90:45:34:B1:14:82:D5:BF:0E:69:8E:CC:49:8D:F5:25:77:EB:F2:E9:3B:9A"); - put("affirmtrustcommercialca [jdk]", - "03:76:AB:1D:54:C5:F9:80:3C:E4:B2:E2:01:A0:EE:7E:EF:7B:57:B6:36:E8:A9:3C:9B:8D:48:60:C9:6F:5F:A7"); - put("affirmtrustpremiumeccca [jdk]", - "BD:71:FD:F6:DA:97:E4:CF:62:D1:64:7A:DD:25:81:B0:7D:79:AD:F8:39:7E:B4:EC:BA:9C:5E:84:88:82:14:23"); put("ttelesecglobalrootclass3ca [jdk]", "FD:73:DA:D3:1C:64:4F:F1:B4:3B:EF:0C:CD:DA:96:71:0B:9C:D9:87:5E:CA:7E:31:70:7A:F3:E9:6D:52:2B:BD"); put("ttelesecglobalrootclass2ca [jdk]", diff --git a/jdk/test/sun/security/ssl/X509TrustManagerImpl/distrust/Entrust.java b/jdk/test/sun/security/ssl/X509TrustManagerImpl/distrust/Entrust.java index 1cc2b55ae51..36c7ecc8540 100644 --- a/jdk/test/sun/security/ssl/X509TrustManagerImpl/distrust/Entrust.java +++ b/jdk/test/sun/security/ssl/X509TrustManagerImpl/distrust/Entrust.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, 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,7 +28,7 @@ /** * @test - * @bug 8337664 8341059 + * @bug 8337664 8341059 8361212 * @summary Check that TLS Server certificates chaining back to distrusted * Entrust roots are invalid * @library /lib/security @@ -40,14 +40,13 @@ public class Entrust { - private static final String certPath = "chains" + File.separator + "entrust"; + private static final String CERT_PATH = "chains" + File.separator + "entrust"; // Each of the roots have a test certificate chain stored in a file // named "-chain.pem". - private static String[] rootsToTest = new String[]{ - "entrustevca", "entrustrootcaec1", "entrustrootcag2", "entrustrootcag4", - "entrust2048ca", "affirmtrustcommercialca", "affirmtrustnetworkingca", - "affirmtrustpremiumca", "affirmtrustpremiumeccca"}; + private static final String[] ROOTS_TO_TEST = new String[]{ + "entrustevca", "entrustrootcaec1", "entrustrootcag2", + "entrustrootcag4", "entrust2048ca"}; // Date when the restrictions take effect private static final ZonedDateTime DISTRUST_DATE = @@ -62,6 +61,6 @@ public static void main(String[] args) throws Exception { }; Date notBefore = distrust.getNotBefore(DISTRUST_DATE); - distrust.testCertificateChain(certPath, notBefore, tms, rootsToTest); + distrust.testCertificateChain(CERT_PATH, notBefore, tms, ROOTS_TO_TEST); } } diff --git a/jdk/test/sun/security/ssl/X509TrustManagerImpl/distrust/chains/entrust/affirmtrustcommercialca-chain.pem b/jdk/test/sun/security/ssl/X509TrustManagerImpl/distrust/chains/entrust/affirmtrustcommercialca-chain.pem deleted file mode 100644 index 76aa6d14338..00000000000 --- a/jdk/test/sun/security/ssl/X509TrustManagerImpl/distrust/chains/entrust/affirmtrustcommercialca-chain.pem +++ /dev/null @@ -1,77 +0,0 @@ -Root Certificate: - Version: 3 (0x2) - Serial Number: 8608355977964138876 (0x7777062726a9b17c) - Signature Algorithm: sha256WithRSAEncryption - Issuer: C=US, O=AffirmTrust, CN=AffirmTrust Commercial - Validity - Not Before: Jan 29 14:06:06 2010 GMT - Not After : Dec 31 14:06:06 2030 GMT - ------BEGIN CERTIFICATE----- -MIIHHjCCBgagAwIBAgIQAWZjFOyCvT00u/gtkCvS2TANBgkqhkiG9w0BAQsFADCB -gzELMAkGA1UEBhMCQ0ExFDASBgNVBAoTC0FmZmlybVRydXN0MSswKQYDVQQLEyJT -ZWUgd3d3LmFmZmlybXRydXN0LmNvbS9yZXBvc2l0b3J5MTEwLwYDVQQDEyhBZmZp -cm1UcnVzdCBFeHRlbmRlZCBWYWxpZGF0aW9uIENBIC0gRVYxMB4XDTI0MDYyODIx -MzgwNVoXDTI1MDcyODIxMzgwNFowgdgxCzAJBg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yq8/nx4P5ZmV -vCT2lI8wRwYDVR0gBEAwPjA8BgRVHSAAMDQwMgYIKwYBBQUHAgEWJmh0dHBzOi8v -d3d3LmFmZmlybXRydXN0LmNvbS9yZXBvc2l0b3J5MEkGA1UdHwRCMEAwPqA8oDqG -OGh0dHA6Ly9jcmwuYWZmaXJtdHJ1c3QuY29tL2NybC9BZmZpcm1UcnVzdENvbW1l -cmNpYWwuY3JsMA4GA1UdDwEB/wQEAwIBhjAdBgNVHSUEFjAUBggrBgEFBQcDAQYI -KwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAATH11fMrINGmQGQqQW0ATteVnUG -LrmRSN2OlmRm+dkUwKXhcQQEfYYlEggPqgvxSUpw13fXSOqVHqAcj3BIqF957kh+ -m3DmC0RX9KaEKD165pf77P5nZcRmZpBl9cctvzIxN19uzcminchusYwLyeWhBtTZ -xpER9LbrfMNaQ7GnrgalMx54QvdjOhw/GJs9/SqEzYmPshL+DzgZX/oAzY63rQIh -rBblf6/2talZqci96oFzNst8rGfPy/xQ7lgkki1hwIYbORMfloBhP+vAZJo0mxdM -ipu3Z0ToK+KU2iqnBxXVr2/kod+CpkHnjUHa1wnQuSaefng3XwZ/vqtSL9c= ------END CERTIFICATE----- diff --git a/jdk/test/sun/security/ssl/X509TrustManagerImpl/distrust/chains/entrust/affirmtrustnetworkingca-chain.pem b/jdk/test/sun/security/ssl/X509TrustManagerImpl/distrust/chains/entrust/affirmtrustnetworkingca-chain.pem deleted file mode 100644 index 7384d31152e..00000000000 --- a/jdk/test/sun/security/ssl/X509TrustManagerImpl/distrust/chains/entrust/affirmtrustnetworkingca-chain.pem +++ /dev/null @@ -1,76 +0,0 @@ -Root Certificate: - Version: 3 (0x2) - Serial Number: 8957382827206547757 (0x7c4f04391cd4992d) - Signature Algorithm: sha1WithRSAEncryption - Issuer: C=US, O=AffirmTrust, CN=AffirmTrust Networking - Validity - Not Before: Jan 29 14:08:24 2010 GMT - Not After : Dec 31 14:08:24 2030 GMT - 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fXXX9zukco8exlOIKWRJSNLxKtSSPDVASrGLQ1xi3qkiLTKci3+jKMNDFf1vw -foZN99HhUcWKXfr2KlWfANdjTMlsTKCfuhfWl1OBVNHGRrACAQCXI/ji0wIDAQAB -o4IBVDCCAVAwNwYIKwYBBQUHAQEEKzApMCcGCCsGAQUFBzABhhtodHRwOi8vb2Nz -cC5hZmZpcm10cnVzdC5jb20wHQYDVR0OBBYEFHkesckXxx6ssccU18Pof7y5UJsV -MBIGA1UdEwEB/wQIMAYBAf8CAQAwHwYDVR0jBBgwFoAUBx/S55zawm6iQLSwelAQ -UHTEyL0wRwYDVR0gBEAwPjA8BgRVHSAAMDQwMgYIKwYBBQUHAgEWJmh0dHBzOi8v -d3d3LmFmZmlybXRydXN0LmNvbS9yZXBvc2l0b3J5MEkGA1UdHwRCMEAwPqA8oDqG -OGh0dHA6Ly9jcmwuYWZmaXJtdHJ1c3QuY29tL2NybC9BZmZpcm1UcnVzdE5ldHdv -cmtpbmcuY3JsMA4GA1UdDwEB/wQEAwIBhjAdBgNVHSUEFjAUBggrBgEFBQcDAQYI -KwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAAhmE4I56hNpnWXQ2Si8a/TgQUZr -X5Jlv1LDvl3rkDyfEIHNZ8dth17SakJYJBWHExph/iIYjCJ9YmeyhghV5rPqT+wF -4yyE2ngenIusfnWT2bTpT9u2VZbCNeACE5XnN2UHSA0J9idPjfLuthViWEvSZZUh -DJ53bX+exO366nDY4AI7owIyhz8hdsWyhZ/0ST+eD+kbgd8osd+GdxzRmyKcfl84 -D1K1uff01T9w2dyUaZglQsFljkaO6xmeXZJsPnhwCp/HlMHWzhAneUQ7I9FZSOW+ -WiYbt4RitmBpysadBReikWM4knECzJQ/fMT9vC0k9BLlqUYRwCH9vr0UnZo= ------END CERTIFICATE----- diff --git a/jdk/test/sun/security/ssl/X509TrustManagerImpl/distrust/chains/entrust/affirmtrustpremiumca-chain.pem b/jdk/test/sun/security/ssl/X509TrustManagerImpl/distrust/chains/entrust/affirmtrustpremiumca-chain.pem deleted file mode 100644 index 6f108bc1229..00000000000 --- a/jdk/test/sun/security/ssl/X509TrustManagerImpl/distrust/chains/entrust/affirmtrustpremiumca-chain.pem +++ /dev/null @@ -1,88 +0,0 @@ -Root Certificate: - Version: 3 (0x2) - Serial Number: 7893706540734352110 (0x6d8c1446b1a60aee) - Signature Algorithm: sha384WithRSAEncryption - Issuer: C=US, O=AffirmTrust, CN=AffirmTrust Premium - Validity - Not Before: Jan 29 14:10:36 2010 GMT - Not After : Dec 31 14:10:36 2040 GMT - ------BEGIN CERTIFICATE----- -MIIIFjCCBv6gAwIBAgIQQVOTWr7tEAJXmRDkCSxkajANBgkqhkiG9w0BAQsFADCB -gzELMAkGA1UEBhMCQ0ExFDASBgNVBAoTC0FmZmlybVRydXN0MSswKQYDVQQLEyJT -ZWUgd3d3LmFmZmlybXRydXN0LmNvbS9yZXBvc2l0b3J5MTEwLwYDVQQDEyhBZmZp -cm1UcnVzdCBFeHRlbmRlZCBWYWxpZGF0aW9uIENBIC0gRVYyMB4XDTI0MDYyODIx -NDgyN1oXDTI1MDcyODIxNDgyNlowgdUxCzAJBgNVBAYTAkNBMRAwDgYDVQQIEwdP -bnRhcmlvMQ8wDQYDVQQHEwZPdHRhd2ExEzARBgsrBgEEAYI3PAIBAxMCQ0ExGDAW -BgsrBgEEAYI3PAIBAhMHT250YXJpbzEcMBoGA1UEChMTQWZmaXJtdHJ1c3QgTGlt -aXRlZDEdMBsGA1UEDxMUUHJpdmF0ZSBPcmdhbml6YXRpb24xEDAOBgNVBAUTBzI1 -NDA1NDcxJTAjBgNVBAMTHHZhbGlkcHJlbWl1bS5hZmZpcm10cnVzdC5jb20wggIi -MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDVRMzwbDq47ivHOKqJdiEJNL2+ -g9Snj/BRctqcQTrIV99RP0pmAh5fHg7vnhVsHqc9sRLVcQWTJk9NuRJ2VnDKWsBa -Xrp5UWaNjS0vaF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Q/MD0wO6A5oDeGNWh0 -dHA6Ly9jcmwuYWZmaXJtdHJ1c3QuY29tL2NybC9BZmZpcm1UcnVzdFByZW1pdW0u -Y3JsMA4GA1UdDwEB/wQEAwIBhjAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUH -AwIwDQYJKoZIhvcNAQELBQADggIBABi64UEwl3l0yIiuSACyVQQIBI60BUmhseac -4BzCAsJrR5tE/2U9QAa2y6JpR1nqm76DJvw1QQgvFcNe+fkwpvoViCaSTbZkGGwD -mQe2xRSYJcDSMQUc/GgzLcX2c1CrexQXE1vwV/q33af1en5s1GzLl915aNS/k1ch -G7EMruJ/D4cuH9j4j2i+b+llmVBzavBwelN5rc693o+Ot9id/1sTWNugwAu3uXGb -VlhETMnjXGIciegOLdWYhWBln0izYlt9IwlDEpjMVaZ0HZlj2JBGaSe4PfEFpJPO -beuPcQpLQGw2XpW2ZMG5JcRYaoKWjixXAGktRA3H9nvVW92jvzx/RX484w2ZM5Rt -E+I1ikAuQLAyWG7clht387e2RuC3NZTtefSyjE3L9gQDOPC+Z9ycwr0WJHRsxFvh -FJQi3JnxgFZf5mc5n2mh3qAgALTNOUHuDiHrerjTOWbpF/1/NJmo/c/YZ63vZIhc -EaER4HuhbBqlpf6z3WOIQdZm1ChwXYHrEcLDgfwm9cXoaVK2HZapkMwQbPffPlT1 -E+AxRFB4YmT1y2WzdaHfhFA9nH6ByUdL5+FfrDoIIUO2e8OLOAcrJsf5+unhAhc0 -v7N48JWdmpstjkXCaCIaidrZLJxS+pikNgHB1dXF/TxokLTiPB9jcYKdGaYs3XHb -YKLdwubu ------END CERTIFICATE----- diff --git a/jdk/test/sun/security/ssl/X509TrustManagerImpl/distrust/chains/entrust/affirmtrustpremiumeccca-chain.pem b/jdk/test/sun/security/ssl/X509TrustManagerImpl/distrust/chains/entrust/affirmtrustpremiumeccca-chain.pem deleted file mode 100644 index 37b1b787084..00000000000 --- a/jdk/test/sun/security/ssl/X509TrustManagerImpl/distrust/chains/entrust/affirmtrustpremiumeccca-chain.pem +++ /dev/null @@ -1,63 +0,0 @@ -Root Certificate: - Version: 3 (0x2) - Serial Number: 8401224907861490260 (0x7497258ac73f7a54) - Signature Algorithm: ecdsa-with-SHA384 - Issuer: C=US, O=AffirmTrust, CN=AffirmTrust Premium ECC - Validity - Not Before: Jan 29 14:20:24 2010 GMT - Not After : Dec 31 14:20:24 2040 GMT - ------BEGIN CERTIFICATE----- -MIIF0zCCBVmgAwIBAgIQFVwk9nYUM5SYOnBd+IoGtzAKBggqhkjOPQQDAzCBhTEL -MAkGA1UEBhMCQ0ExFDASBgNVBAoTC0FmZmlybVRydXN0MSswKQYDVQQLEyJTZWUg -d3d3LmFmZmlybXRydXN0LmNvbS9yZXBvc2l0b3J5MTMwMQYDVQQDEypBZmZpcm1U -cnVzdCBFeHRlbmRlZCBWYWxpZGF0aW9uIENBIC0gRVZFQzEwHhcNMjQwNjI4MjE0 -OTUwWhcNMjUwNzI4MjE0OTQ4WjCB2DELMAkGA1UEBhMCQ0ExEDAOBgNVBAgTB09u -dGFyaW8xDzANBgNVBAcTBk90dGF3YTETMBEGCysGAQQBgjc8AgEDEwJDQTEYMBYG -CysGAQQBgjc8AgECEwdPbnRhcmlvMRwwGgYDVQQKExNBZmZpcm10cnVzdCBMaW1p -dGVkMR0wGwYDVQQPExRQcml2YXRlIE9yZ2FuaXphdGlvbjEQMA4GA1UEBRMHMjU0 -MDU0NzEoMCYGA1UEAxMfdmFsaWRwcmVtaXVtZWNjLmFmZmlybXRydXN0LmNvbTB2 -MBAGByqGSM49AgEGBSuBBAAiA2IABEkLBzBYSJPRENKDaA1iBPQz+jZUV+OoM9nJ -sr9sMfmHaqr3nlWxAMM99b9/usVfYyUxqyi+YL2Z3ZSxjX2dpyhwMtPpIQkL1pMW -Iv55XBIcYRyl2NjcADS9B06G+nnix6OCAzcwggMzMAwGA1UdEwEB/wQCMAAwHQYD -VR0OBBYEFP+37ywf2YJJ/4CEVy1GY4ioGm1yMB8G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YWZmaXJtdHJ1c3QuY29tL2Ny -bC9BZmZpcm1UcnVzdFByZW1pdW1FQ0MuY3JsMA4GA1UdDwEB/wQEAwIBhjAdBgNV -HSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwCgYIKoZIzj0EAwMDaAAwZQIwHJ5g -a6sHvQ51DGr0bWq34awuwlWbybC2grHoNp5uYapcXr/qTJusb/6n+dczqFdaAjEA -7VQY06fE9ifMnTgT9824jc3+H6kfhMk4PoIj9ouWdYfc1DyTBS/low9Hb8liQyFr ------END CERTIFICATE----- From 333a55103ed3e480793539f7329bff6e23771047 Mon Sep 17 00:00:00 2001 From: Antonio Vieiro Date: Fri, 26 Sep 2025 00:10:57 +0000 Subject: [PATCH 26/31] 8348760: RadioButton is not shown if JRadioButtonMenuItem is rendered with ImageIcon in WindowsLookAndFeel 8365375: Method SU3.setAcceleratorSelectionForeground assigns to acceleratorForeground Reviewed-by: sgehwolf, andrew Backport-of: 31fc05c4721aa1aaf12e5f326a52c1db48006abb --- .../com/sun/java/swing/SwingUtilities3.java | 137 ++++++++++- .../windows/WindowsCheckBoxMenuItemUI.java | 20 +- .../plaf/windows/WindowsIconFactory.java | 16 +- .../swing/plaf/windows/WindowsMenuItemUI.java | 140 ++++++++++- .../swing/plaf/windows/WindowsMenuUI.java | 21 +- .../windows/WindowsRadioButtonMenuItemUI.java | 19 +- .../swing/plaf/basic/BasicMenuItemUI.java | 144 ++++------- .../TestRadioAndCheckMenuItemWithIcon.java | 228 ++++++++++++++++++ 8 files changed, 618 insertions(+), 107 deletions(-) create mode 100644 jdk/test/javax/swing/JMenuItem/TestRadioAndCheckMenuItemWithIcon.java diff --git a/jdk/src/share/classes/com/sun/java/swing/SwingUtilities3.java b/jdk/src/share/classes/com/sun/java/swing/SwingUtilities3.java index b50fb2ae1b2..c29297a630a 100644 --- a/jdk/src/share/classes/com/sun/java/swing/SwingUtilities3.java +++ b/jdk/src/share/classes/com/sun/java/swing/SwingUtilities3.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, 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,11 +36,20 @@ import java.applet.Applet; import java.awt.AWTEvent; import java.awt.EventQueue; +import java.awt.Color; import java.awt.Component; import java.awt.Container; +import java.awt.Graphics; +import java.awt.Insets; +import java.awt.Rectangle; import java.awt.Window; +import javax.swing.ButtonModel; +import javax.swing.Icon; import javax.swing.JComponent; +import javax.swing.JMenu; import javax.swing.RepaintManager; +import sun.swing.MenuItemLayoutHelper; +import sun.swing.SwingUtilities2; /** * A collection of utility methods for Swing. @@ -61,6 +70,10 @@ public class SwingUtilities3 { private static final Object DELEGATE_REPAINT_MANAGER_KEY = new StringBuilder("DelegateRepaintManagerKey"); + private static Color disabledForeground; + private static Color acceleratorSelectionForeground; + private static Color acceleratorForeground; + /** * Registers delegate RepaintManager for {@code JComponent}. */ @@ -113,6 +126,128 @@ public static boolean isVsyncRequested(Container rootContainer) { return Boolean.TRUE == vsyncedMap.get(rootContainer); } + public static void applyInsets(Rectangle rect, Insets insets) { + if (insets != null) { + rect.x += insets.left; + rect.y += insets.top; + rect.width -= (insets.right + rect.x); + rect.height -= (insets.bottom + rect.y); + } + } + + public static void paintCheckIcon(Graphics g, MenuItemLayoutHelper lh, + MenuItemLayoutHelper.LayoutResult lr, + Color holdc, Color foreground) { + if (lh.getCheckIcon() != null) { + ButtonModel model = lh.getMenuItem().getModel(); + if (model.isArmed() || (lh.getMenuItem() instanceof JMenu + && model.isSelected())) { + g.setColor(foreground); + } else { + g.setColor(holdc); + } + if (lh.useCheckAndArrow()) { + lh.getCheckIcon().paintIcon(lh.getMenuItem(), g, + lr.getCheckRect().x, lr.getCheckRect().y); + } + g.setColor(holdc); + } + } + + public static void paintIcon(Graphics g, MenuItemLayoutHelper lh, + MenuItemLayoutHelper.LayoutResult lr, Color holdc) { + if (lh.getIcon() != null) { + Icon icon; + ButtonModel model = lh.getMenuItem().getModel(); + if (!model.isEnabled()) { + icon = lh.getMenuItem().getDisabledIcon(); + } else if (model.isPressed() && model.isArmed()) { + icon = lh.getMenuItem().getPressedIcon(); + if (icon == null) { + // Use default icon + icon = lh.getMenuItem().getIcon(); + } + } else { + icon = lh.getMenuItem().getIcon(); + } + + if (icon != null) { + icon.paintIcon(lh.getMenuItem(), g, lr.getIconRect().x, + lr.getIconRect().y); + g.setColor(holdc); + } + } + } + + + public static void paintAccText(Graphics g, MenuItemLayoutHelper lh, + MenuItemLayoutHelper.LayoutResult lr) { + if (!lh.getAccText().isEmpty()) { + ButtonModel model = lh.getMenuItem().getModel(); + g.setFont(lh.getAccFontMetrics().getFont()); + if (!model.isEnabled()) { + + // paint the accText disabled + if (disabledForeground != null) { + g.setColor(disabledForeground); + SwingUtilities2.drawString(lh.getMenuItem(), g, + lh.getAccText(), lr.getAccRect().x, + lr.getAccRect().y + lh.getAccFontMetrics().getAscent()); + } else { + g.setColor(lh.getMenuItem().getBackground().brighter()); + SwingUtilities2.drawString(lh.getMenuItem(), g, + lh.getAccText(), lr.getAccRect().x, + lr.getAccRect().y + lh.getAccFontMetrics().getAscent()); + g.setColor(lh.getMenuItem().getBackground().darker()); + SwingUtilities2.drawString(lh.getMenuItem(), g, + lh.getAccText(), lr.getAccRect().x - 1, + lr.getAccRect().y + lh.getFontMetrics().getAscent() - 1); + } + } else { + + // paint the accText normally + if (model.isArmed() + || (lh.getMenuItem() instanceof JMenu + && model.isSelected())) { + g.setColor(acceleratorSelectionForeground); + } else { + g.setColor(acceleratorForeground); + } + SwingUtilities2.drawString(lh.getMenuItem(), g, lh.getAccText(), + lr.getAccRect().x, lr.getAccRect().y + + lh.getAccFontMetrics().getAscent()); + } + } + } + + public static void setDisabledForeground(Color disabledFg) { + disabledForeground = disabledFg; + } + + public static void setAcceleratorSelectionForeground(Color acceleratorSelectionFg) { + acceleratorSelectionForeground = acceleratorSelectionFg; + } + + public static void setAcceleratorForeground(Color acceleratorFg) { + acceleratorForeground = acceleratorFg; + } + + public static void paintArrowIcon(Graphics g, MenuItemLayoutHelper lh, + MenuItemLayoutHelper.LayoutResult lr, + Color foreground) { + if (lh.getArrowIcon() != null) { + ButtonModel model = lh.getMenuItem().getModel(); + if (model.isArmed() || (lh.getMenuItem() instanceof JMenu + && model.isSelected())) { + g.setColor(foreground); + } + if (lh.useCheckAndArrow()) { + lh.getArrowIcon().paintIcon(lh.getMenuItem(), g, + lr.getArrowRect().x, lr.getArrowRect().y); + } + } + } + /** * Returns delegate {@code RepaintManager} for {@code component} hierarchy. */ diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsCheckBoxMenuItemUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsCheckBoxMenuItemUI.java index ab1a1bce0b6..fdf109c9ddd 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsCheckBoxMenuItemUI.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsCheckBoxMenuItemUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, 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 @@ -74,6 +74,24 @@ protected void paintBackground(Graphics g, JMenuItem menuItem, } super.paintBackground(g, menuItem, bgColor); } + + /** + * Paint MenuItem. + */ + protected void paintMenuItem(Graphics g, JComponent c, + Icon checkIcon, Icon arrowIcon, + Color background, Color foreground, + int defaultTextIconGap) { + if (WindowsMenuItemUI.isVistaPainting()) { + WindowsMenuItemUI.paintMenuItem(accessor, g, c, checkIcon, + arrowIcon, background, foreground, defaultTextIconGap, + menuItem, getPropertyPrefix()); + return; + } + super.paintMenuItem(g, c, checkIcon, arrowIcon, background, + foreground, defaultTextIconGap); + } + /** * Method which renders the text of the current menu item. *

diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java index 90bdc929383..7fda45b254f 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, 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 @@ -785,6 +785,7 @@ public void paintIcon(Component c, Graphics g, int x, int y) { } assert menuItem == null || c == menuItem; Icon icon = getIcon(); + if (type == JCheckBoxMenuItem.class || type == JRadioButtonMenuItem.class) { AbstractButton b = (AbstractButton) c; @@ -808,19 +809,18 @@ public void paintIcon(Component c, Graphics g, int x, int y) { } XPStyle xp = XPStyle.getXP(); if (xp != null) { - Skin skin; - skin = xp.getSkin(c, backgroundPart); - skin.paintSkin(g, x, y, - getIconWidth(), getIconHeight(), backgroundState); - if (icon == null) { - skin = xp.getSkin(c, part); + Skin skin = xp.getSkin(c, part); + if (icon == null || icon.getIconHeight() <= 16) { skin.paintSkin(g, x + OFFSET, y + OFFSET, state); + } else { + skin.paintSkin(g, x + OFFSET, y + icon.getIconHeight() / 2, state); } } } } if (icon != null) { - icon.paintIcon(c, g, x + OFFSET, y + OFFSET); + icon.paintIcon(c, g, x + VistaMenuItemCheckIconFactory.getIconWidth(), + y + OFFSET); } } private static WindowsMenuItemUIAccessor getAccessor( diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java index dddbeeb5074..41995f322db 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, 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 @@ -31,9 +31,11 @@ import javax.swing.plaf.basic.*; import sun.swing.SwingUtilities2; +import sun.swing.MenuItemLayoutHelper; import com.sun.java.swing.plaf.windows.TMSchema.*; import com.sun.java.swing.plaf.windows.XPStyle.*; +import com.sun.java.swing.SwingUtilities3; /** * Windows rendition of the component. @@ -47,8 +49,12 @@ * * @author Igor Kushnirskiy */ - public class WindowsMenuItemUI extends BasicMenuItemUI { + + private static Color disabledForeground; + private static Color acceleratorSelectionForeground; + private static Color acceleratorForeground; + final WindowsMenuItemUIAccessor accessor = new WindowsMenuItemUIAccessor() { @@ -68,6 +74,136 @@ public static ComponentUI createUI(JComponent c) { return new WindowsMenuItemUI(); } + protected void installDefaults() { + super.installDefaults(); + String prefix = getPropertyPrefix(); + + if (acceleratorSelectionForeground == null || + acceleratorSelectionForeground instanceof UIResource) { + acceleratorSelectionForeground = + UIManager.getColor(prefix + ".acceleratorSelectionForeground"); + } + if (acceleratorForeground == null || + acceleratorForeground instanceof UIResource) { + acceleratorForeground = + UIManager.getColor(prefix + ".acceleratorForeground"); + } + if (disabledForeground == null || + disabledForeground instanceof UIResource) { + disabledForeground = + UIManager.getColor(prefix + ".disabledForeground"); + } + } + + + private static void applyInsets(Rectangle rect, Insets insets) { + SwingUtilities3.applyInsets(rect, insets); + } + + private static void paintCheckIcon(Graphics g, MenuItemLayoutHelper lh, + MenuItemLayoutHelper.LayoutResult lr, + Color holdc, Color foreground) { + SwingUtilities3.paintCheckIcon(g, lh, lr, holdc, foreground); + } + + private static void paintIcon(Graphics g, MenuItemLayoutHelper lh, + MenuItemLayoutHelper.LayoutResult lr, Color holdc) { + SwingUtilities3.paintIcon(g, lh, lr, holdc); + } + + private static void paintAccText(Graphics g, MenuItemLayoutHelper lh, + MenuItemLayoutHelper.LayoutResult lr) { + SwingUtilities3.setDisabledForeground(disabledForeground); + SwingUtilities3.setAcceleratorSelectionForeground( + acceleratorSelectionForeground); + SwingUtilities3.setAcceleratorForeground(acceleratorForeground); + SwingUtilities3.paintAccText(g, lh, lr); + } + + private static void paintArrowIcon(Graphics g, MenuItemLayoutHelper lh, + MenuItemLayoutHelper.LayoutResult lr, + Color foreground) { + SwingUtilities3.paintArrowIcon(g, lh, lr, foreground); + } + + protected void paintMenuItem(Graphics g, JComponent c, + Icon checkIcon, Icon arrowIcon, + Color background, Color foreground, + int defaultTextIconGap) { + if (WindowsMenuItemUI.isVistaPainting()) { + WindowsMenuItemUI.paintMenuItem(accessor, g, c, checkIcon, + arrowIcon, background, foreground, + defaultTextIconGap, menuItem, + getPropertyPrefix()); + return; + } + super.paintMenuItem(g, c, checkIcon, arrowIcon, background, + foreground, defaultTextIconGap); + } + + static void paintMenuItem(WindowsMenuItemUIAccessor accessor, Graphics g, + JComponent c, Icon checkIcon, Icon arrowIcon, + Color background, Color foreground, + int defaultTextIconGap, JMenuItem menuItem, String prefix) { + // Save original graphics font and color + Font holdf = g.getFont(); + Color holdc = g.getColor(); + + JMenuItem mi = (JMenuItem) c; + g.setFont(mi.getFont()); + + Rectangle viewRect = new Rectangle(0, 0, mi.getWidth(), mi.getHeight()); + applyInsets(viewRect, mi.getInsets()); + + String acceleratorDelimiter = + UIManager.getString("MenuItem.acceleratorDelimiter"); + if (acceleratorDelimiter == null) { acceleratorDelimiter = "+"; } + Font acceleratorFont = UIManager.getFont("MenuItem.acceleratorFont"); + if (acceleratorFont == null) { + acceleratorFont = UIManager.getFont("MenuItem.font"); + } + + MenuItemLayoutHelper lh = new MenuItemLayoutHelper(mi, checkIcon, + arrowIcon, viewRect, defaultTextIconGap, acceleratorDelimiter, + mi.getComponentOrientation().isLeftToRight(), mi.getFont(), + acceleratorFont, MenuItemLayoutHelper.useCheckAndArrow(menuItem), + prefix); + MenuItemLayoutHelper.LayoutResult lr = lh.layoutMenuItem(); + + paintBackground(accessor, g, mi, background); + paintCheckIcon(g, lh, lr, holdc, foreground); + paintIcon(g, lh, lr, holdc); + + if (lh.getCheckIcon() != null && lh.useCheckAndArrow()) { + Rectangle rect = lr.getTextRect(); + + rect.x += lh.getAfterCheckIconGap(); + + lr.setTextRect(rect); + } + if (!lh.getText().isEmpty()) { + if (lh.getHtmlView() != null) { + // Text is HTML + lh.getHtmlView().paint(g, lr.getTextRect()); + } else { + // Text isn't HTML + paintText(accessor, g, lh.getMenuItem(), + lr.getTextRect(), lh.getText()); + } + } + if (lh.getCheckIcon() != null && lh.useCheckAndArrow()) { + Rectangle rect = lr.getAccRect(); + rect.x += lh.getAfterCheckIconGap(); + lr.setAccRect(rect); + } + paintAccText(g, lh, lr); + paintArrowIcon(g, lh, lr, foreground); + + // Restore original graphics font and color + g.setColor(holdc); + g.setFont(holdf); + } + /** * Method which renders the text of the current menu item. *

diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuUI.java index a2e7795cfe3..d81e172a28e 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuUI.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, 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 @@ -123,6 +123,25 @@ protected void installDefaults() { hotTrackingOn = (obj instanceof Boolean) ? (Boolean)obj : true; } + /** + * Paint MenuItem. + */ + protected void paintMenuItem(Graphics g, JComponent c, + Icon checkIcon, Icon arrowIcon, + Color background, Color foreground, + int defaultTextIconGap) { + if (WindowsMenuItemUI.isVistaPainting()) { + WindowsMenuItemUI.paintMenuItem(accessor, g, c, checkIcon, arrowIcon, + background, foreground, + defaultTextIconGap, menuItem, + getPropertyPrefix()); + return; + } + super.paintMenuItem(g, c, checkIcon, arrowIcon, background, + foreground, defaultTextIconGap); + } + + /** * Draws the background of the menu. * @since 1.4 diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsRadioButtonMenuItemUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsRadioButtonMenuItemUI.java index c43876f38b4..55007916030 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsRadioButtonMenuItemUI.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsRadioButtonMenuItemUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, 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 @@ -74,6 +74,23 @@ protected void paintBackground(Graphics g, JMenuItem menuItem, super.paintBackground(g, menuItem, bgColor); } + /** + * Paint MenuItem. + */ + protected void paintMenuItem(Graphics g, JComponent c, + Icon checkIcon, Icon arrowIcon, + Color background, Color foreground, + int defaultTextIconGap) { + if (WindowsMenuItemUI.isVistaPainting()) { + WindowsMenuItemUI.paintMenuItem(accessor, g, c, checkIcon, + arrowIcon, background, foreground, defaultTextIconGap, + menuItem, getPropertyPrefix()); + return; + } + super.paintMenuItem(g, c, checkIcon, arrowIcon, background, + foreground, defaultTextIconGap); + } + /** * Method which renders the text of the current menu item. *

diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java index 54994b61e3b..0d45bb54f0f 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, 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,17 +25,52 @@ package javax.swing.plaf.basic; -import java.awt.*; -import java.awt.event.*; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.Insets; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.event.ActionEvent; +import java.awt.event.InputEvent; +import java.awt.event.MouseEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; -import javax.swing.*; -import javax.swing.event.*; -import javax.swing.plaf.*; +import javax.swing.ButtonModel; +import javax.swing.Icon; +import javax.swing.InputMap; +import javax.swing.JCheckBoxMenuItem; +import javax.swing.JComponent; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import javax.swing.JRadioButtonMenuItem; +import javax.swing.KeyStroke; +import javax.swing.LookAndFeel; +import javax.swing.MenuElement; +import javax.swing.MenuSelectionManager; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.event.MenuDragMouseEvent; +import javax.swing.event.MenuDragMouseListener; +import javax.swing.event.MenuKeyListener; + +import javax.swing.event.MouseInputListener; +import javax.swing.plaf.ComponentInputMapUIResource; +import javax.swing.plaf.ComponentUI; +import javax.swing.plaf.MenuItemUI; +import javax.swing.plaf.UIResource; import javax.swing.text.View; -import sun.swing.*; +import com.sun.java.swing.SwingUtilities3; +import sun.swing.MenuItemCheckIconFactory; +import sun.swing.MenuItemLayoutHelper; +import sun.swing.SwingUtilities2; +import sun.swing.UIAction; + /** * BasicMenuItem implementation @@ -561,84 +596,22 @@ protected void paintMenuItem(Graphics g, JComponent c, private void paintIcon(Graphics g, MenuItemLayoutHelper lh, MenuItemLayoutHelper.LayoutResult lr, Color holdc) { - if (lh.getIcon() != null) { - Icon icon; - ButtonModel model = lh.getMenuItem().getModel(); - if (!model.isEnabled()) { - icon = lh.getMenuItem().getDisabledIcon(); - } else if (model.isPressed() && model.isArmed()) { - icon = lh.getMenuItem().getPressedIcon(); - if (icon == null) { - // Use default icon - icon = lh.getMenuItem().getIcon(); - } - } else { - icon = lh.getMenuItem().getIcon(); - } - - if (icon != null) { - icon.paintIcon(lh.getMenuItem(), g, lr.getIconRect().x, - lr.getIconRect().y); - g.setColor(holdc); - } - } + SwingUtilities3.paintIcon(g, lh, lr, holdc); } private void paintCheckIcon(Graphics g, MenuItemLayoutHelper lh, MenuItemLayoutHelper.LayoutResult lr, Color holdc, Color foreground) { - if (lh.getCheckIcon() != null) { - ButtonModel model = lh.getMenuItem().getModel(); - if (model.isArmed() || (lh.getMenuItem() instanceof JMenu - && model.isSelected())) { - g.setColor(foreground); - } else { - g.setColor(holdc); - } - if (lh.useCheckAndArrow()) { - lh.getCheckIcon().paintIcon(lh.getMenuItem(), g, - lr.getCheckRect().x, lr.getCheckRect().y); - } - g.setColor(holdc); - } + SwingUtilities3.paintCheckIcon(g, lh, lr, holdc, foreground); } private void paintAccText(Graphics g, MenuItemLayoutHelper lh, MenuItemLayoutHelper.LayoutResult lr) { - if (!lh.getAccText().equals("")) { - ButtonModel model = lh.getMenuItem().getModel(); - g.setFont(lh.getAccFontMetrics().getFont()); - if (!model.isEnabled()) { - // *** paint the accText disabled - if (disabledForeground != null) { - g.setColor(disabledForeground); - SwingUtilities2.drawString(lh.getMenuItem(), g, - lh.getAccText(), lr.getAccRect().x, - lr.getAccRect().y + lh.getAccFontMetrics().getAscent()); - } else { - g.setColor(lh.getMenuItem().getBackground().brighter()); - SwingUtilities2.drawString(lh.getMenuItem(), g, - lh.getAccText(), lr.getAccRect().x, - lr.getAccRect().y + lh.getAccFontMetrics().getAscent()); - g.setColor(lh.getMenuItem().getBackground().darker()); - SwingUtilities2.drawString(lh.getMenuItem(), g, - lh.getAccText(), lr.getAccRect().x - 1, - lr.getAccRect().y + lh.getFontMetrics().getAscent() - 1); - } - } else { - // *** paint the accText normally - if (model.isArmed() - || (lh.getMenuItem() instanceof JMenu - && model.isSelected())) { - g.setColor(acceleratorSelectionForeground); - } else { - g.setColor(acceleratorForeground); - } - SwingUtilities2.drawString(lh.getMenuItem(), g, lh.getAccText(), - lr.getAccRect().x, lr.getAccRect().y + - lh.getAccFontMetrics().getAscent()); - } - } + SwingUtilities3.setDisabledForeground(disabledForeground); + SwingUtilities3.setAcceleratorSelectionForeground( + acceleratorSelectionForeground); + SwingUtilities3.setAcceleratorForeground(acceleratorForeground); + SwingUtilities3.paintAccText(g, lh, lr); } private void paintText(Graphics g, MenuItemLayoutHelper lh, @@ -657,26 +630,11 @@ private void paintText(Graphics g, MenuItemLayoutHelper lh, private void paintArrowIcon(Graphics g, MenuItemLayoutHelper lh, MenuItemLayoutHelper.LayoutResult lr, Color foreground) { - if (lh.getArrowIcon() != null) { - ButtonModel model = lh.getMenuItem().getModel(); - if (model.isArmed() || (lh.getMenuItem() instanceof JMenu - && model.isSelected())) { - g.setColor(foreground); - } - if (lh.useCheckAndArrow()) { - lh.getArrowIcon().paintIcon(lh.getMenuItem(), g, - lr.getArrowRect().x, lr.getArrowRect().y); - } - } + SwingUtilities3.paintArrowIcon(g, lh, lr, foreground); } private void applyInsets(Rectangle rect, Insets insets) { - if(insets != null) { - rect.x += insets.left; - rect.y += insets.top; - rect.width -= (insets.right + rect.x); - rect.height -= (insets.bottom + rect.y); - } + SwingUtilities3.applyInsets(rect, insets); } /** diff --git a/jdk/test/javax/swing/JMenuItem/TestRadioAndCheckMenuItemWithIcon.java b/jdk/test/javax/swing/JMenuItem/TestRadioAndCheckMenuItemWithIcon.java new file mode 100644 index 00000000000..7fa7e5dd0ab --- /dev/null +++ b/jdk/test/javax/swing/JMenuItem/TestRadioAndCheckMenuItemWithIcon.java @@ -0,0 +1,228 @@ +/* + * Copyright (c) 2025, 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 8348760 + * @summary Verify if RadioButtonMenuItem bullet and + * JCheckboxMenuItem checkmark is shown if + * JRadioButtonMenuItem and JCheckboxMenuItem + * is rendered with ImageIcon in WindowsLookAndFeel + * @requires (os.family == "windows") + * @run main/manual TestRadioAndCheckMenuItemWithIcon + */ + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.FlowLayout; +import java.awt.Graphics; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.awt.image.BufferedImage; +import java.util.concurrent.LinkedBlockingQueue; + +import javax.swing.AbstractButton; +import javax.swing.ButtonGroup; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JCheckBoxMenuItem; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JPanel; +import javax.swing.JRadioButtonMenuItem; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.KeyStroke; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; + +public class TestRadioAndCheckMenuItemWithIcon { + + private static final String INSTRUCTIONS = + "Clicking on the Menu above will show a\n" + + "JRadioButtonMenuItem group with 3 radiobutton menuitems\n" + + "and a JCheckBoxMenuItem group with 3 checkbox menuitems.\n" + + "\n" + + "First radiobutton menuitem is selected with imageicon of a red square.\n" + + "Second radiobutton menuitem is unselected with imageicon.\n" + + "Third radiobutton menuItem is unselected without imageicon.\n" + + "\n" + + "First checkbox menuitem is selected with imageicon.\n" + + "Second checkbox menuitem is unselected with imageicon.\n" + + "Third checkbox menuItem is unselected without imageicon.\n" + + "\n" + + "Verify that for first JRadioButtonMenuItem with imageicon,\n" + + "a bullet is shown alongside the imageicon and\n" + + "for first JCheckBoxMenuItem with imageicon\n" + + "a checkmark is shown alongside the imageicon.\n" + + "\n" + + "If bullet and checkmark is shown, test passes else fails."; + + private static final LinkedBlockingQueue resultQueue = new LinkedBlockingQueue(1); + + private static void endTest(boolean result) { + SwingUtilities.invokeLater( + new Runnable() { + public void run() { + try { + resultQueue.put(result); + } catch (Exception ignored) { + } + } + }); + } + + public static void main(String[] args) throws Exception { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + TestRadioAndCheckMenuItemWithIcon.doTest(); + } + }); + + Boolean testPasses = resultQueue.take(); + + if (!testPasses) { + throw new Exception("Test failed!"); + } + } + + public static void doTest() { + BufferedImage img = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB); + Graphics g = img.getGraphics(); + g.setColor(Color.red); + g.fillRect(0, 0, img.getWidth(), img.getHeight()); + g.dispose(); + + BufferedImage img2 = new BufferedImage(64, 64, BufferedImage.TYPE_INT_ARGB); + Graphics g2 = img2.getGraphics(); + g2.setColor(Color.red); + g2.fillRect(0, 0, img2.getWidth(), img2.getHeight()); + g2.dispose(); + + JFrame frame = new JFrame("RadioButtonWithImageIcon"); + ImageIcon imageIcon1 = new ImageIcon(img); + ImageIcon imageIcon2 = new ImageIcon(img2); + AbstractButton button1; + JRadioButtonMenuItem m1 = new JRadioButtonMenuItem("JRadioButtonMenuItem 1", + imageIcon1); + m1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, ActionEvent.ALT_MASK|ActionEvent.CTRL_MASK|ActionEvent.SHIFT_MASK)); + button1 = m1; + button1.setSelected(true); + AbstractButton button2 = new JRadioButtonMenuItem("JRadioButtonMenuItem 2", imageIcon2); + AbstractButton button3 = new JRadioButtonMenuItem("JRadioButtonMenuItem 3"); + + ButtonGroup buttonGroup = new ButtonGroup(); + buttonGroup.add(button1); + buttonGroup.add(button2); + buttonGroup.add(button3); + + AbstractButton check1 = new JCheckBoxMenuItem("JCheckBoxMenuItem 1", + imageIcon1); + check1.setSelected(true); + AbstractButton check2 = new JCheckBoxMenuItem("JCheckBoxMenuItem 2", imageIcon1); + JCheckBoxMenuItem c3; + AbstractButton check3 = c3 = new JCheckBoxMenuItem("JCheckBoxMenuItem 3"); + c3.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F5, ActionEvent.ALT_MASK|ActionEvent.CTRL_MASK|ActionEvent.SHIFT_MASK)); + + JMenu topLevel = new JMenu("Menu"); + + topLevel.add(button1); + topLevel.add(button2); + topLevel.add(button3); + + topLevel.addSeparator(); + + topLevel.add(check1); + topLevel.add(check2); + topLevel.add(check3); + + AbstractButton menuitem1 = new JMenuItem("MenuItem1"); + AbstractButton menuitem2 = new JMenuItem("MenuItem2", imageIcon1); + topLevel.addSeparator(); + topLevel.add(menuitem1); + topLevel.add(menuitem2); + + JMenuBar menuBar = new JMenuBar(); + menuBar.add(topLevel); + + frame.setJMenuBar(menuBar); + + JTextArea instructions = new JTextArea(); + instructions.setText(INSTRUCTIONS); + instructions.setEditable(false); + instructions.setColumns(80); + instructions.setRows(24); + + JScrollPane scrInstructions = new JScrollPane(instructions); + frame.getContentPane().setLayout(new BorderLayout()); + + frame.getContentPane().add(scrInstructions, BorderLayout.CENTER); + + JPanel yesno = new JPanel(); + yesno.setLayout(new GridLayout(1, 2, 40, 40)); + + JButton yes = new JButton("Passes"); + JButton no = new JButton("Fails"); + yesno.add(yes); + yesno.add(no); + + yes.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + frame.dispose(); + endTest(true); + } + }); + + no.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + frame.dispose(); + endTest(false); + } + }); + + frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + frame.addWindowListener(new WindowAdapter() { + @Override + public void windowClosed(WindowEvent e) { + frame.dispose(); + endTest(false); + } + }); + + frame.getContentPane().add(yesno, BorderLayout.SOUTH); + + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } +} From 2e6cbc976f558ccbf004f2803d82be70ad20dfde Mon Sep 17 00:00:00 2001 From: Severin Gehwolf Date: Fri, 26 Sep 2025 15:47:15 +0000 Subject: [PATCH 27/31] 8368308: ISO 4217 Amendment 180 Update Reviewed-by: andrew Backport-of: 85f5bf3f415cc3d44d1618ec574e73f846bb91c4 --- .../share/classes/java/util/CurrencyData.properties | 8 ++++---- jdk/test/java/util/Currency/ISO4217-list-one.txt | 12 ++++++------ jdk/test/java/util/Currency/ValidateISO4217.java | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/jdk/src/share/classes/java/util/CurrencyData.properties b/jdk/src/share/classes/java/util/CurrencyData.properties index 4b87809f4b7..7d1b74b5d1a 100644 --- a/jdk/src/share/classes/java/util/CurrencyData.properties +++ b/jdk/src/share/classes/java/util/CurrencyData.properties @@ -32,7 +32,7 @@ formatVersion=3 # Version of the currency code information in this class. # It is a serial number that accompanies with each amendment. -dataVersion=179 +dataVersion=180 # List of all valid ISO 4217 currency codes. # To ensure compatibility, do not remove codes. @@ -147,7 +147,7 @@ IO=USD # BRUNEI DARUSSALAM BN=BND # BULGARIA -BG=BGN +BG=BGN;2025-12-31-22-00-00;EUR # BURKINA FASO BF=XOF # BURUNDI @@ -193,7 +193,7 @@ HR=EUR # CUBA CU=CUP # Cura\u00e7ao -CW=ANG;2025-04-01-04-00-00;XCG +CW=XCG # CYPRUS CY=EUR # CZECHIA @@ -508,7 +508,7 @@ SR=SRD # SVALBARD AND JAN MAYEN SJ=NOK # Sint Maarten (Dutch part) -SX=ANG;2025-04-01-04-00-00;XCG +SX=XCG # ESWATINI SZ=SZL # SWEDEN diff --git a/jdk/test/java/util/Currency/ISO4217-list-one.txt b/jdk/test/java/util/Currency/ISO4217-list-one.txt index aa8c2725899..ca4bfd6dc94 100644 --- a/jdk/test/java/util/Currency/ISO4217-list-one.txt +++ b/jdk/test/java/util/Currency/ISO4217-list-one.txt @@ -1,12 +1,12 @@ # # -# Amendments up until ISO 4217 AMENDMENT NUMBER 179 -# (As of 02 May 2025) +# Amendments up until ISO 4217 AMENDMENT NUMBER 180 +# (As of 22 September 2025) # # Version FILEVERSION=3 -DATAVERSION=179 +DATAVERSION=180 # ISO 4217 currency data AF AFN 971 2 @@ -44,7 +44,7 @@ BV NOK 578 2 BR BRL 986 2 IO USD 840 2 BN BND 96 2 -BG BGN 975 2 +BG BGN 975 2 2025-12-31-22-00-00 EUR 978 2 BF XOF 952 0 BI BIF 108 0 KH KHR 116 2 @@ -69,7 +69,7 @@ CR CRC 188 2 CI XOF 952 0 HR EUR 978 2 CU CUP 192 2 -CW ANG 532 2 2025-04-01-04-00-00 XCG 532 2 +CW XCG 532 2 CY EUR 978 2 CZ CZK 203 2 DK DKK 208 2 @@ -233,7 +233,7 @@ LK LKR 144 2 SD SDG 938 2 SR SRD 968 2 SJ NOK 578 2 -SX ANG 532 2 2025-04-01-04-00-00 XCG 532 2 +SX XCG 532 2 SZ SZL 748 2 SE SEK 752 2 CH CHF 756 2 diff --git a/jdk/test/java/util/Currency/ValidateISO4217.java b/jdk/test/java/util/Currency/ValidateISO4217.java index 50ef6c15d48..9e49a44f9e0 100644 --- a/jdk/test/java/util/Currency/ValidateISO4217.java +++ b/jdk/test/java/util/Currency/ValidateISO4217.java @@ -25,7 +25,7 @@ * @bug 4691089 4819436 4942982 5104960 6544471 6627549 7066203 7195759 * 8074350 8074351 8145952 8187946 8193552 8202026 8204269 * 8208746 8209775 8274658 8283277 8296239 8321480 8334653 - * 8356096 + * 8356096 8368308 * @summary Validate ISO 4217 data for Currency class. */ @@ -95,7 +95,7 @@ public class ValidateISO4217 { /* Codes that are obsolete, do not have related country, extra currency */ static final String otherCodes = - "ADP-AFA-ATS-AYM-AZM-BEF-BGL-BOV-BYB-BYR-CHE-CHW-CLF-COU-CUC-CYP-" + "ADP-AFA-ATS-AYM-AZM-BEF-BGL-BGN-BOV-BYB-BYR-CHE-CHW-CLF-COU-CUC-CYP-" + "DEM-EEK-ESP-FIM-FRF-GHC-GRD-GWP-HRK-IEP-ITL-LTL-LUF-LVL-MGF-MRO-MTL-MXV-MZM-NLG-" + "PTE-ROL-RUR-SDD-SIT-SLL-SKK-SRG-STD-TMM-TPE-TRL-VEF-UYI-USN-USS-VEB-VED-" + "XAD-XAG-XAU-XBA-XBB-XBC-XBD-XDR-XFO-XFU-XPD-XPT-XSU-XTS-XUA-XXX-" From 5cffbcb0344f2cf16682a09519894ba705182241 Mon Sep 17 00:00:00 2001 From: Andrew John Hughes Date: Fri, 26 Sep 2025 15:53:13 +0000 Subject: [PATCH 28/31] 8365389: Remove static color fields from SwingUtilities3 and WindowsMenuItemUI Reviewed-by: sgehwolf Backport-of: 3468c6e5ef7e7592cf9484736ce333fbe0eaf34d --- .../com/sun/java/swing/SwingUtilities3.java | 21 ++------ .../windows/WindowsCheckBoxMenuItemUI.java | 4 +- .../swing/plaf/windows/WindowsMenuItemUI.java | 52 +++++-------------- .../swing/plaf/windows/WindowsMenuUI.java | 3 +- .../windows/WindowsRadioButtonMenuItemUI.java | 4 +- .../swing/plaf/basic/BasicMenuItemUI.java | 9 ++-- 6 files changed, 28 insertions(+), 65 deletions(-) diff --git a/jdk/src/share/classes/com/sun/java/swing/SwingUtilities3.java b/jdk/src/share/classes/com/sun/java/swing/SwingUtilities3.java index c29297a630a..624733ac41c 100644 --- a/jdk/src/share/classes/com/sun/java/swing/SwingUtilities3.java +++ b/jdk/src/share/classes/com/sun/java/swing/SwingUtilities3.java @@ -70,10 +70,6 @@ public class SwingUtilities3 { private static final Object DELEGATE_REPAINT_MANAGER_KEY = new StringBuilder("DelegateRepaintManagerKey"); - private static Color disabledForeground; - private static Color acceleratorSelectionForeground; - private static Color acceleratorForeground; - /** * Registers delegate RepaintManager for {@code JComponent}. */ @@ -181,7 +177,10 @@ public static void paintIcon(Graphics g, MenuItemLayoutHelper lh, public static void paintAccText(Graphics g, MenuItemLayoutHelper lh, - MenuItemLayoutHelper.LayoutResult lr) { + MenuItemLayoutHelper.LayoutResult lr, + Color disabledForeground, + Color acceleratorSelectionForeground, + Color acceleratorForeground) { if (!lh.getAccText().isEmpty()) { ButtonModel model = lh.getMenuItem().getModel(); g.setFont(lh.getAccFontMetrics().getFont()); @@ -220,18 +219,6 @@ public static void paintAccText(Graphics g, MenuItemLayoutHelper lh, } } - public static void setDisabledForeground(Color disabledFg) { - disabledForeground = disabledFg; - } - - public static void setAcceleratorSelectionForeground(Color acceleratorSelectionFg) { - acceleratorSelectionForeground = acceleratorSelectionFg; - } - - public static void setAcceleratorForeground(Color acceleratorFg) { - acceleratorForeground = acceleratorFg; - } - public static void paintArrowIcon(Graphics g, MenuItemLayoutHelper lh, MenuItemLayoutHelper.LayoutResult lr, Color foreground) { diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsCheckBoxMenuItemUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsCheckBoxMenuItemUI.java index fdf109c9ddd..9efdc860d6d 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsCheckBoxMenuItemUI.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsCheckBoxMenuItemUI.java @@ -84,7 +84,9 @@ protected void paintMenuItem(Graphics g, JComponent c, int defaultTextIconGap) { if (WindowsMenuItemUI.isVistaPainting()) { WindowsMenuItemUI.paintMenuItem(accessor, g, c, checkIcon, - arrowIcon, background, foreground, defaultTextIconGap, + arrowIcon, background, foreground, + disabledForeground, acceleratorSelectionForeground, + acceleratorForeground, defaultTextIconGap, menuItem, getPropertyPrefix()); return; } diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java index 41995f322db..c74f0490eea 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java @@ -51,10 +51,6 @@ */ public class WindowsMenuItemUI extends BasicMenuItemUI { - private static Color disabledForeground; - private static Color acceleratorSelectionForeground; - private static Color acceleratorForeground; - final WindowsMenuItemUIAccessor accessor = new WindowsMenuItemUIAccessor() { @@ -96,36 +92,6 @@ protected void installDefaults() { } - private static void applyInsets(Rectangle rect, Insets insets) { - SwingUtilities3.applyInsets(rect, insets); - } - - private static void paintCheckIcon(Graphics g, MenuItemLayoutHelper lh, - MenuItemLayoutHelper.LayoutResult lr, - Color holdc, Color foreground) { - SwingUtilities3.paintCheckIcon(g, lh, lr, holdc, foreground); - } - - private static void paintIcon(Graphics g, MenuItemLayoutHelper lh, - MenuItemLayoutHelper.LayoutResult lr, Color holdc) { - SwingUtilities3.paintIcon(g, lh, lr, holdc); - } - - private static void paintAccText(Graphics g, MenuItemLayoutHelper lh, - MenuItemLayoutHelper.LayoutResult lr) { - SwingUtilities3.setDisabledForeground(disabledForeground); - SwingUtilities3.setAcceleratorSelectionForeground( - acceleratorSelectionForeground); - SwingUtilities3.setAcceleratorForeground(acceleratorForeground); - SwingUtilities3.paintAccText(g, lh, lr); - } - - private static void paintArrowIcon(Graphics g, MenuItemLayoutHelper lh, - MenuItemLayoutHelper.LayoutResult lr, - Color foreground) { - SwingUtilities3.paintArrowIcon(g, lh, lr, foreground); - } - protected void paintMenuItem(Graphics g, JComponent c, Icon checkIcon, Icon arrowIcon, Color background, Color foreground, @@ -133,7 +99,8 @@ protected void paintMenuItem(Graphics g, JComponent c, if (WindowsMenuItemUI.isVistaPainting()) { WindowsMenuItemUI.paintMenuItem(accessor, g, c, checkIcon, arrowIcon, background, foreground, - defaultTextIconGap, menuItem, + disabledForeground, acceleratorSelectionForeground, + acceleratorForeground, defaultTextIconGap, menuItem, getPropertyPrefix()); return; } @@ -144,6 +111,9 @@ protected void paintMenuItem(Graphics g, JComponent c, static void paintMenuItem(WindowsMenuItemUIAccessor accessor, Graphics g, JComponent c, Icon checkIcon, Icon arrowIcon, Color background, Color foreground, + Color disabledForeground, + Color acceleratorSelectionForeground, + Color acceleratorForeground, int defaultTextIconGap, JMenuItem menuItem, String prefix) { // Save original graphics font and color Font holdf = g.getFont(); @@ -153,7 +123,7 @@ static void paintMenuItem(WindowsMenuItemUIAccessor accessor, Graphics g, g.setFont(mi.getFont()); Rectangle viewRect = new Rectangle(0, 0, mi.getWidth(), mi.getHeight()); - applyInsets(viewRect, mi.getInsets()); + SwingUtilities3.applyInsets(viewRect, mi.getInsets()); String acceleratorDelimiter = UIManager.getString("MenuItem.acceleratorDelimiter"); @@ -171,8 +141,8 @@ static void paintMenuItem(WindowsMenuItemUIAccessor accessor, Graphics g, MenuItemLayoutHelper.LayoutResult lr = lh.layoutMenuItem(); paintBackground(accessor, g, mi, background); - paintCheckIcon(g, lh, lr, holdc, foreground); - paintIcon(g, lh, lr, holdc); + SwingUtilities3.paintCheckIcon(g, lh, lr, holdc, foreground); + SwingUtilities3.paintIcon(g, lh, lr, holdc); if (lh.getCheckIcon() != null && lh.useCheckAndArrow()) { Rectangle rect = lr.getTextRect(); @@ -196,8 +166,10 @@ static void paintMenuItem(WindowsMenuItemUIAccessor accessor, Graphics g, rect.x += lh.getAfterCheckIconGap(); lr.setAccRect(rect); } - paintAccText(g, lh, lr); - paintArrowIcon(g, lh, lr, foreground); + SwingUtilities3.paintAccText(g, lh, lr, disabledForeground, + acceleratorSelectionForeground, + acceleratorForeground); + SwingUtilities3.paintArrowIcon(g, lh, lr, foreground); // Restore original graphics font and color g.setColor(holdc); diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuUI.java index d81e172a28e..c5bd54edf2f 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuUI.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuUI.java @@ -133,7 +133,8 @@ protected void paintMenuItem(Graphics g, JComponent c, if (WindowsMenuItemUI.isVistaPainting()) { WindowsMenuItemUI.paintMenuItem(accessor, g, c, checkIcon, arrowIcon, background, foreground, - defaultTextIconGap, menuItem, + disabledForeground, acceleratorSelectionForeground, + acceleratorForeground, defaultTextIconGap, menuItem, getPropertyPrefix()); return; } diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsRadioButtonMenuItemUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsRadioButtonMenuItemUI.java index 55007916030..41bcfb7b868 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsRadioButtonMenuItemUI.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsRadioButtonMenuItemUI.java @@ -83,7 +83,9 @@ protected void paintMenuItem(Graphics g, JComponent c, int defaultTextIconGap) { if (WindowsMenuItemUI.isVistaPainting()) { WindowsMenuItemUI.paintMenuItem(accessor, g, c, checkIcon, - arrowIcon, background, foreground, defaultTextIconGap, + arrowIcon, background, foreground, + disabledForeground, acceleratorSelectionForeground, + acceleratorForeground, defaultTextIconGap, menuItem, getPropertyPrefix()); return; } diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java index 0d45bb54f0f..0467cf11d4d 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java @@ -607,11 +607,10 @@ private void paintCheckIcon(Graphics g, MenuItemLayoutHelper lh, private void paintAccText(Graphics g, MenuItemLayoutHelper lh, MenuItemLayoutHelper.LayoutResult lr) { - SwingUtilities3.setDisabledForeground(disabledForeground); - SwingUtilities3.setAcceleratorSelectionForeground( - acceleratorSelectionForeground); - SwingUtilities3.setAcceleratorForeground(acceleratorForeground); - SwingUtilities3.paintAccText(g, lh, lr); + SwingUtilities3.paintAccText(g, lh, lr, + disabledForeground, + acceleratorSelectionForeground, + acceleratorForeground); } private void paintText(Graphics g, MenuItemLayoutHelper lh, From 327303315367f15113c17c8525d8eb3bc0f66782 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Wed, 10 Sep 2025 18:12:18 -0700 Subject: [PATCH 29/31] 8352637: Enhance bytecode verification Reviewed-by: fferrari, andrew Backport-of: 974f4da2e53ebde8b06224f4ba0b80aa74c5f434 --- .../src/share/vm/classfile/stackMapTable.cpp | 10 ++++- .../src/share/vm/classfile/stackMapTable.hpp | 2 +- hotspot/src/share/vm/classfile/verifier.cpp | 35 +++++++++-------- .../share/vm/interpreter/bytecodeStream.hpp | 19 ++++++++- jdk/src/share/native/common/check_code.c | 39 +++++++++++++------ 5 files changed, 74 insertions(+), 31 deletions(-) diff --git a/hotspot/src/share/vm/classfile/stackMapTable.cpp b/hotspot/src/share/vm/classfile/stackMapTable.cpp index 547dcf64b98..13606ae1611 100644 --- a/hotspot/src/share/vm/classfile/stackMapTable.cpp +++ b/hotspot/src/share/vm/classfile/stackMapTable.cpp @@ -122,8 +122,16 @@ bool StackMapTable::match_stackmap( } void StackMapTable::check_jump_target( - StackMapFrame* frame, int32_t target, TRAPS) const { + StackMapFrame* frame, int bci, int offset, TRAPS) const { ErrorContext ctx; + // Jump targets must be within the method and the method size is limited. See JVMS 4.11 + int min_offset = -1 * max_method_code_size; + if (offset < min_offset || offset > max_method_code_size) { + frame->verifier()->verify_error(ErrorContext::bad_stackmap(bci, frame), + "Illegal target of jump or branch (bci %d + offset %d)", bci, offset); + return; + } + int target = bci + offset; bool match = match_stackmap( frame, target, true, false, &ctx, CHECK_VERIFY(frame->verifier())); if (!match || (target < 0 || target >= _code_length)) { diff --git a/hotspot/src/share/vm/classfile/stackMapTable.hpp b/hotspot/src/share/vm/classfile/stackMapTable.hpp index a36a7ba3cfd..36fddb39880 100644 --- a/hotspot/src/share/vm/classfile/stackMapTable.hpp +++ b/hotspot/src/share/vm/classfile/stackMapTable.hpp @@ -86,7 +86,7 @@ class StackMapTable : public StackObj { // Check jump instructions. Make sure there are no uninitialized // instances on backward branch. - void check_jump_target(StackMapFrame* frame, int32_t target, TRAPS) const; + void check_jump_target(StackMapFrame* frame, int bci, int offset, TRAPS) const; // The following methods are only used inside this class. diff --git a/hotspot/src/share/vm/classfile/verifier.cpp b/hotspot/src/share/vm/classfile/verifier.cpp index 2dddd1fdedc..4662bf02a5d 100644 --- a/hotspot/src/share/vm/classfile/verifier.cpp +++ b/hotspot/src/share/vm/classfile/verifier.cpp @@ -668,7 +668,6 @@ void ClassVerifier::verify_method(methodHandle m, TRAPS) { // Merge with the next instruction { u2 index; - int target; VerificationType type, type2; VerificationType atype; @@ -1480,9 +1479,8 @@ void ClassVerifier::verify_method(methodHandle m, TRAPS) { case Bytecodes::_ifle: current_frame.pop_stack( VerificationType::integer_type(), CHECK_VERIFY(this)); - target = bcs.dest(); stackmap_table.check_jump_target( - ¤t_frame, target, CHECK_VERIFY(this)); + ¤t_frame, bcs.bci(), bcs.get_offset_s2(), CHECK_VERIFY(this)); no_control_flow = false; break; case Bytecodes::_if_acmpeq : case Bytecodes::_if_acmpne : @@ -1493,19 +1491,16 @@ void ClassVerifier::verify_method(methodHandle m, TRAPS) { case Bytecodes::_ifnonnull : current_frame.pop_stack( VerificationType::reference_check(), CHECK_VERIFY(this)); - target = bcs.dest(); stackmap_table.check_jump_target - (¤t_frame, target, CHECK_VERIFY(this)); + (¤t_frame, bcs.bci(), bcs.get_offset_s2(), CHECK_VERIFY(this)); no_control_flow = false; break; case Bytecodes::_goto : - target = bcs.dest(); stackmap_table.check_jump_target( - ¤t_frame, target, CHECK_VERIFY(this)); + ¤t_frame, bcs.bci(), bcs.get_offset_s2(), CHECK_VERIFY(this)); no_control_flow = true; break; case Bytecodes::_goto_w : - target = bcs.dest_w(); stackmap_table.check_jump_target( - ¤t_frame, target, CHECK_VERIFY(this)); + ¤t_frame, bcs.bci(), bcs.get_offset_s4(), CHECK_VERIFY(this)); no_control_flow = true; break; case Bytecodes::_tableswitch : case Bytecodes::_lookupswitch : @@ -2107,15 +2102,14 @@ void ClassVerifier::verify_switch( } } } - int target = bci + default_offset; - stackmap_table->check_jump_target(current_frame, target, CHECK_VERIFY(this)); + stackmap_table->check_jump_target(current_frame, bci, default_offset, CHECK_VERIFY(this)); for (int i = 0; i < keys; i++) { // Because check_jump_target() may safepoint, the bytecode could have // moved, which means 'aligned_bcp' is no good and needs to be recalculated. aligned_bcp = (address)round_to((intptr_t)(bcs->bcp() + 1), jintSize); - target = bci + (jint)Bytes::get_Java_u4(aligned_bcp+(3+i*delta)*jintSize); + int offset = (jint)Bytes::get_Java_u4(aligned_bcp+(3+i*delta)*jintSize); stackmap_table->check_jump_target( - current_frame, target, CHECK_VERIFY(this)); + current_frame, bci, offset, CHECK_VERIFY(this)); } NOT_PRODUCT(aligned_bcp = NULL); // no longer valid at this point } @@ -2376,8 +2370,13 @@ bool ClassVerifier::ends_in_athrow(u4 start_bc_offset) { break; case Bytecodes::_goto: - case Bytecodes::_goto_w: - target = (opcode == Bytecodes::_goto ? bcs.dest() : bcs.dest_w()); + case Bytecodes::_goto_w: { + int offset = (opcode == Bytecodes::_goto ? bcs.get_offset_s2() : bcs.get_offset_s4()); + int min_offset = -1 * max_method_code_size; + // Check offset for overflow + if (offset < min_offset || offset > max_method_code_size) return false; + + target = bci + offset; if (visited_branches->contains(bci)) { if (bci_stack->is_empty()) { if (handler_stack->is_empty()) { @@ -2398,6 +2397,7 @@ bool ClassVerifier::ends_in_athrow(u4 start_bc_offset) { visited_branches->append(bci); } break; + } // Check that all switch alternatives end in 'athrow' bytecodes. Since it // is difficult to determine where each switch alternative ends, parse @@ -2434,7 +2434,10 @@ bool ClassVerifier::ends_in_athrow(u4 start_bc_offset) { // Push the switch alternatives onto the stack. for (int i = 0; i < keys; i++) { - u4 target = bci + (jint)Bytes::get_Java_u4(aligned_bcp+(3+i*delta)*jintSize); + int min_offset = -1 * max_method_code_size; + int offset = (jint)Bytes::get_Java_u4(aligned_bcp+(3+i*delta)*jintSize); + if (offset < min_offset || offset > max_method_code_size) return false; + u4 target = bci + offset; if (target > code_length) return false; bci_stack->push(target); } diff --git a/hotspot/src/share/vm/interpreter/bytecodeStream.hpp b/hotspot/src/share/vm/interpreter/bytecodeStream.hpp index b814b88d5df..20f38950e1d 100644 --- a/hotspot/src/share/vm/interpreter/bytecodeStream.hpp +++ b/hotspot/src/share/vm/interpreter/bytecodeStream.hpp @@ -121,8 +121,23 @@ class BaseBytecodeStream: StackObj { void set_next_bci(int bci) { assert(0 <= bci && bci <= method()->code_size(), "illegal bci"); _next_bci = bci; } // Bytecode-specific attributes - int dest() const { return bci() + bytecode().get_offset_s2(raw_code()); } - int dest_w() const { return bci() + bytecode().get_offset_s4(raw_code()); } + int get_offset_s2() const { return bytecode().get_offset_s2(raw_code()); } + int get_offset_s4() const { return bytecode().get_offset_s4(raw_code()); } + + // These methods are not safe to use before or during verification as they may + // have large offsets and cause overflows + int dest() const { + int min_offset = -1 * max_method_code_size; + int offset = bytecode().get_offset_s2(raw_code()); + guarantee(offset >= min_offset && offset <= max_method_code_size, "must be"); + return bci() + offset; + } + int dest_w() const { + int min_offset = -1 * max_method_code_size; + int offset = bytecode().get_offset_s4(raw_code()); + guarantee(offset >= min_offset && offset <= max_method_code_size, "must be"); + return bci() + offset; + } // One-byte indices. int get_index_u1() const { assert_raw_index_size(1); return *(jubyte*)(bcp()+1); } diff --git a/jdk/src/share/native/common/check_code.c b/jdk/src/share/native/common/check_code.c index 799b8c654c0..0889c57f49d 100644 --- a/jdk/src/share/native/common/check_code.c +++ b/jdk/src/share/native/common/check_code.c @@ -396,7 +396,8 @@ static jboolean is_superclass(context_type *, fullinfo_type); static void initialize_exception_table(context_type *); static int instruction_length(unsigned char *iptr, unsigned char *end); -static jboolean isLegalTarget(context_type *, int offset); +static jboolean isLegalOffset(context_type *, int bci, int offset); +static jboolean isLegalTarget(context_type *, int target); static void verify_constant_pool_type(context_type *, int, unsigned); static void initialize_dataflow(context_type *); @@ -1161,9 +1162,9 @@ verify_opcode_operands(context_type *context, unsigned int inumber, int offset) case JVM_OPC_goto: { /* Set the ->operand to be the instruction number of the target. */ int jump = (((signed char)(code[offset+1])) << 8) + code[offset+2]; - int target = offset + jump; - if (!isLegalTarget(context, target)) + if (!isLegalOffset(context, offset, jump)) CCerror(context, "Illegal target of jump or branch"); + int target = offset + jump; this_idata->operand.i = code_data[target]; break; } @@ -1177,9 +1178,9 @@ verify_opcode_operands(context_type *context, unsigned int inumber, int offset) int jump = (((signed char)(code[offset+1])) << 24) + (code[offset+2] << 16) + (code[offset+3] << 8) + (code[offset + 4]); - int target = offset + jump; - if (!isLegalTarget(context, target)) + if (!isLegalOffset(context, offset, jump)) CCerror(context, "Illegal target of jump or branch"); + int target = offset + jump; this_idata->operand.i = code_data[target]; break; } @@ -1218,13 +1219,16 @@ verify_opcode_operands(context_type *context, unsigned int inumber, int offset) } } saved_operand = NEW(int, keys + 2); - if (!isLegalTarget(context, offset + _ck_ntohl(lpc[0]))) + int jump = _ck_ntohl(lpc[0]); + if (!isLegalOffset(context, offset, jump)) CCerror(context, "Illegal default target in switch"); - saved_operand[keys + 1] = code_data[offset + _ck_ntohl(lpc[0])]; + int target = offset + jump; + saved_operand[keys + 1] = code_data[target]; for (k = keys, lptr = &lpc[3]; --k >= 0; lptr += delta) { - int target = offset + _ck_ntohl(lptr[0]); - if (!isLegalTarget(context, target)) + jump = _ck_ntohl(lptr[0]); + if (!isLegalOffset(context, offset, jump)) CCerror(context, "Illegal branch in tableswitch"); + target = offset + jump; saved_operand[k + 1] = code_data[target]; } saved_operand[0] = keys + 1; /* number of successors */ @@ -1746,11 +1750,24 @@ static int instruction_length(unsigned char *iptr, unsigned char *end) /* Given the target of a branch, make sure that it's a legal target. */ static jboolean -isLegalTarget(context_type *context, int offset) +isLegalTarget(context_type *context, int target) +{ + int code_length = context->code_length; + int *code_data = context->code_data; + return (target >= 0 && target < code_length && code_data[target] >= 0); +} + +/* Given a bci and offset, make sure the offset is valid and the target is legal */ +static jboolean +isLegalOffset(context_type *context, int bci, int offset) { int code_length = context->code_length; int *code_data = context->code_data; - return (offset >= 0 && offset < code_length && code_data[offset] >= 0); + int max_offset = 65535; // JVMS 4.11 + int min_offset = -65535; + if (offset < min_offset || offset > max_offset) return JNI_FALSE; + int target = bci + offset; + return (target >= 0 && target < code_length && code_data[target] >= 0); } From dde48aedce2fe649e1737b3eec829428381bcb8f Mon Sep 17 00:00:00 2001 From: Aleksei Voitylov Date: Wed, 3 Sep 2025 01:47:08 +0000 Subject: [PATCH 30/31] 8356294: Enhance Path Factories Reviewed-by: abakhtin, fferrari, andrew Backport-of: 2c7f45612d11199a9d5eaa6d61a2893ec4afa687 --- .../xpath/internal/jaxp/XPathFactoryImpl.java | 1 + .../apache/xpath/internal/jaxp/XPathImpl.java | 5 +++++ .../src/jdk/xml/internal/XMLSecurityManager.java | 16 ++++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/jaxp/src/com/sun/org/apache/xpath/internal/jaxp/XPathFactoryImpl.java b/jaxp/src/com/sun/org/apache/xpath/internal/jaxp/XPathFactoryImpl.java index 0f1a2262c3e..217ad54b784 100644 --- a/jaxp/src/com/sun/org/apache/xpath/internal/jaxp/XPathFactoryImpl.java +++ b/jaxp/src/com/sun/org/apache/xpath/internal/jaxp/XPathFactoryImpl.java @@ -187,6 +187,7 @@ public void setFeature(String name, boolean value) if (value && _featureManager != null) { _featureManager.setFeature(JdkXmlFeatures.XmlFeature.ENABLE_EXTENSION_FUNCTION, JdkXmlFeatures.State.FSP, false); + _xmlSecMgr.setSecureProcessing(value); } // all done processing feature diff --git a/jaxp/src/com/sun/org/apache/xpath/internal/jaxp/XPathImpl.java b/jaxp/src/com/sun/org/apache/xpath/internal/jaxp/XPathImpl.java index 8d15deaad30..cc825766709 100644 --- a/jaxp/src/com/sun/org/apache/xpath/internal/jaxp/XPathImpl.java +++ b/jaxp/src/com/sun/org/apache/xpath/internal/jaxp/XPathImpl.java @@ -20,6 +20,7 @@ package com.sun.org.apache.xpath.internal.jaxp; +import javax.xml.XMLConstants; import javax.xml.namespace.QName; import javax.xml.namespace.NamespaceContext; import javax.xml.xpath.XPathExpressionException; @@ -180,6 +181,10 @@ private DocumentBuilder getParser() { // so we really have to create a fresh DocumentBuilder every time we need one // - KK DocumentBuilderFactory dbf = JdkXmlUtils.getDOMFactory(overrideDefaultParser); + if (xmlSecMgr != null && xmlSecMgr.isSecureProcessingSet()) { + dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, + xmlSecMgr.isSecureProcessing()); + } return dbf.newDocumentBuilder(); } catch (ParserConfigurationException e) { // this should never happen with a well-behaving JAXP implementation. diff --git a/jaxp/src/jdk/xml/internal/XMLSecurityManager.java b/jaxp/src/jdk/xml/internal/XMLSecurityManager.java index 2dd165757fd..64de41f51fd 100644 --- a/jaxp/src/jdk/xml/internal/XMLSecurityManager.java +++ b/jaxp/src/jdk/xml/internal/XMLSecurityManager.java @@ -189,6 +189,12 @@ public static enum Processor { */ boolean secureProcessing; + /** + * Flag indicating the secure processing is set explicitly through factories' + * setFeature method and then the setSecureProcessing method + */ + boolean secureProcessingSet; + /** * States that determine if properties are set explicitly */ @@ -236,6 +242,7 @@ public XMLSecurityManager(boolean secureProcessing) { * Setting FEATURE_SECURE_PROCESSING explicitly */ public void setSecureProcessing(boolean secure) { + secureProcessingSet = true; secureProcessing = secure; for (Limit limit : Limit.values()) { if (secure) { @@ -254,6 +261,15 @@ public boolean isSecureProcessing() { return secureProcessing; } + /** + * Returns the state indicating whether the Secure Processing is set explicitly, + * via factories' setFeature and then this class' setSecureProcessing method. + * @return the state indicating whether the Secure Processing is set explicitly + */ + public boolean isSecureProcessingSet() { + return secureProcessingSet; + } + /** * Set limit by property name and state * @param propertyName property name From d5ac2ad89a369697a48e7f3e6b889e22afa50a2f Mon Sep 17 00:00:00 2001 From: Alexey Bakhtin Date: Wed, 27 Aug 2025 13:50:17 -0700 Subject: [PATCH 31/31] 8360937: Enhance certificate handling Reviewed-by: fferrari, andrew Backport-of: d3b1c2be9e87aad07cac29d94679130fe5807c17 --- .../classes/sun/security/util/DerValue.java | 16 ++++++ .../share/classes/sun/security/x509/AVA.java | 55 ++++++++++++++++++- .../testlibrary/CertificateBuilder.java | 29 ++++++++-- 3 files changed, 92 insertions(+), 8 deletions(-) diff --git a/jdk/src/share/classes/sun/security/util/DerValue.java b/jdk/src/share/classes/sun/security/util/DerValue.java index b7d1714769e..2dd262ba993 100644 --- a/jdk/src/share/classes/sun/security/util/DerValue.java +++ b/jdk/src/share/classes/sun/security/util/DerValue.java @@ -822,6 +822,22 @@ public boolean equals(Object o) { doEquals(other, this); } + /** + * Checks that the BMPString does not contain any surrogate characters, + * which are outside the Basic Multilingual Plane. + * + * @throws IOException if illegal characters are detected + */ + public void validateBMPString() throws IOException { + String bmpString = getBMPString(); + for (int i = 0; i < bmpString.length(); i++) { + if (Character.isSurrogate(bmpString.charAt(i))) { + throw new IOException( + "Illegal character in BMPString, index: " + i); + } + } + } + /** * Helper for public method equals() */ diff --git a/jdk/src/share/classes/sun/security/x509/AVA.java b/jdk/src/share/classes/sun/security/x509/AVA.java index 8665745c350..f896b8d6e8e 100644 --- a/jdk/src/share/classes/sun/security/x509/AVA.java +++ b/jdk/src/share/classes/sun/security/x509/AVA.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2025, 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,9 +30,14 @@ import java.io.OutputStream; import java.io.Reader; import java.security.AccessController; +import java.nio.charset.Charset; import java.text.Normalizer; import java.util.*; +import static java.nio.charset.StandardCharsets.ISO_8859_1; +import static java.nio.charset.StandardCharsets.UTF_8; +import static java.nio.charset.StandardCharsets.UTF_16BE; + import sun.security.action.GetBooleanAction; import sun.security.util.*; import sun.security.pkcs.PKCS9Attribute; @@ -606,6 +611,10 @@ private static boolean trailingSpace(Reader in) throws IOException { throw new IOException("AVA, extra bytes = " + derval.data.available()); } + + if (value.tag == DerValue.tag_BMPString) { + value.validateBMPString(); + } } AVA(DerInputStream in) throws IOException { @@ -753,7 +762,7 @@ public String toRFC2253String(Map oidMap) { */ String valStr = null; try { - valStr = new String(value.getDataBytes(), "UTF8"); + valStr = new String(value.getDataBytes(), getCharset(value, false)); } catch (IOException ie) { throw new IllegalArgumentException("DER Value conversion"); } @@ -906,7 +915,7 @@ public String toRFC2253CanonicalString() { */ String valStr = null; try { - valStr = new String(value.getDataBytes(), "UTF8"); + valStr = new String(value.getDataBytes(), getCharset(value, true)); } catch (IOException ie) { throw new IllegalArgumentException("DER Value conversion"); } @@ -1026,6 +1035,46 @@ private static boolean isDerString(DerValue value, boolean canonical) { } } + /* + * Returns the charset that should be used to decode each DN string type. + * + * This method ensures that multi-byte (UTF8String and BMPString) types + * are decoded using the correct charset and the String forms represent + * the correct characters. For 8-bit ASCII-based types (PrintableString + * and IA5String), we return ISO_8859_1 rather than ASCII, so that the + * complete range of characters can be represented, as many certificates + * do not comply with the Internationalized Domain Name ACE format. + * + * NOTE: this method only supports DirectoryStrings of the types returned + * by isDerString(). + */ + private static Charset getCharset(DerValue value, boolean canonical) { + if (canonical) { + switch (value.tag) { + case DerValue.tag_PrintableString: + return ISO_8859_1; + case DerValue.tag_UTF8String: + return UTF_8; + default: + throw new Error("unexpected tag: " + value.tag); + } + } + + switch (value.tag) { + case DerValue.tag_PrintableString: + case DerValue.tag_T61String: + case DerValue.tag_IA5String: + case DerValue.tag_GeneralString: + return ISO_8859_1; + case DerValue.tag_BMPString: + return UTF_16BE; + case DerValue.tag_UTF8String: + return UTF_8; + default: + throw new Error("unexpected tag: " + value.tag); + } + } + boolean hasRFC2253Keyword() { return AVAKeyword.hasKeyword(oid, RFC2253); } diff --git a/jdk/test/java/security/testlibrary/CertificateBuilder.java b/jdk/test/java/security/testlibrary/CertificateBuilder.java index 4ab26d0d12e..b8cb1a73b46 100644 --- a/jdk/test/java/security/testlibrary/CertificateBuilder.java +++ b/jdk/test/java/security/testlibrary/CertificateBuilder.java @@ -53,6 +53,7 @@ import sun.security.x509.SubjectAlternativeNameExtension; import sun.security.x509.URIName; import sun.security.x509.KeyIdentifier; +import sun.security.x509.X500Name; /** * Helper class that builds and signs X.509 certificates. @@ -89,7 +90,7 @@ public class CertificateBuilder { private final CertificateFactory factory; - private X500Principal subjectName = null; + private X500Name subjectName = null; private BigInteger serialNumber = null; private PublicKey publicKey = null; private Date notBefore = null; @@ -114,8 +115,9 @@ public CertificateBuilder() throws CertificateException { * @param name An {@link X500Principal} to be used as the subject name * on this certificate. */ - public void setSubjectName(X500Principal name) { - subjectName = name; + public CertificateBuilder setSubjectName(X500Principal name) { + subjectName = X500Name.asX500Name(name); + return this; } /** @@ -123,8 +125,25 @@ public void setSubjectName(X500Principal name) { * * @param name The subject name in RFC 2253 format */ - public void setSubjectName(String name) { - subjectName = new X500Principal(name); + public CertificateBuilder setSubjectName(String name) { + try { + subjectName = new X500Name(name); + } catch (IOException ioe) { + throw new IllegalArgumentException(ioe); + } + return this; + } + + /** + * Set the subject name for the certificate. This method is useful when + * you need more control over the contents of the subject name. + * + * @param name an {@code X500Name} to be used as the subject name + * on this certificate + */ + public CertificateBuilder setSubjectName(X500Name name) { + subjectName = name; + return this; } /**