Skip to content
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

Closed
FOSSLGYS opened this issue Sep 14, 2016 · 4 comments
Closed

Input Validation - Integer #3

FOSSLGYS opened this issue Sep 14, 2016 · 4 comments
Labels

Comments

@FOSSLGYS
Copy link
Owner

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.

@FOSSLGYS FOSSLGYS added the bug label Sep 14, 2016
@alanefl
Copy link

alanefl commented Sep 15, 2016

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.

@alanefl
Copy link

alanefl commented Sep 15, 2016

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.

@FOSSLGYS
Copy link
Owner Author

Thank you for your contribution. We reviewed your update and provided feedback, and I just looked at your comment, we had suggested the same :-)
Please update the submission.

@FOSSLGYS
Copy link
Owner Author

Thank you for the update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants