Skip to content

Commit

Permalink
feat: sonar fixes and using spring boot dependency management
Browse files Browse the repository at this point in the history
  • Loading branch information
rajadilipkolli committed Nov 25, 2023
1 parent 81dd4db commit 8a0943e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 0 additions & 3 deletions catalog-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
<maven-checkstyle-plugin.version>3.3.1</maven-checkstyle-plugin.version>
<spotless.version>2.40.0</spotless.version>
<maven-pmd-plugin.version>3.16.0</maven-pmd-plugin.version>
<okhttp3.version>4.12.0</okhttp3.version>

<dependency-check-maven.version>9.0.0</dependency-check-maven.version>

Expand Down Expand Up @@ -230,13 +229,11 @@
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>${okhttp3.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>mockwebserver</artifactId>
<version>${okhttp3.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ public void updateOrderFromOrderRequest(OrderRequest orderRequest, Order order)
newOrderItems.forEach(order::addOrderItem);
}

// Manual Merge instead of using OrderItem mergedBook = orderItemRepository.save(orderItem);
// Manual Merge instead of using `var mergedBook = orderItemRepository.save(orderItem)` which
// calls save in middle of transaction
private Long getOrderItemId(List<OrderItem> items, OrderItem orderItem) {
return items.stream()
.filter(item -> Objects.equals(item.getProductCode(), orderItem.getProductCode()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Licensed under MIT License Copyright (c) 2021-2023 Raja Kolli.
import java.net.URI;
import java.util.List;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
Expand All @@ -39,6 +40,7 @@ Licensed under MIT License Copyright (c) 2021-2023 Raja Kolli.
@RequestMapping("/api/orders")
@RequiredArgsConstructor
@Validated
@Slf4j
public class OrderController implements OrderApi {

private final OrderService orderService;
Expand Down Expand Up @@ -71,6 +73,7 @@ public ResponseEntity<OrderResponse> getOrderById(@PathVariable Long id) {
}

public ResponseEntity<String> hardcodedResponse(Long id, Exception ex) {
log.error("Exception occurred ", ex);
return ResponseEntity.ok("fallback-response for id : " + id);
}

Expand Down

0 comments on commit 8a0943e

Please sign in to comment.