Return gracefully when no class found for enhancement. Without this check raises NPE.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@549405 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Pinaki Poddar 2007-06-21 06:18:33 +00:00
parent 1921d6cc59
commit a39a2dace9
2 changed files with 6 additions and 1 deletions

View File

@ -3639,6 +3639,10 @@ public class PCEnhancer {
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 @@ public class PCEnhancer {
for (int i = 0; i < args.length; i++)
classes.addAll(Arrays.asList(cap.parseTypes(args[i])));
}
Project project = new Project();
BCClass bc;
PCEnhancer enhancer;

View File

@ -30,6 +30,7 @@ running-all-classes: No targets were given. Running on all classes in your \
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.