From 50dd30fb0a3731cca86f47be548580a18bd18787 Mon Sep 17 00:00:00 2001 From: Mehtaab Sidhu Date: Sun, 26 Oct 2025 20:54:59 -0700 Subject: [PATCH 1/2] #56 calculateMean() no longer crashes on empty list --- src/java/DataProcessor.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/java/DataProcessor.java b/src/java/DataProcessor.java index 14d9441..0209832 100644 --- a/src/java/DataProcessor.java +++ b/src/java/DataProcessor.java @@ -34,7 +34,10 @@ public void wirteFile(String filepath, List data) throws IOException { // BUG: Returns 0 for empty list without indication public double calculateMean(List numbers) { if (numbers.isEmpty()) { - return 0; + throw new ArithmeticException("List is empty"); + } + if (numbers.size() == 0) { + throw new ArithmeticException("List is empty"); } double sum = 0; for (double num : numbers) { From a2b5e2317cac6b870bfaee489d17c370c05b1071 Mon Sep 17 00:00:00 2001 From: Mehtaab Sidhu Date: Tue, 28 Oct 2025 19:43:51 -0700 Subject: [PATCH 2/2] #39 Fixed error: Authentication login() has no null checks --- src/java/Authentication.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/java/Authentication.java b/src/java/Authentication.java index 54928d8..515dc90 100644 --- a/src/java/Authentication.java +++ b/src/java/Authentication.java @@ -33,6 +33,9 @@ public void registerUser(String username, String password) { // BUG: No null checks - will throw NullPointerException // BUG: Plain text password comparison - SECURITY ISSUE public boolean login(String username, String password) { + if (username == null || password == null) { + return false; + } String storedPassword = users.get(username); boolean isValid = storedPassword.equals(password);