Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlyn Normington2011-03-15 06:11:36 -0400
committerGlyn Normington2011-03-15 06:11:36 -0400
commit70224176c5354138cb62bbbf00b5a16a6c595971 (patch)
tree51b26c13f4dc8d66690c2546200709614617e194
parent4dc6f2b44d5042c9e14542d46d10fe4965431a55 (diff)
downloadorg.eclipse.virgo.kernel-70224176c5354138cb62bbbf00b5a16a6c595971.tar.gz
org.eclipse.virgo.kernel-70224176c5354138cb62bbbf00b5a16a6c595971.tar.xz
org.eclipse.virgo.kernel-70224176c5354138cb62bbbf00b5a16a6c595971.zip
bug 339716: prevent class cast exception when viewing OSGi state in admin console
-rw-r--r--org.eclipse.virgo.kernel.deployer.dm/src/main/java/org/eclipse/virgo/kernel/deployer/app/spring/UserRegionModuleContextAccessor.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/org.eclipse.virgo.kernel.deployer.dm/src/main/java/org/eclipse/virgo/kernel/deployer/app/spring/UserRegionModuleContextAccessor.java b/org.eclipse.virgo.kernel.deployer.dm/src/main/java/org/eclipse/virgo/kernel/deployer/app/spring/UserRegionModuleContextAccessor.java
index 5471f663..487a8437 100644
--- a/org.eclipse.virgo.kernel.deployer.dm/src/main/java/org/eclipse/virgo/kernel/deployer/app/spring/UserRegionModuleContextAccessor.java
+++ b/org.eclipse.virgo.kernel.deployer.dm/src/main/java/org/eclipse/virgo/kernel/deployer/app/spring/UserRegionModuleContextAccessor.java
@@ -49,12 +49,16 @@ final class UserRegionModuleContextAccessor implements ModuleContextAccessor {
"(Bundle-SymbolicName=" + symbolicName + ")");
if (refs.size() != 0) {
for (ServiceReference<ApplicationContext> ref : refs) {
- ApplicationContext appCtx = (ApplicationContext) bundleContext.getService(ref);
+ Object service = bundleContext.getService(ref);
try {
- if (appCtx instanceof ConfigurableOsgiBundleApplicationContext) {
- ConfigurableOsgiBundleApplicationContext cAppCtx = (ConfigurableOsgiBundleApplicationContext) appCtx;
- if (bundleContext == cAppCtx.getBundleContext()) {
- return new ModuleContextWrapper(cAppCtx);
+ // Avoid kernel region application contexts.
+ if (service instanceof ApplicationContext) {
+ ApplicationContext appCtx = (ApplicationContext) service;
+ if (appCtx instanceof ConfigurableOsgiBundleApplicationContext) {
+ ConfigurableOsgiBundleApplicationContext cAppCtx = (ConfigurableOsgiBundleApplicationContext) appCtx;
+ if (bundleContext == cAppCtx.getBundleContext()) {
+ return new ModuleContextWrapper(cAppCtx);
+ }
}
}
} finally {

Back to the top