From d0a459125e57bda70df4a024d4775fea92e09382 Mon Sep 17 00:00:00 2001
From: Dexter Hoon
Date: Tue, 31 Oct 2023 05:53:24 +0800
Subject: [PATCH 1/8] Remove error handling from main and redundant code
---
src/main/java/seedu/cafectrl/CafeCtrl.java | 8 +++++---
.../java/seedu/cafectrl/storage/FileManager.java | 3 ---
src/main/java/seedu/cafectrl/storage/Storage.java | 15 +++++++++------
3 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/src/main/java/seedu/cafectrl/CafeCtrl.java b/src/main/java/seedu/cafectrl/CafeCtrl.java
index 6b3e52b94c..73e667f4a1 100644
--- a/src/main/java/seedu/cafectrl/CafeCtrl.java
+++ b/src/main/java/seedu/cafectrl/CafeCtrl.java
@@ -7,6 +7,7 @@
import seedu.cafectrl.data.Sales;
import seedu.cafectrl.parser.Parser;
import seedu.cafectrl.storage.Storage;
+import seedu.cafectrl.ui.ErrorMessages;
import seedu.cafectrl.ui.Messages;
import seedu.cafectrl.ui.Ui;
@@ -29,7 +30,7 @@ public class CafeCtrl {
/**
* Private constructor for the CafeCtrl class, used for initializing the user interface and menu list.
*/
- private CafeCtrl() throws FileNotFoundException {
+ private CafeCtrl() {
this.ui = new Ui();
this.ui.showToUser(Messages.INITIALISE_STORAGE_MESSAGE);
this.storage = new Storage(this.ui);
@@ -49,7 +50,7 @@ private void setup() {
* This method consistently receives user input, parses commands, and executes the respective command
* until the user enters a "bye" command, terminating the application.
*/
- private void run() throws IOException {
+ private void run() {
ui.printLine();
do {
try {
@@ -62,10 +63,11 @@ private void run() throws IOException {
ui.printLine();
}
} while (!command.isExit());
+
this.storage.saveAll(this.menu, this.sales, this.pantry);
}
- public static void main(String[] args) throws IOException {
+ public static void main(String[] args) {
CafeCtrl cafeCtrl = new CafeCtrl();
cafeCtrl.setup();
cafeCtrl.run();
diff --git a/src/main/java/seedu/cafectrl/storage/FileManager.java b/src/main/java/seedu/cafectrl/storage/FileManager.java
index 8269d8df0d..8ff11f71fd 100644
--- a/src/main/java/seedu/cafectrl/storage/FileManager.java
+++ b/src/main/java/seedu/cafectrl/storage/FileManager.java
@@ -49,7 +49,6 @@ public ArrayList readTextFile(String filePath) {
return textLines;
}
- //@@author DextheChik3n
/**
* Handles opening and creating (if needed) the text file and folder
* @param filePath the file path that is passed in main
@@ -96,7 +95,6 @@ public void overwriteFile(String filePath, ArrayList listOfTextToAdd) th
fw.close();
}
- //@@author DextheChik3n
/**
* Writes text to the text file at the specified file path.
* Will overwrite all text in text file.
@@ -111,7 +109,6 @@ public void overwriteFile(String filePath, String textToAdd) throws IOException
fw.close();
}
- //@@author DextheChik3n
/**
* Appends text to the text file at the specified file path.
* Will add text to text file.
diff --git a/src/main/java/seedu/cafectrl/storage/Storage.java b/src/main/java/seedu/cafectrl/storage/Storage.java
index 6c866d2b40..4c5f8b6a84 100644
--- a/src/main/java/seedu/cafectrl/storage/Storage.java
+++ b/src/main/java/seedu/cafectrl/storage/Storage.java
@@ -59,13 +59,16 @@ public Sales loadSales() {
* @param menu menu from current session
* @param sales sales from current session
* @param pantry pantry from current session
- * @throws IOException if the file is not found in the specified file path
*/
- public void saveAll(Menu menu, Sales sales, Pantry pantry) throws IOException {
- // to be uncommented when the following features are implemented
- //saveMenu(menu);
- //saveSales(sales);
- savePantryStock(pantry);
+ public void saveAll(Menu menu, Sales sales, Pantry pantry) {
+ try {
+ // to be uncommented when the following features are implemented
+ //saveMenu(menu);
+ //saveSales(sales);
+ savePantryStock(pantry);
+ } catch (IOException e) {
+ ui.showToUser("Insert error message here: if the file is not found in the specified file path");
+ }
}
//@@author ziyi105
From 818b1b37a5cea3e6777053c10a64ac0871dce6d0 Mon Sep 17 00:00:00 2001
From: Dexter Hoon
Date: Wed, 1 Nov 2023 16:15:56 +0800
Subject: [PATCH 2/8] Edit error handling in main CafeCtrl class
---
src/main/java/seedu/cafectrl/CafeCtrl.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/main/java/seedu/cafectrl/CafeCtrl.java b/src/main/java/seedu/cafectrl/CafeCtrl.java
index 625b2e0dfe..4be6f20b3d 100644
--- a/src/main/java/seedu/cafectrl/CafeCtrl.java
+++ b/src/main/java/seedu/cafectrl/CafeCtrl.java
@@ -12,6 +12,7 @@
import seedu.cafectrl.ui.Messages;
import seedu.cafectrl.ui.Ui;
+import java.io.FileNotFoundException;
import java.io.IOException;
/**
@@ -35,13 +36,15 @@ private CafeCtrl() {
this.ui = new Ui();
this.ui.showToUser(Messages.INITIALISE_STORAGE_MESSAGE);
this.storage = new Storage(this.ui);
- currentDate = new CurrentDate();
+ this.currentDate = new CurrentDate();
this.sales = new Sales();
try {
this.menu = this.storage.loadMenu();
this.pantry = this.storage.loadPantryStock();
this.sales = this.storage.loadOrderList(menu);
+ } catch (FileNotFoundException e) {
+ System.out.println("print error for FileNotFoundException");
} catch (IOException e) {
System.out.println("print error for IOException");
}
From 4f7cfe1cf5f25608e5ef3ce380cf1a957a3eafb6 Mon Sep 17 00:00:00 2001
From: Dexter Hoon
Date: Wed, 1 Nov 2023 18:24:18 +0800
Subject: [PATCH 3/8] Edit error handling for file storage functionality
---
src/main/java/seedu/cafectrl/CafeCtrl.java | 27 ++-------
.../seedu/cafectrl/storage/FileManager.java | 56 ++++++++-----------
.../java/seedu/cafectrl/storage/Storage.java | 55 +++++++++++-------
.../java/seedu/cafectrl/ui/ErrorMessages.java | 9 ++-
src/test/java/seedu/cafectrl/DukeTest.java | 12 ----
5 files changed, 71 insertions(+), 88 deletions(-)
delete mode 100644 src/test/java/seedu/cafectrl/DukeTest.java
diff --git a/src/main/java/seedu/cafectrl/CafeCtrl.java b/src/main/java/seedu/cafectrl/CafeCtrl.java
index 4be6f20b3d..980e6d2988 100644
--- a/src/main/java/seedu/cafectrl/CafeCtrl.java
+++ b/src/main/java/seedu/cafectrl/CafeCtrl.java
@@ -34,24 +34,13 @@ public class CafeCtrl {
private CafeCtrl() {
this.ui = new Ui();
- this.ui.showToUser(Messages.INITIALISE_STORAGE_MESSAGE);
+ this.ui.showToUser(System.lineSeparator(), Messages.INITIALISE_STORAGE_MESSAGE, System.lineSeparator());
this.storage = new Storage(this.ui);
this.currentDate = new CurrentDate();
this.sales = new Sales();
-
- try {
- this.menu = this.storage.loadMenu();
- this.pantry = this.storage.loadPantryStock();
- this.sales = this.storage.loadOrderList(menu);
- } catch (FileNotFoundException e) {
- System.out.println("print error for FileNotFoundException");
- } catch (IOException e) {
- System.out.println("print error for IOException");
- }
- }
-
- private void setup() {
- ui.showWelcome();
+ this.menu = this.storage.loadMenu();
+ this.pantry = this.storage.loadPantryStock();
+ this.sales = this.storage.loadOrderList(menu);
}
/**
@@ -61,6 +50,7 @@ private void setup() {
* until the user enters a "bye" command, terminating the application.
*/
private void run() {
+ ui.showWelcome();
ui.printLine();
do {
try {
@@ -75,16 +65,11 @@ private void run() {
}
} while (!command.isExit());
- try {
- this.storage.saveAll(this.menu, this.sales, this.pantry);
- } catch (IOException e) {
- System.out.println("print error for IOException");
- }
+ this.storage.saveAll(this.menu, this.sales, this.pantry);
}
public static void main(String[] args) {
CafeCtrl cafeCtrl = new CafeCtrl();
- cafeCtrl.setup();
cafeCtrl.run();
}
diff --git a/src/main/java/seedu/cafectrl/storage/FileManager.java b/src/main/java/seedu/cafectrl/storage/FileManager.java
index 7c009b5cbc..7c9600a9c7 100644
--- a/src/main/java/seedu/cafectrl/storage/FileManager.java
+++ b/src/main/java/seedu/cafectrl/storage/FileManager.java
@@ -12,7 +12,7 @@
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Scanner;
-
+//@@author DextheChik3n
/**
* Manage everything related to file such as writing, reading, opening and creating file
*/
@@ -23,65 +23,51 @@ public FileManager(Ui ui) {
this.ui = ui;
}
- //@@author DextheChik3n
/**
* Reads the text file from the specified file path and stores each line in an ArrayList.
*
* @return ArrayList that consists of every text line in each element
+ * @throws FileNotFoundException if text file at the specified file path does not exist
*/
public ArrayList readTextFile(String filePath) throws FileNotFoundException {
- openTextFile(filePath);
String userWorkingDirectory = System.getProperty("user.dir");
- Path tasksFilePath = Paths.get(userWorkingDirectory, filePath);
- File textFile = new File(String.valueOf(tasksFilePath));
-
- if (textFile.length() < 0) {
- throw new FileNotFoundException();
- }
-
+ Path dataFilePath = Paths.get(userWorkingDirectory, filePath);
+ File textFile = new File(String.valueOf(dataFilePath));
ArrayList textLines = new ArrayList<>();
- // todo Dexter: implement proper error handling here
- try {
- Scanner s = new Scanner(textFile);
- while (s.hasNext()){
- textLines.add(s.nextLine());
- }
+ Scanner s = new Scanner(textFile);
- s.close();
- } catch (FileNotFoundException e) {
- ui.showToUser(ErrorMessages.DATA_FILE_NOT_FOUND_MESSAGE);
+ while (s.hasNext()) {
+ textLines.add(s.nextLine());
}
+
+ s.close();
+
return textLines;
}
/**
- * Handles opening and creating (if needed) the text file and folder
- * @param filePath the file path that is passed in main
- * @return the file path of where the data is stored
- * @throws IOException if an I/O error occurred while creating the text file
+ * Checks if the text file and folder exists in the user's system and creates them (if needed)
+ * @return true if and only if file exists, false otherwise
+ * @param filePath the specified path location of the file
*/
- public String openTextFile(String filePath) {
+ public void checkFileExists(String filePath) throws IOException {
String userWorkingDirectory = System.getProperty("user.dir");
Path dataFilePath = Paths.get(userWorkingDirectory, filePath);
Path dataFolderPath = dataFilePath.getParent();
File textFile = new File(String.valueOf(dataFilePath));
File folder = new File(String.valueOf(dataFolderPath));
+ //Check if data folder exists
if (!Files.exists(dataFolderPath)) {
folder.mkdir();
- ui.showToUser(ErrorMessages.DATA_FOLDER_NOT_FOUND_MESSAGE);
+ ui.showToUser(ErrorMessages.DATA_FOLDER_NOT_FOUND_MESSAGE, System.lineSeparator());
}
+ //Check if the file at the specified file path exists
if (!Files.exists(dataFilePath)) {
- try {
- textFile.createNewFile();
- } catch (Exception e) {
- ui.showToUser(ErrorMessages.DATA_FILE_NOT_FOUND_MESSAGE);
- }
+ textFile.createNewFile();
}
-
- return dataFilePath.toString();
}
/**
@@ -93,8 +79,8 @@ public String openTextFile(String filePath) {
* @throws IOException If I/O operations are interrupted.
*/
public void overwriteFile(String filePath, ArrayList listOfTextToAdd) throws IOException {
- String openFilePath = openTextFile(filePath);
- FileWriter fw = new FileWriter(openFilePath);
+ checkFileExists(filePath);
+ FileWriter fw = new FileWriter(filePath);
for (String line : listOfTextToAdd) {
fw.write(line);
}
@@ -110,6 +96,7 @@ public void overwriteFile(String filePath, ArrayList listOfTextToAdd) th
* @throws IOException If I/O operations are interrupted.
*/
public void overwriteFile(String filePath, String textToAdd) throws IOException {
+ checkFileExists(filePath);
FileWriter fw = new FileWriter(filePath);
fw.write(textToAdd);
fw.close();
@@ -124,6 +111,7 @@ public void overwriteFile(String filePath, String textToAdd) throws IOException
* @throws IOException If I/O operations are interrupted.
*/
public void appendToFile(String filePath, String textToAdd) throws IOException {
+ checkFileExists(filePath);
FileWriter fw = new FileWriter(filePath, true);
fw.write(textToAdd);
fw.close();
diff --git a/src/main/java/seedu/cafectrl/storage/Storage.java b/src/main/java/seedu/cafectrl/storage/Storage.java
index 5a9e2d0e9d..85f9c54bd3 100644
--- a/src/main/java/seedu/cafectrl/storage/Storage.java
+++ b/src/main/java/seedu/cafectrl/storage/Storage.java
@@ -3,6 +3,7 @@
import seedu.cafectrl.data.Menu;
import seedu.cafectrl.data.Pantry;
import seedu.cafectrl.data.Sales;
+import seedu.cafectrl.ui.ErrorMessages;
import seedu.cafectrl.ui.Ui;
import java.io.FileNotFoundException;
@@ -15,9 +16,11 @@
*/
public class Storage {
protected FileManager fileManager;
+ protected Ui ui;
public Storage (Ui ui) {
this.fileManager = new FileManager(ui);
+ this.ui = ui;
}
//@@author ShaniceTang
@@ -25,12 +28,15 @@ public Storage (Ui ui) {
* Loads menu data from a text file, decodes it, and returns it as a Menu object.
*
* @return A Menu object containing data from the file.
- * @throws IOException if the file is not found in the specified file path.
*/
- public Menu loadMenu() throws IOException {
- fileManager.openTextFile(FilePath.MENU_FILE_PATH);
- ArrayList encodedMenu = fileManager.readTextFile(FilePath.MENU_FILE_PATH);
- return Decoder.decodeMenuData(encodedMenu);
+ public Menu loadMenu() {
+ try {
+ ArrayList encodedMenu = fileManager.readTextFile(FilePath.MENU_FILE_PATH);
+ return Decoder.decodeMenuData(encodedMenu);
+ } catch (FileNotFoundException e) {
+ ui.showToUser(ErrorMessages.MENU_FILE_NOT_FOUND_MESSAGE, System.lineSeparator());
+ return new Menu();
+ }
}
/**
@@ -48,9 +54,14 @@ private void saveMenu(Menu menu) throws IOException {
* Read and decode pantryStock data from text file and pass it to the menu
* @return pantryStock with data from the file
*/
- public Pantry loadPantryStock() throws FileNotFoundException {
- ArrayList encodedPantryStock = this.fileManager.readTextFile(FilePath.PANTRY_STOCK_FILE_PATH);
- return Decoder.decodePantryStockData(encodedPantryStock);
+ public Pantry loadPantryStock() {
+ try {
+ ArrayList encodedPantryStock = this.fileManager.readTextFile(FilePath.PANTRY_STOCK_FILE_PATH);
+ return Decoder.decodePantryStockData(encodedPantryStock);
+ } catch (FileNotFoundException e) {
+ ui.showToUser(ErrorMessages.PANTRY_FILE_NOT_FOUND_MESSAGE, System.lineSeparator());
+ return new Pantry(ui);
+ }
}
/**
@@ -67,12 +78,15 @@ private void savePantryStock(Pantry pantry) throws IOException {
* Loads order lists from a text file, decodes it, and returns it as a Sales object.
*
* @return An OrderList object containing data from the file.
- * @throws IOException if the file is not found in the specified file path.
*/
- public Sales loadOrderList(Menu menu) throws IOException {
- fileManager.openTextFile(FilePath.ORDERS_FILE_PATH);
- ArrayList encodedOrderList = fileManager.readTextFile(FilePath.ORDERS_FILE_PATH);
- return Decoder.decodeSales(encodedOrderList, menu);
+ public Sales loadOrderList(Menu menu) {
+ try {
+ ArrayList encodedOrderList = fileManager.readTextFile(FilePath.ORDERS_FILE_PATH);
+ return Decoder.decodeSales(encodedOrderList, menu);
+ } catch (FileNotFoundException e) {
+ ui.showToUser(ErrorMessages.ORDER_LIST_FILE_NOT_FOUND_MESSAGE, System.lineSeparator());
+ return new Sales();
+ }
}
/**
@@ -91,13 +105,16 @@ private void saveOrderList(Sales sales) throws IOException {
* @param menu menu from current session
* @param sales sale object from current session
* @param pantry pantry from current session
- * @throws IOException if the file is not found in the specified file path
*/
- public void saveAll(Menu menu, Sales sales, Pantry pantry) throws IOException {
- saveMenu(menu);
- saveOrderList(sales);
- saveMenu(menu);
- savePantryStock(pantry);
+ public void saveAll(Menu menu, Sales sales, Pantry pantry) {
+ try {
+ saveMenu(menu);
+ saveOrderList(sales);
+ saveMenu(menu);
+ savePantryStock(pantry);
+ } catch (IOException e) {
+ ui.showToUser(e.getMessage());
+ }
}
}
diff --git a/src/main/java/seedu/cafectrl/ui/ErrorMessages.java b/src/main/java/seedu/cafectrl/ui/ErrorMessages.java
index e74966f12d..e8896d07b8 100644
--- a/src/main/java/seedu/cafectrl/ui/ErrorMessages.java
+++ b/src/main/java/seedu/cafectrl/ui/ErrorMessages.java
@@ -24,11 +24,16 @@ public class ErrorMessages {
public static final String INVALID_ADD_ORDER_FORMAT_MESSAGE = "Error: Incorrect format for the add order command.";
public static final String DATA_FOLDER_NOT_FOUND_MESSAGE = "Data Folder was not found!\nIt's ok... "
+ "a new data folder has been created.";
- public static final String DATA_FILE_NOT_FOUND_MESSAGE = "text file was not found!\nIt's ok... "
- + "a new data file has been created.";
public static final String DISH_NOT_FOUND = "I'm sorry, but it appears that dish is so exclusive "
+ "it hasn't even made it to our menu yet!";
public static final String ERROR_IN_PANTRY_STOCK_DATA = "Error in pantry stock data file! Skipping this " +
"particular ingredient!";
public static final String UNIT_NOT_MATCHING = "Sorry, you have used a different unit for this ingredient!";
+
+ public static final String MENU_FILE_NOT_FOUND_MESSAGE = "Menu data was not found!\n"
+ + "No worries, new menu has been created";
+ public static final String PANTRY_FILE_NOT_FOUND_MESSAGE = "Pantry stock data was not found!\n"
+ + "No worries, new pantry has been created";
+ public static final String ORDER_LIST_FILE_NOT_FOUND_MESSAGE = "Order list data was not found!\n"
+ + "No worries, new order list has been created";
}
diff --git a/src/test/java/seedu/cafectrl/DukeTest.java b/src/test/java/seedu/cafectrl/DukeTest.java
deleted file mode 100644
index 23f911598f..0000000000
--- a/src/test/java/seedu/cafectrl/DukeTest.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package seedu.cafectrl;
-
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import org.junit.jupiter.api.Test;
-
-class DukeTest {
- @Test
- public void sampleTest() {
- assertTrue(true);
- }
-}
From 5115b8b25034bdf64ca9dfe329bb5befc1e7090f Mon Sep 17 00:00:00 2001
From: Dexter Hoon
Date: Wed, 1 Nov 2023 18:35:17 +0800
Subject: [PATCH 4/8] Resolve checkstyle errors
---
src/main/java/seedu/cafectrl/CafeCtrl.java | 5 -----
src/main/java/seedu/cafectrl/storage/FileManager.java | 1 -
2 files changed, 6 deletions(-)
diff --git a/src/main/java/seedu/cafectrl/CafeCtrl.java b/src/main/java/seedu/cafectrl/CafeCtrl.java
index 980e6d2988..cba3c4bdd1 100644
--- a/src/main/java/seedu/cafectrl/CafeCtrl.java
+++ b/src/main/java/seedu/cafectrl/CafeCtrl.java
@@ -8,13 +8,9 @@
import seedu.cafectrl.parser.Parser;
import seedu.cafectrl.parser.ParserUtil;
import seedu.cafectrl.storage.Storage;
-import seedu.cafectrl.ui.ErrorMessages;
import seedu.cafectrl.ui.Messages;
import seedu.cafectrl.ui.Ui;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-
/**
* CafeCtrl application's entry point.
* Initializes the application and starts the interaction with the user.
@@ -34,7 +30,6 @@ public class CafeCtrl {
private CafeCtrl() {
this.ui = new Ui();
- this.ui.showToUser(System.lineSeparator(), Messages.INITIALISE_STORAGE_MESSAGE, System.lineSeparator());
this.storage = new Storage(this.ui);
this.currentDate = new CurrentDate();
this.sales = new Sales();
diff --git a/src/main/java/seedu/cafectrl/storage/FileManager.java b/src/main/java/seedu/cafectrl/storage/FileManager.java
index 7c9600a9c7..c87047c2f2 100644
--- a/src/main/java/seedu/cafectrl/storage/FileManager.java
+++ b/src/main/java/seedu/cafectrl/storage/FileManager.java
@@ -48,7 +48,6 @@ public ArrayList readTextFile(String filePath) throws FileNotFoundExcept
/**
* Checks if the text file and folder exists in the user's system and creates them (if needed)
- * @return true if and only if file exists, false otherwise
* @param filePath the specified path location of the file
*/
public void checkFileExists(String filePath) throws IOException {
From df8de17fe11838dae6673191f217b201ea55cab4 Mon Sep 17 00:00:00 2001
From: Dexter Hoon
Date: Wed, 1 Nov 2023 19:41:30 +0800
Subject: [PATCH 5/8] Resolve issues found when pulling code from local repo
---
data/orders.txt | 6 ------
src/main/java/seedu/cafectrl/CafeCtrl.java | 2 +-
src/main/java/seedu/cafectrl/storage/Decoder.java | 2 +-
src/main/java/seedu/cafectrl/storage/Storage.java | 1 +
4 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/data/orders.txt b/data/orders.txt
index 6da5fe95da..e69de29bb2 100644
--- a/data/orders.txt
+++ b/data/orders.txt
@@ -1,6 +0,0 @@
-1 | chicken rice | 2 | 4.0 | true
-1 | chicken roast | 2 | 4.0 | true
-1 | chicken roast | 2 | 4.0 | true
-2 | chicken rice | 2 | 4.0 | true
-2 | chicken roast | 2 | 4.0 | true
-2 | chicken roast | 8 | 16.0 | false
diff --git a/src/main/java/seedu/cafectrl/CafeCtrl.java b/src/main/java/seedu/cafectrl/CafeCtrl.java
index 86968b488b..cba3c4bdd1 100644
--- a/src/main/java/seedu/cafectrl/CafeCtrl.java
+++ b/src/main/java/seedu/cafectrl/CafeCtrl.java
@@ -34,7 +34,7 @@ private CafeCtrl() {
this.currentDate = new CurrentDate();
this.sales = new Sales();
this.menu = this.storage.loadMenu();
- this.pantry = this.storage.loadPantryStock(menu);
+ this.pantry = this.storage.loadPantryStock();
this.sales = this.storage.loadOrderList(menu);
}
diff --git a/src/main/java/seedu/cafectrl/storage/Decoder.java b/src/main/java/seedu/cafectrl/storage/Decoder.java
index 6a61a5153f..8f5dbd8ae6 100644
--- a/src/main/java/seedu/cafectrl/storage/Decoder.java
+++ b/src/main/java/seedu/cafectrl/storage/Decoder.java
@@ -63,7 +63,7 @@ private static ArrayList decodeIngredientData(String[] ingredientsSt
}
//@@author ziyi105
- public static Pantry decodePantryStockData(ArrayList encodedPantryStock, Menu menu) {
+ public static Pantry decodePantryStockData(ArrayList encodedPantryStock) {
ArrayList pantryStock = new ArrayList<>();
if (encodedPantryStock.isEmpty()) {
diff --git a/src/main/java/seedu/cafectrl/storage/Storage.java b/src/main/java/seedu/cafectrl/storage/Storage.java
index 06e8a87b8d..85f9c54bd3 100644
--- a/src/main/java/seedu/cafectrl/storage/Storage.java
+++ b/src/main/java/seedu/cafectrl/storage/Storage.java
@@ -6,6 +6,7 @@
import seedu.cafectrl.ui.ErrorMessages;
import seedu.cafectrl.ui.Ui;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
From 1d15b6ca5e88a9b962fd5b7b3bdef331f7ee4f71 Mon Sep 17 00:00:00 2001
From: Dexter Hoon
Date: Wed, 1 Nov 2023 19:47:16 +0800
Subject: [PATCH 6/8] Resolve checkstyle errors
---
src/main/java/seedu/cafectrl/CafeCtrl.java | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/main/java/seedu/cafectrl/CafeCtrl.java b/src/main/java/seedu/cafectrl/CafeCtrl.java
index cba3c4bdd1..f5700b6650 100644
--- a/src/main/java/seedu/cafectrl/CafeCtrl.java
+++ b/src/main/java/seedu/cafectrl/CafeCtrl.java
@@ -8,7 +8,6 @@
import seedu.cafectrl.parser.Parser;
import seedu.cafectrl.parser.ParserUtil;
import seedu.cafectrl.storage.Storage;
-import seedu.cafectrl.ui.Messages;
import seedu.cafectrl.ui.Ui;
/**
From 0bf4a418f55909b01ad6f5ad9e106d9f5238bd69 Mon Sep 17 00:00:00 2001
From: Dexter Hoon
Date: Wed, 1 Nov 2023 19:50:50 +0800
Subject: [PATCH 7/8] Update EXPECTED.TXT in text-ui-test
---
text-ui-test/EXPECTED.TXT | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT
index b4b14a415c..a386f9d927 100644
--- a/text-ui-test/EXPECTED.TXT
+++ b/text-ui-test/EXPECTED.TXT
@@ -1,6 +1,15 @@
-...Downloading data...
-Data Folder was not found!
-It's ok... a new data folder has been created.
+Menu data was not found!
+No worries, new menu has been created
+
+
+Pantry stock data was not found!
+No worries, new pantry has been created
+
+
+Order list data was not found!
+No worries, new order list has been created
+
+
Hello! Welcome to CafeCTRL!
-----------------------------------------------------
> -----------------------------------------------------
From 50efd7660b27b8f8b144b33d2f0b82a299495921 Mon Sep 17 00:00:00 2001
From: Dexter Hoon
Date: Wed, 1 Nov 2023 19:51:41 +0800
Subject: [PATCH 8/8] Update EXPECTED.TXT in text-ui-test
---
text-ui-test/EXPECTED.TXT | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT
index a386f9d927..9edaa58833 100644
--- a/text-ui-test/EXPECTED.TXT
+++ b/text-ui-test/EXPECTED.TXT
@@ -15,3 +15,7 @@ Hello! Welcome to CafeCTRL!
> -----------------------------------------------------
Goodbye <3 Have a great day ahead!
-----------------------------------------------------
+Data Folder was not found!
+It's ok... a new data folder has been created.
+
+