> -----Original Message----- > From: J. B. Rainsberger [mailto:[EMAIL PROTECTED] > Sent: 29 November 2003 12:18 > To: Cactus Users List > Subject: Re: Code Review (Re: "You must either set location or path on > <pathelement>" Exception Message)
[snip] > >>>>I think this could and /should/ be > >>>> > >>>> new File(javaHome, "../lib/tools.jar"); > >>> > >>> > >>>Are you confident javaHome will always contain a trailing "/"? > >> > >>No. That's the point of using 'new File(directory, relativePath)'. The > >>nice Java folks have already worried about trailing slash or not > >>trailing slash. Why should /we/ worry about it? > > > > > > Cool. I didn't know that :-) BTW, I've had a look at the JDK 1.4 javadoc > > for File and I couldn't see this mentioned anywhere. Are you sure this > > is an exposed feature or simply an implementation detail of the Sun's > > JDK? > > The parent path (the first parameter) is "taken to be a directory" > [Javadoc], so it doesn't matter whether the parent path you specify ends > in "/" -- File treats it like a directory, anyway. The relative path is > always taken from the directory represented by the parent path. The > whole point of the constructor is to avoid this entire trailing slash > issue! :) yep. Sorry, I'm a bit slow this morning :-) Thanks -Vincent --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
