OK, here are my latests findings.
I added a few System.out.println in the public static String
normalizeOSName(String value) method. Namely:
if (value.startsWith("win")) {
String os = "win";
System.out.println("R4LibraryClause.normalizeOSName():value.startsWith('win')");
System.out.println("value:" + value);
[...]
System.out.println("Returned OS:" + os);
return os;
}
I also removed the bundle containing the native libraries from the "bundles"
folder in order to install it manually.
1) When the framework starts, it starts all the bundles and calls the
normalizeOSName a first time. Code output:
R4LibraryClause.normalizeOSName():value.startsWith('win')
value:windows 7 <- notice the space between "windows" and "7"
Returned OS:windows7
-> OK
2) I then install the native bundle: "install
file:org-keridwen-vtk-win7-64b-2.0.3-SNAPSHOT.jar"
The normalizeOSName method is called twice in a raw (I guess by the parse
method first, then by the match method). Code output:
R4LibraryClause.normalizeOSName():value.startsWith('win') <- first call, works
value:win7 <- OK for the if statement line 392
Returned OS:windows7
os.name:Windows 7 <- System.out.println at the start of the match method
os.arch:amd64
R4LibraryClause.normalizeOSName():value.startsWith('win') <- second call, fails
value:windows7 <- NOT OK, there is no space between "windows" and "7", line 392
won't catch it
Returned OS:win <- NOT OK
normal_osname:win;
normal_processor:x86-64;
normal_osversion:6.1.0;
normal_language:fr;
currentOSName:win
osname[0]:windows7
R4LibraryClause.match()-checkOSNames returned false
So the parse() method succeeds while the match() method does not. The input map
configMap is suspect #1. Don't really know where it is initialized
Kind regards,
Ben
Le 12 juin 2014 à 22:33, Benoît Thiébault <[email protected]> a écrit :
> Hi Richard,
>
> Here is what I did: I added a few System.out.println in the
> R4LibraryClause.match() and checkOSNames() methods and recompiled Felix
> Framework (4.5.0-SNAPSHOT thus)
>
> The modified code:
> public boolean match(final Map configMap) throws BundleException {
> System.out.println("os.name:" + System.getProperty("os.name"));
> System.out.println("os.arch:" + System.getProperty("os.arch"));
> final String normal_osname = normalizeOSName((String)
> configMap.get(Constants.FRAMEWORK_OS_NAME));
> System.out.println("normal_osname:" + normal_osname + ";");
> final String normal_processor = normalizeProcessor((String)
> configMap.get(Constants.FRAMEWORK_PROCESSOR));
> System.out.println("normal_processor:" + normal_processor + ";");
> final String normal_osversion = normalizeOSVersion((String)
> configMap.get(Constants.FRAMEWORK_OS_VERSION));
> System.out.println("normal_osversion:" + normal_osversion + ";");
> final String normal_language = (String)
> configMap.get(Constants.FRAMEWORK_LANGUAGE);
> System.out.println("normal_language:" + normal_language + ";");
>
> // Check library's osname.
> if (!checkOSNames(normal_osname, getOSNames())) {
> System.out.println("R4LibraryClause.match()-checkOSNames returned
> false");
> return false;
> }
>
> // Check library's processor.
> if (!checkProcessors(normal_processor, getProcessors())) {
> System.out.println("R4LibraryClause.match()-checkProcessors
> returned false");
> return false;
> }
>
> // Check library's osversion if specified.
> if ((getOSVersions() != null) && (getOSVersions().length > 0)
> && !checkOSVersions(normal_osversion, getOSVersions())) {
> System.out.println("R4LibraryClause.match()-checkOSVersion
> returned false");
> return false;
> }
>
> // Check library's language if specified.
> if ((getLanguages() != null) && (getLanguages().length > 0) &&
> !checkLanguages(normal_language, getLanguages())) {
> System.out.println("R4LibraryClause.match()-checkLanguages
> returned false");
> return false;
> }
>
> // Check library's selection-filter if specified.
> if ((getSelectionFilter() != null) && (getSelectionFilter().length()
> >= 0)
> && !checkSelectionFilter(configMap, getSelectionFilter())) {
> System.out.println("R4LibraryClause.match()-checkSelectionFilter
> returned false");
> return false;
> }
>
> System.out.println("R4LibraryClause.match() -> returned true");
> return true;
> }
>
> private boolean checkOSNames(final String currentOSName, final String[]
> osnames) {
> final boolean win32 = currentOSName.startsWith("win") &&
> !currentOSName.equals("windowsce");
> System.out.println("currentOSName:" + currentOSName);
> for (int i = 0; (osnames != null) && (i < osnames.length); i++) {
> System.out.println("osname[" + i + "]:" + osnames[i]);
> if (osnames[i].equals(currentOSName) ||
> ("win32".equals(osnames[i]) && win32)) {
> return true;
> }
> }
> return false;
> }
>
> The output when run on Windows:
> os.name:Windows 7
> os.arch:amd64
> normal_osname:win;
> normal_processor:x86-64;
> normal_osversion:6.1.0;
> normal_language:fr;
> currentOSName:win
> osname[0]:windows7
> R4LibraryClause.match()-checkOSNames returned false
>
> So the problem seems to be the normal_osname that is win and not windows7…
>
> Do you confirm?
>
> Kind regards,
> Ben
>
> Le 12 juin 2014 à 21:48, Richard S. Hall <[email protected]> a écrit :
>
>> Perhaps you start the JVM up suspended with debug enabled and set a break
>> point up at R4LibraryClause.match() and see precisely why it is failing?
>>
>> The code in there is pretty self explanatory.
>>
>> -> richard
>
--
Dr Benoît Thiébault
Project Manager
Artenum Toulouse - Science & Groupware
http://www.artenum.com
Bâtiment Calfocenter
10, rue Marguerite-Long
31320 Castanet-Tolosan
France
Phone: +33 (0)5 82 95 19 00