[jboss-osgi-commits] JBoss-OSGI SVN: r102896 - in projects/jboss-osgi/projects/runtime/framework/trunk: core/src/main/java/org/jboss/osgi/framework/bundle and 1 other directory.
jboss-osgi-commits at lists.jboss.org
jboss-osgi-commits at lists.jboss.org
Wed Mar 24 12:13:49 EDT 2010
Author: thomas.diesler at jboss.com
Date: 2010-03-24 12:13:47 -0400 (Wed, 24 Mar 2010)
New Revision: 102896
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/bundle/BundleContextTestCase.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
Log:
[JBOSGI-238] [TCK] Framework classpath
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/bundle/BundleContextTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/bundle/BundleContextTestCase.java 2010-03-24 16:13:46 UTC (rev 102895)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/bundle/src/test/java/org/jboss/test/osgi/bundle/BundleContextTestCase.java 2010-03-24 16:13:47 UTC (rev 102896)
@@ -26,6 +26,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -216,6 +217,9 @@
{
assertBundleState(Bundle.INSTALLED, bundle.getState());
assertEquals(url.toExternalForm(), bundle.getLocation());
+
+ Bundle duplicate = systemContext.installBundle(url.toExternalForm());
+ assertSame("Duplicate bundle", bundle, duplicate);
}
finally
{
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2010-03-24 16:13:46 UTC (rev 102895)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2010-03-24 16:13:47 UTC (rev 102896)
@@ -528,6 +528,15 @@
*/
public AbstractBundleState installBundle(Deployment dep) throws BundleException
{
+ if (dep == null)
+ throw new IllegalArgumentException("Null deployment");
+
+ // If a bundle containing the same location identifier is already installed,
+ // the Bundle object for that bundle is returned.
+ AbstractBundleState bundleState = getBundleByLocation(dep.getLocation());
+ if (bundleState != null)
+ return bundleState;
+
// Create the deployment and deploy it
try
{
@@ -536,7 +545,7 @@
att.addAttachment(Deployment.class, dep);
// In case of update the OSGiBundleState is attached
- AbstractBundleState bundleState = dep.getAttachment(AbstractBundleState.class);
+ bundleState = dep.getAttachment(AbstractBundleState.class);
if (bundleState != null)
att.addAttachment(AbstractBundleState.class, bundleState);
More information about the jboss-osgi-commits
mailing list