p.s. Maybe we could just modify StringMap to always do a toString() on the keys it adds to itself via that constructor...that is what we do in StringMap.put()...

On 5/6/09 12:07 PM, [email protected] wrote:
Hi out there

I just found out that as of Felix 1.6.1 the Bundle.getHeaders() returns a 
Dictionary whose keys are of
type java.util.jar.Attribute.Name. The corresponding code is in 
org.apache.felix.framework.cache.JarRevision:

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

Somehow I doubt that this is the right behavior but perhaps someone can prove 
me wrong :-)
This behavior did not disturb my code as long as it was running on a SUN JVM 
(java 6) but it caused
severe trouble when running on IBM's JVM (java 6). I guess this is because IBM 
and SUN might have
different implementations of equals(Object o) and hashCode() for the class 
java.util.jar.Attribute.Name.
However after changing the suspicious code in JarRevision like this:

         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;

the problem disappeared and it also worked on IBM's JVM.

So can anybody please confirm or deny that this is a bug in Felix 1.6.1. If so 
I will open a JIRA issue.

Kind regards
Alex

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to