Skip to content

Commit 8876c97

Browse files
committed
Revert "Fix Sonar smell for possible NPE"
This reverts commit 22859b7.
1 parent 22859b7 commit 8876c97

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,11 +428,16 @@ private CloseSafeProducer<K, V> doCreateTxProducer(String prefix, String suffix,
428428
(String) newProducerConfigs.get(ProducerConfig.TRANSACTIONAL_ID_CONFIG));
429429
}
430430

431+
@Nullable
431432
protected BlockingQueue<CloseSafeProducer<K, V>> getCache() {
432433
return getCache(this.transactionIdPrefix);
433434
}
434435

436+
@Nullable
435437
protected BlockingQueue<CloseSafeProducer<K, V>> getCache(String txIdPrefix) {
438+
if (txIdPrefix == null) {
439+
return null;
440+
}
436441
return this.cache.computeIfAbsent(txIdPrefix, txId -> new LinkedBlockingQueue<>());
437442
}
438443

0 commit comments

Comments
 (0)