diff --git a/src/main/java/org/exceptions/FileService.java b/src/main/java/org/exceptions/FileService.java index 1b8f150..2c207e0 100644 --- a/src/main/java/org/exceptions/FileService.java +++ b/src/main/java/org/exceptions/FileService.java @@ -49,18 +49,26 @@ public class FileService { public static String writeFile(UserEntity user) { + //TODO: Uncomment the lines below. + //TODO: Use your knowledge of exception handling to make the code work as expected + /* Uncomment this section + //TODO: handle the exception FileWriter fw = new FileWriter("userInformation.txt", true); BufferedWriter bw = new BufferedWriter(fw); bw.write(user.toString()); bw.close(); + */ return "user information written to file"; } public static void readFile() { + //TODO: Uncomment the lines below. + //TODO: Use your knowledge of exception handling to make the code work as expected + /* Uncomment this section FileReader file = new FileReader("userInformation.txt"); BufferedReader fileInput = new BufferedReader(file); @@ -69,6 +77,7 @@ public class FileService { System.out.println(fileInput.readLine()); fileInput.close(); + */ } @@ -77,8 +86,9 @@ public class FileService { Date dob = null; - dob = formatter.parse(date); - + //TODO: Uncomment this line. + //TODO: Use your knowledge of exception handling to make the code work as expected + //dob = formatter.parse(date); return dob; } diff --git a/src/main/java/org/Main.java b/src/main/java/org/exceptions/Main.java similarity index 75% rename from src/main/java/org/Main.java rename to src/main/java/org/exceptions/Main.java index 4999d5a..4a47608 100644 --- a/src/main/java/org/Main.java +++ b/src/main/java/org/exceptions/Main.java @@ -1,4 +1,4 @@ -package org; +package org.exceptions; public class Main { public static void main(String[] args) {