Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 346214

Summary: Findbugs complains: o.e.g.w.i.WebContainerActivator.java:126 instanceof will always return true
Product: [RT] Gemini.Web Reporter: Violeta Georgieva <milesg78>
Component: unknownAssignee: Violeta Georgieva <milesg78>
Status: CLOSED FIXED QA Contact:
Severity: trivial    
Priority: P3 CC: eclipse
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Violeta Georgieva CLA 2011-05-18 06:28:13 EDT
When running findbugs for Gemini Web, it complains with:
 
org.eclipse.gemini.web.gemini-web-container/org.eclipse.gemini.web.core/src/main/java/org/eclipse/gemini/web/internal/WebContainerActivator.java:126 instanceof will always return true, since all org.eclipse.gemini.web.core.WebContainer are instances of org.eclipse.gemini.web.core.WebContainer
 
So I’m going to change this issue as follows:
 
org.eclipse.gemini.web.core/src/main/java/org/eclipse/gemini/web/internal/WebContainerActivator.java
index 6faddb4..48e2766 100644
@@ -123,9 +123,7 @@ public class WebContainerActivator implements BundleActivator {
 
         public void removedService(ServiceReference<ServletContext> reference, WebContainer service) {
             this.regTracker.unregisterAll();
-            if (service instanceof WebContainer) {
-                ((WebContainer)service).halt();
-            }
+            service.halt();
         }
 
     }
Comment 1 Violeta Georgieva CLA 2011-05-18 08:49:13 EDT
Change is tested, committed and pushed.
Commit Id: b645548dbd513525b67760ac9b3f09c58b574ec7