dev@glassfish.java.net

[Fwd: Package.getImplementationVersion method in OSGi bundle]

From: Ken Paulsen <Ken.Paulsen_at_Sun.COM>
Date: Thu, 14 Aug 2008 12:33:36 -0700

Forwarding to the dev alias as others may know or be interested in
knowing the answer to this question....

Ken

attached mail follows:



Sahoo,

I'm not sure if you are the right person to ask this, but here goes.

I'm using the Package.getImplementationVersion method to get the version
information out of a JAR file for use in a User-Agent value. This works
fine when in a standalone Java process, but when the JAR file is used as
an OSGi bundle, I'm getting an empty string return value.

Previously, I was calling Class.getProtectionDomain().getCodeSource() in
order to get access to the JAR file itself to read the manifest
directly, and getCodeSource was returning null when the JAR file is an
OSGi module.

Are these known problems with the OSGi implementation in GFv3? Should
these methods be expected to work when a JAR file is used as an OSGi bundle?

Thanks.
Tom