diff options
author | Dave Stevenson | 2008-03-03 17:41:39 +0000 |
---|---|---|
committer | Dave Stevenson | 2008-03-03 17:41:39 +0000 |
commit | 02f72447743506882162efcf3f9783031c4ef1bb (patch) | |
tree | a4e5eed0ea8902ba1c397ff6e693e567a82f60fe | |
parent | 6a5e8a7072a5fc1a9eada9fb347585fd405befd9 (diff) | |
download | rt.equinox.p2-02f72447743506882162efcf3f9783031c4ef1bb.tar.gz rt.equinox.p2-02f72447743506882162efcf3f9783031c4ef1bb.tar.xz rt.equinox.p2-02f72447743506882162efcf3f9783031c4ef1bb.zip |
Fix for Bug 221175. NPE in MetadataGeneratorHelper when called by old update site.
A null manifest was being passed in to createEclipseIU, which was not prepared for null when looking for manifest localization files. Add checks for null manifest and null location from bundle descriptor.
-rw-r--r-- | bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/MetadataGeneratorHelper.java | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/MetadataGeneratorHelper.java b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/MetadataGeneratorHelper.java index 4a083d205..b02bb5fe9 100644 --- a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/MetadataGeneratorHelper.java +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/MetadataGeneratorHelper.java @@ -176,13 +176,15 @@ public class MetadataGeneratorHelper { public static IInstallableUnit createBundleIU(BundleDescription bd, Map manifest, boolean isFolderPlugin, IArtifactKey key, Set localizationIUs) { IInstallableUnit bundleIU = createBundleIU(bd, manifest, isFolderPlugin, key); - String bundleLocalization = (String) manifest.get(Constants.BUNDLE_LOCALIZATION); - if (bundleLocalization == null) { - bundleLocalization = DEFAULT_BUNDLE_LOCALIZATION; - } - Map manifestLocalizations = getManifestLocalizations(manifest, new File(bd.getLocation())); - if (manifestLocalizations != null) { - localizationIUs.addAll(createLocalizationFragmentsForBundle(bd, manifestLocalizations)); + if (manifest != null && bd.getLocation() != null) { + String bundleLocalization = (String) manifest.get(Constants.BUNDLE_LOCALIZATION); + if (bundleLocalization == null) { + bundleLocalization = DEFAULT_BUNDLE_LOCALIZATION; + } + Map manifestLocalizations = getManifestLocalizations(manifest, new File(bd.getLocation())); + if (manifestLocalizations != null) { + localizationIUs.addAll(createLocalizationFragmentsForBundle(bd, manifestLocalizations)); + } } return bundleIU; } @@ -534,20 +536,22 @@ public class MetadataGeneratorHelper { addExtraProperties(iu, extraProperties); iusCreated.add(iu); - String bundleLocalization = null; - if (bd.getHost() == null) // not a fragment - bundleLocalization = (String) manifest.get(Constants.BUNDLE_LOCALIZATION); - if (bundleLocalization == null) - bundleLocalization = DEFAULT_BUNDLE_LOCALIZATION; - - Map manifestLocalizations = getManifestLocalizations(manifest, new File(bd.getLocation())); - - if (manifestLocalizations != null) { - List localizationFragments = createLocalizationFragmentsForBundle(bd, manifestLocalizations); - for (Iterator iter = localizationFragments.iterator(); iter.hasNext();) { - addExtraProperties((IInstallableUnit) iter.next(), extraProperties); + if (manifest != null) { + String bundleLocalization = null; + if (bd.getHost() == null) // not a fragment + bundleLocalization = (String) manifest.get(Constants.BUNDLE_LOCALIZATION); + if (bundleLocalization == null) + bundleLocalization = DEFAULT_BUNDLE_LOCALIZATION; + + Map manifestLocalizations = getManifestLocalizations(manifest, new File(bd.getLocation())); + + if (manifestLocalizations != null) { + List localizationFragments = createLocalizationFragmentsForBundle(bd, manifestLocalizations); + for (Iterator iter = localizationFragments.iterator(); iter.hasNext();) { + addExtraProperties((IInstallableUnit) iter.next(), extraProperties); + } + iusCreated.addAll(localizationFragments); } - iusCreated.addAll(localizationFragments); } return (IInstallableUnit[]) (iusCreated.toArray(new IInstallableUnit[iusCreated.size()])); |