dev@glassfish.java.net

Re: svn commit: r18296 - trunk/v3/core/kernel/src/main/java/com/sun/enterprise/v3/server/DomainXml.java

From: Kedar Mhaswade <Kedar.Mhaswade_at_Sun.COM>
Date: Thu, 28 Feb 2008 00:15:39 -0800

Jerome Dochez wrote:
> Byron
>
> 2 things :
> - can you explain why using getCanonicalFile() is desired here. I am not
> sure I see an advantage...

This is mostly related to Windows.

On Windows, a file created with File f = new File("c:/temp/foo");

has canonical path returned as "C:/temp/foo" whereas
absolute path returned as "c:/temp/foo"

(Observe the case), when the drive was created as "C:".

I guess Canonical path returns the correct system specific path.

> - you do not respect the Java Coding style... please do so
>

I am sorry, but at least this code is highly readable ...

> thanks, Jerome
>
> On Feb 27, 2008, at 1:24 AM, bnevins_at_dev.java.net wrote:
>
>> + private File absolutize(File f)
>> + {
>> + try
>> + {
>> + return f.getCanonicalFile();
>> + }
>> + catch(Exception e)
>> + {
>> + return f.getAbsoluteFile();
>> + }
>> + }
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>