Skip to content

Commit

Permalink
Sonar: Fix Nullable on Possibly null Parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
garyrussell committed Jan 29, 2021
1 parent 9dbd0e5 commit 10cb5e4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,15 @@ public Consumer<K, V> createConsumer(@Nullable String groupId, @Nullable String
return createKafkaConsumer(groupId, clientIdPrefix, clientIdSuffixArg, properties);
}

protected Consumer<K, V> createKafkaConsumer(@Nullable String groupId, @Nullable String clientIdPrefix,
protected Consumer<K, V> createKafkaConsumer(@Nullable String groupId, @Nullable String clientIdPrefixArg,
@Nullable String clientIdSuffixArg, @Nullable Properties properties) {

boolean overrideClientIdPrefix = StringUtils.hasText(clientIdPrefix);
String clientIdPrefix = clientIdPrefixArg;
String clientIdSuffix = clientIdSuffixArg;
if (clientIdPrefix == null) {
clientIdPrefix = "";
}
if (clientIdSuffix == null) {
clientIdSuffix = "";
}
Expand All @@ -275,8 +279,8 @@ protected Consumer<K, V> createKafkaConsumer(@Nullable String groupId, @Nullable
}
}

private Consumer<K, V> createConsumerWithAdjustedProperties(String groupId, String clientIdPrefix,
Properties properties, boolean overrideClientIdPrefix, String clientIdSuffix,
private Consumer<K, V> createConsumerWithAdjustedProperties(@Nullable String groupId, String clientIdPrefix,
@Nullable Properties properties, boolean overrideClientIdPrefix, String clientIdSuffix,
boolean shouldModifyClientId) {

Map<String, Object> modifiedConfigs = new HashMap<>(this.configs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ protected ListenableFuture<SendResult<K, V>> doSend(final ProducerRecord<K, V> p
}

private Callback buildCallback(final ProducerRecord<K, V> producerRecord, final Producer<K, V> producer,
final SettableListenableFuture<SendResult<K, V>> future, Object sample) {
final SettableListenableFuture<SendResult<K, V>> future, @Nullable Object sample) {

return (metadata, exception) -> {
try {
Expand Down

0 comments on commit 10cb5e4

Please sign in to comment.