fix: put more detailed comments in exception files

This commit is contained in:
2026-05-15 17:37:28 +03:30
parent 30eca2a7a5
commit 015840161b
2 changed files with 13 additions and 3 deletions
+12 -2
View File
@@ -49,18 +49,26 @@ public class FileService {
public static String writeFile(UserEntity user) { 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); FileWriter fw = new FileWriter("userInformation.txt", true);
BufferedWriter bw = new BufferedWriter(fw); BufferedWriter bw = new BufferedWriter(fw);
bw.write(user.toString()); bw.write(user.toString());
bw.close(); bw.close();
*/
return "user information written to file"; return "user information written to file";
} }
public static void readFile() { 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"); FileReader file = new FileReader("userInformation.txt");
BufferedReader fileInput = new BufferedReader(file); BufferedReader fileInput = new BufferedReader(file);
@@ -69,6 +77,7 @@ public class FileService {
System.out.println(fileInput.readLine()); System.out.println(fileInput.readLine());
fileInput.close(); fileInput.close();
*/
} }
@@ -77,8 +86,9 @@ public class FileService {
Date dob = null; 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; return dob;
} }
@@ -1,4 +1,4 @@
package org; package org.exceptions;
public class Main { public class Main {
public static void main(String[] args) { public static void main(String[] args) {