You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by ti...@apache.org on 2018/01/24 18:39:47 UTC
[aries-tx-control] 02/03: Tx Control spec compliance - handle null
properties being passed to the local JPA Provider Factory
This is an automated email from the ASF dual-hosted git repository.
timothyjward pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/aries-tx-control.git
commit 13177193cfe29e8552eda89bd193f9106556bb4f
Author: Tim Ward <ti...@apache.org>
AuthorDate: Wed Jan 24 11:18:29 2018 -0500
Tx Control spec compliance - handle null properties being passed to the local JPA Provider Factory
---
.../control/jpa/local/impl/JPAEntityManagerProviderFactoryImpl.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tx-control-providers/jpa/tx-control-provider-jpa-local/src/main/java/org/apache/aries/tx/control/jpa/local/impl/JPAEntityManagerProviderFactoryImpl.java b/tx-control-providers/jpa/tx-control-provider-jpa-local/src/main/java/org/apache/aries/tx/control/jpa/local/impl/JPAEntityManagerProviderFactoryImpl.java
index 4f6673a..9882e23 100644
--- a/tx-control-providers/jpa/tx-control-provider-jpa-local/src/main/java/org/apache/aries/tx/control/jpa/local/impl/JPAEntityManagerProviderFactoryImpl.java
+++ b/tx-control-providers/jpa/tx-control-provider-jpa-local/src/main/java/org/apache/aries/tx/control/jpa/local/impl/JPAEntityManagerProviderFactoryImpl.java
@@ -43,12 +43,13 @@ public class JPAEntityManagerProviderFactoryImpl implements InternalJPAEntityMan
@Override
public AbstractJPAEntityManagerProvider getProviderFor(EntityManagerFactoryBuilder emfb, Map<String, Object> jpaProperties,
Map<String, Object> resourceProviderProperties) {
+ Map<String, Object> jpaPropsToUse = jpaProperties == null ? new HashMap<>() : new HashMap<>(jpaProperties);
checkEnlistment(resourceProviderProperties);
- Object found = jpaProperties.get("javax.persistence.dataSource");
+ Object found = jpaPropsToUse.get("javax.persistence.dataSource");
if(found == null) {
- found = jpaProperties.get("javax.persistence.nonJtaDataSource");
+ found = jpaPropsToUse.get("javax.persistence.nonJtaDataSource");
}
if(found == null) {
@@ -62,7 +63,6 @@ public class JPAEntityManagerProviderFactoryImpl implements InternalJPAEntityMan
throw new IllegalArgumentException("The object found when checking the javax.persistence.dataSource and javax.persistence.nonJtaDataSource properties was not a DataSource.");
}
- Map<String, Object> jpaPropsToUse = new HashMap<>(jpaProperties);
DataSource toUse = JPADataSourceHelper.poolIfNecessary(resourceProviderProperties, unpooled);
jpaPropsToUse.put("javax.persistence.dataSource", toUse);
jpaPropsToUse.put("javax.persistence.nonJtaDataSource", toUse);
--
To stop receiving notification emails like this one, please contact
timothyjward@apache.org.