On 24 September 2010 07:31, Robert Muir <rcm...@gmail.com> wrote:
> On Fri, Sep 24, 2010 at 2:27 AM, Tim Ellison <t.p.elli...@gmail.com> wrote:
>
>>
>> No, I don't think it is a problem.  I was reviewing the invokers of
>> toLowerCase() and was confused by the wording in the spec.  I'm happy
>> that we should simply lowercase it in a locale independent way, and
>> don't need to do a "windows equals" implementation.
>>
>
> Ok, but sure seems like a bug to me.
>
>    File f1 = new File("σ.txt");
>    File f2 = new File("ς.txt");
>    System.out.println(f1.hashCode());
>    System.out.println(f2.hashCode());
>    System.out.println(f1.equals(f2));
>
> 889962580
> 890776533
> true

Here are my results for the equivalent code (easier to compile, as no
need to specify encoding):
        File f1 = new File("\u03c3.txt");
        File f2 = new File("\u03c2.txt");

I also added:

     System.out.println(f2.getCanonicalPath().equals(f1.getCanonicalPath()));

Windows XP: Java 1.5.0 & Java 1.6.0
889962580
890776533
true
true|false - if the file exists before comparing canonicalPaths, then
true, else false.

Minotaur: Diablo Java(TM) SE Runtime Environment (build 1.6.0_07-b02)
889962580
890776533
false
true - does not depend on whether the file exists

Note the change in equals. However, createFile() does not create a
different file.

ISTM that the Windows code should not generate different canonical
paths depending on the contents of the directory.

Not sure about the Un*x code - it seems odd to have equal canonical
paths, but different Files

Reply via email to