System.out.println(Utils.formatMessage(level, "Resolver errors:"));
}
PackageUsesHelper helper = null;
for (ResolverError error : errors) {
Utils.displayError(bundle, level, error.toString());
VersionConstraint constraint = error.getUnsatisfiedConstraint();
switch (error.getType()) {
case MISSING_IMPORT_PACKAGE:
ImportPackageSpecification pkgSpec = (ImportPackageSpecification)constraint;
for (BundleDescription b : state.getBundles()) {
for (ExportPackageDescription pkg : b.getExportPackages()) {
if (pkg.getName().equals(pkgSpec.getName())) {
if (pkgSpec.getVersionRange().isIncluded(pkg.getVersion())) {
if (!pkg.getExporter().isResolved()) {
Utils.displayError(b, level + 1, "Bundle unresolved: " + pkg);
analyzeErrors(pkg.getExporter(), state, bundles, level + 1);
}
} else {
Utils.displayError(b, level + 1, "Version mismatch: " + pkgSpec + " " + pkg);
}
}
}
}
break;
case MISSING_REQUIRE_BUNDLE:
case MISSING_FRAGMENT_HOST:
for (BundleDescription b : state.getBundles()) {
if (b == bundle) {
continue;
}
if (b.getSymbolicName() == null) {
Utils.displayError(b, level, "No SymbolicName for " + b.getLocation());
continue;
}
if (constraint.getName() == null) {
Utils.displayError(bundle, level, "No constraint name: " + constraint);
}
if (b.getSymbolicName().equals(constraint.getName())) {
if (constraint.getVersionRange().isIncluded(b.getVersion())) {
// There must be something wrong in the bundle
analyzeErrors(b, state, bundles, level + 1);
} else {
Utils.displayError(bundle, level, "Version mismatch: " + constraint + " " + b);
}