Skip to content

Commit

Permalink
Fix new Sonar issues
Browse files Browse the repository at this point in the history
  • Loading branch information
garyrussell committed Jan 22, 2019
1 parent ab344af commit 71f4767
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Expand Up @@ -367,9 +367,9 @@ public void onPartitionsAssigned(Collection<TopicPartition> partitions) {
}

protected void publishContainerStoppedEvent() {
ApplicationEventPublisher applicationEventPublisher = getApplicationEventPublisher();
if (applicationEventPublisher != null) {
applicationEventPublisher.publishEvent(new ContainerStoppedEvent(this, parentOrThis()));
ApplicationEventPublisher eventPublisher = getApplicationEventPublisher();
if (eventPublisher != null) {
eventPublisher.publishEvent(new ContainerStoppedEvent(this, parentOrThis()));
}
}

Expand Down
Expand Up @@ -112,8 +112,8 @@
* @author Yang Qiju
* @author Tom van den Berge
*/
public class KafkaMessageListenerContainer<K, V>
extends AbstractMessageListenerContainer<K, V> { // NOSONAR comment density
public class KafkaMessageListenerContainer<K, V> // NOSONAR comment density
extends AbstractMessageListenerContainer<K, V> {

private static final int DEFAULT_ACK_TIME = 5000;

Expand Down Expand Up @@ -383,6 +383,8 @@ public String toString() {

private final class ListenerConsumer implements SchedulingAwareRunnable, ConsumerSeekCallback {

private static final String UNCHECKED = "unchecked";

private static final String RAWTYPES = "rawtypes";

private static final String RAW_TYPES = RAWTYPES;
Expand Down Expand Up @@ -486,7 +488,7 @@ private final class ListenerConsumer implements SchedulingAwareRunnable, Consume

private volatile long lastPoll = System.currentTimeMillis();

@SuppressWarnings("unchecked")
@SuppressWarnings(UNCHECKED)
ListenerConsumer(GenericMessageListener<?> listener, ListenerType listenerType) {
Assert.state(!this.isAnyManualAck || !this.autoCommit,
() -> "Consumer cannot be configured for auto commit for ackMode "
Expand Down Expand Up @@ -947,7 +949,7 @@ private void invokeBatchListener(final ConsumerRecords<K, V> records) {
}
}

@SuppressWarnings({ "unchecked", RAW_TYPES })
@SuppressWarnings({ UNCHECKED, RAW_TYPES })
private void invokeBatchListenerInTx(final ConsumerRecords<K, V> records,
final List<ConsumerRecord<K, V>> recordList) {
try {
Expand Down Expand Up @@ -1100,7 +1102,7 @@ private void invokeRecordListener(final ConsumerRecords<K, V> records) {
* Invoke the listener with each record in a separate transaction.
* @param records the records.
*/
@SuppressWarnings({ "unchecked", RAW_TYPES })
@SuppressWarnings({ UNCHECKED, RAW_TYPES })
private void invokeRecordListenerInTx(final ConsumerRecords<K, V> records) {
Iterator<ConsumerRecord<K, V>> iterator = records.iterator();
while (iterator.hasNext()) {
Expand Down Expand Up @@ -1317,7 +1319,7 @@ else if (!this.isAnyManualAck && !this.autoCommit) {
}
}

@SuppressWarnings({ "unchecked", RAW_TYPES })
@SuppressWarnings({ UNCHECKED, RAW_TYPES })
private void sendOffsetsToTransaction(Producer producer) {
handleAcks();
Map<TopicPartition, OffsetAndMetadata> commits = buildCommits();
Expand Down Expand Up @@ -1674,7 +1676,7 @@ public void onPartitionsAssigned(Collection<TopicPartition> partitions) {
ListenerConsumer.this.transactionTemplate
.execute(new TransactionCallbackWithoutResult() {

@SuppressWarnings({"unchecked", RAWTYPES})
@SuppressWarnings({UNCHECKED, RAWTYPES})
@Override
protected void doInTransactionWithoutResult(TransactionStatus status) {
KafkaResourceHolder holder =
Expand Down

0 comments on commit 71f4767

Please sign in to comment.