You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by mi...@apache.org on 2019/08/19 15:54:29 UTC
[activemq-artemis] branch master updated: Treat empty providerUrl
string same way as null value.
This is an automated email from the ASF dual-hosted git repository.
michaelpearce pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
The following commit(s) were added to refs/heads/master by this push:
new 3d631f0 Treat empty providerUrl string same way as null value.
new e218678 This closes #2783
3d631f0 is described below
commit 3d631f06d0971197848ee3d32e4ac3997c2239ff
Author: Premysl Srubar <pr...@leaseplan.com>
AuthorDate: Sat Aug 3 16:59:18 2019 +0200
Treat empty providerUrl string same way as null value.
---
.../activemq/artemis/jndi/ActiveMQInitialContextFactory.java | 2 +-
.../artemis/tests/integration/jms/SimpleJNDIClientTest.java | 12 ++++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jndi/ActiveMQInitialContextFactory.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jndi/ActiveMQInitialContextFactory.java
index f38872f..d7026b6 100644
--- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jndi/ActiveMQInitialContextFactory.java
+++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jndi/ActiveMQInitialContextFactory.java
@@ -56,7 +56,7 @@ public class ActiveMQInitialContextFactory implements InitialContextFactory {
Map<String, Object> data = new ConcurrentHashMap<>();
String providerUrl = (String) environment.get(javax.naming.Context.PROVIDER_URL);
- if (providerUrl != null) {
+ if (providerUrl != null && !providerUrl.isEmpty()) {
try {
JMSFactoryType providedFactoryType = getFactoryType(providerUrl);
if (providedFactoryType == null) {
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/SimpleJNDIClientTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/SimpleJNDIClientTest.java
index c9299aa..c93f67b 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/SimpleJNDIClientTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/SimpleJNDIClientTest.java
@@ -104,6 +104,18 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase {
}
@Test
+ public void testEmptyConnectionFactoryString() throws NamingException, JMSException {
+ Hashtable<String, String> props = new Hashtable<>();
+ props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory");
+ props.put("connectionFactory.ConnectionFactory", "vm://0");
+
+ //IIB v10 assumes this property is mandatory and sets it to an empty string when not specified
+ props.put("java.naming.provider.url", "");
+ new InitialContext(props);//Must not throw an exception
+
+ }
+
+ @Test
public void testVMCF1() throws NamingException, JMSException {
Hashtable<String, String> props = new Hashtable<>();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory");