Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > A strange behaviour of a File property

Reply
Thread Tools

A strange behaviour of a File property

 
 
Andreas Leitgeb
Guest
Posts: n/a
 
      11-13-2011
Arne Vajhøj <(E-Mail Removed)> wrote:
> On 11/11/2011 10:21 PM, Andreas Leitgeb wrote:
>> Eric Sosman<(E-Mail Removed)> wrote:
>>> IMHO, Java errs in exposing any "path separator" at all, because
>>> it just encourages string-bashing. Note that in some file systems
>>> there is no such thing as a "path separator;" on one such I had
>>> files with names like
>>> SYS$DISK:[USERS.ERIC.PROJECT]README.TXT;22

>> Such beasts still exist in the wild?


> $ type DISK2:[ARNE]HELLOWORLD.JAVA;1

[...]

This doesn't yet answer the "in the wild"-part: Is that a machine
still in productive use, or is it merely running under a VAX-emulator
on a PC (just for playing around)?

Anyway, as it seems (gathered from googled pages), java is able to
translate paths like "/disk2/arne/helloworld.java" to what the
system understands, so there'd not really be much of a need for a Java
programmer to explicitly deal with those path construction pecularities.

 
Reply With Quote
 
 
 
 
Andreas Leitgeb
Guest
Posts: n/a
 
      11-13-2011
Arne Vajhøj <(E-Mail Removed)> wrote:
> On 11/12/2011 5:09 PM, Andreas Leitgeb wrote:
>> Eric Sosman<(E-Mail Removed)> wrote:
>>> On 11/11/2011 10:21 PM, Andreas Leitgeb wrote:
>>>> Eric Sosman<(E-Mail Removed)> wrote:
>>>>> [...] Note that in some file systems
>>>>> there is no such thing as a "path separator;" on one such I had
>>>>> files with names like
>>>>> SYS$DISK:[USERS.ERIC.PROJECT]README.TXT;22
>>>> Such beasts still exist in the wild?
>>> http://en.wikipedia.org/wiki/Files-1...ion_and_naming
>>> "A fossil!" I hear you cry, "A dried relic of prehistory!"

>> I'm not the type who would cry out about it, but I admit, I did think
>> something more or less similar.

> I do not consider version numbers prehistoric relics.


Of course not those... (I think I've seen them even in some modern
filesystems with versioning support).
But I do consider the brackets enclosing the directory part of a
file's path to be such. (namely prehistoric relics)

> * Java actually supports both native syntax and traditional
> *nix / syntax for filenames


So that gets us back to the start:
Just using "/" as dir-separator is very likely to get you far enough.

 
Reply With Quote
 
 
 
 
Arne Vajhøj
Guest
Posts: n/a
 
      11-13-2011
On 11/12/2011 8:15 PM, Andreas Leitgeb wrote:
> Arne Vajhøj<(E-Mail Removed)> wrote:
>> On 11/11/2011 10:21 PM, Andreas Leitgeb wrote:
>>> Eric Sosman<(E-Mail Removed)> wrote:
>>>> IMHO, Java errs in exposing any "path separator" at all, because
>>>> it just encourages string-bashing. Note that in some file systems
>>>> there is no such thing as a "path separator;" on one such I had
>>>> files with names like
>>>> SYS$DISK:[USERS.ERIC.PROJECT]README.TXT;22
>>> Such beasts still exist in the wild?

>
>> $ type DISK2:[ARNE]HELLOWORLD.JAVA;1

> [...]
>
> This doesn't yet answer the "in the wild"-part: Is that a machine
> still in productive use, or is it merely running under a VAX-emulator
> on a PC (just for playing around)?


There are still some in production use.

The one used is hobbyist only though.

> Anyway, as it seems (gathered from googled pages), java is able to
> translate paths like "/disk2/arne/helloworld.java" to what the
> system understands, so there'd not really be much of a need for a Java
> programmer to explicitly deal with those path construction pecularities.


I consider it very relevant for an Java app to be able to handle
native file name syntax - after all that is what most likely
will be specified in config files and manually entered.

Arne


 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      11-13-2011
