Hi,

Yeah it does exactly the same but the code is in a static block so it is
executed when the class is loaded and the imports between both classes make
it fail (circular dep). I didnt like to copy paste the code but it is a
sure way to avoid linkageerror.

About java 2 sec you are right it is ignored here.

- Romain
Le 10 sept. 2012 02:34, "Joseph Bergmark" <bergm...@apache.org> a écrit :

> I know was well over a month ago, but do you remember why:
>
>  WebBeansUtil.getCurrentClassLoader().loadClass(factoryClassname)
>
> is problematic, but a direct call to:
>
> ClassLoader classloader = Thread.currentThread().getContextClassLoader();
>
> is not?  They appear basically the same.  Unless I'm missing
> something, both will fail when java 2 security is enabled as there
> doesn't appear to be a doPriv block or a hook into the security
> service.
>
> Sincerely,
>
> Joe
>
> On Fri, Jul 20, 2012 at 2:18 PM,  <rmannibu...@apache.org> wrote:
> > Author: rmannibucau
> > Date: Fri Jul 20 18:18:25 2012
> > New Revision: 1363887
> >
> > URL: http://svn.apache.org/viewvc?rev=1363887&view=rev
> > Log:
> > OWB-674 avoiding classes dependency which can fail with some JVM
> >
> > Modified:
> >
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/logger/WebBeansLoggerFacade.java
> >
> > Modified:
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/logger/WebBeansLoggerFacade.java
> > URL:
> http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/logger/WebBeansLoggerFacade.java?rev=1363887&r1=1363886&r2=1363887&view=diff
> >
> ==============================================================================
> > ---
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/logger/WebBeansLoggerFacade.java
> (original)
> > +++
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/logger/WebBeansLoggerFacade.java
> Fri Jul 20 18:18:25 2012
> > @@ -23,7 +23,6 @@ package org.apache.webbeans.logger;
> >   */
> >
> >  import org.apache.webbeans.config.OWBLogConst;
> > -import org.apache.webbeans.util.WebBeansUtil;
> >
> >  import java.text.MessageFormat;
> >  import java.util.Locale;
> > @@ -57,7 +56,14 @@ public final class WebBeansLoggerFacade
> >          {
> >              try
> >              {
> > -                Class<?> factoryClazz =
> WebBeansUtil.getCurrentClassLoader().loadClass(factoryClassname);
> > +                // don't use the
> org.apache.webbeans.util.WebBeansUtil.getCurrentClassLoader()
> > +                // to avoid weird dependency and potential failing
> > +                ClassLoader classloader =
> Thread.currentThread().getContextClassLoader();
> > +                if(classloader == null)
> > +                {
> > +                    classloader =
> WebBeansLoggerFacade.class.getClassLoader();
> > +                }
> > +                Class<?> factoryClazz =
> classloader.loadClass(factoryClassname);
> >                  factory = (WebBeansLoggerFactory)
> factoryClazz.newInstance();
> >              }
> >              catch (Exception e)
> >
> >
>

Reply via email to