Skip to content

Commit

Permalink
Always use placeholders instead of string concatenation for log state…
Browse files Browse the repository at this point in the history
…ments.
  • Loading branch information
PascalSchumacher committed Dec 29, 2019
1 parent 28e0465 commit 6e7352c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
7 changes: 3 additions & 4 deletions jsmpp/src/main/java/org/jsmpp/bean/LongSMS.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,15 @@ public static byte[][] splitMessage8Bit(byte[] aMessage) {
int lengthOfData;
byte[] referenceNumber = copyShort2Bytes(getReferenceNumber());
for (int i = 0; i < segmentNum; i++) {
logger.debug("i = " + i);
logger.debug("i = {}", i);
if (segmentNum - i == 1)
lengthOfData = messageLength - i * MAX_MESSAGE_SEGMENT_8BIT;
else
lengthOfData = MAX_MESSAGE_SEGMENT_8BIT;
logger.debug("Length of data = " + lengthOfData);
logger.debug("Length of data = {}", lengthOfData);

segments[i] = new byte[7 + lengthOfData];
logger.debug("segments[" + i + "].length = "
+ segments[i].length);
logger.debug("segments[{}].length = {}", i, segments[i].length);

segments[i][0] = 6; // doesn't include itself, is header length
// SAR identifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ protected Command executeSendCommand(SendCommandTask task, long timeout)
try {
task.executeTask(connection().getOutputStream(), seqNum);
} catch (IOException e) {
logger.error("Failed sending " + task.getCommandName() + " command", e);
logger.error("Failed sending {} command", task.getCommandName(), e);
pendingResponse.remove(seqNum);
throw e;
}
Expand Down Expand Up @@ -141,7 +141,7 @@ public void unbind() throws ResponseTimeoutException, InvalidResponseException,
logger.warn("PDU String should be always valid", e);
} catch (NegativeResponseException e) {
// ignore the negative response
logger.warn("Receive non-ok command_status (" + e.getCommandStatus() + ") for unbind_resp");
logger.warn("Receive non-ok command_status ({}) for unbind_resp", e.getCommandStatus(), e);
}
}

Expand Down
4 changes: 2 additions & 2 deletions jsmpp/src/main/java/org/jsmpp/session/AbstractSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ protected Command executeSendCommand(SendCommandTask task, long timeout)
try {
task.executeTask(connection().getOutputStream(), seqNum);
} catch (IOException e) {
logger.error("Failed sending " + task.getCommandName() + " command", e);
logger.error("Failed sending {} command", task.getCommandName(), e);

if("enquire_link".equals(task.getCommandName())) {
logger.info("Tomas: Ignore failure of sending enquire_link, wait to see if connection is restored");
Expand Down Expand Up @@ -320,7 +320,7 @@ protected void executeSendCommandWithNoResponse(SendCommandTask task)
try {
task.executeTask(connection().getOutputStream(), seqNum);
} catch (IOException e) {
logger.error("Failed sending " + task.getCommandName() + " command", e);
logger.error("Failed sending {} command", task.getCommandName(), e);
close();
throw e;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ protected void fireStateChanged(SessionState newState,
try {
l.onStateChange(newState, oldState, source);
} catch (Exception e) {
logger.error("Invalid runtime exception thrown when calling onStateChange for " + source, e);
logger.error("Invalid runtime exception thrown when calling onStateChange for {}", source, e);
}
}

Expand Down
2 changes: 1 addition & 1 deletion jsmpp/src/main/java/org/jsmpp/util/DefaultComposer.java
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ public byte[] submitMulti(int sequenceNumber, String serviceType,
DistributionList dl = (DistributionList)destAddr;
StringValidator.validateString(dl.getName(), StringParameter.DL_NAME);
} else {
logger.warn("Unknown destination address flag: " + destAddr.getClass());
logger.warn("Unknown destination address flag: {}", destAddr.getClass());
}

}
Expand Down

0 comments on commit 6e7352c

Please sign in to comment.