Skip to content

Commit

Permalink
Sonar: Add Nullable to Possibly Null Parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
garyrussell committed Jan 29, 2021
1 parent ed93e70 commit c7ced03
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ private Channel getChannel(ChannelCachingConnectionProxy connection, boolean tra
LinkedList<ChannelProxy> channelList = determineChannelList(connection, transactional);
ChannelProxy channel = null;
if (connection.isOpen()) {
channel = findOpenChannel(channelList, channel);
channel = findOpenChannel(channelList);
if (channel != null && logger.isTraceEnabled()) {
logger.trace("Found cached Rabbit Channel: " + channel.toString());
}
Expand Down Expand Up @@ -576,9 +576,10 @@ private Semaphore obtainPermits(ChannelCachingConnectionProxy connection) {
return permits;
}

private ChannelProxy findOpenChannel(LinkedList<ChannelProxy> channelList, // NOSONAR LinkedList.removeFirst()
ChannelProxy channelArg) {
ChannelProxy channel = channelArg;
@Nullable
private ChannelProxy findOpenChannel(LinkedList<ChannelProxy> channelList) {

ChannelProxy channel = null;
synchronized (channelList) {
while (!channelList.isEmpty()) {
channel = channelList.removeFirst();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ private void declareBindings(final Channel channel, final Binding... bindings) t
}
}

private <T extends Throwable> void logOrRethrowDeclarationException(@Nullable Declarable element,
private <T extends Throwable> void logOrRethrowDeclarationException(Declarable element,
String elementType, T t) throws T {

publishDeclarationExceptionEvent(element, t);
Expand All @@ -794,7 +794,7 @@ else if (this.logger.isWarnEnabled()) {
}
}

private <T extends Throwable> void publishDeclarationExceptionEvent(Declarable element, T t) {
private <T extends Throwable> void publishDeclarationExceptionEvent(@Nullable Declarable element, T t) {
DeclarationExceptionEvent event = new DeclarationExceptionEvent(this, element, t);
this.lastDeclarationExceptionEvent = event;
if (this.applicationEventPublisher != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1444,7 +1444,7 @@ private Delivery consumeDelivery(Channel channel, String queueName, long timeout
return delivery;
}

private void logReceived(Message message) {
private void logReceived(@Nullable Message message) {
if (message == null) {
logger.debug("Received no message");
}
Expand Down Expand Up @@ -2161,8 +2161,8 @@ private <T> T doExecute(ChannelCallback<T> action, ConnectionFactory connectionF
}
}

private void cleanUpAfterAction(Channel channel, boolean invokeScope, RabbitResourceHolder resourceHolder,
Connection connection) {
private void cleanUpAfterAction(@Nullable Channel channel, boolean invokeScope,
@Nullable RabbitResourceHolder resourceHolder, @Nullable Connection connection) {

if (!invokeScope) {
if (resourceHolder != null) {
Expand Down Expand Up @@ -2257,8 +2257,8 @@ private ConfirmListener addConfirmListener(@Nullable com.rabbitmq.client.Confirm
return listener;
}

private void cleanUpAfterAction(RabbitResourceHolder resourceHolder, Connection connection, Channel channel,
ConfirmListener listener) {
private void cleanUpAfterAction(@Nullable RabbitResourceHolder resourceHolder, @Nullable Connection connection,
@Nullable Channel channel, @Nullable ConfirmListener listener) {

if (listener != null) {
channel.removeConfirmListener(listener);
Expand Down

0 comments on commit c7ced03

Please sign in to comment.