Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

URI vs. File - strange behaviour?  RSS feed

Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!