Author: scottbw
Date: Tue Jan  7 14:54:34 2014
New Revision: 1556230

URL: http://svn.apache.org/r1556230
Log:
Added a guard against null values being passed to File constructor in 
LocalizedResourceFilter, causing issues deploying Wookie on Wildfly (see issue 
WOOKIE-424). Thanks to Darren Jones for the patch.

Modified:
    
wookie/trunk/src/main/java/org/apache/wookie/server/LocalizedResourceFilter.java

Modified: 
wookie/trunk/src/main/java/org/apache/wookie/server/LocalizedResourceFilter.java
URL: 
http://svn.apache.org/viewvc/wookie/trunk/src/main/java/org/apache/wookie/server/LocalizedResourceFilter.java?rev=1556230&r1=1556229&r2=1556230&view=diff
==============================================================================
--- 
wookie/trunk/src/main/java/org/apache/wookie/server/LocalizedResourceFilter.java
 (original)
+++ 
wookie/trunk/src/main/java/org/apache/wookie/server/LocalizedResourceFilter.java
 Tue Jan  7 14:54:34 2014
@@ -16,6 +16,7 @@ package org.apache.wookie.server;
 
 import java.io.File;
 import java.io.IOException;
+import java.lang.String;
 import java.net.URL;
 import java.util.List;
 
@@ -183,7 +184,7 @@ public class LocalizedResourceFilter imp
     for (ULocale locale : locales) {
       String path = basePath.replace(resource, "locales/" + 
locale.toLanguageTag().toLowerCase() + "/" + resource);
       String filePath = filterConfig.getServletContext().getRealPath(path);
-      if (new File(filePath).exists())
+      if (filePath != null && new File(filePath).exists())
         return context + path;
     }
 
@@ -194,7 +195,7 @@ public class LocalizedResourceFilter imp
     if (defaultLocale != null) {
       String path = basePath.replace(resource, "locales/" + 
defaultLocale.toLowerCase() + "/" + resource);
       String filePath = filterConfig.getServletContext().getRealPath(path);
-      if (new File(filePath).exists())
+      if (filePath != null && new File(filePath).exists())
         return context + path;
     }
 
@@ -202,7 +203,8 @@ public class LocalizedResourceFilter imp
     // All attempts to locate a localized copy have failed, so we must try to
     // find a non-localized version instead
     //
-    if (new 
File(filterConfig.getServletContext().getRealPath(basePath)).exists())
+      String filePath = filterConfig.getServletContext().getRealPath(basePath);
+      if (filePath != null && new File(filePath).exists())
       return context + basePath;
 
     //


Reply via email to