diff options
author | Thomas Watson | 2017-06-26 13:53:45 +0000 |
---|---|---|
committer | Thomas Watson | 2017-08-21 15:48:25 +0000 |
commit | 1e4c4c30d8ae7d52c820d93fe1925bde976af065 (patch) | |
tree | 9b634ebf4681b091240ded6d1f40678c075b91c3 | |
parent | 676f51d077edfe0db20b70f9c03a4d584bab170f (diff) | |
download | rt.equinox.framework-M20170918-1300.tar.gz rt.equinox.framework-M20170918-1300.tar.xz rt.equinox.framework-M20170918-1300.zip |
Bug 518740 - The Equinox Framework does not start on ARM using OracleY20170921-1000Y20170920-1000Y20170919-1000Y20170918-1000Y20170917-1000Y20170916-1000Y20170915-1000Y20170914-1000Y20170913-1335Y20170913-1000Y20170912-1000Y20170911-1000Y20170907-1000Y20170831-1000Y20170826-0800Y20170825-0700Y20170824-1850Y20170824-1000U20170921-0520U20170921-0430U20170921-0400U20170914-0400U20170913-1405U20170913-1050U20170913-0250U20170912-1305U20170912-0740U20170907-0400U20170905-1030U20170901-0900U20170831-0400U20170830-0850U20170828-0235U20170826-0930U20170826-0300U20170824-1210U20170824-0830U20170824-0400U20170822-0900S4_7_1_RC4S4_7_1_RC3S4_7_1_RC2R4_7_1M20170921-0255M20170920-2345M20170920-1700M20170920-0400M20170919-1155M20170919-0830M20170918-1300M20170906-1700M20170901-1220M20170901-0200M20170830-1700M20170830-0400M20170824-0635M20170824-0140M20170823-2345M20170823-1700M20170823-0500
Embedded JRE
Change-Id: I4f202f733e177fffe175dec58757f84aa36260d8
Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
-rwxr-xr-x | bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java | 51 | ||||
-rw-r--r-- | bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java | 16 |
2 files changed, 48 insertions, 19 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 a28dbb22c..5129c9f41 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2016 IBM Corporation and others. + * Copyright (c) 2008, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -2677,22 +2677,45 @@ public class SystemBundleTests extends AbstractBundleTests { assertNotNull("No system bundle class loader.", cl); } - public void testJavaProfile() { - String original = System.getProperty("java.specification.version"); - try { - doTestJavaProfile("9.3.1", "JavaSE-9"); - doTestJavaProfile("9", "JavaSE-9"); - doTestJavaProfile("8.4", "JavaSE-1.8"); - doTestJavaProfile("1.10.1", "JavaSE-1.8"); - doTestJavaProfile("1.9", "JavaSE-1.8"); - doTestJavaProfile("1.8", "JavaSE-1.8"); - doTestJavaProfile("1.7", "JavaSE-1.7"); + public void testJavaProfile() throws IOException { + String originalSpecVersion = System.getProperty("java.specification.version"); + String originalJavaHome = System.getProperty("java.home"); + try { + doTestJavaProfile("9.3.1", "JavaSE-9", null); + doTestJavaProfile("9", "JavaSE-9", null); + doTestJavaProfile("8.4", "JavaSE-1.8", null); + doTestJavaProfile("1.10.1", "JavaSE-1.8", null); + doTestJavaProfile("1.9", "JavaSE-1.8", null); + doTestJavaProfile("1.8", "JavaSE-1.8", null); + doTestJavaProfile("1.7", "JavaSE-1.7", null); + doTestJavaProfile("1.8", "JavaSE/compact3-1.8", "compact3"); + doTestJavaProfile("1.8", "JavaSE/compact3-1.8", "\"compact3\""); + doTestJavaProfile("1.8", "JavaSE/compact3-1.8", " \"compact3\" "); + doTestJavaProfile("1.8", "JavaSE/compact3-1.8", " compact3 "); + doTestJavaProfile("1.8", "JavaSE-1.8", "\"compact4\""); + doTestJavaProfile("9", "JavaSE/compact3-1.8", "compact3"); + doTestJavaProfile("9", "JavaSE/compact3-1.8", "\"compact3\""); + doTestJavaProfile("9", "JavaSE-9", "\"compact4\""); } finally { - System.setProperty("java.specification.version", original); + System.setProperty("java.specification.version", originalSpecVersion); + System.setProperty("java.home", originalJavaHome); } } - private void doTestJavaProfile(String javaSpecVersion, String expectedEEName) { + private void doTestJavaProfile(String javaSpecVersion, String expectedEEName, String releaseName) throws FileNotFoundException, IOException { + if (releaseName != null) { + File release = getContext().getDataFile("jre/release"); + release.getParentFile().mkdirs(); + Properties props = new Properties(); + props.put("JAVA_PROFILE", releaseName); + FileOutputStream propStream = new FileOutputStream(release); + try { + props.store(propStream, null); + } finally { + propStream.close(); + } + System.setProperty("java.home", release.getParentFile().getAbsolutePath()); + } System.setProperty("java.specification.version", javaSpecVersion); // create/stop/ test File config = OSGiTestsActivator.getContext().getDataFile(getName() + javaSpecVersion); @@ -2719,7 +2742,7 @@ public class SystemBundleTests extends AbstractBundleTests { } assertEquals("Wrong state for SystemBundle", Bundle.RESOLVED, equinox.getState()); //$NON-NLS-1$ - assertTrue("Wrong osgi EE: " + osgiEE, osgiEE.endsWith(expectedEEName)); + assertTrue("Wrong osgi EE: expected: " + expectedEEName + " but was: " + osgiEE, osgiEE.endsWith(expectedEEName)); } private static File[] createBundles(File outputDir, int bundleCount) throws IOException { diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java index 702c80073..d891eff5d 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2016 IBM Corporation and others. + * Copyright (c) 2012, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -1432,10 +1432,13 @@ public class Storage { File release = new File(javaHome, "release"); //$NON-NLS-1$ if (release.exists()) { Properties releaseProps = new Properties(); - try { - releaseProps.load(new FileInputStream(release)); - if (releaseProps.containsKey("JAVA_PROFILE")) { //$NON-NLS-1$ - embeddedProfileName = "_" + releaseProps.getProperty("JAVA_PROFILE") + "-"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + try (InputStream releaseStream = new FileInputStream(release)) { + releaseProps.load(releaseStream); + String releaseName = releaseProps.getProperty("JAVA_PROFILE"); //$NON-NLS-1$ + if (releaseName != null) { + // make sure to remove extra quotes + releaseName = releaseName.replaceAll("^\\s*\"?|\"?\\s*$", ""); //$NON-NLS-1$ //$NON-NLS-2$ + embeddedProfileName = "_" + releaseName + "-"; //$NON-NLS-1$ //$NON-NLS-2$ } } catch (IOException e) { // ignore @@ -1520,6 +1523,9 @@ public class Storage { } else if (major <= 9 && major > 1) { minor = 8; major = 1; + } else { + // we have reached the end of our search; return the existing result; + return result; } } while (result == null && minor >= 0); return result; |