Skip to content

Commit

Permalink
- fix sonar issues
Browse files Browse the repository at this point in the history
  • Loading branch information
rathnapandi committed Oct 22, 2024
1 parent abb1f36 commit b37436c
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private void readUsersFromAPIManager(UserFilter filter) throws AppException {
public List<User> getUsers(UserFilter filter) throws AppException {
readUsersFromAPIManager(filter);
try {
List<User> allUsers = mapper.readValue(this.apiManagerResponse.get(filter), new TypeReference<List<User>>() {
List<User> allUsers = mapper.readValue(this.apiManagerResponse.get(filter), new TypeReference<>() {
});
List<User> foundUsers = new ArrayList<>();
for (User user : allUsers) {
Expand Down Expand Up @@ -232,11 +232,11 @@ public void changePassword(String newPassword, User actualUser) throws AppExcept
if (statusCode != 204) {
LOG.error("Error changing password of user. Response-Code: {}", statusCode);
Utils.logPayload(LOG, httpResponse);
throw new AppException("Error changing password of user. Response-Code: " + statusCode, ErrorCode.ERROR_CHANGEPASSWORD);
throw new AppException("Error changing password of user. Response-Code: " + statusCode, ErrorCode.ERROR_CHANGE_PASSWORD);
}
}
} catch (Exception e) {
throw new AppException("Error changing password of user.", ErrorCode.ERROR_CHANGEPASSWORD, e);
throw new AppException("Error changing password of user.", ErrorCode.ERROR_CHANGE_PASSWORD, e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void logException(Logger logger) {
if (error == ErrorCode.SUCCESS || error == ErrorCode.CLI_PARSING)
return;
Throwable cause = null;
if (error.getPrintStackTrace().booleanValue() || logger.isDebugEnabled()) {
if (Boolean.TRUE.equals(error.getPrintStackTrace()) || logger.isDebugEnabled()) {
cause = this;
} else {
logger.info("You may enable debug to get more details. See: https://github.com/Axway-API-Management-Plus/apim-cli/wiki/9.1.-Enable-Debug");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public enum ErrorCode {
CANT_UPDATE_QUOTA_CONFIG(47, "Can't update Quota-Configuration."),
CANT_UPDATE_API_STATUS(50, "Can't update the API-Status."),
UNKNOWN_USER(51, "Unknown user given."),
ERROR_CHANGEPASSWORD(52, "Error changing password of user."),
ERROR_CHANGE_PASSWORD(52, "Error changing password of user."),
QUERY_STRING_ROUTING_DISABLED(53, "Query-String routing option in API-Manager is not enabled", false),
API_CONFIG_REQUIRES_QUERY_STRING(54, "The given API-Config needs a query string, as API-Manager has it enabled."),
CANT_UPGRADE_API_ACCESS(55, "Can't upgrade API-Access."),
Expand Down Expand Up @@ -74,18 +74,18 @@ public enum ErrorCode {

private final int code;
private final String description;
private final Boolean printStackTrace;
private final boolean printStackTrace;
private final LogLevel logLevel;

ErrorCode(int code, String description) {
this(code, description, false, LogLevel.ERROR);
}

ErrorCode(int code, String description, Boolean printStackTrace) {
ErrorCode(int code, String description, boolean printStackTrace) {
this(code, description, printStackTrace, LogLevel.ERROR);
}

ErrorCode(int code, String description, Boolean printStackTrace, LogLevel logLevel) {
ErrorCode(int code, String description, boolean printStackTrace, LogLevel logLevel) {
this.code = code;
this.description = description;
this.printStackTrace = printStackTrace;
Expand All @@ -100,7 +100,7 @@ public String getDescription() {
return description;
}

public Boolean getPrintStackTrace() {
public boolean getPrintStackTrace() {
return printStackTrace;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void serialize(APIQuota apiQuota, JsonGenerator jgen, SerializerProvider
apiQuota.setDescription(null);
apiQuota.setId(null);
apiQuota.setName(null);
apiQuota.setSystem(null);
apiQuota.setSystem(false);
apiQuota.setType(null);
for (QuotaRestriction restriction : apiQuota.getRestrictions()) {
restriction.setApiId(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void serialize(APIQuota quota, JsonGenerator jgen, SerializerProvider pro
quota.setId(null);
quota.setType(null);
quota.setDescription(null);
quota.setSystem(null);
quota.setSystem(false);
quota.setName(null);
defaultSerializer.serialize(quota, jgen, provider);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void printCustomProperties() {
new Column().header("Label").headerAlign(HorizontalAlign.LEFT).dataAlign(HorizontalAlign.LEFT).with(prop -> prop.getCustomProperty().getLabel()),
new Column().header("Type").headerAlign(HorizontalAlign.LEFT).dataAlign(HorizontalAlign.LEFT).with(prop -> prop.getCustomProperty().getType()),
new Column().header("Default-Value").headerAlign(HorizontalAlign.LEFT).dataAlign(HorizontalAlign.LEFT).with(prop -> prop.getCustomProperty().getDefaultValue()),
new Column().header("Required").headerAlign(HorizontalAlign.LEFT).dataAlign(HorizontalAlign.LEFT).with(prop -> prop.getCustomProperty().getRequired().toString()),
new Column().header("Required").headerAlign(HorizontalAlign.LEFT).dataAlign(HorizontalAlign.LEFT).with(prop -> String.valueOf(prop.getCustomProperty().getRequired())),
new Column().header("Options").headerAlign(HorizontalAlign.LEFT).dataAlign(HorizontalAlign.LEFT).with(this::getOptions),
new Column().header("RegEx").headerAlign(HorizontalAlign.LEFT).dataAlign(HorizontalAlign.LEFT).with(prop -> prop.getCustomProperty().getRegex())
)));
Expand Down

0 comments on commit b37436c

Please sign in to comment.