Skip to content

Commit 77b66bd

Browse files
committed
Do not let one erroneous bundle fail the whole IU container
Currently if there is one failing bundle the whole container resolution fails and throws an ugly error. In fact there is InvalidTargetBundle for that purpose already and the profile container is even using that. THis one now constructs a InvalidTargetBundle whenever one bundle fails to be constructed from its file.
1 parent b797e37 commit 77b66bd

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/target/IUBundleContainer.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,8 @@ public synchronized IUBundleContainer update(Set<String> toUpdate, IProgressMoni
473473
* @param artifacts the underlying artifact repo against which the bundles are validated
474474
* @return map of BundleInfo to IResolvedBundle
475475
*/
476-
private Map<BundleInfo, TargetBundle> generateResolvedBundles(IQueryable<IInstallableUnit> source, IQueryable<IInstallableUnit> metadata, IFileArtifactRepository artifacts) throws CoreException {
476+
private Map<BundleInfo, TargetBundle> generateResolvedBundles(IQueryable<IInstallableUnit> source,
477+
IQueryable<IInstallableUnit> metadata, IFileArtifactRepository artifacts) {
477478
OSGiBundleQuery query = new OSGiBundleQuery();
478479
IQueryResult<IInstallableUnit> queryResult = source.query(query, null);
479480
Map<BundleInfo, TargetBundle> bundles = new LinkedHashMap<>();
@@ -492,7 +493,8 @@ private Map<BundleInfo, TargetBundle> generateResolvedBundles(IQueryable<IInstal
492493
return bundles;
493494
}
494495

495-
private void generateBundle(IInstallableUnit unit, IFileArtifactRepository repo, Map<BundleInfo, TargetBundle> bundles) throws CoreException {
496+
private void generateBundle(IInstallableUnit unit, IFileArtifactRepository repo,
497+
Map<BundleInfo, TargetBundle> bundles) {
496498
Collection<IArtifactKey> artifacts = unit.getArtifacts();
497499
for (IArtifactKey artifactKey : artifacts) {
498500
File file = null;
@@ -511,8 +513,16 @@ private void generateBundle(IInstallableUnit unit, IFileArtifactRepository repo,
511513
}
512514
}
513515
if (file != null) {
514-
TargetBundle bundle = new TargetBundle(file);
515-
bundles.put(bundle.getBundleInfo(), bundle);
516+
try {
517+
TargetBundle bundle = new TargetBundle(file);
518+
bundles.put(bundle.getBundleInfo(), bundle);
519+
} catch (CoreException e) {
520+
BundleInfo info = new BundleInfo(file.toURI());
521+
info.setSymbolicName(artifactKey.getId());
522+
info.setVersion(artifactKey.getVersion().toString());
523+
InvalidTargetBundle invalidTargetBundle = new InvalidTargetBundle(info, e.getStatus());
524+
bundles.put(info, invalidTargetBundle);
525+
}
516526
}
517527
}
518528
}

0 commit comments

Comments
 (0)