Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.lang.java.programmer > #5495

Re: CLI Java Glitch

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.posted.palinacquisition!news.posted.palinacquisition.POSTED!not-for-mail
NNTP-Posting-Date Tue, 21 Jun 2011 17:11:42 -0500
Date Tue, 21 Jun 2011 15:11:41 -0700
From Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com>
User-Agent Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10
MIME-Version 1.0
Newsgroups comp.lang.java.programmer
Subject Re: CLI Java Glitch
References <meevv65a675khs5c9goa9sp6f2hotf1321@4ax.com> <itogee$k8r$1@localhost.localdomain> <4dffe2ea$0$57121$c30e37c6@exi-reader.telstra.net> <alpine.DEB.2.00.1106212245430.6476@urchin.earth.li>
In-Reply-To <alpine.DEB.2.00.1106212245430.6476@urchin.earth.li>
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
Message-ID <TL-dnR5jfceDipzTnZ2dnUVZ_t6dnZ2d@posted.palinacquisition> (permalink)
Lines 71
X-Usenet-Provider http://www.giganews.com
NNTP-Posting-Host 50.46.118.188
X-Trace sv3-EPsrd9YY/4hYgiLjrv640zY1jiRib/96rA+5JyywLcPbFb5ir3ana+bPc89l/Ii3CqQIMITytuj8ucn!Jb8zvY9GHl8Mz/sh8AQpykXz0s6d8t+WRwWXWJ4PzeMepvmtozhCh3Ce1NYlLVeRLtJ/Ep6IPhhj!BpihfW4TGRxuls2QGx94Hoou4HzS681IiRqrTyUI2YE=
X-Complaints-To abuse@iinet.com
X-DMCA-Complaints-To abuse@iinet.com
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 5103
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:5495

Show key headers only | View raw


On 6/21/11 2:49 PM, Tom Anderson wrote:
> On Tue, 21 Jun 2011, Esmond Pitt wrote:
>
>> On 21/06/2011 8:09 AM, Martin Gregorie wrote:
>>
>>> The Java language system does case-sensitive comparisons between class
>>> names and the files that contain them when checking that a class name
>>> matches the file name that contains it
>>
>> Nitpicking, but it doesn't really do that, does it. It opens a .class
>> file of the name the user specified, loads the class(es) it contains,
>> and tries to find the classname it was looking for among those
>> classes. It doesn't explicitly compare the filename and the classname.
>> The operating system gave it HelloWorld.class in response to
>> 'helloworld.class' because that's how the OS file system happened to
>> work.
>
> The way Java does this at the moment means that 'java helloworld', where
> there is no class 'helloworld', does different things on Windows
> depending on whether there is a class HelloWorld, hElLoWoRlD,
> HelloworlD, etc.
>
> That seems pretty shoddy to me. If you're a case-sensitive program
> running on a case-insensitive operating system, i think it falls on you
> to pay special attention to case in your dealings with that system:

Speaking of "shoddy", some might consider it "shoddy" to call the 
_operating system_ "case-insensitive" when in fact it's the _file 
system_ that is case-insensitive.

And even Unix variants can often be found using case-insensitive file 
systems, just as Windows can often be found using case-sensitive file 
systems (though probably less frequently than the case-insensitive/Unix 
scenario, since the Windows ecosystem is generally more homogeneous).

> when
> java opens a class file, it ought to check that the name of the file
> it's opened actually has the right case, and if it doesn't, discard it,
> and act as if it had got a file not found error from the operating system.

I don't believe that the error comes from the operating system.  The 
error comes from opening a file that matches (according to the rules of 
the file system) the name that was given, which succeeds (i.e. no 
error), but then failing to find a correctly-named class in that file. 
The error itself comes from Java, not from the operating system nor even 
the file system.

And frankly, I don't see how Java can do any better than that.  Even on 
a given OS, the file system itself may or may not be case-insensitive. 
The best Java can do is ask the file system to open the file that the 
user specified (exactly as the user specified it), and then if that 
succeeds to then look for the same-named class.

Short of making Java a case-insensitive language (which seems 
impractical at this point, whether or not anyone might have thought that 
a good idea from the outset), I don't see how Java could improve on the 
situation.  For better or worse, Java _is_ case-sensitive, which means 
that it definitely should be just as illegal for the user to specify 
"helloworld" as the class name when starting the program as it is for 
the programmer to specify "helloworld" as the class name when referring 
to it from code.

