Skip to content

Commit

Permalink
GH-1293: Fix regression
Browse files Browse the repository at this point in the history
- NPE in deprecated `CorrelationData.getReturnedMessage()`.
  • Loading branch information
garyrussell authored and artembilan committed Jan 13, 2021
1 parent bdbb667 commit 1b56b84
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,12 @@ public SettableListenableFuture<Confirm> getFuture() {
@Deprecated
@Nullable
public Message getReturnedMessage() {
return this.returnedMessage.getMessage();
if (this.returnedMessage == null) {
return null;
}
else {
return this.returnedMessage.getMessage();
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2020 the original author or authors.
* Copyright 2019-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -64,6 +64,13 @@
@RabbitAvailable
public class PublisherCallbackChannelTests {

@SuppressWarnings("deprecation")
@Test
void correlationData() {
CorrelationData cd = new CorrelationData();
assertThat(cd.getReturnedMessage()).isNull();
}

@Test
void shutdownWhileCreate() throws IOException, TimeoutException {
Channel delegate = mock(Channel.class);
Expand Down

0 comments on commit 1b56b84

Please sign in to comment.