[jcifs] Equivalent for java.io.File.getCanonicalPath()

Julian Reschke julian.reschke at gmx.de
Tue Feb 3 17:35:06 GMT 2004

Michael B Allen wrote:

>>>Can you give me an example of two URLs that refer to the same file but
>>>not equate equals() == true?
>>I think this already happens when two names differ only in
>>upper/lowercase, such as "smb://foo/bar" and "smb://foo/Bar". You may
>>also want to try "smb://foo/bar " (on NTFS).
> This is not true. Please do not post falsehoods here. If you want to
> report a bug then please take the time to check that you can reproduce it.
 > ...

Sorry, I somehow assumed that two SmbFiles are equal if and only if 
their canonical paths are identical.

After some more testing I think the differences to java.io.File are as 

- SmbFile's concept of "equality" doesn't show in getCanonicalPath(), 
it's hidden inside the "equals" method. Exposing that heuristics either 
inside getCanonicalPath() or in a separate method would be good.

- Instead of checking in the filesystem, SmbFile applies 
canonicalizations on it's own. I *think* this is unwise, because it 
won't work unless jCifs implements *exactly* the same rules as the 
remote operating system.

Regards, Julian

<green/>bytes GmbH -- http://www.greenbytes.de -- tel:+492512807760

More information about the jcifs mailing list