Skip to content

Commit bb35a83

Browse files
committed
GH-1915: Fix New Sonar Issue
1 parent c75e60c commit bb35a83

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

spring-kafka/src/main/java/org/springframework/kafka/listener/KafkaMessageListenerContainer.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,8 @@ public String toString() {
516516

517517
private final class ListenerConsumer implements SchedulingAwareRunnable, ConsumerSeekCallback {
518518

519+
private static final String COMMITTING = "Committing: ";
520+
519521
private static final String ERROR_HANDLER_THREW_AN_EXCEPTION = "Error handler threw an exception";
520522

521523
private static final String UNCHECKED = "unchecked";
@@ -1826,7 +1828,7 @@ private void ackImmediate(ConsumerRecord<K, V> record) {
18261828
Map<TopicPartition, OffsetAndMetadata> commits = Collections.singletonMap(
18271829
new TopicPartition(record.topic(), record.partition()),
18281830
new OffsetAndMetadata(record.offset() + 1));
1829-
this.commitLogger.log(() -> "Committing: " + commits);
1831+
this.commitLogger.log(() -> COMMITTING + commits);
18301832
if (this.producer != null) {
18311833
doSendOffsets(this.producer, commits);
18321834
}
@@ -1845,7 +1847,7 @@ private void ackImmediate(ConsumerRecords<K, V> records) {
18451847
new OffsetAndMetadata(records.records(part)
18461848
.get(records.records(part).size() - 1).offset() + 1));
18471849
}
1848-
this.commitLogger.log(() -> "Committing: " + commits);
1850+
this.commitLogger.log(() -> COMMITTING + commits);
18491851
if (this.producer != null) {
18501852
doSendOffsets(this.producer, commits);
18511853
}
@@ -2613,7 +2615,7 @@ public void ackCurrent(final ConsumerRecord<K, V> record) {
26132615
Collections.singletonMap(new TopicPartition(record.topic(), record.partition()),
26142616
new OffsetAndMetadata(record.offset() + 1));
26152617
if (this.producer == null) {
2616-
this.commitLogger.log(() -> "Committing: " + offsetsToCommit);
2618+
this.commitLogger.log(() -> COMMITTING + offsetsToCommit);
26172619
if (this.syncCommits) {
26182620
commitSync(offsetsToCommit);
26192621
}
@@ -2873,7 +2875,7 @@ private void commitIfNecessary() {
28732875
Map<TopicPartition, OffsetAndMetadata> commits = buildCommits();
28742876
this.logger.debug(() -> "Commit list: " + commits);
28752877
if (!commits.isEmpty()) {
2876-
this.commitLogger.log(() -> "Committing: " + commits);
2878+
this.commitLogger.log(() -> COMMITTING + commits);
28772879
try {
28782880
if (this.syncCommits) {
28792881
commitSync(commits);

0 commit comments

Comments
 (0)