Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 387208

Summary: IllegalArgumentException (Arguments can not be null) when deploying a simple JAR
Product: [RT] Virgo Reporter: Glyn Normington <glyn.normington>
Component: runtimeAssignee: Glyn Normington <glyn.normington>
Status: CLOSED FIXED QA Contact:
Severity: minor    
Priority: P3 CC: tjwatson
Version: 3.5.0.RELEASEKeywords: helpwanted
Target Milestone: 3.6.0.M02   
Hardware: PC   
OS: Mac OS X   
Whiteboard:
Attachments:
Description Flags
Failing bundle
none
Diagnostics
none
Successful bundle none

Description Glyn Normington CLA 2012-08-14 10:35:34 EDT
Created attachment 219866 [details]
Failing bundle

Deploying the attached dup.jar to the 3.5.0.RELEASE kernel produces the attached stack trace. Changing the manifest of the JAR to use more normal capitalisation appears to fix the problem, although there may be hidden junk in the failing manifest.
Comment 1 Glyn Normington CLA 2012-08-14 10:36:11 EDT
Created attachment 219867 [details]
Diagnostics
Comment 2 Glyn Normington CLA 2012-08-14 10:36:50 EDT
Created attachment 219868 [details]
Successful bundle
Comment 3 Glyn Normington CLA 2012-08-14 10:37:29 EDT
A similar bundle which deploys ok is attached as duup.jar. Apologies for the daft filenames.
Comment 4 Glyn Normington CLA 2012-08-14 10:39:34 EDT
Flagging as helpwanted since this is likely to be a fairly easy bug to debug and fix.
Comment 5 Glyn Normington CLA 2012-09-21 10:29:35 EDT
The Equinox method StateObjectFactoryImpl.createBundleDescription is passed a manifest parameter consisting of a Hashtable with entries including:

bundle-symbolicname=dup.a
bundle-manifestversion=2

and the resultant BundleDescriptionImpl has a null name field which ultimately causes the IllegalArgumentException of this bug. (This is because StateBuilder.createBundleDescription indexes into the manifest Hashtable using Constants.BUNDLE_SYMBOLICNAME, "Bundle-SymbolicName", which doesn't find the entry with key "bundle-symbolicname".)

The javadoc for StateObjectFactory.createBundleDescription states:

* The manifest should contain String keys and String values which correspond to 
* proper OSGi manifest headers and values.

I cannot ascertain from the OSGi core spec or the manifest format spec (cited by the OSGi core spec) whether manifest header names are case-sensitive or case-insensitive.
Comment 6 Thomas Watson CLA 2012-09-24 08:15:57 EDT
(In reply to comment #5)
> I cannot ascertain from the OSGi core spec or the manifest format spec
> (cited by the OSGi core spec) whether manifest header names are
> case-sensitive or case-insensitive.

The OSGi Core spec indicates that the header keys should be case insensitive.  The implementation of StateObjectFactory depends on the Dictionary being passed in to implement case insensitivity.
Comment 7 Glyn Normington CLA 2012-09-24 08:59:37 EDT
(In reply to comment #6)
> (In reply to comment #5)
> > I cannot ascertain from the OSGi core spec or the manifest format spec
> > (cited by the OSGi core spec) whether manifest header names are
> > case-sensitive or case-insensitive.
> 
> The OSGi Core spec indicates that the header keys should be case
> insensitive.  The implementation of StateObjectFactory depends on the
> Dictionary being passed in to implement case insensitivity.

Ah, I see. Thanks Tom. Any chance you could add that requirement to the javadoc some time?
Comment 8 Glyn Normington CLA 2012-09-27 09:43:57 EDT
Fixed by adapting the case insensitive map held in Virgo's representation of the bundle manifest into a case insensitive dictionary and passing that to the StateObjectFactory. Two new adapter classes and tests were added to util which were then utilised in the kernel.