Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 297769 | Differences between
and this patch

Collapse All | Expand All

(-)a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/PackageAdminImpl.java (-1 / +39 lines)
Lines 53-58 Link Here
53
public class PackageAdminImpl implements PackageAdmin, FrameworkWiring {
53
public class PackageAdminImpl implements PackageAdmin, FrameworkWiring {
54
	/** framework object */
54
	/** framework object */
55
	protected Framework framework;
55
	protected Framework framework;
56
	private ExportPackageDescription[] exportPackages2;
56
57
57
	/* 
58
	/* 
58
	 * We need to make sure that the GetBundleAction class loads early to prevent a ClassCircularityError when checking permissions.
59
	 * We need to make sure that the GetBundleAction class loads early to prevent a ClassCircularityError when checking permissions.
Lines 221-233 Link Here
221
			} else if (numBundles > 0) {
222
			} else if (numBundles > 0) {
222
				// populate the resolved hosts package sources first (do this outside sync block: bug 280929)
223
				// populate the resolved hosts package sources first (do this outside sync block: bug 280929)
223
				populateLoaders(framework.getAllBundles());
224
				populateLoaders(framework.getAllBundles());
225
				List<AbstractBundle> allBundles = framework.bundles.getBundles();
224
				synchronized (framework.bundles) {
226
				synchronized (framework.bundles) {
225
					// now collect the descriptions to refresh
227
					// now collect the descriptions to refresh
226
					List<BundleDescription> results = new ArrayList<BundleDescription>(numBundles);
228
					List<BundleDescription> results = new ArrayList<BundleDescription>(numBundles);
227
					for (int i = 0; i < numBundles; i++) {
229
					for (int i = 0; i < numBundles; i++) {
228
						BundleDescription description = ((AbstractBundle) bundles[i]).getBundleDescription();
230
						BundleDescription description = ((AbstractBundle) bundles[i]).getBundleDescription();
229
						if (description != null && description.getBundleId() != 0 && !results.contains(description))
231
						if (description != null && description.getBundleId() != 0 && !results.contains(description)) {
230
							results.add(description);
232
							results.add(description);
233
234
							// a bit hackish approach to refresh also split packages 
235
							//							if (description.getBundle().getSymbolicName().equals("org.eclipse.core.runtime")) {
236
237
							// get the list of exported packages of the considered bundle
238
							ExportPackageDescription[] exportPackages = description.getExportPackages();
239
240
							for (int j = 0; j < exportPackages.length; j++) {
241
								ExportPackageDescription examinedPackage = exportPackages[j];
242
243
								// look which bundle not already added exports the same package
244
								for (int z = 0; z < allBundles.size(); z++) {
245
									AbstractBundle bundleThatMayProvideSplitPackage = allBundles.get(z);
246
									// if the bundle was already added - don't bother with any checks and continue
247
									if (results.contains(bundleThatMayProvideSplitPackage.getBundleDescription())) {
248
										continue;
249
									}
250
251
									// now check each package of the bundle that may provide split package
252
									ExportPackageDescription[] potentiallySplitPackages = bundleThatMayProvideSplitPackage.getBundleDescription().getExportPackages();
253
254
									for (int zz = 0; zz < potentiallySplitPackages.length; zz++) {
255
										// so when package names match and one of them seems to be split (in the ugly way, with mandatory attribute)
256
										// add the package with mandatory to refresh.
257
										if (examinedPackage.getName().equals(potentiallySplitPackages[zz].getName()) && potentiallySplitPackages[zz].getDirectives().containsKey("mandatory")) {
258
											results.add(bundleThatMayProvideSplitPackage.getBundleDescription());
259
											break;
260
										}
261
									}
262
263
								}
264
								//								}
265
							}
266
267
						}
231
						if (framework.isRefreshDuplicateBSNAllowed()) {
268
						if (framework.isRefreshDuplicateBSNAllowed()) {
232
							// add in any bundles that have the same symbolic name see bug (169593)
269
							// add in any bundles that have the same symbolic name see bug (169593)
233
							AbstractBundle[] sameNames = framework.bundles.getBundles(bundles[i].getSymbolicName());
270
							AbstractBundle[] sameNames = framework.bundles.getBundles(bundles[i].getSymbolicName());
Lines 242-247 Link Here
242
									}
279
									}
243
							}
280
							}
244
						}
281
						}
282
245
					}
283
					}
246
					descriptions = (results.size() == 0 ? null : results.toArray(new BundleDescription[results.size()]));
284
					descriptions = (results.size() == 0 ? null : results.toArray(new BundleDescription[results.size()]));
247
				}
285
				}

Return to bug 297769