diff --git a/src/main/java/eu/hbp/mip/configurations/KeycloakConfiguration.java b/src/main/java/eu/hbp/mip/configurations/KeycloakConfiguration.java index 390b1d6532eefdcc95b6baf9df0f5a90f3e00515..e3097df3bc5d9f65ba4b0d3937588fb92d462518 100644 --- a/src/main/java/eu/hbp/mip/configurations/KeycloakConfiguration.java +++ b/src/main/java/eu/hbp/mip/configurations/KeycloakConfiguration.java @@ -10,4 +10,4 @@ public class KeycloakConfiguration { public KeycloakSpringBootConfigResolver KeycloakConfigResolver() { return new KeycloakSpringBootConfigResolver(); } -} \ No newline at end of file +} diff --git a/src/main/java/eu/hbp/mip/configurations/SecurityConfiguration.java b/src/main/java/eu/hbp/mip/configurations/SecurityConfiguration.java index f86270f4532fc440151ee50b9101754f79486de6..c7c30ab55ce60a58f1da79e358ffbc0637f6ec45 100644 --- a/src/main/java/eu/hbp/mip/configurations/SecurityConfiguration.java +++ b/src/main/java/eu/hbp/mip/configurations/SecurityConfiguration.java @@ -1,6 +1,7 @@ package eu.hbp.mip.configurations; import eu.hbp.mip.utils.CORSFilter; +import org.jetbrains.annotations.NotNull; import org.keycloak.adapters.springsecurity.KeycloakConfiguration; import org.keycloak.adapters.springsecurity.authentication.KeycloakAuthenticationProvider; import org.keycloak.adapters.springsecurity.config.KeycloakWebSecurityConfigurerAdapter; @@ -69,8 +70,8 @@ public class SecurityConfiguration extends KeycloakWebSecurityConfigurerAdapter private Filter csrfHeaderFilter() { return new OncePerRequestFilter() { @Override - protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, - FilterChain filterChain) throws ServletException, IOException { + protected void doFilterInternal(@NotNull HttpServletRequest request, @NotNull HttpServletResponse response, + @NotNull FilterChain filterChain) throws ServletException, IOException { CsrfToken csrf = (CsrfToken) request.getAttribute(CsrfToken.class.getName()); if (csrf != null) { Cookie cookie = WebUtils.getCookie(request, "XSRF-TOKEN"); diff --git a/src/main/java/eu/hbp/mip/repositories/ExperimentSpecifications.java b/src/main/java/eu/hbp/mip/repositories/ExperimentSpecifications.java index 3379610d5612be715efa4e121fa94faf375acb5c..08423757f2c937a2c0f823063e675726dc2335d0 100644 --- a/src/main/java/eu/hbp/mip/repositories/ExperimentSpecifications.java +++ b/src/main/java/eu/hbp/mip/repositories/ExperimentSpecifications.java @@ -12,7 +12,7 @@ import java.util.List; public class ExperimentSpecifications { public static class ExperimentWithName implements Specification<ExperimentDAO> { - private String name; + private final String name; private String regExp; public ExperimentWithName(String name) { @@ -33,7 +33,7 @@ public class ExperimentSpecifications { public static class ExperimentWithAlgorithm implements Specification<ExperimentDAO> { - private String algorithm; + private final String algorithm; public ExperimentWithAlgorithm(String algorithm) { this.algorithm = algorithm; @@ -50,7 +50,7 @@ public class ExperimentSpecifications { public static class ExperimentWithViewed implements Specification<ExperimentDAO> { - private Boolean viewed; + private final Boolean viewed; public ExperimentWithViewed(Boolean viewed) { this.viewed = viewed; @@ -66,7 +66,7 @@ public class ExperimentSpecifications { public static class ExperimentWithShared implements Specification<ExperimentDAO> { - private Boolean shared; + private final Boolean shared; public ExperimentWithShared(Boolean shared) { this.shared = shared; @@ -82,7 +82,7 @@ public class ExperimentSpecifications { public static class MyExperiment implements Specification<ExperimentDAO> { - private String username; + private final String username; public MyExperiment(String username) { this.username = username; @@ -99,14 +99,14 @@ public class ExperimentSpecifications { public static class SharedExperiment implements Specification<ExperimentDAO> { - private boolean shared; + private final boolean shared; public SharedExperiment(boolean shared) { this.shared = shared; } public Predicate toPredicate(Root<ExperimentDAO> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder cb) { - if (shared == false) { + if (!shared) { return cb.isTrue(cb.literal(false)); } return cb.equal(root.get("shared"), shared); @@ -115,8 +115,8 @@ public class ExperimentSpecifications { public static class ExperimentOrderBy implements Specification<ExperimentDAO> { - private String orderBy; - private Boolean descending; + private final String orderBy; + private final Boolean descending; public ExperimentOrderBy(String orderBy, Boolean descending) { if (properColumnToBeOrderedBy(orderBy)) diff --git a/src/main/java/eu/hbp/mip/services/GalaxyService.java b/src/main/java/eu/hbp/mip/services/GalaxyService.java index 61d5629fdc0e5ce52845638be65f71b8608574a2..23c15d710a1a5c3725080f977e28b0a54b3be00c 100644 --- a/src/main/java/eu/hbp/mip/services/GalaxyService.java +++ b/src/main/java/eu/hbp/mip/services/GalaxyService.java @@ -173,7 +173,7 @@ public class GalaxyService { Response<Object> response = call.execute(); if (response.code() >= 400) { Logger.LogBackgroundAction(experimentName, experimentId, " Response code: " - + response.code() + "" + " with body: " + (response.errorBody() != null ? response.errorBody().string() : " ")); + + response.code() + " with body: " + (response.errorBody() != null ? response.errorBody().string() : " ")); return "internalError"; } result = new Gson().toJson(response.body()); @@ -228,7 +228,7 @@ public class GalaxyService { Response<List<GalaxyWorkflowResult>> response = call.execute(); if (response.code() >= 400) { Logger.LogBackgroundAction(experimentName, experimentId, " Response code: " - + response.code() + "" + " with body: " + (response.errorBody() != null ? response.errorBody().string() : " ")); + + response.code() + " with body: " + (response.errorBody() != null ? response.errorBody().string() : " ")); return null; } getGalaxyWorkflowResultList = response.body(); @@ -266,7 +266,7 @@ public class GalaxyService { Response<Object> response = call.execute(); if (response.code() >= 400) { Logger.LogBackgroundAction(experimentName, experimentId, " Response code: " - + response.code() + "" + " with body: " + (response.errorBody() != null ? response.errorBody().string() : " ")); + + response.code() + " with body: " + (response.errorBody() != null ? response.errorBody().string() : " ")); return null; } resultJson = new Gson().toJson(response.body()); diff --git a/src/main/java/eu/hbp/mip/utils/ErrorMessage.java b/src/main/java/eu/hbp/mip/utils/ErrorMessage.java index ef15c71ae041b277e51c487afb03d17d11556aa8..fdaac15921a846f710f89398a799c41e7a6befa8 100644 --- a/src/main/java/eu/hbp/mip/utils/ErrorMessage.java +++ b/src/main/java/eu/hbp/mip/utils/ErrorMessage.java @@ -4,10 +4,10 @@ package eu.hbp.mip.utils; import java.util.Date; public class ErrorMessage { - private int statusCode; - private Date timestamp; - private String message; - private String description; + private final int statusCode; + private final Date timestamp; + private final String message; + private final String description; public ErrorMessage(int statusCode, Date timestamp, String message, String description) { this.statusCode = statusCode; diff --git a/src/main/java/eu/hbp/mip/utils/HTTPUtil.java b/src/main/java/eu/hbp/mip/utils/HTTPUtil.java index cd3778a00b94083bf52e59234527b71f7036d594..fdd7a9179cbb95bccb73277212a2dd29b5b20b41 100644 --- a/src/main/java/eu/hbp/mip/utils/HTTPUtil.java +++ b/src/main/java/eu/hbp/mip/utils/HTTPUtil.java @@ -70,7 +70,7 @@ public class HTTPUtil { response.append(inputLine); } in.close(); - resp.append(response.toString()); + resp.append(response); return respCode; } diff --git a/src/main/java/eu/hbp/mip/utils/Logger.java b/src/main/java/eu/hbp/mip/utils/Logger.java index c21e2fdc9391be017fed2b470ff04e11d29a45fd..7ea51d74f008f3e5eef6760fc8693dc5d69d5240 100644 --- a/src/main/java/eu/hbp/mip/utils/Logger.java +++ b/src/main/java/eu/hbp/mip/utils/Logger.java @@ -8,8 +8,8 @@ import java.util.UUID; public class Logger { private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(Logger.class); - private String username; - private String endpoint; + private final String username; + private final String endpoint; public Logger(String username, String endpoint){ this.username = username;