Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Commit

Permalink
MNG-4793: search class hierarchy for current realm in case bean is pr…
Browse files Browse the repository at this point in the history
…oxied
  • Loading branch information
mcculls committed Sep 3, 2010
1 parent 9f695ad commit 4efc10f
Showing 1 changed file with 11 additions and 1 deletion.
Expand Up @@ -15,6 +15,7 @@
import java.util.ArrayList;
import java.util.List;

import org.codehaus.plexus.classworlds.realm.ClassRealm;
import org.codehaus.plexus.context.Context;
import org.codehaus.plexus.context.ContextException;
import org.codehaus.plexus.logging.LogEnabled;
Expand Down Expand Up @@ -131,7 +132,16 @@ public synchronized boolean manage( final Object bean )
final ClassLoader tccl = Thread.currentThread().getContextClassLoader();
try
{
Thread.currentThread().setContextClassLoader( bean.getClass().getClassLoader() );
for ( Class<?> clazz = bean.getClass(); clazz != null; clazz = clazz.getSuperclass() )
{
// need to check hierarchy in case bean is proxied
final ClassLoader loader = clazz.getClassLoader();
if ( loader instanceof ClassRealm )
{
Thread.currentThread().setContextClassLoader( loader );
break;
}
}
if ( isContextualizable )
{
contextualize( (Contextualizable) bean );
Expand Down

0 comments on commit 4efc10f

Please sign in to comment.