use of org.eclipse.osgi.service.resolver.ResolverError in project tycho by eclipse.
the class Activator method getRelevantErrors.
private static void getRelevantErrors(State state, Set<ResolverError> errors, BundleDescription bundle) {
ResolverError[] bundleErrors = state.getResolverErrors(bundle);
for (int j = 0; j < bundleErrors.length; j++) {
ResolverError error = bundleErrors[j];
errors.add(error);
VersionConstraint constraint = error.getUnsatisfiedConstraint();
if (constraint instanceof BundleSpecification || constraint instanceof HostSpecification) {
BundleDescription[] requiredBundles = state.getBundles(constraint.getName());
for (int i = 0; i < requiredBundles.length; i++) {
getRelevantErrors(state, errors, requiredBundles[i]);
}
}
}
}
use of org.eclipse.osgi.service.resolver.ResolverError in project tycho by eclipse.
the class EquinoxResolver method assertResolved.
public void assertResolved(State state, BundleDescription desc) throws BundleException {
if (!desc.isResolved()) {
if (logger.isDebugEnabled()) {
logger.debug("Equinox resolver state:\n" + toDebugString(state));
}
StringBuffer msg = new StringBuffer();
msg.append("Bundle ").append(desc.getSymbolicName()).append(" cannot be resolved\n");
msg.append("Resolution errors:\n");
ResolverError[] errors = getResolverErrors(state, desc);
for (int i = 0; i < errors.length; i++) {
ResolverError error = errors[i];
msg.append(" Bundle ").append(error.getBundle().getSymbolicName()).append(" - ").append(error.toString()).append("\n");
}
throw new BundleException(msg.toString());
}
}
use of org.eclipse.osgi.service.resolver.ResolverError in project tycho by eclipse.
the class EquinoxResolver method toDebugString.
public String toDebugString(State state) {
StringBuilder sb = new StringBuilder("Resolved OSGi state\n");
for (BundleDescription otherBundle : state.getBundles()) {
if (!otherBundle.isResolved()) {
sb.append("NOT ");
}
sb.append("RESOLVED ");
sb.append(otherBundle.toString()).append(" : ").append(otherBundle.getLocation());
sb.append('\n');
for (ResolverError error : state.getResolverErrors(otherBundle)) {
sb.append('\t').append(error.toString()).append('\n');
}
}
return sb.toString();
}
use of org.eclipse.osgi.service.resolver.ResolverError in project tycho by eclipse.
the class EquinoxResolver method getRelevantErrors.
private void getRelevantErrors(State state, Set<ResolverError> errors, BundleDescription bundle) {
ResolverError[] bundleErrors = state.getResolverErrors(bundle);
for (int j = 0; j < bundleErrors.length; j++) {
ResolverError error = bundleErrors[j];
errors.add(error);
VersionConstraint constraint = error.getUnsatisfiedConstraint();
if (constraint instanceof BundleSpecification || constraint instanceof HostSpecification) {
BundleDescription[] requiredBundles = state.getBundles(constraint.getName());
for (int i = 0; i < requiredBundles.length; i++) {
// do not handle that bundle (again). See bug 442594.
if (bundle.equals(requiredBundles[i])) {
continue;
}
getRelevantErrors(state, errors, requiredBundles[i]);
}
}
}
}
use of org.eclipse.osgi.service.resolver.ResolverError in project tycho by eclipse.
the class Activator method getResolutionErrors.
public static Set<ResolverError> getResolutionErrors(Bundle bundle) {
Set<ResolverError> errors = new LinkedHashSet<ResolverError>();
try {
if (platformAdmin == null) {
System.err.println("Could not compute diagnostic information for the test bundle resolution problems - PlatformAdmin service is not available");
return errors;
}
State state = platformAdmin.getState(false);
if (state == null) {
System.err.println("Resolver state is null");
return errors;
}
BundleDescription description = state.getBundle(bundle.getBundleId());
if (description == null) {
System.err.println("Could not determine BundleDescription for " + bundle.toString());
}
getRelevantErrors(state, errors, description);
} catch (RuntimeException e) {
System.err.println("Error while computing diagnostic information for the test bundle resolution problems");
e.printStackTrace();
}
return errors;
}
Aggregations