Skip to content

Commit

Permalink
[MODORDERS-1227]. Fix sonar issues
Browse files Browse the repository at this point in the history
  • Loading branch information
BKadirkhodjaev committed Jan 9, 2025
1 parent ccfba14 commit c8c8140
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 18 deletions.
10 changes: 0 additions & 10 deletions src/main/java/org/folio/rest/core/RestClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import io.vertx.core.MultiMap;
import io.vertx.core.Promise;
import io.vertx.core.buffer.Buffer;
import io.vertx.core.http.HttpMethod;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.web.client.HttpResponse;
import io.vertx.ext.web.client.WebClient;
Expand Down Expand Up @@ -46,7 +45,6 @@ public <T> Future<T> post(RequestEntry requestEntry, T entity, Class<T> response
}

public <T> Future<T> post(String endpoint, T entity, Class<T> responseType, RequestContext requestContext) {
log.debug("Sending 'POST {}", endpoint);
var caseInsensitiveHeader = convertToCaseInsensitiveMap(requestContext.getHeaders());
return getVertxWebClient(requestContext.getContext()).postAbs(buildAbsEndpoint(caseInsensitiveHeader, endpoint))
.putHeaders(caseInsensitiveHeader)
Expand All @@ -62,7 +60,6 @@ public <T> Future<T> post(String endpoint, T entity, Class<T> responseType, Requ
}

public <T> Future<Void> postEmptyResponse(String endpoint, T entity, RequestContext requestContext) {
log.debug("Sending 'POST {}", () -> endpoint);
var caseInsensitiveHeader = convertToCaseInsensitiveMap(requestContext.getHeaders());
return getVertxWebClient(requestContext.getContext())
.postAbs(buildAbsEndpoint(caseInsensitiveHeader, endpoint))
Expand All @@ -85,7 +82,6 @@ public <T> Future<Void> put(RequestEntry requestEntry, T dataObject, RequestCont
}
public <T> Future<Void> put(String endpoint, T dataObject, RequestContext requestContext) {
var recordData = JsonObject.mapFrom(dataObject);
log.debug("Sending 'PUT {}'", endpoint);
var caseInsensitiveHeader = convertToCaseInsensitiveMap(requestContext.getHeaders());
return getVertxWebClient(requestContext.getContext())
.putAbs(buildAbsEndpoint(caseInsensitiveHeader, endpoint))
Expand All @@ -102,7 +98,6 @@ public <T>Future<Void> patch(RequestEntry requestEntry, T dataObject, RequestCon
}

public <T>Future<Void> patch(String endpoint, T dataObject, RequestContext requestContext) {
log.debug("Sending 'PATCH {}'", endpoint);
var caseInsensitiveHeader = convertToCaseInsensitiveMap(requestContext.getHeaders());
Promise<Void> promise = Promise.promise();
return getVertxWebClient(requestContext.getContext())
Expand All @@ -121,7 +116,6 @@ public Future<Void> delete(RequestEntry requestEntry, boolean skipError404, Requ
}

public Future<Void> delete(String endpointById, boolean skipError404, RequestContext requestContext) {
log.debug("Sending {} {}", HttpMethod.DELETE, endpointById);
var caseInsensitiveHeader = convertToCaseInsensitiveMap(requestContext.getHeaders());
Promise<Void> promise = Promise.promise();
getVertxWebClient(requestContext.getContext())
Expand Down Expand Up @@ -171,7 +165,6 @@ public <T> Future<T> get(RequestEntry requestEntry, Class<T> responseType, Reque
}

public <T> Future<T> get(String endpoint, boolean skipError404, Class<T> responseType, RequestContext requestContext) {
log.debug("Calling GET {}", endpoint);
var caseInsensitiveHeader = convertToCaseInsensitiveMap(requestContext.getHeaders());
Promise<T> promise = Promise.promise();
getVertxWebClient(requestContext.getContext())
Expand All @@ -189,7 +182,6 @@ public <T> Future<T> get(String endpoint, boolean skipError404, Class<T> respons


public Future<JsonObject> getAsJsonObject(String endpoint, boolean skipError404, RequestContext requestContext) {
log.debug("Calling GET {}", endpoint);
Promise<JsonObject> promise = Promise.promise();
var caseInsensitiveHeader = convertToCaseInsensitiveMap(requestContext.getHeaders());
var webClient = getVertxWebClient(requestContext.getContext());
Expand Down Expand Up @@ -240,7 +232,6 @@ private String buildAbsEndpoint(MultiMap okapiHeaders, String endpoint) {
}

public Future<String> postJsonObjectAndGetId(RequestEntry requestEntry, JsonObject entity, RequestContext requestContext) {
log.debug("Sending 'POST {}", requestEntry.buildEndpoint());
var caseInsensitiveHeader = convertToCaseInsensitiveMap(requestContext.getHeaders());
return getVertxWebClient(requestContext.getContext())
.postAbs(buildAbsEndpoint(caseInsensitiveHeader, requestEntry.buildEndpoint()))
Expand All @@ -252,7 +243,6 @@ public Future<String> postJsonObjectAndGetId(RequestEntry requestEntry, JsonObje
}

public Future<JsonObject> postJsonObject(RequestEntry requestEntry, JsonObject jsonObject, RequestContext requestContext) {
log.debug("Sending 'POST {}", requestEntry.buildEndpoint());
var endpoint = requestEntry.buildEndpoint();
var caseInsensitiveHeader = convertToCaseInsensitiveMap(requestContext.getHeaders());
return getVertxWebClient(requestContext.getContext()).postAbs(buildAbsEndpoint(caseInsensitiveHeader, requestEntry.buildEndpoint()))
Expand Down
4 changes: 0 additions & 4 deletions src/main/java/org/folio/rest/impl/HoldingsSummaryAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

import javax.ws.rs.core.Response;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.folio.rest.annotations.Validate;
import org.folio.rest.core.models.RequestContext;
import org.folio.rest.jaxrs.resource.OrdersHoldingSummary;
Expand All @@ -22,8 +20,6 @@

public class HoldingsSummaryAPI extends BaseApi implements OrdersHoldingSummary {

private static final Logger logger = LogManager.getLogger();

@Autowired
private HoldingsSummaryService holdingsSummaryService;

Expand Down
3 changes: 0 additions & 3 deletions src/main/java/org/folio/rest/impl/PiecesAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import javax.ws.rs.core.Response;

import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.folio.rest.annotations.Validate;
import org.folio.rest.core.models.RequestContext;
import org.folio.rest.jaxrs.model.Piece;
Expand All @@ -32,7 +30,6 @@

public class PiecesAPI extends BaseApi implements OrdersPieces, OrdersPiecesRequests, OrdersPiecesBatch {

private static final Logger logger = LogManager.getLogger();
@Autowired
private PieceStorageService pieceStorageService;
@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void isPieceRequestValid(Piece pieceToCreate, CompositePurchaseOrder orig
combinedErrors.addAll(relatedOrderErrors);
if (CollectionUtils.isNotEmpty(combinedErrors)) {
Errors errors = new Errors().withErrors(combinedErrors).withTotalRecords(combinedErrors.size());
logger.error("Validation error: {}", JsonObject.mapFrom(errors).encodePrettily());
if (logger.isErrorEnabled()) logger.error("Validation error: {}", JsonObject.mapFrom(errors).encodePrettily());
throw new HttpException(RestConstants.BAD_REQUEST, errors);
}
}
Expand Down

0 comments on commit c8c8140

Please sign in to comment.