Skip to content

Commit 805378a

Browse files
committed
Migrate to JSpecify for nullability constraints (take 6)
Resolves #1150 Signed-off-by: Chris Bono <[email protected]>
1 parent de23781 commit 805378a

File tree

3 files changed

+7
-16
lines changed

3 files changed

+7
-16
lines changed

spring-pulsar/src/main/java/org/springframework/pulsar/listener/DefaultPulsarMessageListenerContainer.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -698,14 +698,15 @@ private List<Message<T>> invokeBatchListenerInTxn(Messages<T> messages, List<Mes
698698
}
699699
}
700700

701+
@SuppressWarnings("NullAway")
701702
private List<Message<T>> doInvokeBatchListener(Messages<T> messages, List<Message<T>> messageList,
702703
AtomicBoolean inRetryMode, AtomicBoolean messagesPendingInBatch, @Nullable Transaction txn) {
703704
try {
704705
if (!CollectionUtils.isEmpty(messageList)) {
705-
if (this.batchMessageListener instanceof PulsarBatchAcknowledgingMessageListener
706-
&& this.ackMode.equals(AckMode.MANUAL)) {
706+
if (this.batchMessageListener instanceof PulsarBatchAcknowledgingMessageListener) {
707707
this.batchMessageListener.received(this.consumer, messageList,
708-
new ConsumerBatchAcknowledgment(this.consumer));
708+
this.ackMode.equals(AckMode.MANUAL) ? new ConsumerBatchAcknowledgment(this.consumer)
709+
: null);
709710
}
710711
else if (this.batchMessageListener != null) {
711712
this.batchMessageListener.received(this.consumer, messageList);
@@ -714,8 +715,7 @@ else if (this.batchMessageListener != null) {
714715
handleBatchAcks(messages, txn);
715716
}
716717
if (this.pulsarConsumerErrorHandler != null) {
717-
pendingMessagesHandledSuccessfully(this.pulsarConsumerErrorHandler, inRetryMode,
718-
messagesPendingInBatch);
718+
pendingMessagesHandledSuccessfully(this.pulsarConsumerErrorHandler, inRetryMode, messagesPendingInBatch);
719719
}
720720
}
721721
return Collections.emptyList();

spring-pulsar/src/test/java/org/springframework/pulsar/core/PulsarAdministrationTests.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,6 @@ void createdWithServiceUrlOnly() throws PulsarClientException {
4848
verify(adminBuilder).build();
4949
}
5050

51-
@Test
52-
void createdWithNullCustomizer() throws PulsarClientException {
53-
PulsarAdminBuilderCustomizer customizer = null;
54-
var admin = new PulsarAdministration(customizer);
55-
admin.setAdminBuilder(adminBuilder);
56-
admin.createAdminClient();
57-
verify(adminBuilder).build();
58-
}
59-
6051
@Test
6152
void createdWithSingleCustomizer() throws PulsarClientException {
6253
var customizer = mock(PulsarAdminBuilderCustomizer.class);

spring-pulsar/src/test/java/org/springframework/pulsar/listener/PulsarListenerTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -782,13 +782,13 @@ void springMessagingMessageListenerWithHeaders() throws Exception {
782782
}
783783

784784
@Test
785-
void simpleBatchListenerWithHeaders() throws Exception {
785+
void SchemaTestCasessimpleBatchListenerWithHeaders() throws Exception {
786786
MessageId messageId = pulsarTemplate.newMessage("hello-simple-batch-listener")
787787
.withMessageCustomizer(
788788
messageBuilder -> messageBuilder.property("foo", "simpleBatchListenerWithHeaders"))
789789
.withTopic("plt-simpleBatchListenerWithHeaders")
790790
.send();
791-
assertThat(simpleBatchListenerLatch.await(10, TimeUnit.SECONDS)).isTrue();
791+
assertThat(simpleBatchListenerLatch.await(120, TimeUnit.SECONDS)).isTrue();
792792
assertThat(capturedBatchData).containsExactly("hello-simple-batch-listener");
793793
assertThat(batchMessageIds).containsExactly(messageId);
794794
assertThat(batchTopicNames)

0 commit comments

Comments
 (0)