Skip to main content

Filename containing illegal character been allowed to open...?

2 replies [Last post]
rustyknight
Offline
Joined: 2006-03-24
Points: 0

I've just stumbled across this weird issue.

Our project is using an auto file name creation process, appending a series of strings together to produce our file name.

I stumbled across an issue with the filename being allowed to contain, which should be, an illegal character under windows (":"), except File.exists returns true on the file and we can open the file using an InputStream and read the contents.

I've done a local search for the file (including searching for it's contents) and can't seem to find, but Java is allowing the file to be created somewhere.

Has anybody else had a similar issue or know why this been allowed to occur?

Cheers
Shane

Message was edited by: rustyknight

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
walterln
Offline
Joined: 2007-04-17
Points: 0

Assuming you are on Windows, the file system can allow file names which the Win32 sub system doesn't.

See for more information [url]http://blogs.msdn.com/brian_dewey/archive/2004/01/19/60263.aspx[/url].

rustyknight
Offline
Joined: 2006-03-24
Points: 0

Okay, that "kinda" makes sense...

I did eventually find the file, it was been saved under the correct folder, but the name was been filtered so that every thing after and including the ":" character was been truncated...don't know why I didn't see it before, think I was still stunned that I wasn't getting an exception ...

Cheers
Shane