shouryaj98 / Hotel-Management-Project-Java

It is a Hotel Management tool which can be used to manage activites like storing customer details, booking rooms of four different types, ordering food for particular rooms, unbooking rooms and showing the bill.
MIT License
335 stars 426 forks source link

Fix some bugs #45

Open Soullloud opened 11 months ago

Soullloud commented 11 months ago

Input Validation: In the bookRoom method, you should validate user input for room numbers to ensure it's a valid integer. Add input validation for other user inputs to prevent crashes due to invalid input.

Thread Safety: When using multi-threading (e.g., writing data to the "backup" file), you should consider thread safety. Accessing shared data without proper synchronization can lead to data corruption. You might want to use synchronization mechanisms like synchronized blocks or methods to ensure thread safety.

Error Handling: In your main method, when reading the "backup" file, you catch and print exceptions with a generic message ("Not a valid input"). It's essential to handle exceptions more gracefully. For example, you can print a specific error message or log exceptions for debugging.