Skip to content

LAB DONE#32

Open
vRUZIx wants to merge 2 commits intoironhack-labs:mainfrom
vRUZIx:main
Open

LAB DONE#32
vRUZIx wants to merge 2 commits intoironhack-labs:mainfrom
vRUZIx:main

Conversation

@vRUZIx
Copy link

@vRUZIx vRUZIx commented Feb 25, 2026

No description provided.

Copilot AI review requested due to automatic review settings February 25, 2026 19:29
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a multi-module Maven project for lab 2.02, which demonstrates order processing using JSON data. The implementation creates a parent POM with two child modules: order-data (handles JSON parsing of orders) and order-logic (applies business logic to calculate order totals).

Changes:

  • Created parent POM with dependency management for Gson and SLF4J libraries
  • Implemented order-data module with Order, OrderItem, and OrderProcessor classes using Gson for JSON deserialization
  • Implemented order-logic module with OrderCalculator class to compute grand totals across multiple orders

Reviewed changes

Copilot reviewed 16 out of 38 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
solution-lab-2.02-maven/pom.xml Parent POM configuration with module declarations and dependency management
solution-lab-2.02-maven/order-data/pom.xml Child module POM with Gson dependency and exec-maven-plugin configuration
solution-lab-2.02-maven/order-data/src/main/java/* Data model classes (Order, OrderItem) and JSON processing (OrderProcessor, Main)
solution-lab-2.02-maven/order-logic/pom.xml Child module POM with dependency on order-data module
solution-lab-2.02-maven/order-logic/src/main/java/* Business logic implementation (OrderCalculator, Main)
solution-lab-2.02-maven/src/main/java/com/ironhack/Main.java Placeholder Main class in parent (should be removed)
solution-lab-2.02-maven/.idea/* IDE configuration files (should not be in version control)
solution-lab-2.02-maven/order-data/target/* Build artifacts (should not be in version control)
solution-lab-2.02-maven/order-logic/target/* Build artifacts (should not be in version control)
.idea/* Root IDE configuration files (should not be in version control)
Files not reviewed (12)
  • .idea/.gitignore: Language not supported
  • .idea/compiler.xml: Language not supported
  • .idea/lab-java-maven-main.iml: Language not supported
  • .idea/misc.xml: Language not supported
  • .idea/modules.xml: Language not supported
  • .idea/vcs.xml: Language not supported
  • solution-lab-2.02-maven/.idea/.gitignore: Language not supported
  • solution-lab-2.02-maven/.idea/compiler.xml: Language not supported
  • solution-lab-2.02-maven/.idea/encodings.xml: Language not supported
  • solution-lab-2.02-maven/.idea/jarRepositories.xml: Language not supported
  • solution-lab-2.02-maven/.idea/misc.xml: Language not supported
  • solution-lab-2.02-maven/.idea/vcs.xml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to +2
C:\Users\nihad\Desktop\ITSkillSprint\LABs\lab4\lab-java-maven\solution-lab-2.02-maven\order-logic\src\main\java\com\ironhack\Main.java
C:\Users\nihad\Desktop\ITSkillSprint\LABs\lab4\lab-java-maven\solution-lab-2.02-maven\order-logic\src\main\java\com\ironhack\OrderCalculator.java
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file contains absolute file paths specific to the developer's local machine (C:\Users\nihad\Desktop...). Build artifacts with absolute paths should not be committed to version control as they will not work on other machines and expose the developer's local file system structure. Add the target/ directory to .gitignore to prevent these files from being tracked.

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +9
package com.ironhack;

//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
public static void main(String[] args) {

}
} No newline at end of file
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Main.java file appears to be a placeholder with an empty main method and IDE-generated comments. Since the parent POM has packaging type 'pom' (a multi-module aggregator), it should not contain source code. This file and the entire src directory should be removed from the parent project as only the child modules should contain source code.

Copilot uses AI. Check for mistakes.
Comment on lines +7 to +12
public Order processOrder(String orderData) {
Gson gson = new Gson();

Order order = gson.fromJson(orderData, Order.class);
return order;
}
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The processOrder method lacks input validation. If orderData is null or malformed JSON, gson.fromJson() could throw exceptions or return null. Consider adding validation to check if orderData is null or empty, and handle JsonSyntaxException to provide meaningful error messages.

Copilot uses AI. Check for mistakes.
Comment on lines +8 to +10
BigDecimal grandTotal = BigDecimal.ZERO;
for(Order order : orders){
grandTotal = grandTotal.add(order.getOrderTotal());
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The calculateGrandTotal method lacks null safety checks. If the orders list is null or contains null Order elements, this will throw a NullPointerException. Consider adding validation to check if orders is null before iterating, and handle null elements within the list.

Suggested change
BigDecimal grandTotal = BigDecimal.ZERO;
for(Order order : orders){
grandTotal = grandTotal.add(order.getOrderTotal());
if (orders == null) {
return BigDecimal.ZERO;
}
BigDecimal grandTotal = BigDecimal.ZERO;
for (Order order : orders){
if (order != null) {
grandTotal = grandTotal.add(order.getOrderTotal());
}

Copilot uses AI. Check for mistakes.

public void printOrderItems(){
System.out.println("List of Items: ");
for(OrderItem item : orderItems){
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The printOrderItems method will throw a NullPointerException if orderItems is null or contains null elements. Add null checks before iterating over the orderItems list and handle null items within the loop.

Suggested change
for(OrderItem item : orderItems){
if (orderItems == null || orderItems.isEmpty()) {
System.out.println("No items in this order.");
return;
}
for (OrderItem item : orderItems) {
if (item == null) {
System.out.println("Item: null");
continue;
}

Copilot uses AI. Check for mistakes.
package com.ironhack;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The import statement for GsonBuilder is unused. It should be removed to keep the code clean and avoid unnecessary imports.

Suggested change
import com.google.gson.GsonBuilder;

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +10
# Default ignored files
/shelf/
/workspace.xml
# Ignored default folder with query files
/queries/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IDE-specific configuration files (.idea directory) should not be committed to version control as they are specific to individual development environments and can cause conflicts between team members using different IDE configurations. Consider adding .idea/ to .gitignore.

Copilot uses AI. Check for mistakes.
Comment on lines +10 to +11
Order order = gson.fromJson(orderData, Order.class);
return order;
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intermediate variable 'order' is unnecessary. Consider simplifying this method by directly returning the result of gson.fromJson() instead of storing it in a variable first.

Suggested change
Order order = gson.fromJson(orderData, Order.class);
return order;
return gson.fromJson(orderData, Order.class);

Copilot uses AI. Check for mistakes.
Comment on lines +3 to +5
import com.ironhack.Order;
import com.ironhack.OrderProcessor;

Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The imports for Order and OrderProcessor are redundant because they are in the same package (com.ironhack). They should be removed as same-package classes don't need to be explicitly imported.

Suggested change
import com.ironhack.Order;
import com.ironhack.OrderProcessor;

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants