Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Kaegi2008-11-27 01:23:47 +0000
committerSimon Kaegi2008-11-27 01:23:47 +0000
commitaf87fe18f1bc198d212c104bdb35dfc0ce846634 (patch)
tree19b20b7758724ce6e8d940cc2d84ecdb99818375 /bundles/org.eclipse.equinox.simpleconfigurator.manipulator/src
parent820f40be999fc62feaa39a67515e2ea7aeb45281 (diff)
downloadrt.equinox.p2-af87fe18f1bc198d212c104bdb35dfc0ce846634.tar.gz
rt.equinox.p2-af87fe18f1bc198d212c104bdb35dfc0ce846634.tar.xz
rt.equinox.p2-af87fe18f1bc198d212c104bdb35dfc0ce846634.zip
Bug 256650 test failures in N20081126-2000 - Error while loading manipulator
Support old style bundle locations when a simpleconfigurator with version less than 1.0.100 is present so that end 2 end tests pass
Diffstat (limited to 'bundles/org.eclipse.equinox.simpleconfigurator.manipulator/src')
-rw-r--r--bundles/org.eclipse.equinox.simpleconfigurator.manipulator/src/org/eclipse/equinox/internal/simpleconfigurator/manipulator/SimpleConfiguratorManipulatorUtils.java28
1 files changed, 24 insertions, 4 deletions
diff --git a/bundles/org.eclipse.equinox.simpleconfigurator.manipulator/src/org/eclipse/equinox/internal/simpleconfigurator/manipulator/SimpleConfiguratorManipulatorUtils.java b/bundles/org.eclipse.equinox.simpleconfigurator.manipulator/src/org/eclipse/equinox/internal/simpleconfigurator/manipulator/SimpleConfiguratorManipulatorUtils.java
index 183a5aaa1..d01a33188 100644
--- a/bundles/org.eclipse.equinox.simpleconfigurator.manipulator/src/org/eclipse/equinox/internal/simpleconfigurator/manipulator/SimpleConfiguratorManipulatorUtils.java
+++ b/bundles/org.eclipse.equinox.simpleconfigurator.manipulator/src/org/eclipse/equinox/internal/simpleconfigurator/manipulator/SimpleConfiguratorManipulatorUtils.java
@@ -14,9 +14,12 @@ import java.util.Arrays;
import java.util.Comparator;
import org.eclipse.equinox.internal.frameworkadmin.utils.Utils;
import org.eclipse.equinox.internal.simpleconfigurator.utils.BundleInfo;
+import org.osgi.framework.Version;
public class SimpleConfiguratorManipulatorUtils {
+ private static final Version OLD_VERSION = new Version("1.0.100");
+
public static void writeConfiguration(BundleInfo[] simpleInfos, File outputFile) throws IOException {
// if empty remove the configuration file
@@ -44,10 +47,20 @@ public class SimpleConfiguratorManipulatorUtils {
Utils.createParentDir(outputFile);
BufferedWriter writer = null;
IOException caughtException = null;
+ boolean oldStyle = false;
+ for (int i = 0; i < simpleInfos.length; i++) {
+ if (SimpleConfiguratorManipulatorImpl.SERVICE_PROP_VALUE_CONFIGURATOR_SYMBOLICNAME.equals(simpleInfos[i].getSymbolicName())) {
+ Version version = new Version(simpleInfos[i].getVersion());
+ if (version.compareTo(OLD_VERSION) < 0)
+ oldStyle = true;
+ break;
+ }
+ }
+
try {
writer = new BufferedWriter(new FileWriter(outputFile));
for (int i = 0; i < simpleInfos.length; i++) {
- writer.write(createBundleInfoLine(simpleInfos[i]));
+ writer.write(createBundleInfoLine(simpleInfos[i], oldStyle));
writer.newLine();
}
} catch (IOException e) {
@@ -67,14 +80,14 @@ public class SimpleConfiguratorManipulatorUtils {
throw caughtException;
}
- public static String createBundleInfoLine(BundleInfo bundleInfo) throws IOException {
+ public static String createBundleInfoLine(BundleInfo bundleInfo, boolean oldStyle) throws IOException {
// symbolicName,version,location,startLevel,markedAsStarted
StringBuffer buffer = new StringBuffer();
buffer.append(bundleInfo.getSymbolicName());
buffer.append(',');
buffer.append(bundleInfo.getVersion());
buffer.append(',');
- buffer.append(createBundleLocation(bundleInfo.getLocation()));
+ buffer.append(createBundleLocation(bundleInfo.getLocation(), oldStyle));
buffer.append(',');
buffer.append(bundleInfo.getStartLevel());
buffer.append(',');
@@ -82,7 +95,14 @@ public class SimpleConfiguratorManipulatorUtils {
return buffer.toString();
}
- public static String createBundleLocation(URI location) {
+ public static String createBundleLocation(URI location, boolean oldStyle) {
+ if (oldStyle) {
+ String scheme = location.getScheme();
+ if (scheme == null)
+ scheme = "file";
+ return scheme + ":" + location.getSchemeSpecificPart();
+ }
+
String result = location.toString();
int commaIndex = result.indexOf(',');
while (commaIndex != -1) {

Back to the top