- Added null checking during property set to prevent NPE

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@416549 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Adrian T. Co 2006-06-23 03:06:28 +00:00
parent 80bf2417f1
commit 0f59ecc433
1 changed files with 33 additions and 19 deletions

View File

@ -404,19 +404,33 @@ public class ActiveMQConnectionFactory extends JNDIBaseStorable implements Conne
public void populateProperties(Properties props) {
props.setProperty("asyncDispatch", Boolean.toString(isAsyncDispatch()));
props.setProperty(Context.PROVIDER_URL, getBrokerURL());
props.setProperty("brokerURL", getBrokerURL());
if (getClientID() != null)
if (getBrokerURL() != null) {
props.setProperty(Context.PROVIDER_URL, getBrokerURL());
props.setProperty("brokerURL", getBrokerURL());
}
if (getClientID() != null) {
props.setProperty("clientID", getClientID());
}
props.setProperty("copyMessageOnSend", Boolean.toString(isCopyMessageOnSend()));
props.setProperty("disableTimeStampsByDefault", Boolean.toString(isDisableTimeStampsByDefault()));
props.setProperty("objectMessageSerializationDefered", Boolean.toString(isObjectMessageSerializationDefered()));
props.setProperty("optimizedMessageDispatch", Boolean.toString(isOptimizedMessageDispatch()));
props.setProperty("password", getPassword());
if (getPassword() != null) {
props.setProperty("password", getPassword());
}
props.setProperty("useAsyncSend", Boolean.toString(isUseAsyncSend()));
props.setProperty("useCompression", Boolean.toString(isUseCompression()));
props.setProperty("useRetroactiveConsumer", Boolean.toString(isUseRetroactiveConsumer()));
props.setProperty("userName", getUserName());
if (getUserName() != null) {
props.setProperty("userName", getUserName());
}
props.setProperty("closeTimeout", Integer.toString(getCloseTimeout()));
props.setProperty("alwaysSessionAsync", Boolean.toString(isAlwaysSessionAsync()));
props.setProperty("optimizeAcknowledge", Boolean.toString(isOptimizeAcknowledge()));