Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
The framework reports Felix Version as 0.0.0
I've track the issue down and here's the problem:
File Felix.java - original code
private static String getFrameworkVersion()
{
// The framework version property. Properties props = new Properties();
InputStream in = Felix.class.getResourceAsStream("Felix.properties");
------------------
Here's the change needed to make it work
private static String getFrameworkVersion()
{
// The framework version property. Properties props = new Properties();
InputStream in = Felix.class.getClassLoader().getResourceAsStream("Felix.properties");
alternative:
InputStream in = Felix.class.getResourceAsStream("/Felix.properties");
----------------------------
Then add the Felix.properties resource to the root of the framework jar. Its content should contain:
felix.version = 6.0.1
where 6.0.1 is replaced with the actual felix version.
The problem is that getResourceAsStream(resource) is relative the location of the class if the resource does not start with a leading "/" . You could also resolve the problem by putting the "Felix.properties" file in the same directory as the Felix, but that seems like a strange place to locate it.
I looked for solution where the version number was obtained from the Bundle-Version in the "MANIFEST.MF", but this information is not available when Felix is embedded in the application. In an android environment, you can't add the "Felix.properties" file at runtime due to file access permissions. You also can't solve the problem by adding a "felix.version" property to the config used to initialize the framework, it get's overwritten with a 0.0.0 version if the "Felix.properties" file does not exist.