openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgras...@apache.org
Subject svn commit: r1334001 - in /openjpa/branches/1.2.x: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingRepository.java openjpa-kernel/src/main/java/org/apache/openjpa/meta/JavaTypes.java
Date Fri, 04 May 2012 14:44:39 GMT
Author: jgrassel
Date: Fri May  4 14:44:39 2012
New Revision: 1334001

URL: http://svn.apache.org/viewvc?rev=1334001&view=rev
Log:
OPENJPA-2133: OpenJPA doesn't find custom mappings with an applicable class loader

Modified:
    openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingRepository.java
    openjpa/branches/1.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/JavaTypes.java

Modified: openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingRepository.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingRepository.java?rev=1334001&r1=1334000&r2=1334001&view=diff
==============================================================================
--- openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingRepository.java
(original)
+++ openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingRepository.java
Fri May  4 14:44:39 2012
@@ -547,7 +547,7 @@ public class MappingRepository
                 strat = JavaTypes.classForName(name, cls,
                     (ClassLoader) AccessController.doPrivileged(
                         J2DoPrivHelper.getClassLoaderAction(
-                            ClassStrategy.class)));
+                            ClassStrategy.class)), false);
             ClassStrategy strategy = 
                 (ClassStrategy) AccessController.doPrivileged(
                     J2DoPrivHelper.newInstanceAction(strat));
@@ -580,7 +580,7 @@ public class MappingRepository
         try {
             Class c = JavaTypes.classForName(name, field,
                 (ClassLoader) AccessController.doPrivileged(
-                    J2DoPrivHelper.getClassLoaderAction(FieldStrategy.class)));
+                    J2DoPrivHelper.getClassLoaderAction(FieldStrategy.class)), false);
             if (FieldStrategy.class.isAssignableFrom(c)) {
                 FieldStrategy strat = (FieldStrategy)
                     AccessController.doPrivileged(
@@ -654,7 +654,7 @@ public class MappingRepository
                     discrim.getClassMapping(),
                     (ClassLoader) AccessController.doPrivileged(
                         J2DoPrivHelper.getClassLoaderAction(
-                            DiscriminatorStrategy.class)));
+                            DiscriminatorStrategy.class)), false);
             DiscriminatorStrategy strategy = (DiscriminatorStrategy)
                 AccessController.doPrivileged(
                     J2DoPrivHelper.newInstanceAction(strat));
@@ -718,7 +718,7 @@ public class MappingRepository
                     version.getClassMapping(),
                     (ClassLoader) AccessController.doPrivileged(
                         J2DoPrivHelper.getClassLoaderAction(
-                            VersionStrategy.class)));
+                            VersionStrategy.class)), false);
         } catch (Exception e) {
             throw new MetaDataException(_loc.get("bad-version-strategy",
                 version.getClassMapping(), name), e);

Modified: openjpa/branches/1.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/JavaTypes.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/JavaTypes.java?rev=1334001&r1=1334000&r2=1334001&view=diff
==============================================================================
--- openjpa/branches/1.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/JavaTypes.java
(original)
+++ openjpa/branches/1.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/JavaTypes.java
Fri May  4 14:44:39 2012
@@ -189,6 +189,18 @@ public class JavaTypes {
     /**
      * Check the given name against the same set of standard packages used
      * when parsing metadata.
+     * 
+     * @param mustExist Whether the supplied loader <b>must</b> be able to load
the class. 
+     * If true no attempt to use a different classloader will be made. If false the 
+     * ClassResolver from the configuration will be used.
+     */
+    public static Class<?> classForName(String name, ClassMetaData context, ClassLoader
loader, boolean mustExist) {
+    	return classForName(name, context, context.getDescribedType(), null, loader, mustExist);
+    }  
+    
+    /**
+     * Check the given name against the same set of standard packages used
+     * when parsing metadata.
      */
     public static Class classForName(String name, ValueMetaData context) {
         return classForName(name, context, null);



Mime
View raw message