Skip to content

Commit cff9236

Browse files
authored
GH-3916: Delete redundant null check
Fixes: #3916 Delete redundant null check Signed-off-by: JaeYeon Kim <[email protected]>
1 parent ec154a3 commit cff9236

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

spring-kafka/src/main/java/org/springframework/kafka/core/DefaultKafkaProducerFactory.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
* @author Thomas Strauß
117117
* @author Adrian Gygax
118118
* @author Soby Chacko
119+
* @author Jaeyeon Kim
119120
*/
120121
public class DefaultKafkaProducerFactory<K, V> extends KafkaResourceFactory
121122
implements ProducerFactory<K, V>, ApplicationContextAware,
@@ -1181,13 +1182,11 @@ public void commitTransaction() throws ProducerFencedException {
11811182

11821183
@Override
11831184
public void abortTransaction() throws ProducerFencedException {
1184-
LOGGER.debug(() -> toString() + " abortTransaction()");
1185-
if (this.producerFailed != null) {
1186-
LOGGER.debug(() -> {
1187-
String message = this.producerFailed == null ? "" : this.producerFailed.getMessage();
1188-
return "abortTransaction ignored - previous txFailed: " + message
1189-
+ ": " + this;
1190-
});
1185+
Exception producerFailedToUse = this.producerFailed;
1186+
LOGGER.debug(() -> this + " abortTransaction()");
1187+
if (producerFailedToUse != null) {
1188+
LOGGER.debug(() -> "abortTransaction ignored - previous txFailed: " + producerFailedToUse.getMessage()
1189+
+ ": " + this);
11911190
}
11921191
else {
11931192
try {

0 commit comments

Comments
 (0)