It's not a secret anymore!
The moose likes Servlets and the fly likes URI vs. File - strange behaviour? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "URI vs. File - strange behaviour?" Watch "URI vs. File - strange behaviour?" New topic

URI vs. File - strange behaviour?

Johann Evans
Ranch Hand

Joined: Nov 18, 2002
Posts: 47
Interesting happening I had with my servlet and was wondering if anyone can explain it?
I'm using the JAXP SaxParser in a servlet to read a config XML document for the servlet for service rendering. Funny thing is that the SaxParser has a parse() method that can either take a File object or a String uri object plus the handler and a few other overloaded parse() methods. But my experience with the SaxParser was strangely different on an XP machine and a Win2000 machine.
The File object I passed on my machine (XP) and also on the Win2000 server. My machine did a succesful translation from the UNC win filepath to a URI. But Win2000 failed to do this translation under the exact same testing environment. So I simply used the File.toURI().toString() to pass it to the SaxParser and viola, it worked.
This seemed very odd to me - so I thought I'd post it here and see if anyone had any similar experience (Using JAXP1.0).
I agree. Here's the link:
subject: URI vs. File - strange behaviour?
It's not a secret anymore!