This commit is contained in:
Michael Pearce 2019-08-19 16:53:58 +01:00
commit e218678e4f
2 changed files with 13 additions and 1 deletions

View File

@ -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) {

View File

@ -103,6 +103,18 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase {
connectionFactory.createConnection().close();
}
@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<>();