You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Richard S. Hall (JIRA)" <ji...@apache.org> on 2009/05/11 18:09:45 UTC

[jira] Resolved: (FELIX-1130) Bundle.getHeaders() returns a Dictionary

     [ https://issues.apache.org/jira/browse/FELIX-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard S. Hall resolved FELIX-1130.
------------------------------------

       Resolution: Fixed
    Fix Version/s: felix-2.0.0

I committed a patch that overrides putAll() and calls put() on each entry, where put() overrides the super class to do a toString() on each key. Please close this issue if you are satisfied. Thanks for the feedback.

> 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
>            Assignee: Richard S. Hall
>             Fix For: felix-2.0.0
>
>
> 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/users@felix.apache.org/msg04248.html
> http://www.mail-archive.com/users@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.