On 11/12/2011 8:28 PM, Andreas Leitgeb wrote:
> Arne Vajhøj<(E-Mail Removed)> wrote:
>> On 11/12/2011 5:09 PM, Andreas Leitgeb wrote:
>>> Eric Sosman<(E-Mail Removed)> wrote:
>>>> On 11/11/2011 10:21 PM, Andreas Leitgeb wrote:
>>>>> Eric Sosman<(E-Mail Removed)> wrote:
>>>>>> [...] Note that in some file systems
>>>>>> there is no such thing as a "path separator;" on one such I had
>>>>>> files with names like
>>>>>> SYS$DISK:[USERS.ERIC.PROJECT]README.TXT;22
>>>>> Such beasts still exist in the wild?
>>>> http://en.wikipedia.org/wiki/Files-1...ion_and_naming
>>>> "A fossil!" I hear you cry, "A dried relic of prehistory!"
>>> I'm not the type who would cry out about it, but I admit, I did think
>>> something more or less similar.

>> I do not consider version numbers prehistoric relics.

>
> Of course not those... (I think I've seen them even in some modern
> filesystems with versioning support).
> But I do consider the brackets enclosing the directory part of a
> file's path to be such. (namely prehistoric relics)


So / is modern but [] is oldfashioned.

Are there any objective reason for that?

>> * Java actually supports both native syntax and traditional
>> *nix / syntax for filenames

>
> So that gets us back to the start:
> Just using "/" as dir-separator is very likely to get you far enough.


It will get you to where a user actually specify a filename
in normal native syntax.

Arne



 
Reply With Quote
 
Eric Sosman
Guest
Posts: n/a
 
      11-13-2011
On 11/12/2011 8:15 PM, Andreas Leitgeb wrote:
> Arne Vajhøj<(E-Mail Removed)> wrote:
>> On 11/11/2011 10:21 PM, Andreas Leitgeb wrote:
>>> Eric Sosman<(E-Mail Removed)> wrote:
>>>> IMHO, Java errs in exposing any "path separator" at all, because
>>>> it just encourages string-bashing. Note that in some file systems
>>>> there is no such thing as a "path separator;" on one such I had
>>>> files with names like
>>>> SYS$DISK:[USERS.ERIC.PROJECT]README.TXT;22
>>> Such beasts still exist in the wild?

>
>> $ type DISK2:[ARNE]HELLOWORLD.JAVA;1

> [...]
>
> This doesn't yet answer the "in the wild"-part: Is that a machine
> still in productive use, or is it merely running under a VAX-emulator
> on a PC (just for playing around)?
>
> Anyway, as it seems (gathered from googled pages), java is able to
> translate paths like "/disk2/arne/helloworld.java" to what the
> system understands, so there'd not really be much of a need for a Java
> programmer to explicitly deal with those path construction pecularities.


Speaking as a person who wrote code that tried to mediate
between VMS ("structured") file names and Unix ("just glob it") paths,
I am here to tell you that there are many subtle traps. Version numbers
inevitably got garbled, if not "in translation" then "in manipulation"
on the other side of the fence. The fact that the parent directory of

SYS$DISK:[USERS.ERIC.PROJECT]README.TXT;22
was
SYS$DISK:[USERS.ERIC]PROJECT.DIR;1

baffled innumerable Unixoid programs that thought they could just "take
everything before the rightmost separator" to get the parent's name.
Anybody who thinks the mapping is half a day's work has got another
think coming -- and weeks of unplanned labor, too. I've got the scars.

Common LISP supported a richer filename abstraction, one that could
handle Unix and DOS and Apollo and Mac and VMS and probably others I wot
not of. Steele was certainly aware of LISP's capability (he made money
off a LISP book, after all), so Java's blinkered view is puzzling.

IMHO, File is the second-sloppiest "everyday" core Java class,
losing out only to Date (if "losing" is the right word).

--
Eric Sosman
http://www.velocityreviews.com/forums/(E-Mail Removed)d
 
Reply With Quote
 
Andreas Leitgeb
Guest
Posts: n/a
 
      11-13-2011
