-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Input Validation - Integer #3
Comments
I intend to fix this by throwing an IllegalArgumentException if the user enters a string which is not an integer, which will print useful feedback to the user. I plan to add two checks for integer parsing in the project. The first in the jButtonRemoveActionPerformed method, and the second in the jButtonAddActionPerformed method. These are the only instances of Integer.parseInt on the entire project. |
Now that I think about it, it's probably better to instead catch a NumberFormatException then print a useful message to the user in the GUI itself. |
Thank you for your contribution. We reviewed your update and provided feedback, and I just looked at your comment, we had suggested the same :-) |
Thank you for the update. |
The input fields expect an integer, however no checks are in place to ensure that. If the user enters a string the program throws an exception. Proper exception handling is required at the back end (formal or informal). And the user should be provided feedback if he/she enters invalid input.
The text was updated successfully, but these errors were encountered: