From f1588ced3230848777011aa2502c172c882cdb85 Mon Sep 17 00:00:00 2001 From: Hugues Malphettes Date: Tue, 22 Jun 2010 04:40:52 +0000 Subject: [PATCH] bug fixes after testing this git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2035 7e9141cc-0065-0410-87d8-b60c137991c4 --- .../webapp/WebBundleTrackerCustomizer.java | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/webapp/WebBundleTrackerCustomizer.java b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/webapp/WebBundleTrackerCustomizer.java index 65c1059b9a4..df257839fd2 100644 --- a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/webapp/WebBundleTrackerCustomizer.java +++ b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/webapp/WebBundleTrackerCustomizer.java @@ -72,9 +72,21 @@ public class WebBundleTrackerCustomizer implements BundleTrackerCustomizer { */ public Object addingBundle(Bundle bundle, BundleEvent event) { - - boolean isWebBundle = register(bundle); - return isWebBundle ? bundle : null; + if (bundle.getState() == Bundle.ACTIVE) + { + boolean isWebBundle = register(bundle); + return isWebBundle ? bundle : null; + } + else if (bundle.getState() == Bundle.STOPPING) + { + unregister(bundle); + } + else + { + //we should not be called in that state as + //we are registered only for ACTIVE and STOPPING + } + return null; } /** @@ -96,6 +108,14 @@ public class WebBundleTrackerCustomizer implements BundleTrackerCustomizer { //nothing the web-bundle was already track. something changed. //we only reload the webapps if the bundle is stopped and restarted. // System.err.println(bundle.getSymbolicName()); + if (bundle.getState() == Bundle.STOPPING || bundle.getState() == Bundle.ACTIVE) + { + unregister(bundle); + } + if (bundle.getState() == Bundle.ACTIVE) + { + register(bundle); + } } /**