This content has been marked as final.
Show 3 replies
-
1. Re: Spaces in Paths - %20 Weirdness
dlindquist Mar 2, 2005 5:52 PM (in response to dlindquist)Further information...
The root cause of this appears to be the fact that JBoss registers itself as an URLConnection provider, and it's FileURLConnection object is broken (replaces spaces with %20).
This occurs when trying to do a parse on an XML document giving the parser a File object.
Here's a stack trace to show how it works:java.io.FileNotFoundException: D:\path\with%20spaces\to\file.xml at org.jboss.net.protocol.file.FileURLConnection.connect(FileURLConnection.java:71) at org.jboss.net.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:80) at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source) at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
Is there any workaround to fix this damn thing? -
2. Re: Spaces in Paths - %20 Weirdness
dbeachy1 Mar 10, 2005 3:48 PM (in response to dlindquist)Yes, this is nasty JBoss bug that is killing us in deployment. I'm amazed that this bug is still there all the way through version 4.0.1. I am working on submitting a proper bug report, but in the meantime I have created a patched lib/jboss-common.jar with the following fix to FileURLConnection.java:
---------------public FileURLConnection(final URL url) throws MalformedURLException, IOException { super(url); // D. Beachy: fix to handle URI-encoded paths with spaces String decodedPath = URLDecoder.decode(url.getPath().replace('/', File.separatorChar).replace('|', ':'), "UTF-8"); file = new File(decodedPath); doOutput = false; }
---------------
Then I compiled it and updated the original jboss-common.jar with the class file. Presto -- JBoss now correctly handles real file URLs. I still can't believe this bug hasn't been fixed long before now...
- Doug
http://www.chalexopenadvantage.org/