If Java is deficient in any way here, I'd say it's the inability to 
specify the .class file name separately from the name of the class 
itself, specifically because of the potential for this mis-match of 
casing rules.  But even that seems a stretch to me, especially since 
offering that option could encourage people naming their .class files 
something completely different than the class contained within 
(something I'd rather not see as a general practice :) ).

Pete

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

CLI Java Glitch Gene Wirchenko <genew@ocis.net> - 2011-06-20 14:24 -0700
  Re: CLI Java Glitch Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-06-20 14:48 -0700
  Re: CLI Java Glitch Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-06-20 18:49 -0300
  Re: CLI Java Glitch Martin Gregorie <martin@address-in-sig.invalid> - 2011-06-20 22:09 +0000
    Re: CLI Java Glitch Esmond Pitt <esmond.pitt@bigpond.com> - 2011-06-21 10:16 +1000
      Re: CLI Java Glitch Tom Anderson <twic@urchin.earth.li> - 2011-06-21 22:49 +0100
        Re: CLI Java Glitch Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-06-21 15:11 -0700
          Re: CLI Java Glitch Gene Wirchenko <genew@ocis.net> - 2011-06-21 16:37 -0700
            Re: CLI Java Glitch Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-06-21 17:54 -0700
            Re: CLI Java Glitch lewbloch <lewbloch@gmail.com> - 2011-06-22 09:02 -0700
              Re: CLI Java Glitch Gene Wirchenko <genew@ocis.net> - 2011-06-22 10:12 -0700
                Re: CLI Java Glitch Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-06-22 10:39 -0700
          Re: CLI Java Glitch Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-06-22 09:50 -0700
          Re: CLI Java Glitch Tom Anderson <twic@urchin.earth.li> - 2011-06-22 19:44 +0100
            Re: CLI Java Glitch Michael Wojcik <mwojcik@newsguy.com> - 2011-06-23 12:31 -0400
              Re: CLI Java Glitch Tom Anderson <twic@urchin.earth.li> - 2011-06-23 23:04 +0100
                Re: CLI Java Glitch Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-06-23 21:40 -0700
                Re: CLI Java Glitch Michael Wojcik <mwojcik@newsguy.com> - 2011-06-24 09:43 -0400
          Re: CLI Java Glitch Michael Wojcik <mwojcik@newsguy.com> - 2011-06-23 12:24 -0400
            Re: CLI Java Glitch Gene Wirchenko <genew@ocis.net> - 2011-06-23 14:32 -0700
            Re: CLI Java Glitch lewbloch <lewbloch@gmail.com> - 2011-06-24 09:12 -0700
              Re: CLI Java Glitch Bent C Dalager <bcd@pvv.ntnu.no> - 2011-06-24 22:49 +0000
                Re: CLI Java Glitch Gene Wirchenko <genew@ocis.net> - 2011-06-26 20:29 -0700
        Re: CLI Java Glitch Gene Wirchenko <genew@ocis.net> - 2011-06-21 16:29 -0700
        Re: CLI Java Glitch Nigel Wade <nmw-news@ion.le.ac.uk> - 2011-06-22 11:54 +0100
          Re: CLI Java Glitch Gene Wirchenko <genew@ocis.net> - 2011-06-22 10:16 -0700
            Re: CLI Java Glitch Patricia Shanahan <pats@acm.org> - 2011-06-22 11:06 -0700
              Re: CLI Java Glitch Gene Wirchenko <genew@ocis.net> - 2011-06-22 11:46 -0700
                Re: CLI Java Glitch Gene Wirchenko <genew@ocis.net> - 2011-06-22 12:50 -0700
                Re: CLI Java Glitch Nigel Wade <nmw-news@ion.le.ac.uk> - 2011-06-23 15:23 +0100
                Re: CLI Java Glitch Gene Wirchenko <genew@ocis.net> - 2011-06-23 08:58 -0700
                Re: CLI Java Glitch lewbloch <lewbloch@gmail.com> - 2011-06-24 08:58 -0700
                Re: CLI Java Glitch Gene Wirchenko <genew@ocis.net> - 2011-06-24 11:36 -0700
                Re: CLI Java Glitch Paul Cager <paul.cager@googlemail.com> - 2011-06-22 14:45 -0700
                Re: CLI Java Glitch Tom Anderson <twic@urchin.earth.li> - 2011-06-22 23:29 +0100
                Re: CLI Java Glitch Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-06-22 18:08 -0700
                Re: CLI Java Glitch Tom Anderson <twic@urchin.earth.li> - 2011-06-23 23:20 +0100
                Re: CLI Java Glitch Esmond Pitt <esmond.pitt@bigpond.com> - 2011-06-24 10:28 +1000
                Re: CLI Java Glitch Tom Anderson <twic@urchin.earth.li> - 2011-06-25 22:58 +0100
                Re: CLI Java Glitch Gene Wirchenko <genew@ocis.net> - 2011-06-26 20:31 -0700
                Re: CLI Java Glitch lewbloch <lewbloch@gmail.com> - 2011-06-24 09:00 -0700
          Re: CLI Java Glitch Tom Anderson <twic@urchin.earth.li> - 2011-06-22 20:00 +0100
            Re: CLI Java Glitch Nigel Wade <nmw-news@ion.le.ac.uk> - 2011-06-23 15:18 +0100
        Re: CLI Java Glitch Esmond Pitt <esmond.pitt@bigpond.com> - 2011-06-23 11:40 +1000
          Re: CLI Java Glitch Esmond Pitt <esmond.pitt@bigpond.com> - 2011-06-23 20:21 +1000
          Re: CLI Java Glitch Gene Wirchenko <genew@ocis.net> - 2011-06-23 09:00 -0700
            Re: CLI Java Glitch Esmond Pitt <esmond.pitt@bigpond.com> - 2011-06-24 10:24 +1000
    Re: CLI Java Glitch Tom Anderson <twic@urchin.earth.li> - 2011-06-21 22:52 +0100
  Re: CLI Java Glitch Jeff Higgins <jeff@invalid.invalid> - 2011-06-20 19:11 -0400
    Re: CLI Java Glitch Lew Bloch <lewisbloch@google.com> - 2011-06-20 16:25 -0700
      Re: CLI Java Glitch Jeff Higgins <jeff@invalid.invalid> - 2011-06-20 19:45 -0400
        Re: CLI Java Glitch Lew Bloch <lewisbloch@google.com> - 2011-06-20 18:28 -0700
        Ping: Lew Bloch Jeff Higgins <jeff@invalid.invalid> - 2011-06-20 23:26 -0400
          Re: Ping: Lew Bloch Lew Bloch <lewisbloch@google.com> - 2011-06-21 10:25 -0700
            Re: Ping: Lew Bloch Jeff Higgins <jeff@invalid.invalid> - 2011-06-21 14:36 -0400
      Re: CLI Java Glitch Patricia Shanahan <pats@acm.org> - 2011-06-20 17:02 -0700
        Re: CLI Java Glitch Jeff Higgins <jeff@invalid.invalid> - 2011-06-20 20:37 -0400
          Re: CLI Java Glitch Jeff Higgins <jeff@invalid.invalid> - 2011-06-20 20:44 -0400
            Re: CLI Java Glitch Tom Anderson <twic@urchin.earth.li> - 2011-06-21 22:45 +0100
  Re: CLI Java Glitch Roedy Green <see_website@mindprod.com.invalid> - 2011-06-20 16:55 -0700
    Re: CLI Java Glitch Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-06-20 20:44 -0400
      Re: CLI Java Glitch Gene Wirchenko <genew@ocis.net> - 2011-06-20 19:26 -0700
      Re: CLI Java Glitch Paul Cager <paul.cager@googlemail.com> - 2011-06-21 02:34 -0700
        Re: CLI Java Glitch Silvio <silvio@moc.com> - 2011-06-21 16:50 +0200
        Re: CLI Java Glitch "Gavino" <invalid@invalid.invalid> - 2011-06-21 21:35 +0200
      Re: CLI Java Glitch Roedy Green <see_website@mindprod.com.invalid> - 2011-06-21 11:59 -0700
        Re: CLI Java Glitch Gene Wirchenko <genew@ocis.net> - 2011-06-21 13:03 -0700
          Re: CLI Java Glitch BGB <cr88192@hotmail.com> - 2011-06-21 14:21 -0700
  Re: CLI Java Glitch Gene Wirchenko <genew@ocis.net> - 2011-06-20 19:29 -0700
  Re: CLI Java Glitch Tom Anderson <twic@urchin.earth.li> - 2011-06-21 22:42 +0100
    Re: CLI Java Glitch Gene Wirchenko <genew@ocis.net> - 2011-06-21 14:48 -0700
  Re: CLI Java Glitch Jeff Higgins <jeff@invalid.invalid> - 2011-06-21 21:52 -0400
    Re: CLI Java Glitch Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-06-22 07:56 -0300
      Re: CLI Java Glitch Jeff Higgins <jeff@invalid.invalid> - 2011-06-22 08:02 -0400
        Re: CLI Java Glitch Gene Wirchenko <genew@ocis.net> - 2011-06-22 10:18 -0700
          Re: CLI Java Glitch Jeff Higgins <jeff@invalid.invalid> - 2011-06-22 15:01 -0400
            Re: CLI Java Glitch Gene Wirchenko <genew@ocis.net> - 2011-06-22 12:54 -0700
          Re: CLI Java Glitch Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-06-22 18:52 -0300
          Re: CLI Java Glitch Michael Wojcik <mwojcik@newsguy.com> - 2011-06-23 15:13 -0400

csiph-web