Author: rickhall
Date: Tue Jun 12 11:19:53 2007
New Revision: 546579
URL: http://svn.apache.org/viewvc?view=rev&rev=546579
Log:
Found a new corner case in our check for determining when to delegate to the
parent class loader; essentially, since the framework uses threads for
setting the start level and refreshing packages, it is possible that no
module classes are on the call stack, so in that case we don't want to
delegate to the parent class loader.
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
URL:
http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java?view=diff&rev=546579&r1=546578&r2=546579
==============================================================================
---
felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
(original)
+++
felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
Tue Jun 12 11:19:53 2007
@@ -466,9 +466,20 @@
// a class loader or class itself, because we want to ignore
// calls to ClassLoader.loadClass() and Class.forName() since
// we are trying to find out who instigated the class load.
+ // Also since Felix uses threads for changing the start level
+ // and refreshing packages, it is possible that there is no
+ // module classes on the call stack; therefore, as soon as we
+ // see Thread on the call stack we exit this loop. Other cases
+ // where modules actually use threads are not an issue because
+ // the module classes will be on the call stack before the
+ // Thread class.
// TODO: FRAMEWORK - This check is a hack and we should see if we can think
// of another way to do it, since it won't necessarily work in all situations.
- if ((this.getClass().getClassLoader() !=
classes[i].getClassLoader())
+ if (Thread.class.equals(classes[i]))
+ {
+ break;
+ }
+ else if ((this.getClass().getClassLoader() !=
classes[i].getClassLoader())
&& !ClassLoader.class.isAssignableFrom(classes[i])
&& !Class.class.equals(classes[i]))
{