fix empty keystore files

fix Collections.EMPTY_MAP doesn't support put() method issue
This commit is contained in:
Howard Gao 2015-07-14 20:07:00 +08:00
parent 2e9705cd97
commit 779092f48f
7 changed files with 5 additions and 0 deletions

View File

@ -20,6 +20,7 @@ import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.security.AccessController; import java.security.AccessController;
import java.security.PrivilegedAction; import java.security.PrivilegedAction;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Properties; import java.util.Properties;
@ -241,6 +242,10 @@ public class ActiveMQConnectionFactory extends JNDIBaseStorable implements Conne
String scheme = uri.getScheme(); String scheme = uri.getScheme();
if ("vm".equals(scheme)) { if ("vm".equals(scheme)) {
Map<String, String> params = URISupport.parseParameters(uri); Map<String, String> params = URISupport.parseParameters(uri);
//EMPTY_MAP is immutable, so use a normal map instead.
if (params == Collections.EMPTY_MAP) {
params = new HashMap<String, String>();
}
params.put("invmBrokerId", uri.getHost() == null ? "localhost" : uri.getHost()); params.put("invmBrokerId", uri.getHost() == null ? "localhost" : uri.getHost());
defaultTcpUri = URISupport.createRemainingURI(defaultTcpUri, params); defaultTcpUri = URISupport.createRemainingURI(defaultTcpUri, params);
return defaultTcpUri; return defaultTcpUri;

BIN
tests/activemq5-unit-tests/src/test/java/client.keystore Normal file → Executable file

Binary file not shown.

BIN
tests/activemq5-unit-tests/src/test/java/server.keystore Normal file → Executable file

Binary file not shown.