mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-17 17:44:40 +02:00
8170705: sun/net/www/protocol/http/StackTraceTest.java fails intermittently with Invalid Http response
Reviewed-by: dfuchs
This commit is contained in:
parent
f6e688c7c8
commit
1df787692a
1 changed files with 14 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -21,22 +21,30 @@
|
||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @test
|
* @test
|
||||||
* @bug 4773417 5003746
|
* @bug 4773417 5003746
|
||||||
|
* @library /test/lib
|
||||||
|
* @build jdk.test.lib.Utils
|
||||||
|
* @run main StackTraceTest
|
||||||
* @summary HttpURLConnection.getInputStream() produces IOException with
|
* @summary HttpURLConnection.getInputStream() produces IOException with
|
||||||
* bad stack trace; HttpURLConnection.getInputStream loses
|
* bad stack trace; HttpURLConnection.getInputStream loses
|
||||||
* exception message, exception class
|
* exception message, exception class
|
||||||
*/
|
*/
|
||||||
import java.net.*;
|
import java.net.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import jdk.test.lib.Utils;
|
||||||
|
|
||||||
public class StackTraceTest {
|
public class StackTraceTest {
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
URL url;
|
InetSocketAddress refusing = Utils.refusingEndpoint();
|
||||||
try (ServerSocket ss = new ServerSocket(0)) { // refusing socket
|
int port = refusing.getPort();
|
||||||
url = new URL("http://localhost:" + ss.getLocalPort() + "/");
|
String host = refusing.getAddress().getHostAddress();
|
||||||
}
|
if (host.contains(":"))
|
||||||
|
host = "[" + host + "]";
|
||||||
|
URL url = URI.create("http://" + host + ":" + port + "/").toURL();
|
||||||
|
System.out.println("URL: " + url);
|
||||||
|
|
||||||
URLConnection uc = url.openConnection();
|
URLConnection uc = url.openConnection();
|
||||||
|
|
||||||
// Trigger implicit connection by trying to retrieve bogus
|
// Trigger implicit connection by trying to retrieve bogus
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue