[jdk11u-dev] RFR: 8061729: Update java/net tests to eliminate dependency on sun.net.www.MessageHeader and some other internal APIs

Lutz Schmidt lucy at openjdk.org
Fri Mar 15 15:32:01 UTC 2024


On Mon, 11 Mar 2024 21:21:21 GMT, Amos Shi <ashi at openjdk.org> wrote:

> Backport of [JDK-8061729](https://bugs.openjdk.org/browse/JDK-8061729) - `Test Case Only`
> 
> There are 3 commits in this PR
> - Commit 1. `git apply` clean backport from original commit. All files is clean, except `ProxyFromCache.java`
> - Commit 2. Manully apply changes to `ProxyFromCache.java`. the following lines in the file cannot be applied automatically, we manually merged the same change.
> 
> 
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved.
> + * Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved.
>   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
>   *
>   * This code is free software; you can redistribute it and/or modify it
> @@ -25,14 +25,22 @@
>   * @test
>   * @bug 6498566
>   * @summary URL.openConnection(Proxy.NO_PROXY) may connect through a proxy.
> - * @modules java.base/sun.net.www
>   * @library /test/lib
>   * @run main/othervm ProxyFromCache
>   */
>  
> -import java.net.*;
> -import java.io.*;
> -import sun.net.www.MessageHeader;
> +import java.io.IOException;
> +import java.io.InputStream;
> +import java.io.OutputStream;
> +import java.net.HttpURLConnection;
> +import java.net.InetAddress;
> +import java.net.InetSocketAddress;
> +import java.net.Proxy;
> +import java.net.ServerSocket;
> +import java.net.Socket;
> +import java.net.URL;
> +
> +import jdk.test.lib.net.HttpHeaderParser;
>  import jdk.test.lib.net.URIBuilder;
>  
>  /* Creates a simple proxy and http server that just return 200 OK.
> 
> 
> - Commit 3. Fix compile error in `HttpHeaderParser.java`: the `switch case arrow` is not avaible in Java 11
> 
> Testing
> - Local: Passed on MacOS M1 laptop
>   - `ProxyFromCache.java` - Test results: passed: 1
>   - `RequestURI.java` - Test results: passed: 1
>   - `CloseOptionHeader.java` - Test results: passed: 1
>   - `HttpHeaderParserTest.java` - Test results: passed: 1
>   - `NTLMTest.java` - Test results: passed: 1
>   - `NoNTLM.java` - Test results: passed: 1
>   - `RetryUponTimeout.java` - Test results: passed: 1
>   - `UserAgent.java` - Test results: passed: 1
>   - `B6226610.java` - Test results: passed: 1
>   - `TunnelProxy.java` - Not a test or directory containing tests: sun/net/www/protocol/https/HttpsURLConnection/TunnelProxy.java
>   - `HttpHeaderParser.java` - Cannot determine test suite from test (is TEST.ROOT missing?): dev-8061729-11/test/lib/jdk/test/lib/net/HttpHeaderParser.java
> - Pipeline: All checks have passed
> - Testing Machine: SAP nightlies passed on `2024-03-13,14,15`

LGTM.

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

Marked as reviewed by lucy (Reviewer).

PR Review: https://git.openjdk.org/jdk11u-dev/pull/2596#pullrequestreview-1939239595


More information about the jdk-updates-dev mailing list