Uploaded image for project: 'Wookie'
  1. Wookie
  2. WOOKIE-424

NPE with Wookie.war deployed on WildFly 8.0.0.CR1

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.14.0
    • 1.0.0
    • Server
    • None
    • WildFly 8.0.0.CR1, Undertow web server component 1.0.0.Beta31-SNAPSHOT

    Description

      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().

      Attachments

        Activity

          People

            Unassigned Unassigned
            darrenjones Darren Jones
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: