Skip to content

Commit

Permalink
Fix sonar issues
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanChernetskyi committed Jun 24, 2024
1 parent a190ced commit cadcd08
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/main/java/org/folio/inventory/resources/MoveApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,9 @@ private void updateItems(RoutingContext routingContext, WebContext context, List
}

private List<HoldingsRecord> updateInstanceIdForHoldings(String toInstanceId, List<JsonObject> jsons) {
jsons.forEach(MoveApiUtil::removeExtraRedundantFields);

return jsons.stream()
.peek(MoveApiUtil::removeExtraRedundantFields)
.map(json -> json.mapTo(HoldingsRecord.class))
.map(holding -> holding.withInstanceId(toInstanceId))
.collect(toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static Optional<ValidationError> updateOwnershipHasRequiredFields(String
List<String> requiredFields = Arrays.stream(updateOwnershipClass.getDeclaredFields()).map(Field::getName).toList();
for (String field: requiredFields) {
var value = updateOwnershipRequest.getValue(field);
if (value == null || (value instanceof JsonArray && ((JsonArray) value).isEmpty())) {
if (value == null || (value instanceof JsonArray jsonArray && jsonArray.isEmpty())) {
return Optional.of(new ValidationError(field + " is a required field", field, null));
}
}
Expand Down

0 comments on commit cadcd08

Please sign in to comment.