diff options
author | Thomas Watson | 2010-01-05 20:17:15 +0000 |
---|---|---|
committer | Thomas Watson | 2010-01-05 20:17:15 +0000 |
commit | 73abfdc4703a27439b27fb44f5770cf5ffde0281 (patch) | |
tree | caf5465ec5408ea8044b259c61af3ab92e13fadb /bundles/org.eclipse.osgi/resolver | |
parent | 3127775d9ded1da4ba40ea8fdbe2c6887a42730e (diff) | |
download | rt.equinox.framework-73abfdc4703a27439b27fb44f5770cf5ffde0281.tar.gz rt.equinox.framework-73abfdc4703a27439b27fb44f5770cf5ffde0281.tar.xz rt.equinox.framework-73abfdc4703a27439b27fb44f5770cf5ffde0281.zip |
Bug 298894 - IllegalArgumentException can occur during PackagePermission check
Diffstat (limited to 'bundles/org.eclipse.osgi/resolver')
2 files changed, 5 insertions, 5 deletions
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/PermissionChecker.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/PermissionChecker.java index 0c9033ffa..4ef1b4197 100644 --- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/PermissionChecker.java +++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/PermissionChecker.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2009 IBM Corporation and others. + * Copyright (c) 2004, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -41,7 +41,7 @@ public class PermissionChecker { errorType = ResolverError.IMPORT_PACKAGE_PERMISSION; producer = context.getBundle(((ExportPackageDescription) bd).getExporter().getBundleId()); producerPermission = new PackagePermission(bd.getName(), PackagePermission.EXPORTONLY); - consumerPermission = new PackagePermission(vc.getName(), producer, PackagePermission.IMPORT); + consumerPermission = producer != null ? new PackagePermission(vc.getName(), producer, PackagePermission.IMPORT) : new PackagePermission(vc.getName(), PackagePermission.IMPORT); } else { boolean requireBundle = vc instanceof BundleSpecification; errorType = requireBundle ? ResolverError.REQUIRE_BUNDLE_PERMISSION : ResolverError.FRAGMENT_BUNDLE_PERMISSION; diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverConstraint.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverConstraint.java index 49713ee0f..b692b1155 100644 --- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverConstraint.java +++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverConstraint.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2008 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2005, 2010 IBM Corporation and others. All rights reserved. This * program and the accompanying materials are made available under the terms of * the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -42,9 +42,9 @@ public abstract class ResolverConstraint { // Same as VersionConstraint but does additinal permission checks boolean isSatisfiedBy(VersionSupplier vs) { - if (!bundle.getResolver().getPermissionChecker().checkPermission(constraint, vs.getBaseDescription())) + if (vs.getResolverBundle().isUninstalled() || !bundle.getResolver().getPermissionChecker().checkPermission(constraint, vs.getBaseDescription())) return false; - return vs.getSubstitute() == null && !vs.getResolverBundle().isUninstalled() && constraint.isSatisfiedBy(vs.getBaseDescription()); + return vs.getSubstitute() == null && constraint.isSatisfiedBy(vs.getBaseDescription()); } // returns the companion VersionConstraint object from the State |