[ 
https://issues.apache.org/jira/browse/FELIX-1453?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12740652#action_12740652
 ] 

Richard S. Hall commented on FELIX-1453:
----------------------------------------

Looking at the code, I don't really see how this could happen. We write the 
location in two places BundleArchive.setLocation() and 
BundleArchive.setRevisionLocation() in the initial install of a bundle. If an 
exception occurs in either of these places, it looks like it is passed up and 
ultimately out of the BundleArchive constructor. It is caught in 
BundleCache.create() which checks to see if a directory was created for the 
bundle and it so deletes it, before passing the exception out to 
Felix.installBundle(). So, it doesn't look like this is the path it took.

Is it possible that this bundle was updated when the location file could not be 
written? It looks like it might be possible for something to go wrong in that 
situation since the creation of the revision directory and copying of the 
revision JAR file happens before adding the revision to the bundle's revision 
array, so perhaps a well-timed exception could cause the rollback to miss the 
newly created revision directory.

> BundleArchive.createRevisionFromLocation may throw NullPointerException
> -----------------------------------------------------------------------
>
>                 Key: FELIX-1453
>                 URL: https://issues.apache.org/jira/browse/FELIX-1453
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: felix-1.8.1
>            Reporter: Felix Meschberger
>
> When BundleArchive.createRevisionFromLocation is called with the location 
> being null, a NullPointerException is thrown on line 995 (Rev. 801082).
> The fix obviously seems to be to check for null on this line and actually 
> pass it through like this:
> Index: src/main/java/org/apache/felix/framework/cache/BundleArchive.java
> ===================================================================
> --- src/main/java/org/apache/felix/framework/cache/BundleArchive.java 
> (Revision 801082)
> +++ src/main/java/org/apache/felix/framework/cache/BundleArchive.java 
> (Arbeitskopie)
> @@ -992,7 +992,7 @@
>                          location, true);
>                  }
>              }
> -            else if (location.startsWith(INPUTSTREAM_PROTOCOL))
> +            else if (location == null || 
> location.startsWith(INPUTSTREAM_PROTOCOL))
>              {
>                  // Assume all input streams point to JAR files.
>                  result = new JarRevision(m_logger, m_configMap, 
> revisionRootDir,

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to