Author: mprudhom
Date: Thu Jan 18 15:21:44 2007
New Revision: 497635

URL: http://svn.apache.org/viewvc?view=rev&rev=497635
Log:
Guard for null in Class.getClassLoader().

Modified:
    
incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java

Modified: 
incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java
URL: 
http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java?view=diff&rev=497635&r1=497634&r2=497635
==============================================================================
--- 
incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java
 (original)
+++ 
incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java
 Thu Jan 18 15:21:44 2007
@@ -656,9 +656,14 @@
             cls = cls.getEnclosingClass();
 
         String rsrc = StringUtils.replace(cls.getName(), ".", "/");
-        URL url = cls.getClassLoader().getResource(rsrc + ".java");
+        ClassLoader loader = cls.getClassLoader();
+        if (loader == null)
+            loader = ClassLoader.getSystemClassLoader();
+        if (loader == null)
+            return null;
+        URL url = loader.getResource(rsrc + ".java");
         if (url == null) {
-            url = cls.getClassLoader().getResource(rsrc + ".class");
+            url = loader.getResource(rsrc + ".class");
             if (url == null)
                 return null;
         }


Reply via email to