Arne Vajhøj <(E-Mail Removed)> wrote:
> On 11/12/2011 8:28 PM, Andreas Leitgeb wrote:
>> Arne Vajhøj<(E-Mail Removed)> wrote:
>>> On 11/12/2011 5:09 PM, Andreas Leitgeb wrote:
>>>> Eric Sosman<(E-Mail Removed)> wrote:
>>>>> On 11/11/2011 10:21 PM, Andreas Leitgeb wrote:
>>>>>> Eric Sosman<(E-Mail Removed)> wrote:
>>>>>>> [...] Note that in some file systems
>>>>>>> there is no such thing as a "path separator;" on one such I had
>>>>>>> files with names like
>>>>>>> SYS$DISK:[USERS.ERIC.PROJECT]README.TXT;22
>>>>>> Such beasts still exist in the wild?
>>>>> http://en.wikipedia.org/wiki/Files-1...ion_and_naming
>>>>> "A fossil!" I hear you cry, "A dried relic of prehistory!"
>>>> I'm not the type who would cry out about it, but I admit, I did think
>>>> something more or less similar.
>>> I do not consider version numbers prehistoric relics.

>> Of course not those... (I think I've seen them even in some modern
>> filesystems with versioning support).
>> But I do consider the brackets enclosing the directory part of a
>> file's path to be such. (namely prehistoric relics)


> So / is modern but [] is oldfashioned.
> Are there any objective reason for that?


