openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ppod...@apache.org
Subject svn commit: r549405 - in /openjpa/trunk/openjpa-kernel/src/main: java/org/apache/openjpa/enhance/PCEnhancer.java resources/org/apache/openjpa/enhance/localizer.properties
Date Thu, 21 Jun 2007 06:18:34 GMT
Author: ppoddar
Date: Wed Jun 20 23:18:33 2007
New Revision: 549405

URL: http://svn.apache.org/viewvc?view=rev&rev=549405
Log:
Return gracefully when no class found for enhancement. Without this check raises NPE.

Modified:
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java
    openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/enhance/localizer.properties

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java?view=diff&rev=549405&r1=549404&r2=549405
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java
Wed Jun 20 23:18:33 2007
@@ -3639,6 +3639,10 @@
         if (args.length == 0) {
             log.info(_loc.get("running-all-classes"));
             classes = repos.getPersistentTypeNames(true, loader);
+            if (classes == null) {
+            	log.warn(_loc.get("no-class-to-enhance"));
+            	return false;
+            }
         } else {
             ClassArgParser cap = conf.getMetaDataRepositoryInstance().
                 getMetaDataFactory().newClassArgParser();
@@ -3647,7 +3651,7 @@
             for (int i = 0; i < args.length; i++)
                 classes.addAll(Arrays.asList(cap.parseTypes(args[i])));
         }
-
+        
         Project project = new Project();
         BCClass bc;
         PCEnhancer enhancer;

Modified: openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/enhance/localizer.properties
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/enhance/localizer.properties?view=diff&rev=549405&r1=549404&r2=549405
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/enhance/localizer.properties
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/enhance/localizer.properties
Wed Jun 20 23:18:33 2007
@@ -30,6 +30,7 @@
     persistent classes list, or all metadata files in classpath directories if \
 	you have not listed your persistent classes.  Use -help to display tool \
     usage information.
+no-class-to-enhance: Found no class to enhance.
 detach-custom-ser: Type "{0}" is set to detach on serialize, but implements \
 	a custom readObject and/or writeObject method.  You cannot use custom \
 	serialization with detachment. 



Mime
View raw message