Commit 98785c1a by Johannes Edmeier

Fix FindBugs issues

parent e09cf820
......@@ -58,34 +58,6 @@ public class AdminServerProperties {
this.contextPath = PathUtils.normalizePath(contextPath);
}
public String getContextPath() {
return contextPath;
}
public MonitorProperties getMonitor() {
return monitor;
}
public String[] getMetadataKeysToSanitize() {
return metadataKeysToSanitize;
}
public void setMetadataKeysToSanitize(String[] metadataKeysToSanitize) {
this.metadataKeysToSanitize = metadataKeysToSanitize;
}
public String[] getProbedEndpoints() {
return probedEndpoints;
}
public void setProbedEndpoints(String[] probedEndpoints) {
this.probedEndpoints = probedEndpoints;
}
public InstanceProxyProperties getInstanceProxy() {
return instanceProxy;
}
@lombok.Data
public static class MonitorProperties {
/**
......@@ -121,13 +93,5 @@ public class AdminServerProperties {
* Headers not to be forwarded when making requests to clients.
*/
private Set<String> ignoredHeaders = new HashSet<>(asList("Cookie", "Set-Cookie", "Authorization"));
public Set<String> getIgnoredHeaders() {
return ignoredHeaders;
}
public void setIgnoredHeaders(Set<String> ignoredHeaders) {
this.ignoredHeaders = ignoredHeaders;
}
}
}
......@@ -22,6 +22,7 @@ import de.codecentric.boot.admin.server.domain.events.InstanceEvent;
import reactor.core.publisher.Mono;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import org.springframework.context.expression.MapAccessor;
......@@ -83,7 +84,7 @@ public class LetsChatNotifier extends AbstractStatusChangeNotifier {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
// Let's Chat requiers the token as basic username, the password can be an arbitrary string.
String auth = Base64Utils.encodeToString(String.format("%s:%s", token, username).getBytes());
String auth = Base64Utils.encodeToString(String.format("%s:%s", token, username).getBytes(StandardCharsets.UTF_8));
headers.add(HttpHeaders.AUTHORIZATION, String.format("Basic %s", auth));
return Mono.fromRunnable(() -> restTemplate.exchange(createUrl(), HttpMethod.POST,
new HttpEntity<>(createMessage(event, instance), headers), Void.class));
......
......@@ -104,10 +104,8 @@ public class FilteringNotifier extends AbstractEventNotifier {
}
public Map<String, NotificationFilter> getNotificationFilters() {
synchronized (filters) {
return Collections.unmodifiableMap(new HashMap<>(filters));
}
}
public void setCleanupInterval(Duration cleanupInterval) {
this.cleanupInterval = cleanupInterval;
......
......@@ -26,6 +26,7 @@ import reactor.core.publisher.Mono;
import reactor.test.StepVerifier;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import org.junit.Before;
......@@ -44,11 +45,11 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
public class LetsChatNotifierTest {
private final String room = "text_room";
private final String token = "text_token";
private final String user = "api_user";
private final String host = "http://localhost";
private final Instance instance = Instance.create(InstanceId.of("-id-"))
private static final String room = "text_room";
private static final String token = "text_token";
private static final String user = "api_user";
private static final String host = "http://localhost";
private static final Instance instance = Instance.create(InstanceId.of("-id-"))
.register(Registration.create("App", "http://health").build());
private LetsChatNotifier notifier;
private RestTemplate restTemplate;
......@@ -103,7 +104,7 @@ public class LetsChatNotifierTest {
private HttpEntity<?> expectedMessage(String message) {
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.setContentType(MediaType.APPLICATION_JSON);
String auth = Base64Utils.encodeToString(String.format("%s:%s", token, user).getBytes());
String auth = Base64Utils.encodeToString(String.format("%s:%s", token, user).getBytes(StandardCharsets.UTF_8));
httpHeaders.add(HttpHeaders.AUTHORIZATION, String.format("Basic %s", auth));
Map<String, Object> messageJson = new HashMap<>();
messageJson.put("text", message);
......
......@@ -46,7 +46,7 @@ import static org.assertj.core.api.Java6Assertions.assertThat;
public class InfoUpdaterTest {
@ClassRule
public static WireMockClassRule wireMockClassRule = new WireMockClassRule(Options.DYNAMIC_PORT);
public static final WireMockClassRule wireMockClassRule = new WireMockClassRule(Options.DYNAMIC_PORT);
@Rule
public WireMockClassRule wireMock = wireMockClassRule;
......
......@@ -51,7 +51,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class StatusUpdaterTest {
@ClassRule
public static WireMockClassRule wireMockClass = new WireMockClassRule(Options.DYNAMIC_PORT);
public static final WireMockClassRule wireMockClass = new WireMockClassRule(Options.DYNAMIC_PORT);
@Rule
public WireMockClassRule wireMock = wireMockClass;
......
......@@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
public class ProbeEndpointsStrategyTest {
@ClassRule
public static WireMockClassRule wireMockClassRule = new WireMockClassRule(Options.DYNAMIC_PORT);
public static final WireMockClassRule wireMockClassRule = new WireMockClassRule(Options.DYNAMIC_PORT);
@Rule
public WireMockClassRule wireMock = wireMockClassRule;
......
......@@ -61,7 +61,7 @@ public abstract class AbstractInstancesProxyControllerIntegrationTest {
private static ParameterizedTypeReference<Map<String, Object>> RESPONSE_TYPE = new ParameterizedTypeReference<Map<String, Object>>() {
};
@ClassRule
public static WireMockClassRule wireMock = new WireMockClassRule(
public static final WireMockClassRule wireMock = new WireMockClassRule(
options().dynamicPort().extensions(new ConnectionCloseExtension()));
private static WebTestClient client;
private static String instanceId;
......
......@@ -54,7 +54,7 @@ import static org.springframework.http.HttpHeaders.EMPTY;
public class InstanceWebClientTest {
@ClassRule
public static WireMockClassRule wireMockClass = new WireMockClassRule(Options.DYNAMIC_PORT);
public static final WireMockClassRule wireMockClass = new WireMockClassRule(Options.DYNAMIC_PORT);
@Rule
public WireMockClassRule wireMock = wireMockClass;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment