FELIX-5014 - Added case for Windows versions with no space.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1700038 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/util/manifestparser/NativeLibraryClause.java b/framework/src/main/java/org/apache/felix/framework/util/manifestparser/NativeLibraryClause.java
index a9ac0b7..8fec7dd 100644
--- a/framework/src/main/java/org/apache/felix/framework/util/manifestparser/NativeLibraryClause.java
+++ b/framework/src/main/java/org/apache/felix/framework/util/manifestparser/NativeLibraryClause.java
@@ -602,19 +602,23 @@
{
os = OS_WINDOWS_VISTA;
}
- else if ((value.indexOf(" 7") >= 0) || value.equals("win7"))
+ else if ((value.indexOf(" 7") >= 0) || value.startsWith(OS_WINDOWS_7)
+ || value.equals("win7"))
{
os = OS_WINDOWS_7;
}
- else if ((value.indexOf(" 8") >= 0) || value.equals("win8"))
+ else if ((value.indexOf(" 8") >= 0) || value.startsWith(OS_WINDOWS_8)
+ || value.equals("win8"))
{
os = OS_WINDOWS_8;
}
- else if ((value.indexOf(" 9") >= 0) || value.equals("win9"))
+ else if ((value.indexOf(" 9") >= 0) || value.startsWith(OS_WINDOWS_9)
+ || value.equals("win9"))
{
os = OS_WINDOWS_9;
}
- else if ((value.indexOf(" 10") >= 0) || value.equals("win10"))
+ else if ((value.indexOf(" 10") >= 0) || value.startsWith(OS_WINDOWS_10)
+ || value.equals("win10"))
{
os = OS_WINDOWS_10;
}
diff --git a/framework/src/test/java/org/apache/felix/framework/util/manifestparser/NativeLibraryClauseTest.java b/framework/src/test/java/org/apache/felix/framework/util/manifestparser/NativeLibraryClauseTest.java
index cb24c56..394ce9d 100644
--- a/framework/src/test/java/org/apache/felix/framework/util/manifestparser/NativeLibraryClauseTest.java
+++ b/framework/src/test/java/org/apache/felix/framework/util/manifestparser/NativeLibraryClauseTest.java
@@ -36,6 +36,7 @@
assertEquals("windowsvista", NativeLibraryClause.normalizeOSName("WinVista"));
assertEquals("windows7", NativeLibraryClause.normalizeOSName("Windows 7"));
assertEquals("windows8", NativeLibraryClause.normalizeOSName("Win8"));
+ assertEquals("windows10", NativeLibraryClause.normalizeOSName("Windows 10"));
assertEquals("linux", NativeLibraryClause.normalizeOSName("Linux1.2.3"));
assertEquals("aix", NativeLibraryClause.normalizeOSName("AIX-4.5.6"));
assertEquals("digitalunix", NativeLibraryClause.normalizeOSName("digitalunix_blah"));
@@ -71,6 +72,7 @@
assertEquals("windows7", NativeLibraryClause.normalizeOSName("windows7"));
assertEquals("windows8", NativeLibraryClause.normalizeOSName("windows8"));
assertEquals("windows9", NativeLibraryClause.normalizeOSName("windows9"));
+ assertEquals("windows10", NativeLibraryClause.normalizeOSName("windows10"));
assertEquals("windows95", NativeLibraryClause.normalizeOSName("windows95"));
assertEquals("windows98", NativeLibraryClause.normalizeOSName("windows98"));
assertEquals("windowsce", NativeLibraryClause.normalizeOSName("windowsce"));
@@ -98,6 +100,7 @@
assertTrue(NativeLibraryClause.getOsNameWithAliases("Windows 7").contains("windows7"));
assertTrue(NativeLibraryClause.getOsNameWithAliases("Windows7").contains("windows7"));
assertTrue(NativeLibraryClause.getOsNameWithAliases("Win8").contains("windows8"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("Windows 10").contains("windows10"));
assertTrue(NativeLibraryClause.getOsNameWithAliases("Linux1.2.3").contains("linux"));
assertTrue(NativeLibraryClause.getOsNameWithAliases("AIX-4.5.6").contains("aix"));
assertTrue(NativeLibraryClause.getOsNameWithAliases("digitalunix_blah").contains("digitalunix"));
@@ -133,6 +136,7 @@
assertTrue(NativeLibraryClause.getOsNameWithAliases("windows7").contains("windows7"));
assertTrue(NativeLibraryClause.getOsNameWithAliases("windows8").contains("windows8"));
assertTrue(NativeLibraryClause.getOsNameWithAliases("windows9").contains("windows9"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("windows10").contains("windows10"));
assertTrue(NativeLibraryClause.getOsNameWithAliases("windows95").contains("windows95"));
assertTrue(NativeLibraryClause.getOsNameWithAliases("windows98").contains("windows98"));
assertTrue(NativeLibraryClause.getOsNameWithAliases("windowsce").contains("windowsce"));