Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2006-12-18 10:05:32 -0500
committerThomas Watson2006-12-18 10:05:32 -0500
commit8113d8a74eb53184036e4a9eb78049246a8b2b9b (patch)
tree2bb2030c3d4b029a73cd3fa8ae5606be1a07581e
parent7d95b1d69593a8d6b04c35d79f44517a734bca7c (diff)
downloadrt.equinox.framework-8113d8a74eb53184036e4a9eb78049246a8b2b9b.tar.gz
rt.equinox.framework-8113d8a74eb53184036e4a9eb78049246a8b2b9b.tar.xz
rt.equinox.framework-8113d8a74eb53184036e4a9eb78049246a8b2b9b.zip
Bug 167824 ClasspathManager calls adapor hooks with wrong bytecodeR32x_v20061218
-rw-r--r--bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/baseadaptor/loader/ClasspathManager.java23
1 files changed, 14 insertions, 9 deletions
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/baseadaptor/loader/ClasspathManager.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/baseadaptor/loader/ClasspathManager.java
index c9227ede3..b3ad225e4 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/baseadaptor/loader/ClasspathManager.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/baseadaptor/loader/ClasspathManager.java
@@ -39,7 +39,6 @@ import org.osgi.framework.FrameworkEvent;
*/
public class ClasspathManager {
private static final FragmentClasspath[] emptyFragments = new FragmentClasspath[0];
- private static final int BUF_SIZE = 8 * 1024;
private BaseData data;
private String[] classpath;
@@ -397,7 +396,9 @@ public class ClasspathManager {
* {@link ClassLoadingStatsHook#preFindLocalClass(String, ClasspathManager)} methods. Then it
* will search for the class. If a class is found then all configured class loading hooks
* {@link ClassLoadingHook#processClass(String, byte[], ClasspathEntry, BundleEntry, ClasspathManager)}
- * methods will be called. Finally all the configured class loading stats hooks
+ * methods will be called. The class is then defined; if successfully then all configured class loading
+ * stats hooks {@link ClassLoadingStatsHook#recordClassDefine(String, Class, byte[], ClasspathEntry, BundleEntry, ClasspathManager)}
+ * methods are called. Finally all the configured class loading stats hooks
* {@link ClassLoadingStatsHook#postFindLocalClass(String, Class, ClasspathManager)} methods are called.
* @param classname the requested class name.
* @return the requested class
@@ -467,10 +468,7 @@ public class ClasspathManager {
}
try {
- Class result = defineClass(name, classbytes, classpathEntry, entry);
- for (int i = 0; i < hooks.length; i++)
- hooks[i].recordClassDefine(name, result, classbytes, classpathEntry, entry, this);
- return result;
+ return defineClass(name, classbytes, classpathEntry, entry, hooks);
} catch (Error e) {
if (Debug.DEBUG && Debug.DEBUG_LOADER)
Debug.println(" error defining class " + name); //$NON-NLS-1$
@@ -482,14 +480,16 @@ public class ClasspathManager {
* Defines the specified class. This method will first call all the configured class loading hooks
* {@link ClassLoadingHook#processClass(String, byte[], ClasspathEntry, BundleEntry, ClasspathManager)}
* methods. Then it will call the {@link BaseClassLoader#defineClass(String, byte[], ClasspathEntry, BundleEntry)}
- * method to define the class.
+ * method to define the class. After that, the class loading stat hooks are called to announce the class
+ * definition.
* @param name the name of the class to define
* @param classbytes the class bytes
* @param classpathEntry the classpath entry used to load the class bytes
* @param entry the BundleEntry used to load the class bytes
+ * @param statsHooks the class loading stat hooks
* @return the defined class
*/
- private Class defineClass(String name, byte[] classbytes, ClasspathEntry classpathEntry, BundleEntry entry) {
+ private Class defineClass(String name, byte[] classbytes, ClasspathEntry classpathEntry, BundleEntry entry, ClassLoadingStatsHook[] statsHooks) {
ClassLoadingHook[] hooks = data.getAdaptor().getHookRegistry().getClassLoadingHooks();
byte[] modifiedBytes = classbytes;
for (int i = 0; i < hooks.length; i++) {
@@ -497,7 +497,12 @@ public class ClasspathManager {
if (modifiedBytes != null)
classbytes = modifiedBytes;
}
- return classloader.defineClass(name, classbytes, classpathEntry, entry);
+
+ Class result = classloader.defineClass(name, classbytes, classpathEntry, entry);
+
+ for (int i = 0; i < statsHooks.length; i++)
+ statsHooks[i].recordClassDefine(name, result, classbytes, classpathEntry, entry, this);
+ return result;
}
/**

Back to the top