Darren Jones created WOOKIE-424:
-----------------------------------
Summary: NPE with Wookie.war deployed on WildFly 8.0.0.CR1
Key: WOOKIE-424
URL: https://issues.apache.org/jira/browse/WOOKIE-424
Project: Wookie
Issue Type: Bug
Components: Server
Affects Versions: 0.15.0
Environment: WildFly 8.0.0.CR1, Undertow web server component
1.0.0.Beta31-SNAPSHOT
Reporter: Darren Jones
In LocalizedResourceFilter, there is code that looks for a localized copy of a
resource. Here is an example snippet that gives rise to the exception (around
line 185):
String filePath = filterConfig.getServletContext().getRealPath(path);
if (new File(filePath).exists())
return context + path;
According to the javadoc for ServletContext.getRealPath(), it is allowed to
return null if the file does not exist. As my widgets are not localized, this
is the case, and a NullPointerException occurs because null is then passed to
new File(filePath).
I'm not sure why this has not been found before - perhaps other web servers
have been returning non-null if a resource does not exist.
I've fixed it temporarily with a local patch that does an extra null check
before calling new File():
String filePath = filterConfig.getServletContext().getRealPath(path);
if (filePath != null && new File(filePath).exists())
return context + path;
I will attach a patch file since there are 3 places in the file using
getRealPath().
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)