From commits-return-60313-apmail-harmony-commits-archive=harmony.apache.org@harmony.apache.org Thu Oct 01 12:31:51 2009 Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 44204 invoked from network); 1 Oct 2009 12:31:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 1 Oct 2009 12:31:50 -0000 Received: (qmail 69840 invoked by uid 500); 1 Oct 2009 12:31:50 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 69808 invoked by uid 500); 1 Oct 2009 12:31:50 -0000 Mailing-List: contact commits-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 commits@harmony.apache.org Received: (qmail 69762 invoked by uid 99); 1 Oct 2009 12:31:50 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Oct 2009 12:31:50 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Oct 2009 12:31:47 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 89178234C004 for ; Thu, 1 Oct 2009 05:31:23 -0700 (PDT) Message-ID: <1531198604.1254400283546.JavaMail.jira@brutus> Date: Thu, 1 Oct 2009 05:31:23 -0700 (PDT) From: "Oliver Deakin (JIRA)" To: commits@harmony.apache.org Subject: [jira] Commented: (HARMONY-6315) [classlib][nio] FileChannel.map throws IOException when called with size 0 In-Reply-To: <1199117289.1251105119467.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HARMONY-6315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12761190#action_12761190 ] Oliver Deakin commented on HARMONY-6315: ---------------------------------------- Thanks Catherine - Ive applied the latest patch at repo revision r820629. Please check it applied as expected. > [classlib][nio] FileChannel.map throws IOException when called with size 0 > -------------------------------------------------------------------------- > > Key: HARMONY-6315 > URL: https://issues.apache.org/jira/browse/HARMONY-6315 > Project: Harmony > Issue Type: Bug > Components: Classlib > Environment: Unix > Reporter: Catherine Hope > Assignee: Oliver Deakin > Fix For: 6.0M1, 5.0M12 > > Attachments: 6315-patch.txt, 6315.patch > > > Creating a MappedByteBuffer by calling FileChannel.map with size 0 throws an IOException, as the native call to mmap will fail with invalid argument when called with size 0. Also the IOException is thrown without any message from the Java after the native has returned with -1, which isn't ideal. On IBM and Sun Java a MappedByteBuffer is constructed with 0 capacity. > The stack trace of the error is: > java.io.IOException: Call to mmap failed with error 22: Invalid argument > at org.apache.harmony.luni.platform.OSMemory.mmap(OSMemory.java:547) /* after calling OSMemoryLinux32.c which calls mmap */ > at org.apache.harmony.luni.platform.PlatformAddressFactory.allocMap(PlatformAddressFactory.java:37) /* returns a PlatformAddress of where the map is */ > at org.apache.harmony.nio.internal.FileChannelImpl.mapImpl(FileChannelImpl.java:191) /* creates PlatformAddress, which is passed to MappedByteBuffer constructor */ > at org.apache.harmony.nio.internal.ReadOnlyFileChannel.map(ReadOnlyFileChannel.java:89) > at org.apache.harmony.nio.tests.java.nio.MappedByteBufferTest.testEmptyBuffer(MappedByteBufferTest.java:70) > I think where to fix this is the native function, and return a dummy long address, as the implementation of the MappedByteBuffer constructor (in my testcase this is a ReadOnlyDirectByteBuffer) requires a PlatformAddress. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.