From dev-return-39186-apmail-harmony-dev-archive=harmony.apache.org@harmony.apache.org Tue Apr 13 15:49:37 2010 Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 76224 invoked from network); 13 Apr 2010 15:49:37 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 13 Apr 2010 15:49:37 -0000 Received: (qmail 84702 invoked by uid 500); 13 Apr 2010 15:49:36 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 84645 invoked by uid 500); 13 Apr 2010 15:49:35 -0000 Mailing-List: contact dev-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list dev@harmony.apache.org Received: (qmail 84631 invoked by uid 99); 13 Apr 2010 15:49:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Apr 2010 15:49:35 +0000 X-ASF-Spam-Status: No, hits=-0.6 required=10.0 tests=AWL,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of oliver.deakin@googlemail.com designates 72.14.220.158 as permitted sender) Received: from [72.14.220.158] (HELO fg-out-1718.google.com) (72.14.220.158) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Apr 2010 15:49:28 +0000 Received: by fg-out-1718.google.com with SMTP id e21so2942168fga.0 for ; Tue, 13 Apr 2010 08:49:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=sMOc72vDED/+u26BnS0yGFlDKz77shWpFzMEf1NLuhI=; b=dfqkLkQVLbJOI6uFc/woNDnjDB7yKnFvfc9FF0Fn3EXmFxAUaSD5gcA5qU/PnJ/aFi O3BOQLdNAdrA0Lcx5sb7HRrBtt/5t+O1K6Z7SBaSV5jtInn8wLwK0as66bbPcGMz7a6s iORw9EmnNgL8MkCKLH/SVQUBJwabkjG4fs11s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=a7ilFzOGsrj4lWe8dGDTZc9XgtbLcWqGVAzvr7W2swh95Ky9Dd3rxUc2wNxQHucyfR DmEai2t1VmQa6HD11cHBXP7ss28IAdQ0cjnVCFNFCFoo09RiHIRjTBwG4lw1FssTxVpx xVsMbq4m6PYZQ4UjVQX6y26mCz4qrT1Y00xAY= Received: by 10.223.15.143 with SMTP id k15mr3518290faa.57.1271173746348; Tue, 13 Apr 2010 08:49:06 -0700 (PDT) Received: from [9.20.183.159] (gbibp9ph1--blueice4n1.emea.ibm.com [195.212.29.91]) by mx.google.com with ESMTPS id z10sm11309918fka.1.2010.04.13.08.49.03 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 13 Apr 2010 08:49:03 -0700 (PDT) Message-ID: <4BC4926F.8000207@googlemail.com> Date: Tue, 13 Apr 2010 16:49:03 +0100 From: Oliver Deakin User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4 MIME-Version: 1.0 To: dev@harmony.apache.org CC: regisxu@apache.org Subject: Re: svn commit: r931940 - in /harmony/enhanced/java/trunk/classlib/modules/luni/src: main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnectionImpl.java test/api/common/org/apache/harmony/luni/tests/java/net/HttpURLConnectionTest.java References: <20100408134228.CB71D23889EA@eris.apache.org> In-Reply-To: <20100408134228.CB71D23889EA@eris.apache.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Regis/Deven, This commit causes org.apache.harmony.luni.tests.java.net.URLConnectionTest to hang for me with the following output: [junit] Running org.apache.harmony.luni.tests.java.net.URLConnectionTest [junit] 2010-04-13 15:01:02.250::INFO: Logging to STDERR via org.mortbay.log.StdErrLog [junit] 2010-04-13 15:01:02.281::INFO: jetty-6.0.x [junit] 2010-04-13 15:01:02.343::INFO: Started SocketConnector @ 0.0.0.0:4456 [junit] Wait timed out. Test HTTP Server shut down. Reverting to the previous revision of HttpURLConnectionImpl.java fixes the problem. Can you investigate what is causing this and either revert the change or apply a fix please? Thanks. Regards, Oliver On 08/04/2010 14:42, regisxu@apache.org wrote: > Author: regisxu > Date: Thu Apr 8 13:42:28 2010 > New Revision: 931940 > > URL: http://svn.apache.org/viewvc?rev=931940&view=rev > Log: > Apply patch for HARMONY-6494: [classlib][luni] OutputStream of HttpURLConnection should not throw IOExecption > > Modified: > harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnectionImpl.java > harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/HttpURLConnectionTest.java > > Modified: harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnectionImpl.java > URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnectionImpl.java?rev=931940&r1=931939&r2=931940&view=diff > ============================================================================== > --- harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnectionImpl.java (original) > +++ harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnectionImpl.java Thu Apr 8 13:42:28 2010 > @@ -359,6 +359,8 @@ public class HttpURLConnectionImpl exten > boolean closed; > > int limit; > + > + boolean fixedMod = false; > > public HttpOutputStream() { > cacheLength = defaultCacheSize; > @@ -366,9 +368,10 @@ public class HttpURLConnectionImpl exten > limit = -1; > } > > - public HttpOutputStream(int limit) { > + public HttpOutputStream(int limit, boolean fixedMode) { > writeToSocket = true; > this.limit = limit; > + this.fixedMod = fixedMode; > if (limit> 0) { > cacheLength = limit; > } else { > @@ -445,7 +448,10 @@ public class HttpURLConnectionImpl exten > return; > } > closed = true; > - if (writeToSocket) { > + //Only with such situation when the fixedContentLength field of HttpURLConnection > + //is set by HttpURLConnection.setFixedLengthStreamingMode and larger than 0, the > + //IOException will be throwed > + if (writeToSocket&& fixedMod) { > if (limit> 0) { > throw new IOException(Messages.getString("luni.25")); //$NON-NLS-1$ > } > @@ -952,11 +958,14 @@ public class HttpURLConnectionImpl exten > sendChunked = true; > limit = -1; > } > + > + boolean fixedMode = false; > if (fixedContentLength>= 0) { > limit = fixedContentLength; > + fixedMode = true; > } > if ((httpVersion> 0&& sendChunked) || limit>= 0) { > - os = new HttpOutputStream(limit); > + os = new HttpOutputStream(limit, fixedMode); > doRequest(); > return os; > } > > Modified: harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/HttpURLConnectionTest.java > URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/HttpURLConnectionTest.java?rev=931940&r1=931939&r2=931940&view=diff > ============================================================================== > --- harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/HttpURLConnectionTest.java (original) > +++ harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/HttpURLConnectionTest.java Thu Apr 8 13:42:28 2010 > @@ -317,6 +317,34 @@ public class HttpURLConnectionTest exten > // correct, too many bytes written > } > } > + > + /** > + * When an OutputStream of HtttpURLConnection is closed with below > + * situation: fixed-length mod is disable and the content-length of the > + * HtttpURLConnection is larger than 0, it should not throw IOExeption which > + * indicates there are more bytes need be written into the underlying > + * Socket. > + * > + * @throws IOException > + */ > + public void test_closeWithFixedLengthDisableMod() throws IOException { > + String posted = "just a test"; > + java.net.HttpURLConnection conn = (java.net.HttpURLConnection) url > + .openConnection(); > + conn.setDoOutput(true); > + conn.setRequestMethod("POST"); > + conn.setRequestProperty("Content-Length", "" + (888)); > + > + OutputStream out = conn.getOutputStream(); > + out.write(posted.getBytes()); > + > + try { > + out.close(); > + // expected > + } catch (IOException e) { > + fail("should not throw IOException"); > + } > + } > > /** > * @tests java.net.HttpURLConnection#setChunkedStreamingMode_I() > > > > -- Oliver Deakin Unless stated otherwise above: IBM United Kingdom Limited - Registered in England and Wales with number 741598. Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU