Return-Path: Delivered-To: apmail-jackrabbit-dev-archive@www.apache.org Received: (qmail 36259 invoked from network); 27 Apr 2009 13:52:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 27 Apr 2009 13:52:52 -0000 Received: (qmail 61538 invoked by uid 500); 27 Apr 2009 13:52:51 -0000 Delivered-To: apmail-jackrabbit-dev-archive@jackrabbit.apache.org Received: (qmail 61470 invoked by uid 500); 27 Apr 2009 13:52:51 -0000 Mailing-List: contact dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list dev@jackrabbit.apache.org Received: (qmail 61462 invoked by uid 99); 27 Apr 2009 13:52:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Apr 2009 13:52:51 +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; Mon, 27 Apr 2009 13:52:50 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 5BE07234C003 for ; Mon, 27 Apr 2009 06:52:30 -0700 (PDT) Message-ID: <731105749.1240840350361.JavaMail.jira@brutus> Date: Mon, 27 Apr 2009 06:52:30 -0700 (PDT) From: "Thomas Mueller (JIRA)" To: dev@jackrabbit.apache.org Subject: [jira] Resolved: (JCR-2067) FileDataStore: only open a stream when really necessary In-Reply-To: <1677570981.1239271212997.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/JCR-2067?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Thomas Mueller resolved JCR-2067. --------------------------------- Resolution: Fixed Committed in revision 768982 (trunk) > FileDataStore: only open a stream when really necessary > ------------------------------------------------------- > > Key: JCR-2067 > URL: https://issues.apache.org/jira/browse/JCR-2067 > Project: Jackrabbit Content Repository > Issue Type: Improvement > Reporter: Thomas Mueller > Assignee: Thomas Mueller > > Currently, PropertyImpl.getValue() opens a FileInputStream if the FileDataStore is used. > If the application doesn't use the value, this stream is never closed. > PropertyImpl.getValue(): > return internalGetValue().toJCRValue(session); > InternalValue.toJCRValue(..): > case PropertyType.BINARY: > return new BinaryValue(((BLOBFileValue) val).getStream()); > BLOBInDataStore.getStream(): > return getDataRecord().getStream(); > FileDataRecord.getStream(): > return new FileInputStream(file); > One solution is to return a 'lazy' file input stream that only opens the file when reading from the stream (and closing the file when the last byte was read). Maybe there is already a class (in Apache Commons maybe?) that can do that. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.