[jdk21u-dev] RFR: 8348986: Improve coverage of enhanced exception messages

Severin Gehwolf sgehwolf at openjdk.org
Mon Sep 29 09:15:10 UTC 2025


On Fri, 29 Aug 2025 00:23:47 GMT, Alexey Bakhtin <abakhtin at openjdk.org> wrote:

> I'd like to backport JDK-8348986 to control sensitive information in Exception messages.
> 
> Backport is not clean. The following changes were applied manually:
> - src/java.base/share/classes/module-info.java
>   - exports jdk.internal.util updated manually because JDK25 has more dependencies 
> - src/java.base/share/classes/sun/nio/ch/DatagramSocketAdaptor.java
>   - copyright year
> - src/java.base/share/classes/sun/nio/ch/SocketAdaptor.java
>   - changes discarded. JDK21 does not have JDK-8343791 and related changes (Socket::connect() does not throw UnknownHostException)
> - src/java.base/unix/classes/sun/nio/ch/UnixAsynchronousSocketChannelImpl.java
>   - trivial merge in the import section, copyright year is updated
> - src/java.base/unix/classes/sun/nio/fs/UnixUserPrincipals.java
>   - trivial merge in the lookupName() method. JDK21 version still has SecurityManager related code
>   - copyright year
> - src/java.base/share/classes/sun/net/util/IPAddressUtil.java
>   - JDK21 does not have JDK-8272215 It can not be backported because of API changes. validateNumericFormatV4() method is changed instead of invalidIpAddressLiteral
>   - copyright year
> - src/jdk.httpserver/share/classes/sun/net/httpserver/simpleserver/JWebServer.java
>   - setEnhancedExceptions method was added manually because of a context difference
> - src/java.base/share/classes/java/net/HostPortrange.java
>   - copyright year
> - src/java.base/share/classes/java/net/Inet6Address.java
>   - changes discarded. JDK21 does not have JDK-8272215 and related functionality. 
> - src/java.base/share/classes/java/net/InetAddress.java
>   - UnknownHostException in the getLocalHost method is updated manually because of a context difference
>   - copyright year
> - src/java.base/share/classes/java/net/Proxy.java
>   - copyright year
>   - import section
> - src/java.base/share/classes/java/net/SocketPermission.java
>   - copyright year
> - src/java.base/share/classes/java/net/SocksSocketImpl.java
>   - copyright year
>   - import section
> - src/java.base/share/classes/java/net/URL.java
>   - copyright year
>   - import section
> - src/java.net.http/share/classes/jdk/internal/net/http/websocket/OpeningHandshake.java
>   - copyright year
> - src/java.base/share/native/libnet/net_util.c
>   - copyright year
> - src/java.base/share/native/libnet/net_util.h
>   - copyright year
> - src/java.base/unix/native/libnet/net_util_md.c
>   - copyright year
> - src/java.base/windows/classes/sun/nio/ch/WindowsAsynchronousSocketChannelImpl.java
>   - copyright year
>   - import section
> - src/java.base...

Failure is:

java.lang.Exception: Module module java.net.http has not been granted ("java.lang.RuntimePermission" "accessClassInPackage.jdk.internal.util")
	at CheckAccessClassInPackagePermissions.main(CheckAccessClassInPackagePermissions.java:114)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:333)
	at java.base/java.lang.Thread.run(Thread.java:1583)


> java/lang/SecurityManager/CheckAccessClassInPackagePermissions test failure is not related to the current changes

@alexeybakhtin I highly doubt that. We don't see the failure anywhere else in JDK 21u. See https://github.com/openjdk/jdk21u-dev/pulls for other PRs which have clean CI. Also this patch touches the `java.net.http` module in a very relevant way. This needs to be fixed.

-------------

PR Comment: https://git.openjdk.org/jdk21u-dev/pull/2132#issuecomment-3345861196


More information about the jdk-updates-dev mailing list