Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Niefer2010-03-17 16:25:23 -0400
committerAndrew Niefer2010-03-17 16:25:23 -0400
commitf09ccf6bd0009abdd187a3e9a01f0c669eab9aec (patch)
tree715d9fb2d999c15a9fb8e4f07d59e3ba49c5582f
parent4af1391156bebd57a787d14d8672891e1cfde002 (diff)
downloadrt.equinox.framework-f09ccf6bd0009abdd187a3e9a01f0c669eab9aec.tar.gz
rt.equinox.framework-f09ccf6bd0009abdd187a3e9a01f0c669eab9aec.tar.xz
rt.equinox.framework-f09ccf6bd0009abdd187a3e9a01f0c669eab9aec.zip
Bug 304558 - [launcher] Main#findMax fails with bundle names containing '_'
-rw-r--r--bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java11
-rw-r--r--bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/WebStartMain.java4
2 files changed, 8 insertions, 7 deletions
diff --git a/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java b/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java
index 4e083955a..da30753c8 100644
--- a/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java
+++ b/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java
@@ -1018,7 +1018,7 @@ public class Main {
matches.add(candidates[i]);
}
String[] names = (String[]) matches.toArray(new String[matches.size()]);
- int result = findMax(names);
+ int result = findMax(target, names);
if (result == -1)
return null;
File candidate = new File(start, names[result]);
@@ -1076,15 +1076,16 @@ public class Main {
return searchFor(target, start);
}
- protected int findMax(String[] candidates) {
+ protected int findMax(String prefix, String[] candidates) {
int result = -1;
Object maxVersion = null;
for (int i = 0; i < candidates.length; i++) {
String name = (candidates[i] != null) ? candidates[i] : ""; //$NON-NLS-1$
String version = ""; //$NON-NLS-1$ // Note: directory with version suffix is always > than directory without version suffix
- int index = name.indexOf('_');
- if (index != -1)
- version = name.substring(index + 1);
+ if (prefix == null)
+ version = name; //webstart just passes in versions
+ else if (name.startsWith(prefix + "_")) //$NON-NLS-1$
+ version = name.substring(prefix.length() + 1); //prefix_version
Object currentVersion = getVersionElements(version);
if (maxVersion == null) {
result = i;
diff --git a/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/WebStartMain.java b/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/WebStartMain.java
index 067e2b6fa..c4c744054 100644
--- a/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/WebStartMain.java
+++ b/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/WebStartMain.java
@@ -115,7 +115,7 @@ public class WebStartMain extends Main {
for (int i = 0; i < versions.length; i++) {
versions[i] = ((BundleInfo) matches.get(i)).version;
}
- highest = findMax(versions);
+ highest = findMax(null, versions);
return ((BundleInfo) matches.get(highest)).location;
}
@@ -146,7 +146,7 @@ public class WebStartMain extends Main {
for (int i = 0; i < versions.length; i++) {
versions[i] = ((BundleInfo) matches.get(i)).version;
}
- highest = findMax(versions);
+ highest = findMax(null, versions);
return (BundleInfo) (removeMatch ? matches.remove(highest) : matches.get(highest));
}

Back to the top