Fixed FELIX-3427 NPE in UPnP Web Console Plugin
https://issues.apache.org/jira/browse/FELIX-3427

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1309021 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole-plugins/upnp/src/main/java/org/apache/felix/webconsole/plugins/upnp/internal/ControlServlet.java b/webconsole-plugins/upnp/src/main/java/org/apache/felix/webconsole/plugins/upnp/internal/ControlServlet.java
index c443dd0..784213f 100644
--- a/webconsole-plugins/upnp/src/main/java/org/apache/felix/webconsole/plugins/upnp/internal/ControlServlet.java
+++ b/webconsole-plugins/upnp/src/main/java/org/apache/felix/webconsole/plugins/upnp/internal/ControlServlet.java
@@ -94,6 +94,12 @@
                     // 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 @@
                     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()))