Skip to content

Commit aed701e

Browse files
committed
mer JavaDoc och tagit bort onödig kod som coderabbit varna om.
1 parent 0b38e92 commit aed701e

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

src/main/java/com/example/Main.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ public void run() {
4646
if (!validateLogin(jdbcUrl, dbUser, dbPass, username, password)) {
4747
System.out.println("Invalid username or password.");
4848
System.out.println("0) Exit");
49-
scanner.nextLine();
5049
scanner.close();
5150
return;
5251
}
@@ -137,6 +136,8 @@ private void getMissionById(Scanner scanner, String jdbcUrl, String dbUser, Stri
137136
System.out.println("Mission ID: " + rs.getLong("mission_id"));
138137
System.out.println("Spacecraft: " + rs.getString("spacecraft"));
139138
System.out.println("Launch Date: " + rs.getDate("launch_date"));
139+
} else {
140+
System.out.println("No mission found with ID: " + missionId);
140141
}
141142
}
142143
}
@@ -236,6 +237,8 @@ private void updateAccountPassword(Scanner scanner, String jdbcUrl, String dbUse
236237
int rowsAffected = stmt.executeUpdate();
237238
if (rowsAffected > 0) {
238239
System.out.println("Password updated successfully");
240+
} else {
241+
System.out.println("No account found with user_id: " + userId);
239242
}
240243
}
241244
} catch (NumberFormatException e) {
@@ -264,6 +267,8 @@ private void deleteAccount(Scanner scanner, String jdbcUrl, String dbUser, Strin
264267
int rowsAffected = stmt.executeUpdate();
265268
if (rowsAffected > 0) {
266269
System.out.println("Account deleted successfully");
270+
} else {
271+
System.out.println("No account found with user_id: " + userId);
267272
}
268273
}
269274
} catch (NumberFormatException e) {
@@ -296,6 +301,9 @@ private boolean validateLogin(String jdbcUrl, String dbUser, String dbPass,
296301
}
297302
}
298303

304+
/**
305+
* Checks if dev mode is enabled.
306+
*/
299307
private static boolean isDevMode(String[] args) {
300308
if (Boolean.getBoolean("devMode"))
301309
return true;
@@ -304,6 +312,10 @@ private static boolean isDevMode(String[] args) {
304312
return Arrays.asList(args).contains("--dev");
305313
}
306314

315+
316+
/**
317+
* Gets config from system properties or environment variables.
318+
*/
307319
private static String resolveConfig(String propertyKey, String envKey) {
308320
String v = System.getProperty(propertyKey);
309321
if (v == null || v.trim().isEmpty()) {

0 commit comments

Comments
 (0)