[
https://issues.jboss.org/browse/AS7-6249?page=com.atlassian.jira.plugin.s...
]
Christian Kaltepoth updated AS7-6249:
-------------------------------------
Attachment: as7-url-bug.zip
Sample project to reproduce the issue
ServletContext.getResource() doesn't work correctly for files
containing hash characters
----------------------------------------------------------------------------------------
Key: AS7-6249
URL:
https://issues.jboss.org/browse/AS7-6249
Project: Application Server 7
Issue Type: Bug
Components: Web
Affects Versions: 7.1.3.Final (EAP)
Environment: Linux 3.2.0-30-generic Ubuntu SMP x86_64 GNU/Linux
Reporter: Christian Kaltepoth
Assignee: Remy Maucherat
Attachments: as7-url-bug.zip
{{ServletContext.getResource()}} returns an invalid URL if the file name contains {{#}}
characters.
Example:
{code:java}
URL url = servletContext.getResource("/file#1.txt");
{code}
The resulting URL object will be spitted at the {{#}} character like this:
{code}
url.toString(): jndi:/default-host/tomcat-url-bug/file#1.txt
url.getPath(): /default-host/tomcat-url-bug/file
url.getRef(): 1.txt
{code}
Calling {{url.openStream()}} will throw a {{FileNotFoundException}}.
This is a known Tomcat issue fixed in 7.0.28.
References:
https://issues.apache.org/bugzilla/show_bug.cgi?id=53257
https://issues.apache.org/bugzilla/show_bug.cgi?id=51584
According to the discussion on the Tomcat issue tracker, there are also problems for
other characters which have special meaning in URLs.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira