Bundle.getHeaders() returns a Dictionary<java.util.jar.Attribute.Name,String>
-----------------------------------------------------------------------------

                 Key: FELIX-1130
                 URL: https://issues.apache.org/jira/browse/FELIX-1130
             Project: Felix
          Issue Type: Bug
          Components: Framework
    Affects Versions: felix-1.6.1
         Environment: IBM J9 VM (build 2.4, J2RE 1.6.0 IBM J9 2.4 AIX ppc64-64 
jvmap6460-20090215_29883 (JIT enabled, AOT enabled)
            Reporter: Alexander Berger


Bundle.getHeaders() returns a Dictionary whose key type is 
java.util.jar.Attribute.Name but the key type should be 
java.lang.String. For some unknown reasons (I guess different implementations 
of equals() and hashCode()) this
causes no problems with SUN's JRE but a lot of trouble with IBM's JRE. 
Especially bundles that rely on bundle 
headers (like for example Felix SCR) do not work on IBM's JRE due to this bug.

The suspicious code is in the getManifestHeader() member of 
org.apache.felix.framework.cache.JarRevision and DirectoryRevision:

            Manifest mf = jarFile.getManifest();
            // Create a case insensitive map of manifest attributes.
            return new StringMap(mf.getMainAttributes(), false);

So either org.apache.felix.framework.cache.JarRevision and DirectoryRevision 
should be changed in order for 
their getManifestHeader() member to return a Dictionary<String,String> 

            Manifest mf = jarFile.getManifest();
            // Create a case insensitive map of manifest attributes.
            final Attributes attributes = mf.getMainAttributes();
            final StringMap m = new StringMap(false);
            for ( final Object name : attributes.keySet() ) {
                final String text = name.toString();
                m.put(text, attributes.getValue(text));
            }
            return m;

or as Richard suggested the org.apache.felix.framework.util.StringMap
class should override putAll(Map) and ensure that all keys are of type String 
(like StringMap.put(...)) does.

Corresponding mailing list entries:

http://www.mail-archive.com/us...@felix.apache.org/msg04248.html
http://www.mail-archive.com/us...@felix.apache.org/msg04249.html


-- 
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