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

Tom Rutchik closed FELIX-5946.
------------------------------
    Resolution: Fixed

I figured out what's going on, and it not an issue.  I'll explain what's going 
just to document the scenario.

In my situation, I've added the felix framework source code to my project as a 
library module that is compiled and added as a dependent library jar to my 
application.

The source code does not contain the "Felix.properties" file.  It's a file 
added to the felix production jar downstream of the compilation process.  
Appearently it extracts the version number from the pom.xml.  That all makes 
sense.  So in my situation, I'm responsible for adding the "Felix.properties" 
file.  So I added it to the library module project, but unfortunately I put it 
in the wrong place.  It needed to stored in my development environment at 
"resources/org/apache/felix/framework/Felix.properties. I had put it at 
"org/apache/felix/framework/Felix.properties".  That's where the "Felix.java" 
exists.  The module build process will not add non java resources to the 
resulting jar file.  Non java resources need to be added to the "resources" 
directory.  So that was my mistake.  

> Felix Version Number is 0.0.0
> -----------------------------
>
>                 Key: FELIX-5946
>                 URL: https://issues.apache.org/jira/browse/FELIX-5946
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>            Reporter: Tom Rutchik
>            Priority: Major
>
> 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
> {color:#000080}private static {color}String getFrameworkVersion()
> {
>  {color:#808080}// The framework version property.
> {color} Properties props = {color:#000080}new {color}Properties();
>  InputStream in = 
> Felix.{color:#000080}class{color}.getResourceAsStream({color:#008000}"Felix.properties"{color});
> ------------------
> Here's the change needed to  make it work
> {color:#000080}private static {color}{color:#333333}String 
> getFrameworkVersion(){color}
> {color:#333333}{{color}
>  {color:#808080}// The framework version property.
> {color}{color:#333333} Properties props = {color}{color:#000080}new 
> {color}{color:#333333}Properties();{color}
> {color:#333333} InputStream in = 
> Felix.{color}{color:#000080}class{color}{color:#333333}.getClassLoader().getResourceAsStream({color}{color:#008000}"Felix.properties"{color}{color:#333333});{color}
> {color:#333333}alternative:{color}
> {color:#333333}InputStream in = 
> Felix.{color:#000080}class{color}.getResourceAsStream({color:#008000}"/Felix.properties"{color});{color}
> {color:#333333}----------------------------{color}
> Then add the Felix.properties resource to the root of the framework jar. Its 
> content should contain:
> {color:#000080}felix.version {color}= {color:#008000}6.0.1{color}
> where 6.0.1 is replaced with the actual felix version.
> {color:#333333}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.{color}
> {color:#333333}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.{color}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to