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

Handle invalid input in the TextField event listener in SimpletimerDemo #38

Open
coderabbitai bot opened this issue Jul 1, 2024 · 0 comments
Open
Assignees

Comments

@coderabbitai
Copy link

coderabbitai bot commented Jul 1, 2024

There is an existing bug in the TextField event listener in SimpletimerDemo.java, where invalid input is not properly handled. This issue was preserved in the recent refactor in PR #37.

PR: #37
Comment: #37 (comment)

The bug can be fixed by ensuring that the input value is a valid number before updating the time field. Here is a suggested fix:

new TextField("Start Time", e -> {
  try {
    time = new BigDecimal(e.getValue());
  } catch (NumberFormatException ex) {
    Notification.show("Invalid input. Please enter a valid number.");
    return;
  }
  update();
});

This issue needs to be addressed to improve the robustness of the application.

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

No branches or pull requests

2 participants