Cleaned up the System Bundle's dependency on the framework version constant.
git-svn-id: https://svn.apache.org/repos/asf/incubator/felix/trunk@384518 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java
index de98707..9b0c80b 100644
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java
+++ b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java
@@ -3326,42 +3326,30 @@
m_configMutable.put(
- FelixConstants.FELIX_VERSION_PROPERTY, getVersion() );
+ FelixConstants.FELIX_VERSION_PROPERTY, getFrameworkVersion());
}
-
- private static final String FELIX_VERSION_VALUE;
-
- static
- {
- FELIX_VERSION_VALUE = getVersion0();
- }
-
-
- private static String getVersion0()
+ /**
+ * Read the framework version from the property file.
+ * @return the framework version as a string.
+ **/
+ private static String getFrameworkVersion()
{
// The framework version property.
Properties props = new Properties();
- InputStream in = Felix.class.getResourceAsStream( "Felix.properties" );
+ InputStream in = Felix.class.getResourceAsStream("Felix.properties");
try
{
- props.load( in );
+ props.load(in);
}
- catch ( IOException e )
+ catch (IOException ex)
{
- e.printStackTrace();
+ ex.printStackTrace();
}
- return props.getProperty( FelixConstants.FELIX_VERSION_PROPERTY, "unknown" );
- }
-
-
- public static String getVersion()
- {
- return FELIX_VERSION_VALUE;
+ return props.getProperty(FelixConstants.FELIX_VERSION_PROPERTY, "unknown");
}
-
private void processAutoProperties()
{
// The auto-install property specifies a space-delimited list of
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/SystemBundle.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/SystemBundle.java
index 6f9b759..32d56aa 100644
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/SystemBundle.java
+++ b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/SystemBundle.java
@@ -126,8 +126,10 @@
// Initialize header map as a case insensitive map.
Map map = new StringMap(false);
- map.put(FelixConstants.BUNDLE_VERSION, Felix.getVersion() );
- map.put(FelixConstants.BUNDLE_SYMBOLICNAME, FelixConstants.SYSTEM_BUNDLE_SYMBOLICNAME);
+ map.put(FelixConstants.BUNDLE_VERSION,
+ getFelix().getConfig().get(FelixConstants.FELIX_VERSION_PROPERTY));
+ map.put(FelixConstants.BUNDLE_SYMBOLICNAME,
+ FelixConstants.SYSTEM_BUNDLE_SYMBOLICNAME);
map.put(FelixConstants.BUNDLE_NAME, "System Bundle");
map.put(FelixConstants.BUNDLE_DESCRIPTION,
"This bundle is system specific; it implements various system services.");