for (ResolverError error : errors) {
logError(bundle, level, error);
VersionConstraint constraint = error.getUnsatisfiedConstraint();
switch (error.getType()) {
case MISSING_IMPORT_PACKAGE:
ImportPackageSpecification pkgSpec = (ImportPackageSpecification)constraint;
for (BundleDescription b : getBundles()) {
for (ExportPackageDescription pkg : b.getExportPackages()) {
if (pkg.getName().equals(pkgSpec.getName())) {
if (pkgSpec.getVersionRange().isIncluded(pkg.getVersion())) {
if (!pkg.getExporter().isResolved()) {
logError(b, level, "Bundle unresolved: " + pkg);
analyzeErrors(pkg.getExporter(), bundles, level + 1);
}
} else {
logError(b, level, "Version mismatch: " + pkgSpec + " " + pkg);
}
}
}
}
break;
case MISSING_REQUIRE_BUNDLE:
case MISSING_FRAGMENT_HOST:
// BundleSpecification bundleSpec = (BundleSpecification)constraint;
for (BundleDescription b : getBundles()) {
if (b == bundle) {
continue;
}
if (b.getSymbolicName() == null) {
logError(b, level, "No SymbolicName for " + b.getLocation());
continue;
}
if (constraint.getName() == null) {
logError(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, bundles, level);
} else {
logError(bundle, level, "Version mismatch: " + constraint + " " + b);
}
}
}
break;
case IMPORT_PACKAGE_USES_CONFLICT:
ImportPackageSpecification importPackage = (ImportPackageSpecification)constraint;
for (BundleDescription b : getBundles()) {
for (ExportPackageDescription pkg : b.getExportPackages()) {
if (pkg.getName().equals(importPackage.getName())) {
logError(pkg.getExporter(), level + 1, pkg.toString());
}
}
}
break;