Skip to content

Commit 4714343

Browse files
authored
fixed #167 by replacing string concatenation with a StringBuffer. Unfortunately StringBuilder can’t be used because of Java 1.4.2 (#243)
Signed-off-by: Dominik Obermaier <dominik.obermaier@gmail.com>
2 parents 31bcfcc + f15da33 commit 4714343

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

org.eclipse.paho.client.mqttv3/src/main/java/org/eclipse/paho/client/mqttv3/MqttAsyncClient.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -794,18 +794,18 @@ public IMqttToken subscribe(String[] topicFilters, int[] qos, Object userContext
794794
this.comms.removeMessageListener(topicFilters[i]);
795795
}
796796

797-
String subs = "";
797+
StringBuffer subs = new StringBuffer();
798798
for (int i=0;i<topicFilters.length;i++) {
799799
if (i>0) {
800-
subs+=", ";
800+
subs.append(", ");
801801
}
802-
subs+= "topic="+ topicFilters[i]+" qos="+qos[i];
802+
subs.append("topic=").append(topicFilters[i]).append(" qos=").append(qos[i]);
803803

804804
//Check if the topic filter is valid before subscribing
805805
MqttTopic.validate(topicFilters[i], true/*allow wildcards*/);
806806
}
807807
//@TRACE 106=Subscribe topicFilter={0} userContext={1} callback={2}
808-
log.fine(CLASS_NAME,methodName,"106",new Object[]{subs, userContext, callback});
808+
log.fine(CLASS_NAME,methodName,"106",new Object[]{subs.toString(), userContext, callback});
809809

810810
MqttToken token = new MqttToken(getClientId());
811811
token.setActionCallback(callback);

0 commit comments

Comments
 (0)