RFR: 8358048: java/net/httpclient/HttpsTunnelAuthTest.java incorrectly calls Thread::stop

Volkan Yazici vyazici at openjdk.org
Fri Jul 25 17:10:54 UTC 2025


On Fri, 25 Jul 2025 07:56:49 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

> Can I please get a review of this test-only change which fixes an accidental use of `Thread.stop()`? This addresses https://bugs.openjdk.org/browse/JDK-8358048.
> 
> The test during it's termination attempts to close the `ProxyServer` and invokes `ProxyServer.stop()`. The `ProxyServer` does not have a `stop()` method of its own but since the `ProxyServer` is a `java.lang.Thread`, calling `stop()` on the `ProxyServer` ends up calling the `Thread.stop()`. The use of `stop()` in this test is accidental and the test should have used `ProxyServer.close()`.
> 
> The commit in this PR fixes the issue by removing the use of `ProxyServer.stop()`. The test continues to pass with this change.

Given `HttpTestServer` implements `AutoCloseable`, does a follow-up issue to change `ProxyServer` from `extends Thread implements Closeable` to `implements AutoCloseable` make sense? This can simplify several existing use sites terminating these resources, and avoid unintended `Thread` method invocations as was in this case.

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

Marked as reviewed by vyazici (Committer).

PR Review: https://git.openjdk.org/jdk/pull/26473#pullrequestreview-3056221592


More information about the net-dev mailing list