Intermittent ClassCastException in PolicyHandler [message #698123] |
Mon, 18 July 2011 20:11 |
arkady.ioffe Messages: 1 Registered: July 2011 |
Junior Member |
|
|
I encountered irregular exception Cannot Cast String to IBuddyPolicy, when the code in the plug-in that declares buddy policy registered trying to load a class from rt.jar.
I narrow down this to step in DefaultClassLoader when it tries to find a class using buddy policy. Thus it goes to org.eclipse.osgi.framework.internal.core.PolicyHandler#getPolicyImplementation() , and the exception occurs in hte following lines:
74 if (REGISTERED_POLICY.equals(buddyName)) {
75 policies[policyOrder] = new RegisteredPolicy(policedLoader);
76 return (IBuddyPolicy) policies[policyOrder];
77 }
Somehow it happens that string value "registered" in policies[0] was not reset
in line 75 to instance of class RegisteredPolicy, so line 76 throws Exception.
All code in this synchronized method executes in the Main thread. I cannot understand what is going on? This irregular Exception has average frequency about 30%.
Please help.
Arkady
|
|
|
Powered by
FUDForum. Page generated in 0.02650 seconds