diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TeamRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TeamRepository.java index a09053c91b0..bcb10277901 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TeamRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TeamRepository.java @@ -247,7 +247,7 @@ public class TeamRepository extends EntityRepository { List allTeams = resultList.getData(); List joinableTeams = allTeams.stream() - .filter(isJoinable ? Team::getIsJoinable : t -> true) + .filter(Boolean.TRUE.equals(isJoinable) ? Team::getIsJoinable : t -> true) .filter(t -> !t.getName().equals(ORGANIZATION_NAME)) .collect(Collectors.toList()); // build hierarchy of joinable teams diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseRepository.java index 0d3c6ebf5c6..9bf51268d79 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseRepository.java @@ -85,7 +85,7 @@ public class TestCaseRepository extends EntityRepository { values.put(testCaseParameterValue.getName(), testCaseParameterValue.getValue()); } for (TestCaseParameter parameter : parameterDefinition) { - if (parameter.getRequired() + if (Boolean.TRUE.equals(parameter.getRequired()) && (!values.containsKey(parameter.getName()) || values.get(parameter.getName()) == null)) { throw new IllegalArgumentException( "Required parameter " + parameter.getName() + " is not passed in parameterValues"); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/elasticSearch/BuildSearchIndexResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/elasticSearch/BuildSearchIndexResource.java index bc4c602d24f..44b96da487a 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/elasticSearch/BuildSearchIndexResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/elasticSearch/BuildSearchIndexResource.java @@ -266,7 +266,7 @@ public class BuildSearchIndexResource { ElasticSearchIndexDefinition.ElasticSearchIndexType indexType = elasticSearchIndexDefinition.getIndexMappingByEntityType(entityType); - if (createRequest.getRecreateIndex()) { + if (Boolean.TRUE.equals(createRequest.getRecreateIndex())) { // Delete index elasticSearchIndexDefinition.deleteIndex(indexType); // Create index @@ -307,7 +307,7 @@ public class BuildSearchIndexResource { ElasticSearchIndexDefinition.ElasticSearchIndexType indexType = elasticSearchIndexDefinition.getIndexMappingByEntityType(entityType); - if (createRequest.getRecreateIndex()) { + if (Boolean.TRUE.equals(createRequest.getRecreateIndex())) { // Delete index elasticSearchIndexDefinition.deleteIndex(indexType); // Create index diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/UserResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/UserResource.java index 7f5dee9dd13..a27836d9c22 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/UserResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/UserResource.java @@ -788,9 +788,10 @@ public class UserResource extends EntityResource { @ApiResponse(responseCode = "400", description = "Bad request") }) public Response registerNewUser(@Context UriInfo uriInfo, @Valid RegistrationRequest create) throws IOException { - if (ConfigurationHolder.getInstance() - .getConfig(ConfigurationHolder.ConfigurationType.AUTHENTICATION_CONFIG, AuthenticationConfiguration.class) - .getEnableSelfSignup()) { + if (Boolean.TRUE.equals( + ConfigurationHolder.getInstance() + .getConfig(ConfigurationHolder.ConfigurationType.AUTHENTICATION_CONFIG, AuthenticationConfiguration.class) + .getEnableSelfSignup())) { User registeredUser = registerUser(uriInfo, create); if (isEmailServiceEnabled) { try { @@ -847,7 +848,7 @@ public class UserResource extends EntityResource { String user) throws IOException { User registeredUser = dao.getByName(uriInfo, user, getFields("isEmailVerified")); - if (registeredUser.getIsEmailVerified()) { + if (Boolean.TRUE.equals(registeredUser.getIsEmailVerified())) { // no need to do anything return Response.status(Response.Status.OK).entity("Email Already Verified For User.").build(); } @@ -1100,7 +1101,7 @@ public class UserResource extends EntityResource { .build(); } - if (storedUser != null && storedUser.getIsBot() != null && storedUser.getIsBot()) { + if (storedUser != null && Boolean.TRUE.equals(storedUser.getIsBot())) { return Response.status(BAD_REQUEST) .entity(new ErrorMessage(BAD_REQUEST.getStatusCode(), INVALID_USERNAME_PASSWORD)) .build(); @@ -1235,7 +1236,7 @@ public class UserResource extends EntityResource { } User registeredUser = dao.get(uriInfo, emailVerificationToken.getUserId(), userRepository.getFieldsWithUserAuth("*")); - if (registeredUser.getIsEmailVerified()) { + if (Boolean.TRUE.equals(registeredUser.getIsEmailVerified())) { LOG.info("User [{}] already registered.", emailToken); return; } @@ -1259,7 +1260,7 @@ public class UserResource extends EntityResource { public User extendRegistrationToken(UriInfo uriInfo, String existingToken) throws IOException { EmailVerificationToken emailVerificationToken = (EmailVerificationToken) tokenRepository.findByToken(existingToken); User registeredUser = dao.get(uriInfo, emailVerificationToken.getUserId(), getFields("isEmailVerified")); - if (registeredUser.getIsEmailVerified()) { + if (Boolean.TRUE.equals(registeredUser.getIsEmailVerified())) { // no need to do anything return registeredUser; } @@ -1400,7 +1401,7 @@ public class UserResource extends EntityResource { throw new RuntimeException( "Password Reset Token" + token.getToken() + "Expired token. Please issue a new request"); } - if (!token.getIsActive()) { + if (Boolean.FALSE.equals(token.getIsActive())) { throw new RuntimeException("Password Reset Token" + token.getToken() + "Token was marked inactive"); } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/security/JwtFilter.java b/openmetadata-service/src/main/java/org/openmetadata/service/security/JwtFilter.java index ad2736ddf2d..8f822ab73a7 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/security/JwtFilter.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/security/JwtFilter.java @@ -135,7 +135,7 @@ public class JwtFilter implements ContainerRequestFilter { String userName = validateAndReturnUsername(claims); // validate bot token - if (claims.containsKey(BOT_CLAIM) && claims.get(BOT_CLAIM).asBoolean()) { + if (claims.containsKey(BOT_CLAIM) && Boolean.TRUE.equals(claims.get(BOT_CLAIM).asBoolean())) { validateBotToken(tokenFromHeader, userName); }