FELIX-3666 move workaround for framework bug to the isFragment bundle to apply it where the framework bug appears

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1418285 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java
index fe741db..8019468 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java
@@ -392,9 +392,8 @@
                 // write the state only
                 resp.setContentType( "application/json" ); //$NON-NLS-1$
                 resp.setCharacterEncoding( "UTF-8" ); //$NON-NLS-1$
-                final boolean isFragment = (bundle.getState() == Bundle.UNINSTALLED ? false : isFragmentBundle(bundle));
-                resp.getWriter().print("{\"fragment\":" + isFragment // //$NON-NLS-1$
-                    + ",\"stateRaw\":" + bundle.getState() + "}"); //$NON-NLS-1$ //$NON-NLS-2$
+                resp.getWriter().print( "{\"fragment\":" + isFragmentBundle( bundle ) // //$NON-NLS-1$
+                    + ",\"stateRaw\":" + bundle.getState() + "}" ); //$NON-NLS-1$ //$NON-NLS-2$
                 return;
             }
         }
@@ -748,11 +747,19 @@
         }
     }
 
-    private final boolean isFragmentBundle( Bundle bundle)
+
+    private final boolean isFragmentBundle( Bundle bundle )
     {
+        // Workaround for FELIX-3670
+        if ( bundle.getState() == Bundle.UNINSTALLED )
+        {
+            return bundle.getHeaders().get( Constants.FRAGMENT_HOST ) != null;
+        }
+
         return getPackageAdmin().getBundleType( bundle ) == PackageAdmin.BUNDLE_TYPE_FRAGMENT;
     }
 
+
     private final void bundleDetails( JSONWriter jw, Bundle bundle, final String pluginRoot, final String servicesRoot, final Locale locale)
         throws JSONException
     {