提交 2677d57f 编写于 作者: C chegar

6937703: java/net regression test issues with samevm

Reviewed-by: alanb
上级 0bde254d
...@@ -684,8 +684,6 @@ java/net/SocketInputStream/SocketClosedException.java generic-all ...@@ -684,8 +684,6 @@ java/net/SocketInputStream/SocketClosedException.java generic-all
java/net/SocketInputStream/SocketTimeout.java generic-all java/net/SocketInputStream/SocketTimeout.java generic-all
# Linux i586, address already in use or timeout, samevm issues # Linux i586, address already in use or timeout, samevm issues
java/net/URLConnection/B5052093.java generic-all
java/net/URLConnection/contentHandler/UserContentHandler.java generic-all
java/net/URLConnection/DisconnectAfterEOF.java generic-all java/net/URLConnection/DisconnectAfterEOF.java generic-all
java/net/URLConnection/HandleContentTypeWithAttrs.java generic-all java/net/URLConnection/HandleContentTypeWithAttrs.java generic-all
java/net/URLConnection/Responses.java generic-all java/net/URLConnection/Responses.java generic-all
...@@ -696,8 +694,6 @@ java/net/URLConnection/ZeroContentLength.java generic-all ...@@ -696,8 +694,6 @@ java/net/URLConnection/ZeroContentLength.java generic-all
java/net/ResponseCache/B6181108.java generic-all java/net/ResponseCache/B6181108.java generic-all
java/net/ResponseCache/ResponseCacheTest.java generic-all java/net/ResponseCache/ResponseCacheTest.java generic-all
java/net/URL/GetContent.java generic-all java/net/URL/GetContent.java generic-all
java/net/URL/TestIPv6Addresses.java generic-all
java/net/URLClassLoader/HttpTest.java generic-all
java/net/URLConnection/HttpContinueStackOverflow.java generic-all java/net/URLConnection/HttpContinueStackOverflow.java generic-all
java/net/URLConnection/Redirect307Test.java generic-all java/net/URLConnection/Redirect307Test.java generic-all
java/net/URLConnection/RedirectLimit.java generic-all java/net/URLConnection/RedirectLimit.java generic-all
...@@ -726,9 +722,6 @@ sun/net/www/http/KeepAliveCache/KeepAliveTimerThread.java generic-all ...@@ -726,9 +722,6 @@ sun/net/www/http/KeepAliveCache/KeepAliveTimerThread.java generic-all
# Connection refused, windows samevm # Connection refused, windows samevm
sun/net/www/protocol/http/DigestTest.java generic-all sun/net/www/protocol/http/DigestTest.java generic-all
# Fails on Fedora 9 32bit & 64bit & Solaris 10, wrong proxy for http://localhost/index.html
java/net/ProxySelector/B6737819.java generic-all
############################################################################ ############################################################################
# jdk_nio # jdk_nio
......
...@@ -23,9 +23,15 @@ ...@@ -23,9 +23,15 @@
/* /*
* @test * @test
* @bug 6737819 * @bug 6737819
* @run main/othervm B6737819
* @summary sun.misc.net.DefaultProxySelector doesn't use proxy setting to localhost * @summary sun.misc.net.DefaultProxySelector doesn't use proxy setting to localhost
*/ */
/* Run in othervm mode since the test sets HTTP proxy system properties that
* are read once and cached by the protocol handler. A previous test using the
* HTTP handler may run and these system properties may be ignored for this test.
*/
import java.net.ProxySelector; import java.net.ProxySelector;
import java.net.Proxy; import java.net.Proxy;
import java.net.URI; import java.net.URI;
......
...@@ -150,10 +150,14 @@ static class NameVerifier implements HostnameVerifier { ...@@ -150,10 +150,14 @@ static class NameVerifier implements HostnameVerifier {
} }
} }
public static void main(String args[]) throws Exception { public static void main(String args[]) throws Exception {
ResponseCache.setDefault(new MyResponseCache()); try {
FNPrefix = System.getProperty("test.src", ".")+"/"; ResponseCache.setDefault(new MyResponseCache());
OutFNPrefix = System.getProperty("test.scratch", ".")+"/"; FNPrefix = System.getProperty("test.src", ".")+"/";
new ResponseCacheTest(); OutFNPrefix = System.getProperty("test.scratch", ".")+"/";
new ResponseCacheTest();
} finally{
ResponseCache.setDefault(null);
}
} }
static class MyResponseCache extends ResponseCache { static class MyResponseCache extends ResponseCache {
......
...@@ -30,8 +30,7 @@ ...@@ -30,8 +30,7 @@
import java.net.*; import java.net.*;
import java.util.*; import java.util.*;
import java.io.*; import java.io.*;
import java.nio.*;
import sun.net.www.ParseUtil;
/** /**
* Request should get serviced by the cache handler. Response get * Request should get serviced by the cache handler. Response get
...@@ -52,9 +51,13 @@ public class getResponseCode { ...@@ -52,9 +51,13 @@ public class getResponseCode {
} }
} }
public static void main(String args[]) throws Exception { public static void main(String args[]) throws Exception {
ResponseCache.setDefault(new MyResponseCache()); try {
FNPrefix = System.getProperty("test.src", ".")+"/"; ResponseCache.setDefault(new MyResponseCache());
new getResponseCode(); FNPrefix = System.getProperty("test.src", ".")+"/";
new getResponseCode();
} finally{
ResponseCache.setDefault(null);
}
} }
static class MyResponseCache extends ResponseCache { static class MyResponseCache extends ResponseCache {
......
...@@ -23,8 +23,12 @@ ...@@ -23,8 +23,12 @@
/* @test /* @test
* @bug 4451522 4460484 * @bug 4451522 4460484
* @run main/othervm TestIPv6Addresses
* @summary URI and URL getHost() methods don't comform to RFC 2732 * @summary URI and URL getHost() methods don't comform to RFC 2732
*/ */
// Run in othervm because the tests sets a SecurityManager
import java.net.*; import java.net.*;
public class TestIPv6Addresses { public class TestIPv6Addresses {
......
...@@ -56,9 +56,9 @@ public class HttpTest { ...@@ -56,9 +56,9 @@ public class HttpTest {
} }
public void run() { public void run() {
InputStream in = null;
try { try {
in = s.getInputStream();
InputStream in = s.getInputStream();
for (;;) { for (;;) {
// read entire request from client // read entire request from client
...@@ -111,6 +111,9 @@ public class HttpTest { ...@@ -111,6 +111,9 @@ public class HttpTest {
} // for } // for
} catch (Exception e) { } catch (Exception e) {
unexpected(e);
} finally {
if (in != null) { try {in.close(); } catch(IOException e) {unexpected(e);} }
} }
} }
} }
...@@ -131,6 +134,11 @@ public class HttpTest { ...@@ -131,6 +134,11 @@ public class HttpTest {
} }
} }
void unexpected(Exception e) {
System.out.println(e);
e.printStackTrace();
}
public static HttpServer create() throws Exception { public static HttpServer create() throws Exception {
if (svr != null) if (svr != null)
return svr; return svr;
...@@ -211,6 +219,7 @@ public class HttpTest { ...@@ -211,6 +219,7 @@ public class HttpTest {
// one GET request // one GET request
svr.counters().reset(); svr.counters().reset();
InputStream in = cl.getResourceAsStream("foo2.gif"); InputStream in = cl.getResourceAsStream("foo2.gif");
in.close();
System.out.println(svr.counters()); System.out.println(svr.counters());
if (svr.counters().getCount() > 1) { if (svr.counters().getCount() > 1) {
failed = true; failed = true;
......
/* /*
* Copyright (c) 2007 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2007 Sun Microsystems, Inc. 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
* under the terms of the GNU General Public License version 2 only, as * under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this * published by the Free Software Foundation.
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
* *
* This code is distributed in the hope that it will be useful, but WITHOUT * This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
...@@ -66,17 +64,29 @@ public class B5052093 implements HttpCallback { ...@@ -66,17 +64,29 @@ public class B5052093 implements HttpCallback {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
server = new HttpServer(new B5052093(), 1, 10, 0); server = new HttpServer(new B5052093(), 1, 10, 0);
URL url = new URL("http://localhost:"+server.getLocalPort()+"/foo"); try {
URLConnection conn = url.openConnection(); URL url = new URL("http://localhost:"+server.getLocalPort()+"/foo");
int i = conn.getContentLength(); URLConnection conn = url.openConnection();
long l = conn.getContentLengthLong(); int i = conn.getContentLength();
if (i != -1 || l != testSize) long l = conn.getContentLengthLong();
throw new RuntimeException("Wrong content-length from http"); if (i != -1 || l != testSize) {
System.out.println("conn.getContentLength = " + i);
System.out.println("conn.getContentLengthLong = " + l);
System.out.println("testSize = " + testSize);
throw new RuntimeException("Wrong content-length from http");
}
URLConnection fu = new LargeFileURLConnection(new LargeFile()); URLConnection fu = new LargeFileURLConnection(new LargeFile());
i = fu.getContentLength(); i = fu.getContentLength();
l = fu.getContentLengthLong(); l = fu.getContentLengthLong();
if (i != -1 || l != testSize) if (i != -1 || l != testSize) {
throw new RuntimeException("Wrong content-length from file"); System.out.println("fu.getContentLength = " + i);
System.out.println("fu.getContentLengthLong = " + l);
System.out.println("testSize = " + testSize);
throw new RuntimeException("Wrong content-length from file");
}
} finally {
server.terminate();
}
} }
} }
...@@ -25,8 +25,16 @@ ...@@ -25,8 +25,16 @@
* @bug 4191147 * @bug 4191147
* @summary 1.2beta4 does not load user defined content handlers * @summary 1.2beta4 does not load user defined content handlers
* @build UserContentHandler * @build UserContentHandler
* @run main UserContentHandler * @run main/othervm UserContentHandler
*/ */
/* Run in othervm mode since the test sets a system property, java.content.handler.pkgs,
* that prepends a specific package prefix defining a text/plain content
* handler. If other URLConnection tests run before this one they might trigger
* the Sun implementation text/plain content handler in sun.net.www.content
* to be loaded and cached, this will break this test.
*/
import java.net.*; import java.net.*;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
...@@ -55,7 +63,7 @@ public class UserContentHandler implements Runnable { ...@@ -55,7 +63,7 @@ public class UserContentHandler implements Runnable {
// don't close the connection immediately as otherwise // don't close the connection immediately as otherwise
// the http headers may not have been received and the // the http headers may not have been received and the
// http client will re-connect. // http client will re-connect.
Thread.currentThread().sleep(2000); Thread.sleep(2000);
s.close(); s.close();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册