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

Sergey Chernyshev schernyshev at openjdk.org
Mon Sep 29 13:54:52 UTC 2025


On Tue, 23 Sep 2025 19:49:19 GMT, Alexey Bakhtin <abakhtin at openjdk.org> wrote:

> I'd like to backport JDK-8348986 to control sensitive information in Exception messages.
> 
> Backport from https://github.com/openjdk/jdk21u-dev/pull/2132 is not clean. The following changes were applied manually:
> - src/java.base/share/classes/sun/nio/ch/DatagramSocketAdaptor.java
>     - copyright year
> - src/java.base/share/classes/sun/nio/ch/NioSocketImpl.java
>     - Throwing IOException from the connect() method is updated manually because of a context difference
> - src/java.base/share/classes/module-info.java
>     - exports sun.security.util updated manually
> - src/java.base/share/classes/java/net/Inet4AddressImpl.java
>     - changes discarded. JDK17 does not have JDK-8244202 and related changes : lookupAllHostAddr(String hostname, LookupPolicy lookupPolicy)
> - src/java.base/share/classes/java/net/InetAddress.java
>     - throwing UnknownHostException from NameServiceAddresses::get is updated manually because of context differences
>     - import section
>     - no CachecdLookup and ValidCachedLookup classes in JDK17. changes discarded
> - src/java.base/share/classes/java/net/Proxy.java
>     - copyright year
> - src/java.base/share/classes/java/net/SocketPermission.java
>     - copyright year
> - src/java.base/share/classes/java/net/SocksSocketImpl.java
>     - copyright year
> - src/java.base/share/classes/java/net/URI.java
>     - import section
> - src/java.base/share/classes/java/net/URL.java
>     - copyright year
> - src/java.base/share/classes/java/net/URLStreamHandler.java
>     - copyright year
> - src/java.base/share/classes/sun/net/www/protocol/jar/Handler.java
>     - copyright year
> - src/java.base/windows/native/libnet/Inet4AddressImpl.c
>     - copyright year
> - src/java.base/windows/native/libnet/Inet6AddressImpl.c
>     - copyright year
> - src/java.base/share/native/libnet/net_util.h
>     - copyright year
>     - getEnhancedExceptionsAllowed() declaration added manually because of context difference
> - src/java.naming/share/classes/com/sun/jndi/toolkit/url/Uri.java
>     - parseCompat method is updated manually because of context differences
> - src/java.base/windows/classes/sun/nio/ch/WindowsAsynchronousSocketChannelImpl.java
>     - copyright year
> - src/java.base/windows/classes/sun/nio/fs/WindowsUserPrincipals.java
>     - copyright year
>     - lookup method is updated manually because of context differences
> - src/jdk.httpserver/share/classes/sun/net/httpserver/simpleserver/JWebServer.java
>     - no such class in JDK17
> 
> Modified and related JTREG tests are passed

src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java line 879:

> 877:             // connect failed, close the channel
> 878:             close();
> 879:             throw Exceptions.ioException(ioe, sa);

A similar change is needed also in `AbstractPlainSocketImpl.java`

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

PR Review Comment: https://git.openjdk.org/jdk17u-dev/pull/3989#discussion_r2388073416


More information about the jdk-updates-dev mailing list