Author: rmannibucau
Date: Sun Nov 11 13:09:21 2012
New Revision: 1407969
URL: http://svn.apache.org/viewvc?rev=1407969&view=rev
Log:
avoiding NPE (mainly coming from custom test classes)
Modified:
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
Modified:
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java?rev=1407969&r1=1407968&r2=1407969&view=diff
==============================================================================
---
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
(original)
+++
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
Sun Nov 11 13:09:21 2012
@@ -1476,20 +1476,22 @@ public class AnnotationDeployer implemen
addJaxRsProviders(finder,
ejbModule.getAppModule().getJaxRsProviders(), Provider.class);
}
- for (PersistenceModule pm :
ejbModule.getAppModule().getPersistenceModules()) {
- for (org.apache.openejb.jee.jpa.unit.PersistenceUnit pu :
pm.getPersistence().getPersistenceUnit()) {
- if ((pu.isExcludeUnlistedClasses() == null ||
!pu.isExcludeUnlistedClasses())
- &&
"true".equalsIgnoreCase(pu.getProperties().getProperty(OPENEJB_JPA_AUTO_SCAN)))
{
- // no need of meta currently since JPA providers
doesn't support it
- final List<Class<?>> classes =
finder.findAnnotatedClasses(Entity.class);
- final List<String> existingClasses = pu.getClazz();
- for (Class<?> clazz : classes) {
- final String name = clazz.getName();
- if (!existingClasses.contains(name)) {
- pu.getClazz().add(name);
+ if (ejbModule.getAppModule() != null) {
+ for (PersistenceModule pm :
ejbModule.getAppModule().getPersistenceModules()) {
+ for (org.apache.openejb.jee.jpa.unit.PersistenceUnit pu :
pm.getPersistence().getPersistenceUnit()) {
+ if ((pu.isExcludeUnlistedClasses() == null ||
!pu.isExcludeUnlistedClasses())
+ &&
"true".equalsIgnoreCase(pu.getProperties().getProperty(OPENEJB_JPA_AUTO_SCAN)))
{
+ // no need of meta currently since JPA providers
doesn't support it
+ final List<Class<?>> classes =
finder.findAnnotatedClasses(Entity.class);
+ final List<String> existingClasses = pu.getClazz();
+ for (Class<?> clazz : classes) {
+ final String name = clazz.getName();
+ if (!existingClasses.contains(name)) {
+ pu.getClazz().add(name);
+ }
}
+ pu.setScanned(true);
}
- pu.setScanned(true);
}
}
}