On 6/12/14, 16:33 , Benoît Thiébault wrote:
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?

Looks like it, but that doesn't make much sense. You need to look into normalizeOSName() and see why it doesn't match "windows7"...when I edited my OS name to be "Windows 7" it worked correctly, so the only thing that makes sense here is that the value being passed to normalizeOSName() is not "Windows 7"...

-> richard


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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to