myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwald...@apache.org
Subject svn commit: r886032 - /myfaces/trinidad/branches/1.2.12.2-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/ResourceServlet.java
Date Wed, 02 Dec 2009 01:49:05 GMT
Author: jwaldman
Date: Wed Dec  2 01:49:05 2009
New Revision: 886032

URL: http://svn.apache.org/viewvc?rev=886032&view=rev
Log:
TRINIDAD-1629 ResourceServlet.java._setHeaders() can call response.setContentType() with a
null contentType resulting in an NPE on Websphere.
minor code fix to previous checkin. thanks Gary Kind

Modified:
    myfaces/trinidad/branches/1.2.12.2-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/ResourceServlet.java

Modified: myfaces/trinidad/branches/1.2.12.2-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/ResourceServlet.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.2-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/ResourceServlet.java?rev=886032&r1=886031&r2=886032&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.2-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/ResourceServlet.java
(original)
+++ myfaces/trinidad/branches/1.2.12.2-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/ResourceServlet.java
Wed Dec  2 01:49:05 2009
@@ -436,6 +436,16 @@
         contentType = "image/vnd.microsoft.icon";
       else
         contentType = getServletContext().getMimeType(resourcePath);
+
+      // The resource has an file extension we have not 
+      // included in the case statement above
+      if (contentType == null)
+      {
+        _LOG.warning("ResourceServlet._setHeaders(): " +  
+                     "Content type for {0} is NULL!\n" +
+                     "Cause: Unknown file extension",
+                     resourcePath);
+      }
     }
     
     if (contentType != null)
@@ -446,18 +456,6 @@
       if (contentLength >= 0)
         response.setContentLength(contentLength);
     }
-    else
-    {
-      // The resource has an file extension we have not 
-      // included in the case statement above
-      url = connection.getURL();
-      resourcePath = url.getPath();
-
-      _LOG.warning("ResourceServlet._setHeaders(): " +  
-                   "Content type for {0} is NULL!\n" +
-                   "Cause: Unknown file extension",
-                   resourcePath);
-    } 
     
     long lastModified;
     try



Mime
View raw message