Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2017-04-27 14:08:01 -0400
committerThomas Watson2017-04-27 14:08:01 -0400
commit664dd67f1b7243bae360df038ae09730f4c60972 (patch)
treedea59ed8a71668294db2376bde0898cc707b5746
parent810dcad5bf51dd05ed1075ae15f0153d9a78d985 (diff)
downloadrt.equinox.framework-664dd67f1b7243bae360df038ae09730f4c60972.tar.gz
rt.equinox.framework-664dd67f1b7243bae360df038ae09730f4c60972.tar.xz
rt.equinox.framework-664dd67f1b7243bae360df038ae09730f4c60972.zip
Bug 515920 - "Windows Server 2016" to osname.aliases I20170428-0550I20170428-0445I20170427-2000
Change-Id: I07d5537eddb796db7a434a3616bc50acdc51b8ec Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
-rwxr-xr-xbundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java28
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/AliasMapper.java8
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/osname.aliases1
3 files changed, 36 insertions, 1 deletions
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java
index e6707c409..a28dbb22c 100755
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java
@@ -3043,4 +3043,32 @@ public class SystemBundleTests extends AbstractBundleTests {
assertNotNull("No framework active thread for \"" + uuid + "\" found in : " + Arrays.toString(threads), found);
assertEquals("Wrong daemon type.", expectIsDeamon, found.isDaemon());
}
+
+ public void testWindowsAlias() {
+ String origOS = System.getProperty("os.name");
+ File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$
+ Map configuration = new HashMap();
+ configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath());
+ System.setProperty("os.name", "Windows 5000");
+ Equinox equinox = null;
+ try {
+ equinox = new Equinox(configuration);
+ equinox.init();
+ Assert.assertEquals("Wrong framework os name value", "win32", equinox.getBundleContext().getProperty(Constants.FRAMEWORK_OS_NAME));
+ } catch (BundleException e) {
+ fail("Failed init", e);
+ } finally {
+ System.setProperty("os.name", origOS);
+ try {
+ if (equinox != null) {
+ equinox.stop();
+ equinox.waitForStop(1000);
+ }
+ } catch (BundleException e) {
+ fail("Failed to stop framework.", e);
+ } catch (InterruptedException e) {
+ fail("Failed to stop framework.", e);
+ }
+ }
+ }
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/AliasMapper.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/AliasMapper.java
index 67be8107b..b6fd06b3c 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/AliasMapper.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/AliasMapper.java
@@ -65,7 +65,13 @@ public class AliasMapper {
}
public String getCanonicalOSName(String osname) {
- String result = osnameCanonicalTable.get(osname.toLowerCase());
+ String lowerName = osname.toLowerCase();
+ String result = osnameCanonicalTable.get(lowerName);
+ if (result == null) {
+ if (lowerName.startsWith("windows")) { //$NON-NLS-1$
+ return "win32"; //$NON-NLS-1$
+ }
+ }
return result == null ? osname : result;
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/osname.aliases b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/osname.aliases
index 513730b80..729762a6c 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/osname.aliases
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/osname.aliases
@@ -46,6 +46,7 @@ WindowsServer2012 "Windows 2012" "Windows Server 2012" Win2012 Win32 # Microsoft
WindowsServer2012R2 "Windows 2012 R2" "Windows Server 2012 R2" Win2012R2 Win32 # Microsoft
WindowsServer2015 "Windows 2015" "Windows Server 2015" Win2015 Win32 # Microsoft
WindowsServer2015R2 "Windows 2015 R2" "Windows Server 2015 R2" Win2015R2 Win32 # Microsoft
+WindowsServer2016 "Windows 2016" "Windows Server 2016" Win2016 Win32 # Microsoft
Windows7 "Windows 7" Win7 Win32 # Microsoft
Windows8 "Windows 8" "Windows 8.1" "Windows 8.2" "Windows 8.3" Win8 Win32 # Microsoft
Windows10 "Windows 10" Win10 Win32 # Microsoft

Back to the top