[jboss-osgi-commits] JBoss-OSGI SVN: r97860 - in projects/jboss-osgi/projects/runtime/framework/trunk: src/main/java/org/jboss/osgi/framework/bundle and 1 other directories.
jboss-osgi-commits at lists.jboss.org
jboss-osgi-commits at lists.jboss.org
Tue Dec 15 15:25:03 EST 2009
Author: thomas.diesler at jboss.com
Date: 2009-12-15 15:25:03 -0500 (Tue, 15 Dec 2009)
New Revision: 97860
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleWrapper.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiSystemState.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleActivatorDeployer.java
Log:
[JBOSGI-204] Failure in Bundle.start() uninstalls the bundle
Done
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml 2009-12-15 20:06:59 UTC (rev 97859)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml 2009-12-15 20:25:03 UTC (rev 97860)
@@ -661,8 +661,6 @@
<excludes>
<!-- http://community.jboss.org/thread/145863 -->
<exclude>org/jboss/test/osgi/service/ServiceMixUnitTestCase.class</exclude>
- <!-- [JBOSGI-204] Failure in Bundle.start() uninstalls the bundle -->
- <exclude>org/jboss/test/osgi/bundle/BundleLifecycleTestCase.class</exclude>
</excludes>
</configuration>
</plugin>
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2009-12-15 20:06:59 UTC (rev 97859)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2009-12-15 20:25:03 UTC (rev 97860)
@@ -1179,9 +1179,14 @@
try
{
- String name = bundleState.getDeploymentUnit().getName();
- deployerClient.change(name, DeploymentStages.INSTALLED);
- deployerClient.checkComplete(name);
+ DeploymentUnit unit = bundleState.getDeploymentUnit();
+ deployerClient.change(unit.getName(), DeploymentStages.INSTALLED);
+ deployerClient.checkComplete(unit.getName());
+
+ // The potential BundleException is attached by the OSGiBundleActivatorDeployer
+ BundleException startEx = unit.removeAttachment(BundleException.class);
+ if (startEx != null)
+ throw startEx;
}
catch (DeploymentException ex)
{
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleWrapper.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleWrapper.java 2009-12-15 20:06:59 UTC (rev 97859)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleWrapper.java 2009-12-15 20:25:03 UTC (rev 97860)
@@ -70,7 +70,7 @@
return bundleState;
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("rawtypes")
public Enumeration findEntries(String path, String filePattern, boolean recurse)
{
return bundleState.findEntries(path, filePattern, recurse);
@@ -91,19 +91,19 @@
return bundleState.getEntry(path);
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("rawtypes")
public Enumeration getEntryPaths(String path)
{
return bundleState.getEntryPaths(path);
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("rawtypes")
public Dictionary getHeaders()
{
return bundleState.getHeaders();
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("rawtypes")
public Dictionary getHeaders(String locale)
{
return bundleState.getHeaders(locale);
@@ -129,7 +129,7 @@
return bundleState.getResource(name);
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("rawtypes")
public Enumeration getResources(String name) throws IOException
{
return bundleState.getResources(name);
@@ -165,7 +165,7 @@
return bundleState.hasPermission(permission);
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("rawtypes")
public Class loadClass(String name) throws ClassNotFoundException
{
return bundleState.loadClass(name);
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiSystemState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiSystemState.java 2009-12-15 20:06:59 UTC (rev 97859)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiSystemState.java 2009-12-15 20:25:03 UTC (rev 97860)
@@ -123,7 +123,7 @@
return null;
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("rawtypes")
public Enumeration getEntryPaths(String path)
{
log.warn("[JBOSGI-138] getEntryPaths(" + path + ")");
@@ -136,7 +136,7 @@
return null;
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("rawtypes")
public Enumeration getResources(String name) throws IOException
{
log.warn("[JBOSGI-138] getResources(" + name + ")");
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleActivatorDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleActivatorDeployer.java 2009-12-15 20:06:59 UTC (rev 97859)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleActivatorDeployer.java 2009-12-15 20:25:03 UTC (rev 97860)
@@ -25,6 +25,7 @@
import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.osgi.framework.bundle.OSGiBundleState;
+import org.osgi.framework.BundleException;
/**
* OSGiBundleActivatorDeployer.
@@ -48,9 +49,12 @@
{
bundleState.startInternal();
}
- catch (Throwable t)
+ catch (BundleException ex)
{
- throw DeploymentException.rethrowAsDeploymentException("Error starting bundle: " + bundleState, t);
+ // We do not rethrow this exception to the deployer framework.
+ // An exception during Bundle.start() is regarded as a normal deployemtn condition and handeled internally by the OSGi layer.
+ // The OSGiBundleManager picks up this BundleException and rethrows it if available.
+ unit.addAttachment(BundleException.class, ex);
}
}
@@ -61,9 +65,9 @@
{
deployment.stopInternal();
}
- catch (Throwable t)
+ catch (BundleException ex)
{
- log.warn("Error stopping bundle: " + deployment, t);
+ log.warn("Error stopping bundle: " + deployment, ex);
}
}
}
More information about the jboss-osgi-commits
mailing list