Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 94571 invoked from network); 8 Dec 2005 07:42:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 8 Dec 2005 07:42:37 -0000 Received: (qmail 67610 invoked by uid 500); 8 Dec 2005 07:42:32 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 67516 invoked by uid 500); 8 Dec 2005 07:42:31 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 67437 invoked by uid 99); 8 Dec 2005 07:42:30 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Dec 2005 23:42:30 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of mario@ops.co.at designates 194.152.182.4 as permitted sender) Received: from [194.152.182.4] (HELO smtp.ops.co.at) (194.152.182.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Dec 2005 23:42:28 -0800 Received: by smtp.ops.co.at (Postfix, from userid 65534) id 085AA23C0AC; Thu, 8 Dec 2005 08:42:06 +0100 (CET) Received: from [192.168.3.1] (mgate.int.ops.co.at [172.27.0.11]) by smtp.ops.co.at (Postfix) with ESMTP id EB7D523C0AB for ; Thu, 8 Dec 2005 08:42:02 +0100 (CET) Message-ID: <4397E3CA.7000707@ops.co.at> Date: Thu, 08 Dec 2005 08:42:02 +0100 From: Mario Ivankovits User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050715) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jakarta Commons Developers List Subject: Re: [VFS] Exception while copying FileObject References: <43971342.40506@sharedvalue.com> In-Reply-To: <43971342.40506@sharedvalue.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 2.64 (2004-01-11) on smtp.ops.co.at X-Spam-Level: X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No, hits=-8.9 required=6.0 tests=AWL,BAYES_00,RATWR10_MESSID autolearn=no version=2.64 X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi Eric! > With commons-vfs RC6, I experience sometimes the following exception : > Could not write to "file:///tmp/test/file3.txt" because it is read-only. This again has something to do with the internal vfs cache. > throws Exception { > FileSystemManager fsManager = VFS.getManager(); > FileObject file1 = fsManager.resolveFile("/tmp/file1.txt"); > FileObject file2 = fsManager.resolveFile("/tmp/file2.txt"); > new File("/tmp/test/").mkdirs(); > > FileObject file3 = fsManager.resolveFile("/tmp/test/file3.txt"); > FileUtil.copyContent(file1, file3); > new File("/tmp/test/file3.txt").delete(); > new File("/tmp/test/").delete(); > new File("/tmp/test/").mkdirs(); > file3 = fsManager.resolveFile("/tmp/test/file3.txt"); > file3.close(); > FileUtil.copyContent(file2, file3); > This will force vfs to refresh its internal states and then it works. PS: instead of FileUtils you might use file3.copyFrom(file2, Selectors.SELECT_SELF); In your case it will do the same, but that way you can also copy directroies or apply a file filter ... --- Mario --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org