No, it's not needed in this case.  Since we're just getting access to the
classloader for the Class that we're currently executing (ie.
PersistenceProviderImpl in this case), then just doing a standard
getClassLoader() invocation is acceptable.  We've followed this practice in
other areas of the OpenJPA code.

Kevin

On Wed, Nov 12, 2008 at 10:07 AM, Michael Dick <[EMAIL PROTECTED]>wrote:

> Will the change below result in a security exception? We might want to use
>
> AccessController.doPrivileged(J2DoPrivHelper.getClassLoaderAction(PersistenceProviderImpl.class)));
> instead.
>
> I'm not sure it's really required but it caught my eye.
>
> -mike
>
> On Wed, Nov 12, 2008 at 8:09 AM, <[EMAIL PROTECTED]> wrote:
>
> > Author: kwsutter
> > Date: Wed Nov 12 06:09:29 2008
> > New Revision: 713374
> >
> > URL: http://svn.apache.org/viewvc?rev=713374&view=rev
> > Log:
> > OPENJPA-767.  Change which classloader gets used for loading the OpenJPA
> > runtime classes in a container environment.  Previous to this change, we
> > were using the classloader provided to us via the PersistenceUnitInfo.
>  But,
> > this wasn't sufficient in an OSGi-container environment.  Initial tests
> show
> > that using the classloader of the PersistenceProviderImpl is working
> > better...  More testing and experimentation required...
> >
> > Modified:
> >
> >
>  
> openjpa/sandboxes/osgi/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java
> >
> > Modified:
> >
> openjpa/sandboxes/osgi/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java
> > URL:
> >
> http://svn.apache.org/viewvc/openjpa/sandboxes/osgi/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java?rev=713374&r1=713373&r2=713374&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> openjpa/sandboxes/osgi/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java
> > (original)
> > +++
> >
> openjpa/sandboxes/osgi/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java
> > Wed Nov 12 06:09:29 2008
> > @@ -140,7 +140,7 @@
> >             }
> >
> >             BrokerFactory factory = getBrokerFactory(cp, poolValue,
> > -                pui.getClassLoader());
> > +                    PersistenceProviderImpl.class.getClassLoader());
> >             if (transformerException != null) {
> >                 Log log = factory.getConfiguration().getLog(
> >                     OpenJPAConfiguration.LOG_RUNTIME);
> >
> >
> >
>

Reply via email to