felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vvalc...@apache.org
Subject svn commit: r1309021 - /felix/trunk/webconsole-plugins/upnp/src/main/java/org/apache/felix/webconsole/plugins/upnp/internal/ControlServlet.java
Date Tue, 03 Apr 2012 16:29:31 GMT
Author: vvalchev
Date: Tue Apr  3 16:29:31 2012
New Revision: 1309021

URL: http://svn.apache.org/viewvc?rev=1309021&view=rev
Log:
Fixed FELIX-3427 NPE in UPnP Web Console Plugin
https://issues.apache.org/jira/browse/FELIX-3427

Modified:
    felix/trunk/webconsole-plugins/upnp/src/main/java/org/apache/felix/webconsole/plugins/upnp/internal/ControlServlet.java

Modified: felix/trunk/webconsole-plugins/upnp/src/main/java/org/apache/felix/webconsole/plugins/upnp/internal/ControlServlet.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/upnp/src/main/java/org/apache/felix/webconsole/plugins/upnp/internal/ControlServlet.java?rev=1309021&r1=1309020&r2=1309021&view=diff
==============================================================================
--- felix/trunk/webconsole-plugins/upnp/src/main/java/org/apache/felix/webconsole/plugins/upnp/internal/ControlServlet.java
(original)
+++ felix/trunk/webconsole-plugins/upnp/src/main/java/org/apache/felix/webconsole/plugins/upnp/internal/ControlServlet.java
Tue Apr  3 16:29:31 2012
@@ -94,6 +94,12 @@ public class ControlServlet extends Http
                     // enable caching
                     response.setDateHeader("Last-Modified", LAST_MODIFIED); //$NON-NLS-1$
 
+                    InputStream in = icon.getInputStream();
+                    if (null == in) { // this is buggy implementations
+                        response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+                        return;
+                    }
+
                     String mime = icon.getMimeType();
                     if (mime != null)
                         response.setContentType(mime);
@@ -103,7 +109,6 @@ public class ControlServlet extends Http
                     if (size > 0)
                         response.setContentLength(size);
 
-                    InputStream in = icon.getInputStream();
                     // can't use buffer, because it's might block if reading byte[]
                     int read;
                     while (-1 != (read = in.read()))



Mime
View raw message