In a way, I envy you (Eric and Arne) for your wider horizon. I've
never got in touch with it, and haven't found any official ISO image
or zip or tarball, either, to get my own hands on it. (I guess the
"open" in "openvms" is more like the one in "openmotif", than the
one in "openoffice".

That said, I do have my "personal reasons" for calling openvms
essentially irrelevant for new software development (a bit like
pre-X MacOS, CP/M - not to mention my sharp pocket-computers from
last decade's eighties). I'm not going to write a thesis on
scientific classification of operating systems by their "obsolete-
ness", though.

It's the same principial reason, btw., that makes others discard
anything non-MS.

 
Reply With Quote
 
Martin Gregorie
Guest
Posts: n/a
 
      11-13-2011
On Sat, 12 Nov 2011 20:42:21 -0500, Arne Vajhøj wrote:

> On 11/12/2011 8:28 PM, Andreas Leitgeb wrote:
>> Arne Vajhøj<(E-Mail Removed)> wrote:
>>> On 11/12/2011 5:09 PM, Andreas Leitgeb wrote:
>>>> Eric Sosman<(E-Mail Removed)> wrote:
>>>>> On 11/11/2011 10:21 PM, Andreas Leitgeb wrote:
>>>>>> Eric Sosman<(E-Mail Removed)> wrote:
>>>>>>> [...] Note that in some file systems there is no such thing as a
>>>>>>> "path separator;" on one such I had files with names like
>>>>>>> SYS$DISK:[USERS.ERIC.PROJECT]README.TXT;22
>>>>>> Such beasts still exist in the wild?
>>>>> http://en.wikipedia.org/wiki/Files-1...ion_and_naming
>>>>> "A fossil!" I hear you cry, "A dried relic of prehistory!"
>>>> I'm not the type who would cry out about it, but I admit, I did think
>>>> something more or less similar.
>>> I do not consider version numbers prehistoric relics.

>>
>> Of course not those... (I think I've seen them even in some modern
>> filesystems with versioning support).
>> But I do consider the brackets enclosing the directory part of a file's
>> path to be such. (namely prehistoric relics)

>
> So / is modern but [] is oldfashioned.
>
> Are there any objective reason for that?
>
>>> * Java actually supports both native syntax and traditional
>>> *nix / syntax for filenames

>>
>> So that gets us back to the start:
>> Just using "/" as dir-separator is very likely to get you far enough.

>
> It will get you to where a user actually specify a filename in normal
> native syntax.
>

.... but its best to get into the habit of assembling a filename along the
lines of
dirNameList + File.separator + fileName

rather than using
dirNameList + "/" + fileName


--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |
 
Reply With Quote
 
Andreas Leitgeb
Guest
Posts: n/a
 
      11-13-2011
Arne Vajhøj <(E-Mail Removed)> wrote:
> On 11/12/2011 8:15 PM, Andreas Leitgeb wrote:
>> Arne Vajhøj<(E-Mail Removed)> wrote:
>>> On 11/11/2011 10:21 PM, Andreas Leitgeb wrote:
>>>> Eric Sosman<(E-Mail Removed)> wrote:
>>>>> IMHO, Java errs in exposing any "path separator" at all, because
>>>>> it just encourages string-bashing. Note that in some file systems
>>>>> there is no such thing as a "path separator;" on one such I had
>>>>> files with names like
>>>>> SYS$DISK:[USERS.ERIC.PROJECT]README.TXT;22
>>>> Such beasts still exist in the wild?
>>> $ type DISK2:[ARNE]HELLOWORLD.JAVA;1

>> This doesn't yet answer the "in the wild"-part: Is that a machine
>> still in productive use, or is it merely running under a VAX-emulator
>> on a PC (just for playing around)?

> There are still some in production use.
> The one used is hobbyist only though.


These aren't sufficient criteria for "non-obsolete" in my own dictionary

>> Anyway, as it seems (gathered from googled pages), java is able to
>> translate paths like "/disk2/arne/helloworld.java" to what the
>> system understands, so there'd not really be much of a need for a Java
>> programmer to explicitly deal with those path construction pecularities.

> I consider it very relevant for an Java app to be able to handle
> native file name syntax - after all that is what most likely
> will be specified in config files and manually entered.


If a Java application making use of "/"-heuristics on filenames was deployed
to an openvms platform, then likely those who deploy it will have to explain
to the users how to specify paths for that app. That's bad luck for systems
on the waning side of their project life cycle.

 
Reply With Quote
 
Andreas Leitgeb
Guest
Posts: n/a
 
      11-13-2011
Martin Gregorie <(E-Mail Removed)> wrote:
> On Sat, 12 Nov 2011 20:42:21 -0500, Arne Vajhøj wrote:
>>>> * Java actually supports both native syntax and traditional
>>>> *nix / syntax for filenames
>>> So that gets us back to the start:
>>> Just using "/" as dir-separator is very likely to get you far enough.

>> It will get you to where a user actually specify a filename in normal
>> native syntax.

> ... but its best to get into the habit of assembling a filename along the
> lines of
> dirNameList + File.separator + fileName
> rather than using
> dirNameList + "/" + fileName


What I picked up from this semi off topic thread is, that the particular
distinction is utterly irrelevant, and the only portable (in Java's sense)
way to do file-name manipulations would be to wrap the original name in a
File object, and stick to File methods as much as possible, turning back
to a String only at the end of all the jugglings.

If portability means merely "runs on Windows and various unixoids", then
File.separator is at least better than "\\".

 
Reply With Quote
 
Andreas Leitgeb
Guest
Posts: n/a
 
      11-13-2011
Eric Sosman <(E-Mail Removed)> wrote:
> Speaking as a person who wrote code that tried to mediate
> between VMS ("structured") file names and Unix ("just glob it") paths,
> I am here to tell you that there are many subtle traps. Version numbers
> inevitably got garbled, if not "in translation" then "in manipulation"
> on the other side of the fence. The fact that the parent directory of
>
> SYS$DISK:[USERS.ERIC.PROJECT]README.TXT;22
> was
> SYS$DISK:[USERS.ERIC]PROJECT.DIR;1
>
> baffled innumerable Unixoid programs that thought they could just "take
> everything before the rightmost separator" to get the parent's name.
> Anybody who thinks the mapping is half a day's work has got another
> think coming -- and weeks of unplanned labor, too. I've got the scars.


I'm still wondering, how this effort was even worth it.

Dinosaur systems typically are left with the software that ran on them
since Jura, and "new SW" often means binary-patching the running
processes directly in memory, rather than deploying brand-new (i.e. less
than 10 years old) code onto them. (Not entirely serious now.

Anyway, multiplying your effort for the task with the probability of
some random code going to be deployed on openvms makes it rather
cheap after all. Cheaper than having to teach coders to write file
name manipulations portably beyond choice of separator char in the
first place.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange Behaviour in finding Size of a File felix C Programming 34 11-19-2012 01:09 PM
Property File - property value break on multiple line Dev_SH Java 0 12-30-2010 09:34 AM
debugger behaviour different to execution behaviour Andy Chambers Java 1 05-14-2007 09:51 AM
strange file upload behaviour (404 with one pdf but not with another) mikecom@gmx.net ASP .Net 3 06-27-2006 10:15 AM
Strange behaviour when parsing a XML file Francesco Moi Perl Misc 2 07-27-2005 04:47 PM



Advertisments