Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4190157
Votes 0
Synopsis using "Con" as a class name causes a problem (reserved filename in Win32)
Category java:compiler
Reported Against 1.1.6
Release Fixed
State 5-Cause Known, bug
Priority: 5-Very Low
Related Bugs 6241975 , 5043449 , 6176051
Submit Date 16-NOV-1998
Description


/*

This might be known already. But I couldn't find in the
bug search.  If one use the word "Con" as a name for a
class, the JDK compiler produces the byte code, and
dumps to the screen, instead of creating a file
"Con.class".  Appearantly, it misinterprets the class
name as Console or something.

*/
class Con {
    public static void outputMessage() {
	System.out.println("java.version                  = " +
			   System.getProperty("java.version"));
	System.out.println("Operating System Name         = " +
			   System.getProperty("os.name"));
	System.out.println("Operating system architecture = " +
			   System.getProperty("os.arch"));
	System.out.println("Operating system version      = " +
			   System.getProperty("os.version") + "\n");
    }

    public static void main(String[] args) {
	outputMessage();
    }
}

(Review ID: 42799)
======================================================================
Posted Date : 2006-02-03 05:02:52.0
Work Around


Don't use the word "Con".
======================================================================
Evaluation
I recall that there is special meaning for Con on win32 systems.  For Con.class as well?  I don't know.  Passing this on...

  xxxxx@xxxxx   1998-12-01

CON, LPT, NUL, and several others are reserved pathnames in win32.
Presumably, the compiler should know about these and escape them,
though I am unhappy with the idea that the compiler should know anything
about the platform it is running on -- it *should* be the canonical
100% pure Java program.  Again, this shows the need for a platform-independent
filesystem, or a means to query its capabilities in an abstract way.
See also 4307912.  Unlike the case with that bug, however, adopting a
"lowest common denominator" approach, always escaping these names on all
platforms, is not so unpalatable.

  xxxxx@xxxxx   2000-02-02
After bug 6176051 has been fixed in Mustang, the compiler should
now be able to handle this situation gracefully.
Posted Date : 2006-02-03 05:08:18.0

bug 6176051 has been fixed. Should check if the class file is a valid writable file before writing it, and fail gracefully if not.
Posted Date : 2006-12-08 03:32:22.0

See 6241975 for a list of bad possible names.
Posted Date : 2009-09-24 00:22:58.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang