[jboss-osgi-commits] JBoss-OSGI SVN: r97236 - projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer.

jboss-osgi-commits at lists.jboss.org jboss-osgi-commits at lists.jboss.org
Tue Dec 1 09:29:43 EST 2009


Author: thomas.diesler at jboss.com
Date: 2009-12-01 09:29:43 -0500 (Tue, 01 Dec 2009)
New Revision: 97236

Modified:
   projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleMetaDataDeployer.java
   projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStartStopDeployer.java
Log:
Fix NPEs in deployers due to missing Deployment attachment

Modified: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleMetaDataDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleMetaDataDeployer.java	2009-12-01 14:23:16 UTC (rev 97235)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleMetaDataDeployer.java	2009-12-01 14:29:43 UTC (rev 97236)
@@ -23,6 +23,7 @@
 
 //$Id$
 
+import java.net.URL;
 import java.util.jar.Attributes;
 import java.util.jar.Manifest;
 
@@ -59,7 +60,8 @@
          log.debug("Bundle-SymbolicName: " + symbolicName + " in " + file);
 
          Deployment dep = unit.getAttachment(Deployment.class);
-         metaData.setBundleLocation(dep.getLocation());
+         URL location = (dep != null ? dep.getLocation() : unit.getRoot().toURL());
+         metaData.setBundleLocation(location);
 
          // Add a marker that this is an OSGi deployment
          unit.addAttachment(OSGiConstants.KEY_BUNDLE_SYMBOLIC_NAME, symbolicName);

Modified: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStartStopDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStartStopDeployer.java	2009-12-01 14:23:16 UTC (rev 97235)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStartStopDeployer.java	2009-12-01 14:29:43 UTC (rev 97236)
@@ -68,7 +68,7 @@
    public void deploy(DeploymentUnit unit, Bundle bundle) throws DeploymentException
    {
       Deployment dep = unit.getAttachment(Deployment.class);
-      boolean autoStart = dep.isAutoStart();
+      boolean autoStart = (dep != null ? dep.isAutoStart() : true);
       
       if (autoStart == true)
       {



More information about the jboss-osgi-commits mailing list