RFR [11] 8203297: java/net/URL/OpenStream.java fails intermittently

Daniel Fuchs daniel.fuchs at oracle.com
Wed May 23 15:59:49 UTC 2018


+1

-- daniel

On 23/05/2018 16:43, Chris Hegarty wrote:
> This is a review for a trivial change to a test to make it more robust on
> platforms, Mac, where system proxies are used by HttpURLConnection,
> by default.  This test should never use a proxy.
> 
> https://bugs.openjdk.java.net/browse/JDK-8203297
> 
> diff --git a/test/jdk/java/net/URL/OpenStream.java b/test/jdk/java/net/URL/OpenStream.java
> --- a/test/jdk/java/net/URL/OpenStream.java
> +++ b/test/jdk/java/net/URL/OpenStream.java
> @@ -31,19 +31,19 @@
>   
>   
>   public class OpenStream {
>   
>       static String badHttp = "http://foo.bar.baz/";
>   
>       public static void main(String[] args) throws IOException {
>   
>           URL u = new URL(badHttp);
>           try {
> -            InputStream in = u.openStream();
> +            InputStream in = u.openConnection(Proxy.NO_PROXY).getInputStream();
>           } catch (IOException x) {
>               return;
>           }
>           throw new RuntimeException("Expected UnknownHostException to be thrown");
>   
>       }
>   
>   }
> 
> -Chris.
> 



More information about the net-dev mailing list