Skip to content

Commit

Permalink
Fix sonar
Browse files Browse the repository at this point in the history
  • Loading branch information
olevitt committed Sep 27, 2024
1 parent 525fba7 commit 2e2f08e
Showing 1 changed file with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
Expand All @@ -19,6 +16,10 @@
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@EnableAsync
@Component
@ConditionalOnProperty(name = "event.webhook.enabled", havingValue = "true")
Expand Down Expand Up @@ -50,15 +51,11 @@ public WebhookEventListener(ObjectMapper objectMapper, OkHttpClient okHttpClient
@Async
@EventListener
public void onOnyxiaEvent(OnyxiaEvent onyxiaEvent) throws JsonProcessingException {
if (!includes.isEmpty()) {
if (!includes.contains(onyxiaEvent.getType())) {
return;
}
if (!includes.isEmpty() && !includes.contains(onyxiaEvent.getType())) {
return;
}
if (!excludes.isEmpty()) {
if (excludes.contains(onyxiaEvent.getType())) {
return;
}
if (!excludes.isEmpty() && excludes.contains(onyxiaEvent.getType())) {
return;
}
RequestBody body = RequestBody.create(objectMapper.writeValueAsString(onyxiaEvent), JSON);
Request request = new Request.Builder().url(url).post(body).build();
Expand Down

0 comments on commit 2e2f08e

Please sign in to comment.