Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2008-03-07 03:10:42 +0000
committerPascal Rapicault2008-03-07 03:10:42 +0000
commit15cb3b4a078da7e25c5ec33c68262dfe20eed79d (patch)
treeb1acff8d3737bab3a2f8331935c8a49c33594c6a
parent0e43693c24472e828357f45391d5c3d5eeff19e0 (diff)
downloadrt.equinox.p2-15cb3b4a078da7e25c5ec33c68262dfe20eed79d.tar.gz
rt.equinox.p2-15cb3b4a078da7e25c5ec33c68262dfe20eed79d.tar.xz
rt.equinox.p2-15cb3b4a078da7e25c5ec33c68262dfe20eed79d.zip
Bug 221706 - Eclipse can't start when working dir is not set to the install folder
-rw-r--r--bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherParser.java8
-rw-r--r--bundles/org.eclipse.equinox.frameworkadmin.test/src/org/eclipse/equinox/frameworkadmin/tests/NoConfigurationValueInEclipseIni.java55
2 files changed, 63 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherParser.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherParser.java
index bb62a62ee..8d9875c0e 100644
--- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherParser.java
+++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherParser.java
@@ -271,6 +271,14 @@ public class EclipseLauncherParser {
resolveNextLine = null;
} else {
resolveNextLine = needsPathResolution(lines[i], osgiInstallArea, launcherData.getLauncher().getParentFile().getAbsolutePath() + File.separator);
+ //We don't write -configuration when it is the default value
+ if (resolveNextLine != null && EquinoxConstants.OPTION_CONFIGURATION.equalsIgnoreCase(lines[i])) {
+ if ("configuration".equals(EquinoxManipulatorImpl.makeRelative(lines[i + 1], resolveNextLine))) { //$NON-NLS-1$
+ i++;
+ resolveNextLine = null;
+ continue;
+ }
+ }
}
bw.write(lines[i]);
bw.newLine();
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.test/src/org/eclipse/equinox/frameworkadmin/tests/NoConfigurationValueInEclipseIni.java b/bundles/org.eclipse.equinox.frameworkadmin.test/src/org/eclipse/equinox/frameworkadmin/tests/NoConfigurationValueInEclipseIni.java
new file mode 100644
index 000000000..98f53c472
--- /dev/null
+++ b/bundles/org.eclipse.equinox.frameworkadmin.test/src/org/eclipse/equinox/frameworkadmin/tests/NoConfigurationValueInEclipseIni.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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 http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.frameworkadmin.tests;
+
+import java.io.File;
+import java.io.IOException;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.equinox.internal.provisional.frameworkadmin.*;
+import org.osgi.framework.BundleException;
+
+public class NoConfigurationValueInEclipseIni extends FwkAdminAndSimpleConfiguratorTest {
+
+ public NoConfigurationValueInEclipseIni(String name) {
+ super(name);
+ }
+
+ public void testAbsenceOfConfigurationInEclipseINI() throws Exception {
+ createMinimalConfiguration(NoConfigurationValueInEclipseIni.class.getName());
+ File launcherIni = new File(getInstallFolder(), getLauncherName() + ".ini");
+ assertNotContent(launcherIni, "-configuration");
+ }
+
+ public void testPresenceOfConfigurationInEclipseINI() throws FrameworkAdminRuntimeException, IOException, BundleException {
+ FrameworkAdmin fwkAdmin = getEquinoxFrameworkAdmin();
+ Manipulator manipulator = fwkAdmin.getManipulator();
+
+ File installFolder = Activator.getContext().getDataFile("bis" + NoConfigurationValueInEclipseIni.class.getName());
+ File configurationFolder = new File(installFolder, "config2");
+ String launcherName = "eclipse";
+
+ LauncherData launcherData = manipulator.getLauncherData();
+ launcherData.setFwConfigLocation(configurationFolder);
+ launcherData.setLauncher(new File(installFolder, launcherName));
+
+ BundleInfo osgiBi = new BundleInfo("org.eclipse.osgi", "3.3.1", FileLocator.resolve(Activator.getContext().getBundle().getEntry("dataFile/org.eclipse.osgi.jar")).toExternalForm(), 0, true);
+ BundleInfo configuratorBi = new BundleInfo("org.eclipse.equinox.simpleconfigurator", "1.0.0", FileLocator.resolve(Activator.getContext().getBundle().getEntry("dataFile/org.eclipse.equinox.simpleconfigurator.jar")).toExternalForm(), 1, true);
+
+ manipulator.getConfigData().addBundle(osgiBi);
+ manipulator.getConfigData().addBundle(configuratorBi);
+
+ try {
+ manipulator.save(false);
+ } catch (IllegalStateException e) {
+ //TODO We ignore the framework JAR location not set exception
+ }
+ File launcherIni = new File(installFolder, launcherName + ".ini");
+ assertContent(launcherIni, "-configuration");
+ }
+}

Back to the top