commit | b5e8c6217dac78be64141f9cf8a349a25cfe421a | [log] [tgz] |
---|---|---|
author | Valentin Valchev <vvalchev@apache.org> | Tue Apr 03 16:29:31 2012 +0000 |
committer | Valentin Valchev <vvalchev@apache.org> | Tue Apr 03 16:29:31 2012 +0000 |
tree | e776ae4f3ab47c24cb34b2d0872209971e7eef98 | |
parent | ae38b5b7a277e565820666705e678eec7a03f9bf [diff] |
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()))