Bug 108699 - [osgi] condpermadmin mutable to immutable conditions cause NPE
Summary: [osgi] condpermadmin mutable to immutable conditions cause NPE
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Runtime (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1.1   Edit
Assignee: Thomas Watson CLA Friend
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-02 11:14 EDT by Thomas Watson CLA Friend
Modified: 2005-09-03 10:29 EDT (History)
1 user (show)

See Also:


Attachments
Fix for 3.1.1 (1.96 KB, patch)
2005-09-02 11:36 EDT, Thomas Watson CLA Friend
no flags Details | Diff
Updated fix (1.96 KB, patch)
2005-09-02 14:00 EDT, Thomas Watson CLA Friend
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Watson CLA Friend 2005-09-02 11:14:47 EDT
In the case where there are conditions that start as mutable and later become
immutable, ConditionalPermissions.implies should check the conditions array 
returned from getNeededConditions for null.

   Condition conds[] = cpsArray[i].getNeededConditions();
-> if (conds == null) continue cpsLoop;

There is a test in org.osgi.test.cases.permissionadmin.conditional that 
checks this scenario.

java.lang.NullPointerException
        at 
org.eclipse.osgi.framework.internal.core.ConditionalPermissions.implies
(ConditionalPermissions.java:136)
        at 
org.eclipse.osgi.framework.internal.core.BundleCombinedPermissions.implies
(BundleCombinedPermissions.java:190)
        at java.security.ProtectionDomain.implies(ProtectionDomain.java:193)
at java.security.AccessControlContext.checkPermission
(AccessControlContext.java:254)
Comment 1 Thomas Watson CLA Friend 2005-09-02 11:35:12 EDT
Fixed in HEAD.  This needs to be fixed in 3.1.1 to pass the R4 TCK.
Comment 2 Thomas Watson CLA Friend 2005-09-02 11:36:55 EDT
Created attachment 26802 [details]
Fix for 3.1.1

Pascal, please review patch against 3.1.1 maintenance branch.  Thanks.
Comment 3 Thomas Watson CLA Friend 2005-09-02 14:00:32 EDT
Created attachment 26807 [details]
Updated fix

The null check for neededConditions should happen before the
neededConditions.length check.
Comment 4 Pascal Rapicault CLA Friend 2005-09-02 18:49:01 EDT
Patch reviewed, good to go.
Comment 5 Thomas Watson CLA Friend 2005-09-03 10:29:39 EDT
Fixed in HEAD and 3.1 maintenance branch.