Return-Path: Delivered-To: apmail-commons-user-archive@www.apache.org Received: (qmail 93780 invoked from network); 12 Jan 2009 16:54:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Jan 2009 16:54:09 -0000 Received: (qmail 98960 invoked by uid 500); 12 Jan 2009 16:54:06 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 98665 invoked by uid 500); 12 Jan 2009 16:54:05 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 98654 invoked by uid 99); 12 Jan 2009 16:54:05 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Jan 2009 08:54:05 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of ralph.goers@dslextreme.com designates 209.85.217.19 as permitted sender) Received: from [209.85.217.19] (HELO mail-gx0-f19.google.com) (209.85.217.19) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Jan 2009 16:53:54 +0000 Received: by gxk12 with SMTP id 12so1041gxk.10 for ; Mon, 12 Jan 2009 08:53:33 -0800 (PST) Received: by 10.142.185.21 with SMTP id i21mr12359156wff.220.1231779209861; Mon, 12 Jan 2009 08:53:29 -0800 (PST) Received: from ?192.168.10.129? (adsl-66-51-196-164.dslextreme.com [66.51.196.164]) by mx.google.com with ESMTPS id 28sm8348739wfd.14.2009.01.12.08.53.28 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 12 Jan 2009 08:53:29 -0800 (PST) Message-Id: <4D45E850-CACE-4A4A-9BF5-601ED05016A1@dslextreme.com> To: "Commons Users List" In-Reply-To: <496B428D.7020402@wilken.de> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Subject: Re: [VFS] File names are NOT case sensitive on Windows Date: Mon, 12 Jan 2009 08:53:27 -0800 References: <496B428D.7020402@wilken.de> X-Mailer: Apple Mail (2.930.3) From: Ralph Goers X-Virus-Checked: Checked by ClamAV on apache.org On Jan 12, 2009, at 5:15 AM, Schuster, Stephan (Wilken GmbH) wrote: > Hi together, > > I just encountered the following problem with Commons VFS on Windows: > > FileSystemManager fsManager = VFS.getManager(); > FileObject fo1 = fsManager.resolveFile("c:\\test.txt"); // lower case > FileObject fo2 = fsManager.resolveFile("C:\\test.txt"); // upper case > System.out.println(fo1.equals(fo2)); // false but should be true > > > > > A while ago i was wondering why AbstractFileObject does not > overwrite equals() or hashCode() but uses a simple object comparison > (see http://www.mail-archive.com/user@commons.apache.org/msg01655.html) > . > > Mario Ivankovits answered: > > "The current VFS implementation (if you do not use anything else > then the only-working SoftRefFilesCache) ensures that two > resolveFile will return the same object if you ask for the same > filename, thus, in terms of VFS there is nothing bad with the object > comparison." > > That's right, however, the caching mechanism uses a TreeMap hashing > file systems by a so called FileSystemKey which encapsulates their > root path as an implementation of FileName (on Windows: > WindowsFileName). Comparing two such FileSystemKeys internally > results in a simple String comparison where e.g. "c:" and "C:" are > considered different. In the test case listed above, VFS will > therefore create two instances of FileObject, one for "c:\\test.txt" > and one for "C:\\test.txt". An object comparison between both > obviously returns false even though it's the same file. > > > Since file names are not case sensitive on Windows, equals(), > hashCode() and compareTo() of WindowsFileName should probably > convert all paths to lower case before comparing them. > > > Any other ideas? Please create an issue in Jira. If you would like to create a patch please feel free. ;-) Ralph --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@commons.apache.org For additional commands, e-mail: user-help@commons.apache.org