I'll update the test case and make it available shortly - thank for your interest. However, in the mean time please see the rest of this thread - the problem is that the retrieval from the weak hash map always returns a non-null object. I think some analysis tools (like findbugs) will also point this out.
I know this is an old item, but the JIRA is still open. Is that test code you wrote still available someplace? For some odd reason I feel like debugging this :-)
Maybe best to attach the source to the JIRA item actually
It's a maven project which d/ls the requires the libraries and then bootstraps the OSGi platform and runs the test.
From what I can see, as OSGi handles the classloaders, the weakHashMap that CGLIB uses can have a certain key reclaimed during a class generation which leads to the NPE problem.
A simple if/cache population on the fly should do the trick but maybe it's something bigger.
Thanks for looking into this!
Chris Nokleberg wrote:
On 4/25/07, Costin <email@example.com> wrote:
> Basically, it seems that there the classloader asked from the cache, does
> not exist.
> The problem occured when doing some proxying on OSGi for
> java.util.ArrayList. I'm completely buffled on why this occurs - seems to be
> working fine with other java classes such as java.util.Date.
That is pretty strange. Have you made any progress? I don't really
have a good way to test this problem. If you could put a zip together
with all the necessary jars and a sample program we can probably track
it down quickly. Of course the answer may just end up being an issue
I suspect that my environment (OSGi) is to quite different then the traditional J2EE
but so far I haven't been able to identify the exact cause. By looking at the cglib code, it seems that the classloader should be already in the cache but I can't figure out where the initialization occurs.
I'll post back more information once I have it.