Skip to content

Commit 65ac48a

Browse files
committed
Replaces indexOf for contains for greater readability
Signed-off-by: Otavio R. Piske <angusyoung@gmail.com>
1 parent c1664f9 commit 65ac48a

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

  • org.eclipse.paho.client.mqttv3/src/main/java/org/eclipse/paho/client/mqttv3/logging
  • org.eclipse.paho.mqttv5.client/src/main/java/org/eclipse/paho/mqttv5/client/logging
  • org.eclipse.paho.sample.utility/src/main/java/org/eclipse/paho/sample/utility

org.eclipse.paho.client.mqttv3/src/main/java/org/eclipse/paho/client/mqttv3/logging/JSR47Logger.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ private void logToJsr47(java.util.logging.Level julLevel, String sourceClass, St
190190
ResourceBundle messageCatalog, String msg, Object[] inserts, Throwable thrown) {
191191
// LogRecord logRecord = new LogRecord(julLevel, msg);
192192
String formattedWithArgs = msg;
193-
if (msg.indexOf("=====")== -1) {
193+
if (!msg.contains("=====")) {
194194
formattedWithArgs = MessageFormat.format(getResourceMessage(messageCatalog, msg), inserts);
195195
}
196196
LogRecord logRecord = new LogRecord(julLevel, resourceName + ": " +formattedWithArgs);

org.eclipse.paho.mqttv5.client/src/main/java/org/eclipse/paho/mqttv5/client/logging/JSR47Logger.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ private void logToJsr47(java.util.logging.Level julLevel, String sourceClass, St
190190
ResourceBundle messageCatalog, String msg, Object[] inserts, Throwable thrown) {
191191
// LogRecord logRecord = new LogRecord(julLevel, msg);
192192
String formattedWithArgs = msg;
193-
if (msg.indexOf("=====")== -1) {
193+
if (!msg.contains("=====")) {
194194
formattedWithArgs = MessageFormat.format(getResourceMessage(messageCatalog, msg), inserts);
195195
}
196196
LogRecord logRecord = new LogRecord(julLevel, resourceName + ": " +formattedWithArgs);

org.eclipse.paho.sample.utility/src/main/java/org/eclipse/paho/sample/utility/MQTTFrame.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,12 +475,12 @@ public void run() {
475475
// If the entry in the IP Address drop down list contains '://' then assume
476476
// the connection has been explicitly entered as tcp://ip_address:port or local://broker_name.
477477
// Otherwise read the ip address and port number from their respective drop downs.
478-
if ( ipAddr.indexOf("://") < 0 ) {
478+
if (!ipAddr.contains("://")) {
479479
connStr = "tcp://" + ipAddr + ":" + portNum;
480480
} else {
481481
connStr = ipAddr;
482482
}
483-
483+
484484
connect( connStr, optionsComp.isPersistenceSelected() );
485485

486486
// Successful connect(no exception). Remember the ipAddress and port in the drop downs

0 commit comments

Comments
 (0)