Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A89229F17 for ; Thu, 22 Mar 2012 13:50:45 +0000 (UTC) Received: (qmail 89646 invoked by uid 500); 22 Mar 2012 13:50:45 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 89572 invoked by uid 500); 22 Mar 2012 13:50:45 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 89562 invoked by uid 99); 22 Mar 2012 13:50:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Mar 2012 13:50:45 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Mar 2012 13:50:43 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 245AE340DFE for ; Thu, 22 Mar 2012 13:50:22 +0000 (UTC) Date: Thu, 22 Mar 2012 13:50:22 +0000 (UTC) From: "Gary D. Gregory (Resolved) (JIRA)" To: issues@commons.apache.org Message-ID: <50281634.2241.1332424222160.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1877919768.35074.1332219106005.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Resolved] (VFS-407) [RAM] Reading a RAM FileSystem file fails because it never returns EOF -1. 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/VFS-407?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Gary D. Gregory resolved VFS-407. --------------------------------- Resolution: Fixed Patch applied, in SVN, thank you! > [RAM] Reading a RAM FileSystem file fails because it never returns EOF -1. > -------------------------------------------------------------------------- > > Key: VFS-407 > URL: https://issues.apache.org/jira/browse/VFS-407 > Project: Commons VFS > Issue Type: Bug > Affects Versions: 2.0 > Reporter: Miroslav Pokorny > Fix For: 2.1 > > Attachments: CustomRamProviderTest.java, EmptyRamProviderFileBugTests-from-miroslav.pokorny-20120322.patch > > Original Estimate: 5m > Remaining Estimate: 5m > > RamFileRandomAccessContent > ORIGINAL > @Override > public int read(byte[] b, int off, int len) throws IOException > { > int retLen = Math.min(len, getLeftBytes()); > RamFileRandomAccessContent.this.readFully(b, off, retLen); > return retLen; > } > // getLeftBytes() returns 0 when empty. retLen is 0 when empty and never -1. > FIXED > // HACK Patched to return -1 when empty previously it returned 0 > @Override > public int read(final byte[] b, final int off, final int len) throws IOException { > int retLen = InputStreams.END; > final int left = RamFileRandomAccessContent.this.getLeftBytes(); > if (left > 0) { > retLen = Math.min(len, left); > RamFileRandomAccessContent.this.readFully(b, off, retLen); > } > return retLen; > } -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira