Skip to content

Commit

Permalink
Skip target bundles with invalid manifest during IU generation #996
Browse files Browse the repository at this point in the history
A call to BundlesAction.createBundleDescription() returns null, if the
manifest of the current bundle contains invalid headers (e.g. the same
package is imported twice).

If left unchecked, this causes an unhandled NullPointerException a few
lines further down. Add an explicit null, in order to simply skip this
invalid bundle.
  • Loading branch information
ptziegler authored and HannesWell committed Dec 9, 2023
1 parent 0a0b138 commit d7a9363
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,14 @@ public static Stream<IInstallableUnit> generateInstallableUnits(TargetBundle tar
PublisherInfo publisherInfo = new PublisherInfo();
publisherInfo.setArtifactOptions(IPublisherInfo.A_INDEX);
BundleDescription bundleDescription = BundlesAction.createBundleDescription(headers, null);
IInstallableUnit iu = BundlesAction.createBundleIU(bundleDescription,
BundlesAction.createBundleArtifactKey(bundleDescription.getSymbolicName(),
bundleDescription.getVersion().toString()),
publisherInfo);
return Stream.of(iu);
// null if bundle contains invalid manifest headers
if (bundleDescription != null) {
IInstallableUnit iu = BundlesAction.createBundleIU(bundleDescription,
BundlesAction.createBundleArtifactKey(bundleDescription.getSymbolicName(),
bundleDescription.getVersion().toString()),
publisherInfo);
return Stream.of(iu);
}
} catch (IOException e) {
// can't use it then...
}
Expand Down

0 comments on commit d7a9363

Please sign in to comment.