diff options
author | Andrew Niefer | 2009-07-22 14:21:42 +0000 |
---|---|---|
committer | Andrew Niefer | 2009-07-22 14:21:42 +0000 |
commit | 6f07aa6ffefa64a91390ef7b353128bc379a1ca0 (patch) | |
tree | a99f34db02015569d9963f6690f96fba1e8ba82d | |
parent | cc1df5f410ed6cf1ecc273b7f874803ae9ccc69d (diff) | |
download | rt.equinox.p2-6f07aa6ffefa64a91390ef7b353128bc379a1ca0.tar.gz rt.equinox.p2-6f07aa6ffefa64a91390ef7b353128bc379a1ca0.tar.xz rt.equinox.p2-6f07aa6ffefa64a91390ef7b353128bc379a1ca0.zip |
bug 277547 - StringIndexOutOfBoundException when setLauncherName is passed an empty string
2 files changed, 28 insertions, 1 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/SetLauncherNameActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/SetLauncherNameActionTest.java index ef87e0a9c..7765c2472 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/SetLauncherNameActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/SetLauncherNameActionTest.java @@ -8,6 +8,7 @@ ******************************************************************************/ package org.eclipse.equinox.p2.tests.touchpoint.eclipse; +import java.io.File; import java.util.*; import org.eclipse.equinox.internal.p2.touchpoint.eclipse.EclipseTouchpoint; import org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions.ActionConstants; @@ -53,4 +54,30 @@ public class SetLauncherNameActionTest extends AbstractProvisioningTest { assertNotSame(launcherName, profile.getProperty(EclipseTouchpoint.PROFILE_PROP_LAUNCHER_NAME)); } + public void testEmptyName() { + Map parameters = new HashMap(); + EclipseTouchpoint touchpoint = new EclipseTouchpoint(); + + File tempFolder = getTempFolder(); + Properties profileProperties = new Properties(); + profileProperties.put(IProfile.PROP_INSTALL_FOLDER, tempFolder.toString()); + profileProperties.put(IProfile.PROP_ENVIRONMENTS, "osgi.ws=cocoa,osgi.os=macosx,osgi.arch=x86"); + IProfile profile = createProfile("launcherNameProfile", null, profileProperties); + + InstallableUnitOperand operand = new InstallableUnitOperand(null, createIU("test")); + touchpoint.initializePhase(null, profile, "test", parameters); + parameters.put(ActionConstants.PARM_PROFILE, profile); + parameters.put("iu", operand.second()); + touchpoint.initializeOperand(profile, operand, parameters); + + Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); + assertNotNull(manipulator); + + parameters.put(ActionConstants.PARM_LAUNCHERNAME, ""); + parameters = Collections.unmodifiableMap(parameters); + + SetLauncherNameAction action = new SetLauncherNameAction(); + action.execute(parameters); + } + }
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java index c494820d2..cf13039e2 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java @@ -252,7 +252,7 @@ public class Util { public static File getLauncherPath(IProfile profile) { String name = profile.getProperty(EclipseTouchpoint.PROFILE_PROP_LAUNCHER_NAME); - if (name == null) + if (name == null || name.length() == 0) name = "eclipse"; //$NON-NLS-1$ return new File(getInstallFolder(profile), getLauncherName(name, getOSFromProfile(profile))); } |