Return-Path: Delivered-To: apmail-jackrabbit-dev-archive@www.apache.org Received: (qmail 68880 invoked from network); 2 Feb 2011 10:01:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 2 Feb 2011 10:01:57 -0000 Received: (qmail 59816 invoked by uid 500); 2 Feb 2011 10:01:57 -0000 Delivered-To: apmail-jackrabbit-dev-archive@jackrabbit.apache.org Received: (qmail 59228 invoked by uid 500); 2 Feb 2011 10:01:53 -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 59213 invoked by uid 99); 2 Feb 2011 10:01:52 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Feb 2011 10:01:52 +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; Wed, 02 Feb 2011 10:01:50 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id EEE5F189103 for ; Wed, 2 Feb 2011 10:01:28 +0000 (UTC) Date: Wed, 2 Feb 2011 10:01:28 +0000 (UTC) From: "Thomas Mueller (JIRA)" To: dev@jackrabbit.apache.org Message-ID: <1407246134.4747.1296640888975.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <485808626.2721.1296572609011.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] Resolved: (JCR-2872) DataStore: changing the modified date fails if the file is open for reading (Windows only) 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-2872?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Thomas Mueller resolved JCR-2872. --------------------------------- Resolution: Fixed Committed in the trunk and 2.2 branch. > DataStore: changing the modified date fails if the file is open for reading (Windows only) > ------------------------------------------------------------------------------------------ > > Key: JCR-2872 > URL: https://issues.apache.org/jira/browse/JCR-2872 > Project: Jackrabbit Content Repository > Issue Type: Bug > Components: jackrabbit-core > Environment: Windows > Reporter: Thomas Mueller > Assignee: Thomas Mueller > Fix For: 2.2.3 > > > If the file is open for reading, Windows doesn't allow to change the last modified time using File.setLastModified(): > org.apache.jackrabbit.core.data.DataStoreException: Failed to update record > modified date: 2ac72495fd1e270777821b8a872903c79c84a8d9 > at org.apache.jackrabbit.core.data.FileDataStore.addRecord(FileDataStore.java:250) > at org.apache.jackrabbit.core.value.BLOBInDataStore.getInstance(BLOBInDataStore.java:119) > at org.apache.jackrabbit.core.value.InternalValue.getBLOBFileValue(InternalValue.java:619) > at org.apache.jackrabbit.core.value.InternalValue.create(InternalValue.java:369) > at org.apache.jackrabbit.core.value.InternalValueFactory.create(InternalValueFactory.java:94) > at org.apache.jackrabbit.core.value.ValueFactoryImpl.createBinary(ValueFactoryImpl.java:74) > Test case and possible workaround: > import java.io.File; > import java.io.FileInputStream; > import java.io.RandomAccessFile; > public class Test { > public static void main(String... args) throws Exception { > String name = "test.txt"; > File test = new File(name); > RandomAccessFile r = new RandomAccessFile(name, "rw"); > r.write(0); > r.close(); > long mod = test.lastModified(); > Thread.sleep(3000); > FileInputStream in = new FileInputStream(name); > if (!test.setLastModified(test.lastModified()+1)) { > if (!test.canWrite()) { > System.out.println("Can't write to " + name); > } else { > System.out.println("canWrite ok"); > r = new RandomAccessFile(name, "rw"); > int old = r.read(); > r.seek(0); > r.write(old); > r.close(); > } > } else { > System.out.println("setLastModified ok"); > } > System.out.println("Modified old: " + mod); > System.out.println("Modified now: " + test.lastModified()); > in.close(); > System.out.println("input closed"); > if (!test.setLastModified(test.lastModified()+1)) { > if (!test.canWrite()) { > System.out.println("Can't write to " + name); > } else { > System.out.println("canWrite ok"); > } > } else { > System.out.println("setLastModified ok"); > } > new File(name).delete(); > } > } -- This message is automatically generated by JIRA. - For more information on JIRA, see: http://www.atlassian.com/software/jira