Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
framework-5.6.10
-
None
-
android os version 26
Description
I'll be describing the issue, explain where the problem occurs and why, and a possible fix that I have verified.
The default.properties file contained in jar: org.apache.felix.framework-5.6.10.jar needs the line:
org.osgi.util..tracker; version=1.5.1 \
changed to:
org.osgi.util..tracker; version=1.5.1, \
(a comma entered after the version number.)
Without the comma added, the class: org.osgi.framework.Version
throws an unrecoverable exception when the version is parsed.
I tracked the issue down and found out that the string value for minor part of the version number which should have been the string "1" was instead having the value "1 #".
The Interger.parse("1 #") is what's throwing the exception (since the # character is not numeric). If you look deeper at the default.properties file you see it contains the following:
org.osgi.util.tracker; version=1.5.1 \
${jre-${java.specification.version}} \
${jre-${felix.detect.jpms}} \
#
- Java platform package export properties.
I don't know what the ${jre-$ entries are for, but they seem to have been evaluated to the empty string. So that's how the minor version subpart string gets to be "1 #" instead of "1"
I repackage the jar with that one change in place and Felix starts up correctly.
Note: Another possible solution is to eliminate the continuation character "\" at the end of the
version since it appears to be last entry. I just don't understand what the motivation for the {jre-$ entries are so I don't want to claim my solution is necessarily the right solution for all circumstances, since another possible solution would be to eliminate the continuation character "\" at the end of the line: "${jre-${felix.detect.jpms}} \" .
What's makes the issue critical is that the 5.6.10 release will not work on Android without this change, and it's a bit tricky and time consuming to discover the cause. ( I'm not sure why this isn't an issue for any environment(it might be!), but the strongest claim I can make is that it is an issue in the android environment.
And lastly just to be clear, the exception is thrown when the Felix object is first created. Here's
a snippet of what that code looks like:
String apkFileDir = ConsoleActivity.consoleActivity.getFilesDir().toString();
config.put("osgi.signature.support.verify", "false"); // signed jar checking disabled for development
config.put( .....
Felix f = new Felix(config);