sharanggupta opened a new pull request, #577:
URL: https://github.com/apache/felix-dev/pull/577

   Fixes [FELIX-6817](https://issues.apache.org/jira/browse/FELIX-6817).
   
   The `NullPointerException` in the report (`Content.hasEntry(String)` called 
on a `null` element of the content path, from 
`BundleRevisionImpl.getResourceLocal`) happens when a resource lookup through 
the class loader of a wiring reaches the revision after a refresh has closed it.
   
   `BundleWiringImpl.findClassOrResourceByDelegation()` checks that the wiring 
is not disposed before it calls `BundleClassLoader.findResource()`, but a 
concurrent refresh can close the revision in between. `close()` sets the 
content to `null` and drops the content path. `getContentPath()` then rebuilds 
the path from the `null` content: `MultiReleaseContent.wrap()` swallows the 
resulting exception and returns `null`, so the cached path is a list holding 
`null`, and every later lookup on that revision fails the same way.
   
   `initializeContentPath()` now returns an empty content path for a closed 
revision, so the lookup finds nothing, like `getResourcesLocal()` already does 
when there is no content path. The empty path is not cached, because a refresh 
closes all revisions of the bundle and then reopens the current one with 
`resetContent()`, after which the path must be computed again.
   
   **Test:** 
`ResourceLoadingTest.resourceLoadingFromClosedRevisionFindsNothing` keeps the 
class loader of a bundle's wiring, updates and refreshes the bundle, and then 
calls `findResource()` and `findResources()` on the old class loader, which is 
the state the race leads to. On `master` it fails with the 
`NullPointerException` from the report; with the change it passes, and `mvn 
clean verify` of the framework module passes locally.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to