Return-Path: Delivered-To: apmail-incubator-harmony-dev-archive@www.apache.org Received: (qmail 53483 invoked from network); 19 Jul 2006 03:21:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 19 Jul 2006 03:21:25 -0000 Received: (qmail 92342 invoked by uid 500); 19 Jul 2006 03:21:23 -0000 Delivered-To: apmail-incubator-harmony-dev-archive@incubator.apache.org Received: (qmail 92288 invoked by uid 500); 19 Jul 2006 03:21:23 -0000 Mailing-List: contact harmony-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-dev@incubator.apache.org Received: (qmail 92277 invoked by uid 99); 19 Jul 2006 03:21:23 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Jul 2006 20:21:23 -0700 X-ASF-Spam-Status: No, hits=1.9 required=10.0 tests=DNS_FROM_RFC_ABUSE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: 202.81.18.155 is neither permitted nor denied by domain of firepure@gmail.com) Received: from [202.81.18.155] (HELO ausmtp06.au.ibm.com) (202.81.18.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Jul 2006 20:21:22 -0700 Received: from sd0208e0.au.ibm.com (d23rh904.au.ibm.com [202.81.18.202]) by ausmtp06.au.ibm.com (8.13.6/8.13.6) with ESMTP id k6J3MiNI8785968 for ; Wed, 19 Jul 2006 13:22:44 +1000 Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.250.244]) by sd0208e0.au.ibm.com (8.12.10/NCO/VER6.8) with ESMTP id k6J3ONDl221226 for ; Wed, 19 Jul 2006 13:24:23 +1000 Received: from d23av03.au.ibm.com (loopback [127.0.0.1]) by d23av03.au.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id k6J3Kx3o018837 for ; Wed, 19 Jul 2006 13:21:00 +1000 Received: from d23m0011.cn.ibm.com ([9.181.32.74]) by d23av03.au.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id k6J3KxdQ017808 for ; Wed, 19 Jul 2006 13:20:59 +1000 Received: from [9.181.107.166] ([9.181.107.166]) by d23m0011.cn.ibm.com (Lotus Domino Release 6.5.5HF262) with ESMTP id 2006071911174527-15354 ; Wed, 19 Jul 2006 11:17:45 +0800 Message-ID: <44BDA45C.9000403@gmail.com> Date: Wed, 19 Jul 2006 11:17:48 +0800 From: "Jimmy, Jing Lv" User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) MIME-Version: 1.0 To: harmony-dev@incubator.apache.org Subject: [classlib][nio]the conflict of RI and spec? X-MIMETrack: Itemize by SMTP Server on D23M0011/23/M/IBM(Release 6.5.5HF262 | April 5, 2006) at 19/07/2006 11:17:45, Serialize by Router on D23M0011/23/M/IBM(Release 6.5.5HF262 | April 5, 2006) at 19/07/2006 11:20:59, Serialize complete at 19/07/2006 11:20:59 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-1; format=flowed X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi: I find a conflict that RI does not behave as spec says in java.nio.channels.FileChannel.transforFrom(ReadableByteChannel src, long position,long count). The spec says:"...Fewer than the requested number of bytes will be transferred if the source channel has fewer than count bytes remaining..."[1]. As expected, invoking this method with a count larger than the number of bytes remaining in the ReadableByteChannel, RI should return a number of bytes exactly transfered. But in fact, RI throws an IOException. I run the test[2] on windowsXP SP2 with RI1.5.0_01 and RI1.5.0_06, and on Linux(redhat 9) with RI1.5.0_02 and RI1.5.0_06, and get the same result. Currently Harmony behave well on this. I guess this is a bug of RI, and Harmony implementation is good. If no objection, I suggest add this test to Harmony. Any opinions? Thanks! [1] spec of FileChannel: http://java.sun.com/j2se/1.5.0/docs/api/java/nio/channels/FileChannel.html [2] the test: public void test_transferFromLReadableByteChannelJJ_overflow() throws Exception { String content = "test content"; int length = content.length(); File readFile = File.createTempFile("testfile1", "tmp"); File writeFile = File.createTempFile("testfile2", "tmp"); FileOutputStream fos = new FileOutputStream(readFile); try { fos.write(content.getBytes()); } finally { fos.close(); } FileChannel fc1 = new FileInputStream(readFile).getChannel(); FileChannel fc2 = new FileOutputStream(writeFile).getChannel(); try { long result = fc2.transferFrom(fc1, 0, length * 2); assertEquals(length, result); } finally { fc1.close(); fc2.close(); } } -- Best Regards! Jimmy, Jing Lv China Software Development Lab, IBM --------------------------------------------------------------------- Terms of use : http://incubator.apache.org/harmony/mailing.html To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org For additional commands, e-mail: harmony-dev-help@incubator.apache.org