Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2009-12-14 18:29:25 +0000
committerThomas Watson2009-12-14 18:29:25 +0000
commit439979181a5d683b5216dc5dac260cebbe79c01f (patch)
tree7912c369d0a04f990791aa2dc8db32e4de133b75 /bundles
parent233fbc10cdbf015745036964e76c1e6ba54f0e81 (diff)
downloadrt.equinox.framework-439979181a5d683b5216dc5dac260cebbe79c01f.tar.gz
rt.equinox.framework-439979181a5d683b5216dc5dac260cebbe79c01f.tar.xz
rt.equinox.framework-439979181a5d683b5216dc5dac260cebbe79c01f.zip
Bug 289719 - PackageAdmin.refreshPackages issue
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/AbstractBundleTests.java3
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/PackageAdminBundleTests.java40
-rw-r--r--bundles/org.eclipse.osgi/console/src/org/eclipse/osgi/framework/internal/core/FrameworkCommandInterpreter.java2
-rw-r--r--bundles/org.eclipse.osgi/console/src/org/eclipse/osgi/framework/internal/core/FrameworkCommandProvider.java4
-rw-r--r--bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/PackageAdminImpl.java2
-rw-r--r--bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Util.java12
-rw-r--r--bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/launch/EquinoxFWClassLoader.java12
7 files changed, 58 insertions, 17 deletions
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/AbstractBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/AbstractBundleTests.java
index 512304238..7735ba56c 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/AbstractBundleTests.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/AbstractBundleTests.java
@@ -171,6 +171,9 @@ public class AbstractBundleTests extends CoreTest {
case BundleEvent.STOPPED :
result.append("STOPPED");
break;
+ case BundleEvent.STOPPING :
+ result.append("STOPPING");
+ break;
case BundleEvent.UNINSTALLED :
result.append("UNINSTALLED");
break;
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/PackageAdminBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/PackageAdminBundleTests.java
index 44ea11f1e..3280d32d1 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/PackageAdminBundleTests.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/PackageAdminBundleTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2007, 2009 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
@@ -169,4 +169,42 @@ public class PackageAdminBundleTests extends AbstractBundleTests {
fail("Unexpected exception", e); //$NON-NLS-1$
}
}
+
+ public void testBug289719() throws Exception {
+ Bundle bug259903a = installer.installBundle("test.bug259903.a"); //$NON-NLS-1$
+ Bundle bug259903b = installer.installBundle("test.bug259903.b"); //$NON-NLS-1$
+ Bundle bug259903c = installer.installBundle("test.bug259903.c"); //$NON-NLS-1$
+ TestListener testListener = new TestListener();
+ OSGiTestsActivator.getContext().addBundleListener(testListener);
+ try {
+ installer.resolveBundles(new Bundle[] {bug259903a, bug259903b, bug259903c});
+ bug259903a.start();
+ bug259903b.start();
+ bug259903c.start();
+ installer.getStartLevel().setBundleStartLevel(bug259903c, 2);
+ installer.getStartLevel().setBundleStartLevel(bug259903b, 3);
+ installer.getStartLevel().setBundleStartLevel(bug259903a, 4);
+
+ testListener.getEvents(); // clear events
+ installer.refreshPackages(new Bundle[] {bug259903a});
+ Object[] expectedEvents = new Object[] {new BundleEvent(BundleEvent.STOPPING, bug259903a), new BundleEvent(BundleEvent.STOPPED, bug259903a), new BundleEvent(BundleEvent.STOPPING, bug259903b), new BundleEvent(BundleEvent.STOPPED, bug259903b), new BundleEvent(BundleEvent.STOPPING, bug259903c), new BundleEvent(BundleEvent.STOPPED, bug259903c), new BundleEvent(BundleEvent.UNRESOLVED, bug259903a), new BundleEvent(BundleEvent.UNRESOLVED, bug259903b), new BundleEvent(BundleEvent.UNRESOLVED, bug259903c), new BundleEvent(BundleEvent.RESOLVED, bug259903c), new BundleEvent(BundleEvent.RESOLVED, bug259903b), new BundleEvent(BundleEvent.RESOLVED, bug259903a), new BundleEvent(BundleEvent.STARTING, bug259903c), new BundleEvent(BundleEvent.STARTED, bug259903c),
+ new BundleEvent(BundleEvent.STARTING, bug259903b), new BundleEvent(BundleEvent.STARTED, bug259903b), new BundleEvent(BundleEvent.STARTING, bug259903a), new BundleEvent(BundleEvent.STARTED, bug259903a),};
+ Object[] actualEvents = testListener.getEvents();
+ compareResults(expectedEvents, actualEvents);
+
+ installer.getStartLevel().setBundleStartLevel(bug259903c, 4);
+ installer.getStartLevel().setBundleStartLevel(bug259903b, 4);
+ installer.getStartLevel().setBundleStartLevel(bug259903a, 4);
+ installer.refreshPackages(new Bundle[] {bug259903a});
+ expectedEvents = new Object[] {new BundleEvent(BundleEvent.STOPPING, bug259903c), new BundleEvent(BundleEvent.STOPPED, bug259903c), new BundleEvent(BundleEvent.STOPPING, bug259903b), new BundleEvent(BundleEvent.STOPPED, bug259903b), new BundleEvent(BundleEvent.STOPPING, bug259903a), new BundleEvent(BundleEvent.STOPPED, bug259903a), new BundleEvent(BundleEvent.UNRESOLVED, bug259903c), new BundleEvent(BundleEvent.UNRESOLVED, bug259903b), new BundleEvent(BundleEvent.UNRESOLVED, bug259903a), new BundleEvent(BundleEvent.RESOLVED, bug259903a), new BundleEvent(BundleEvent.RESOLVED, bug259903b), new BundleEvent(BundleEvent.RESOLVED, bug259903c), new BundleEvent(BundleEvent.STARTING, bug259903a), new BundleEvent(BundleEvent.STARTED, bug259903a),
+ new BundleEvent(BundleEvent.STARTING, bug259903b), new BundleEvent(BundleEvent.STARTED, bug259903b), new BundleEvent(BundleEvent.STARTING, bug259903c), new BundleEvent(BundleEvent.STARTED, bug259903c),};
+ actualEvents = testListener.getEvents();
+ compareResults(expectedEvents, actualEvents);
+
+ } catch (Exception e) {
+ fail("Unexpected exception", e); //$NON-NLS-1$
+ } finally {
+ OSGiTestsActivator.getContext().removeBundleListener(testListener);
+ }
+ }
}
diff --git a/bundles/org.eclipse.osgi/console/src/org/eclipse/osgi/framework/internal/core/FrameworkCommandInterpreter.java b/bundles/org.eclipse.osgi/console/src/org/eclipse/osgi/framework/internal/core/FrameworkCommandInterpreter.java
index 263aab463..a54f2d813 100644
--- a/bundles/org.eclipse.osgi/console/src/org/eclipse/osgi/framework/internal/core/FrameworkCommandInterpreter.java
+++ b/bundles/org.eclipse.osgi/console/src/org/eclipse/osgi/framework/internal/core/FrameworkCommandInterpreter.java
@@ -330,7 +330,7 @@ public class FrameworkCommandInterpreter implements CommandInterpreter {
while (keysEnum.hasMoreElements()) {
keys[i++] = (String) keysEnum.nextElement();
}
- Util.sort(keys);
+ Util.sortByString(keys);
if (title != null) {
println(title);
diff --git a/bundles/org.eclipse.osgi/console/src/org/eclipse/osgi/framework/internal/core/FrameworkCommandProvider.java b/bundles/org.eclipse.osgi/console/src/org/eclipse/osgi/framework/internal/core/FrameworkCommandProvider.java
index 3ee84dbb6..e2f36de7b 100644
--- a/bundles/org.eclipse.osgi/console/src/org/eclipse/osgi/framework/internal/core/FrameworkCommandProvider.java
+++ b/bundles/org.eclipse.osgi/console/src/org/eclipse/osgi/framework/internal/core/FrameworkCommandProvider.java
@@ -1388,12 +1388,12 @@ public class FrameworkCommandProvider implements CommandProvider, SynchronousBun
public void _threads(CommandInterpreter intp) throws Exception {
ThreadGroup[] threadGroups = getThreadGroups();
- Util.sort(threadGroups);
+ Util.sortByString(threadGroups);
ThreadGroup tg = getTopThreadGroup();
Thread[] threads = new Thread[tg.activeCount()];
int count = tg.enumerate(threads, true);
- Util.sort(threads);
+ Util.sortByString(threads);
StringBuffer sb = new StringBuffer(120);
intp.println();
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/PackageAdminImpl.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/PackageAdminImpl.java
index d8c78e47b..4a2bd784c 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/PackageAdminImpl.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/PackageAdminImpl.java
@@ -421,7 +421,7 @@ public class PackageAdminImpl implements PackageAdmin {
}
AbstractBundle[] refresh = (AbstractBundle[]) bundlesList.toArray(new AbstractBundle[bundlesList.size()]);
// first sort by id/start-level order
- Util.sort(refresh);
+ Util.sort(refresh, 0, refresh.length);
// then sort by dependency order
framework.startLevelManager.sortByDependency(refresh);
boolean[] previouslyResolved = new boolean[refresh.length];
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Util.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Util.java
index cff868660..de5683cc1 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Util.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Util.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
+ * Copyright (c) 2003, 2009 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
@@ -22,8 +22,8 @@ public class Util {
*
* @param array The array of objects to sort
*/
- public static void sort(Object[] array) {
- qsort(array, 0, array.length - 1);
+ public static void sortByString(Object[] array) {
+ qSortByString(array, 0, array.length - 1);
}
/**
@@ -39,7 +39,7 @@ public class Util {
* @exception ArrayIndexOutOfBoundsException when <code>start < 0</code>
* or <code>end >= array.length</code>
*/
- public static void qsort(Object[] array, int start, int stop) {
+ public static void qSortByString(Object[] array, int start, int stop) {
if (start >= stop)
return;
@@ -71,11 +71,11 @@ public class Util {
}
// sort the left partition, if the right index has not reached the left side of array
if (start < right) {
- qsort(array, start, right);
+ qSortByString(array, start, right);
}
// sort the right partition, if the left index has not reached the right side of array
if (left < stop) {
- qsort(array, left, stop);
+ qSortByString(array, left, stop);
}
}
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/launch/EquinoxFWClassLoader.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/launch/EquinoxFWClassLoader.java
index 090a94f99..01fd48b94 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/launch/EquinoxFWClassLoader.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/launch/EquinoxFWClassLoader.java
@@ -15,8 +15,8 @@ import java.net.URLClassLoader;
class EquinoxFWClassLoader extends URLClassLoader {
- private static final String[] DELEGATE_PARENT = {"java.", "org.osgi.", "org.eclipse.osgi.launch.", "org.eclipse.osgi.service.", "org.eclipse.osgi.framework.log", "org.eclipse.osgi.framework.adaptor", "org.eclipse.osgi.framework.internal.core.ReferenceInputStream"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
- private static final String[] SKIP_PARENT = new String[0]; // nothing right now is skipped
+ private static final String[] DELEGATE_PARENT_FIRST = {"java.", "org.osgi.", "org.eclipse.osgi.launch.", "org.eclipse.osgi.service.", "org.eclipse.osgi.framework.log", "org.eclipse.osgi.framework.adaptor", "org.eclipse.osgi.framework.internal.core.ReferenceInputStream"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
+ private static final String[] DELEGATE_CHILD_FIRST = new String[0]; // nothing right now is skipped
private final ClassLoader parent;
@@ -59,11 +59,11 @@ class EquinoxFWClassLoader extends URLClassLoader {
}
private boolean childFirst(String name) {
- for (int i = SKIP_PARENT.length - 1; i >= 0; i--)
- if (name.startsWith(SKIP_PARENT[i]))
+ for (int i = DELEGATE_CHILD_FIRST.length - 1; i >= 0; i--)
+ if (name.startsWith(DELEGATE_CHILD_FIRST[i]))
return true;
- for (int i = DELEGATE_PARENT.length - 1; i >= 0; i--)
- if (name.startsWith(DELEGATE_PARENT[i]))
+ for (int i = DELEGATE_PARENT_FIRST.length - 1; i >= 0; i--)
+ if (name.startsWith(DELEGATE_PARENT_FIRST[i]))
return false;
return true;

Back to the top