Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/java/Authentication.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
5 changes: 4 additions & 1 deletion src/java/DataProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ public void wirteFile(String filepath, List<String> data) throws IOException {
// BUG: Returns 0 for empty list without indication
public double calculateMean(List<Double> 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) {
Expand Down