Skip to content

8348986: Improve coverage of enhanced exception messages#2132

Open
alexeybakhtin wants to merge 2 commits intoopenjdk:masterfrom
alexeybakhtin:JDK-8348986
Open

8348986: Improve coverage of enhanced exception messages#2132
alexeybakhtin wants to merge 2 commits intoopenjdk:masterfrom
alexeybakhtin:JDK-8348986

Conversation

@alexeybakhtin
Copy link

@alexeybakhtin alexeybakhtin commented Aug 29, 2025

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/windows/classes/sun/nio/fs/WindowsUserPrincipals.java
    • copyright year
  • src/java.base/share/classes/sun/net/www/protocol/jar/JarFileFactory.java
    • changes discarded. JDK21 does not have JDK-8341142 and related functionality.

Modified and related JTREG tests are passed


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • JDK-8348986 needs maintainer approval
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change requires CSR request JDK-8366459 to be approved

Issues

  • JDK-8348986: Improve coverage of enhanced exception messages (Enhancement - P3)
  • JDK-8366459: Improve coverage of enhanced exception messages (CSR)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk21u-dev.git pull/2132/head:pull/2132
$ git checkout pull/2132

Update a local copy of the PR:
$ git checkout pull/2132
$ git pull https://git.openjdk.org/jdk21u-dev.git pull/2132/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 2132

View PR using the GUI difftool:
$ git pr show -t 2132

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk21u-dev/pull/2132.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 29, 2025

👋 Welcome back abakhtin! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Aug 29, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot changed the title Backport b6f827ef054959662190e21ce63fc3d3c45b92f3 8348986: Improve coverage of enhanced exception messages Aug 29, 2025
@openjdk
Copy link

openjdk bot commented Aug 29, 2025

This backport pull request has now been updated with issue from the original commit.

@openjdk openjdk bot added the backport Port of a pull request already in a different code base label Aug 29, 2025
@openjdk
Copy link

openjdk bot commented Aug 29, 2025

At least one of the issues associated with this backport has a resolved CSR for a different version. As this means that this backport may also need a CSR, the csr label is being added to this pull request to signal this potential requirement. The command /csr unneeded can be used to remove the label in case a CSR is not needed.

@openjdk openjdk bot added csr Pull request needs approved CSR before integration rfr Pull request is ready for review labels Aug 29, 2025
@mlbridge
Copy link

mlbridge bot commented Aug 29, 2025

Webrevs

@openjdk openjdk bot removed the csr Pull request needs approved CSR before integration label Sep 4, 2025
@alexeybakhtin
Copy link
Author

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

@jerboaa
Copy link
Contributor

jerboaa commented Sep 29, 2025

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.

@alexeybakhtin
Copy link
Author

@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.

Thank you. You are right. I've added accessClassInPackage.jdk.internal.util permission to the java java.net.http module

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 28, 2025

@alexeybakhtin This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply issue a /touch or /keepalive command to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 25, 2025

@alexeybakhtin This pull request has been inactive for more than 8 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! This can be done using the /open pull request command.

@bridgekeeper bridgekeeper bot closed this Nov 25, 2025
@alexeybakhtin
Copy link
Author

/open

@openjdk openjdk bot reopened this Feb 4, 2026
@openjdk
Copy link

openjdk bot commented Feb 4, 2026

@alexeybakhtin This pull request is now open

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport Port of a pull request already in a different code base rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

2 participants

Comments