Author: rmannibucau
Date: Sun Oct  5 13:10:16 2014
New Revision: 1629490

URL: http://svn.apache.org/r1629490
Log:
backporting Thiago fix to avoid NPE is a persistence unit datasource isnull

Modified:
    
tomee/tomee/branches/tomee-1.7.x/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java

Modified: 
tomee/tomee/branches/tomee-1.7.x/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java
URL: 
http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java?rev=1629490&r1=1629489&r2=1629490&view=diff
==============================================================================
--- 
tomee/tomee/branches/tomee-1.7.x/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java
 (original)
+++ 
tomee/tomee/branches/tomee-1.7.x/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java
 Sun Oct  5 13:10:16 2014
@@ -1367,6 +1367,10 @@ public class AutoConfig implements Dynam
             // first try exact matching without JtaManaged which is not 
mandatory actually (custom DS + JTADataSourceWrapperFactory)
             final String jtaWithJavaAndSlash = 
replaceJavaAndSlash(unit.getJtaDataSource());
             for (final String potentialName : asList(prefix + 
jtaWithJavaAndSlash, jtaWithJavaAndSlash)) {
+                if(potentialName == null) {
+                    // If unit.getJtaDataSource() is null, one of the 
potentialName is also null.
+                    continue;
+                }
                 final ResourceInfo jtaInfo = 
configFactory.getResourceInfo(potentialName);
                 if (jtaInfo != null) {
                     if 
(!"false".equalsIgnoreCase(jtaInfo.properties.getProperty("JtaManaged")) // 
don't test true since it can be missing
@@ -1381,6 +1385,10 @@ public class AutoConfig implements Dynam
 
             final String nonJtaWithJavaAndSlash = 
replaceJavaAndSlash(unit.getNonJtaDataSource());
             for (final String potentialName : asList(prefix + 
nonJtaWithJavaAndSlash, nonJtaWithJavaAndSlash)) {
+                if(potentialName == null) {
+                    // If unit.getNonJtaDataSource() is null, one of the 
potentialName is also null
+                    continue;
+                }
                 final ResourceInfo info = 
configFactory.getResourceInfo(potentialName);
                 if (info != null) {
                     if 
(!"true".equalsIgnoreCase(info.properties.getProperty("JtaManaged"))


Reply via email to