Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2009-11-24 17:02:52 +0000
committerPascal Rapicault2009-11-24 17:02:52 +0000
commit4453a745b731e60f2bdb617732ff76607d64039e (patch)
treef3aa15becf2806a5323aef7fd0058db3802fd786
parent8c3e05ec7649c9025357c65f25575f3b5370069a (diff)
downloadrt.equinox.p2-4453a745b731e60f2bdb617732ff76607d64039e.tar.gz
rt.equinox.p2-4453a745b731e60f2bdb617732ff76607d64039e.tar.xz
rt.equinox.p2-4453a745b731e60f2bdb617732ff76607d64039e.zip
Improve parsing logic to be more resilient to non compliant manifest filesR34x_v20091124
-rw-r--r--bundles/org.eclipse.equinox.frameworkadmin/META-INF/MANIFEST.MF1
-rw-r--r--bundles/org.eclipse.equinox.frameworkadmin/src/org/eclipse/equinox/internal/frameworkadmin/utils/Utils.java16
2 files changed, 11 insertions, 6 deletions
diff --git a/bundles/org.eclipse.equinox.frameworkadmin/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.frameworkadmin/META-INF/MANIFEST.MF
index 53e28cdaa..dde7d5e4c 100644
--- a/bundles/org.eclipse.equinox.frameworkadmin/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.frameworkadmin/META-INF/MANIFEST.MF
@@ -6,6 +6,7 @@ Bundle-Version: 1.0.2.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Import-Package: org.eclipse.osgi.service.pluginconversion;version="1.0.0",
+ org.eclipse.osgi.util;version="1.1.0",
org.osgi.framework;version="1.3.0",
org.osgi.service.startlevel;version="1.0.0"
Export-Package: org.eclipse.equinox.internal.frameworkadmin.utils;x-friends:="org.eclipse.equinox.frameworkadmin.equinox,org.eclipse.equinox.p2.metadata.generator",
diff --git a/bundles/org.eclipse.equinox.frameworkadmin/src/org/eclipse/equinox/internal/frameworkadmin/utils/Utils.java b/bundles/org.eclipse.equinox.frameworkadmin/src/org/eclipse/equinox/internal/frameworkadmin/utils/Utils.java
index 99e836129..02550f313 100644
--- a/bundles/org.eclipse.equinox.frameworkadmin/src/org/eclipse/equinox/internal/frameworkadmin/utils/Utils.java
+++ b/bundles/org.eclipse.equinox.frameworkadmin/src/org/eclipse/equinox/internal/frameworkadmin/utils/Utils.java
@@ -22,6 +22,8 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.internal.provisional.frameworkadmin.BundleInfo;
import org.eclipse.osgi.service.pluginconversion.PluginConversionException;
import org.eclipse.osgi.service.pluginconversion.PluginConverter;
+import org.eclipse.osgi.util.ManifestElement;
+import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
public class Utils {
@@ -85,13 +87,15 @@ public class Utils {
// It is not a manifest, but a plugin or a fragment
try {
- Manifest m = new Manifest(manifestStream);
- Dictionary manifest = manifestToProperties(m.getMainAttributes());
+ Map manifest = ManifestElement.parseBundleManifest(manifestStream, null);
// add this check to handle the case were we read a non-OSGi manifest
if (manifest.get(Constants.BUNDLE_SYMBOLICNAME) == null)
return convertPluginManifest(bundleLocation, true);
- return manifest;
+ return manifestToProperties(manifest);
} catch (IOException ioe) {
+ System.out.println(ioe);
+ return null;
+ } catch (BundleException be) {
return null;
}
} finally {
@@ -498,12 +502,12 @@ public class Utils {
return new URL(fromSt + "/" + path);
}
- private static Properties manifestToProperties(Attributes d) {
+ private static Properties manifestToProperties(Map d) {
Iterator iter = d.keySet().iterator();
Properties result = new Properties();
while (iter.hasNext()) {
- Attributes.Name key = (Attributes.Name) iter.next();
- result.put(key.toString(), d.get(key));
+ String key = (String) iter.next();
+ result.put(key, d.get(key));
}
return result;
}

Back to the top