Skip to content

Commit 9659ffb

Browse files
committed
Fix: reverts changes to Product and Order.Java files
1 parent 651165f commit 9659ffb

File tree

2 files changed

+0
-24
lines changed
  • lesson_14/exceptions/exceptions_app/src/main/java/com/codedifferently/lesson14/ecommerce

2 files changed

+0
-24
lines changed

lesson_14/exceptions/exceptions_app/src/main/java/com/codedifferently/lesson14/ecommerce/Order.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,14 @@ public Order(String orderId, Product product, int quantity) {
1212
}
1313

1414
public String getOrderId() throws OrderNotFoundException {
15-
if (orderId == null) {
16-
throw new OrderNotFoundException("This order does not match any in our records");
17-
}
1815
return orderId;
1916
}
2017

2118
public Product getProduct() throws OrderNotFoundException {
22-
if (product == null) {
23-
throw new OrderNotFoundException("This Product is not in our system.");
24-
}
2519
return product;
2620
}
2721

2822
public int getQuantity() throws OrderNotFoundException {
29-
if (quantity == 0) {
30-
throw new OrderNotFoundException("Out of Stock.");
31-
}
32-
3323
return quantity;
3424
}
3525
}

lesson_14/exceptions/exceptions_app/src/main/java/com/codedifferently/lesson14/ecommerce/Product.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,10 @@ public Product(String productId, String name) {
1010
}
1111

1212
public String getProductId() {
13-
if (productId == null) {
14-
try {
15-
throw new ProductNotFoundException("The product ID can not be found.");
16-
} catch (ProductNotFoundException e) {
17-
System.out.println(e);
18-
}
19-
}
2013
return productId;
2114
}
2215

2316
public String getName() {
24-
if (name == null) {
25-
try {
26-
throw new ProductNotFoundException("Nothing matches that name");
27-
} catch (ProductNotFoundException e) {
28-
System.out.println(e);
29-
}
30-
}
3117
return name;
3218
}
3319
}

0 commit comments

Comments
 (0)