[jdk8u-dev] RFR: 8223145: Replace wildcard address with loopback or local host in tests - part 1

SendaoYan syan at openjdk.org
Wed Oct 22 09:20:48 UTC 2025


Hi, all

We observed the test java/net/Socket/GetLocalAddress.java intermittently fails "java.net.SocketException: Invalid argument or cannot assign requested address" very often. So I want to backport JDK-8223145 to jdk8u-dev to fix this issue.

Testing:

- [x] Test all the touch files locally on linux-x64, except sun/net/www/httptest/TestHttpServer.java and lib/testlibrary/jdk/testlibrary/net/URIBuilder.java which use as test library.
- [ ] Test all the jtreg tests by jenkins.

There are 3 types of files cause backport uncleanly.

1. Different context cause should replace '127.0.0.1' as 'loopback' manually.

jdk/test/com/sun/net/httpserver/bugs/B6361557.java
jdk/test/java/net/Socket/UrgentDataTest.java
jdk/test/sun/net/www/http/HttpURLConnection/PostOnDelete.java

2. Different context cause deal with copyright year manually.
jdk/test/java/net/Socket/TestAfterClose.java
jdk/test/java/net/ResponseCache/ResponseCacheTest.java
jdk/test/sun/net/www/protocol/http/B8012625.java


3. Test was added after jdk8+, so it's not needed deal with jdk8u-dev
java/net/SocketOption/OptionsTest.java
java/net/URLPermission/nstest/LookupTest.java
sun/net/www/http/HttpURLConnection/NTLMAuthWithSM.java

4. The test library located difference, so we need to adopt in jdk8u-dev: replace '@library /test/lib' as '@library /lib/testlibrary', and replace 'import jdk.test.lib.net.URIBuilder;' as 'import jdk.testlibrary.net.URIBuilder;'.
java/net/ResponseCache/ResponseCacheTest.java
java/net/HttpURLConnection/UnmodifiableMaps.java
sun/net/www/protocol/https/HttpsURLConnection/CookieHandlerTest.java
sun/net/www/http/KeepAliveStream/KeepAliveStreamClose.java
java/net/URL/GetContent.java

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

Commit messages:
 - replace '@library /test/lib' as '@library /lib/testlibrary', and replace 'import jdk.test.lib.net.URIBuilder;' as 'import jdk.testlibrary.net.URIBuilder;'
 - Backport 7d4520c109f408a7dbcdcc424dfef121e3eeaaa7

Changes: https://git.openjdk.org/jdk8u-dev/pull/707/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk8u-dev&pr=707&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8223145
  Stats: 191 lines in 21 files changed: 132 ins; 1 del; 58 mod
  Patch: https://git.openjdk.org/jdk8u-dev/pull/707.diff
  Fetch: git fetch https://git.openjdk.org/jdk8u-dev.git pull/707/head:pull/707

PR: https://git.openjdk.org/jdk8u-dev/pull/707


More information about the jdk8u-dev mailing list