Fix "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE" SpotBugs complaint

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2021-05-14 14:40:28 +02:00
parent 16ca03cb5c
commit 4790e7b7e4
No known key found for this signature in database
GPG key ID: 7076EA9751AACDDA

View file

@ -74,56 +74,64 @@ public class AddParticipantsToConversation extends Worker {
String credentials = ApiUtils.getCredentials(user.getUsername(), user.getToken());
RetrofitBucket retrofitBucket;
for (String userId : selectedUserIds) {
retrofitBucket = ApiUtils.getRetrofitBucketForAddParticipant(apiVersion, user.getBaseUrl(),
conversationToken,
userId);
if (selectedUserIds != null) {
for (String userId : selectedUserIds) {
retrofitBucket = ApiUtils.getRetrofitBucketForAddParticipant(apiVersion, user.getBaseUrl(),
conversationToken,
userId);
ncApi.addParticipant(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap())
.subscribeOn(Schedulers.io())
.blockingSubscribe();
ncApi.addParticipant(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap())
.subscribeOn(Schedulers.io())
.blockingSubscribe();
}
}
for (String groupId : selectedGroupIds) {
retrofitBucket = ApiUtils.getRetrofitBucketForAddParticipantWithSource(
apiVersion,
user.getBaseUrl(),
conversationToken,
"groups",
groupId
);
if (selectedGroupIds != null) {
for (String groupId : selectedGroupIds) {
retrofitBucket = ApiUtils.getRetrofitBucketForAddParticipantWithSource(
apiVersion,
user.getBaseUrl(),
conversationToken,
"groups",
groupId
);
ncApi.addParticipant(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap())
.subscribeOn(Schedulers.io())
.blockingSubscribe();
ncApi.addParticipant(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap())
.subscribeOn(Schedulers.io())
.blockingSubscribe();
}
}
for (String circleId : selectedCircleIds) {
retrofitBucket = ApiUtils.getRetrofitBucketForAddParticipantWithSource(
apiVersion,
user.getBaseUrl(),
conversationToken,
"circles",
circleId
);
if (selectedCircleIds != null) {
for (String circleId : selectedCircleIds) {
retrofitBucket = ApiUtils.getRetrofitBucketForAddParticipantWithSource(
apiVersion,
user.getBaseUrl(),
conversationToken,
"circles",
circleId
);
ncApi.addParticipant(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap())
.subscribeOn(Schedulers.io())
.blockingSubscribe();
ncApi.addParticipant(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap())
.subscribeOn(Schedulers.io())
.blockingSubscribe();
}
}
for (String email : selectedEmails) {
retrofitBucket = ApiUtils.getRetrofitBucketForAddParticipantWithSource(
apiVersion,
user.getBaseUrl(),
conversationToken,
"emails",
email
);
if (selectedEmails != null) {
for (String email : selectedEmails) {
retrofitBucket = ApiUtils.getRetrofitBucketForAddParticipantWithSource(
apiVersion,
user.getBaseUrl(),
conversationToken,
"emails",
email
);
ncApi.addParticipant(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap())
.subscribeOn(Schedulers.io())
.blockingSubscribe();
ncApi.addParticipant(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap())
.subscribeOn(Schedulers.io())
.blockingSubscribe();
}
}
eventBus.post(new EventStatus(user.getId(), EventStatus.EventType.PARTICIPANTS_UPDATE, true));