Fixed FELIX-4012 Sometimes the UPnP plugin fails to start due to device being removed from network
https://issues.apache.org/jira/browse/FELIX-4012

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1464003 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 95a9f4f..c638cbc 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
@@ -540,7 +540,13 @@
     {

         UPnPDevice device = (UPnPDevice) bc.getService(ref);

 

-        UPnPIcon[] _icons = device == null ? null : device.getIcons(null);

+        UPnPIcon[] _icons = null;

+        try // Fix for FELIX-4012

+        {

+            _icons = device == null ? null : device.getIcons(null);

+        } catch(IllegalStateException e) { // since OSGi r4.3

+            device = null; // don't track that device, it has been removed

+        }

         if (_icons != null && _icons.length > 0)

         {

             icons.put(ref.getProperty(UPnPDevice.UDN), _icons[0]);