Skip to content

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

@coderabbitai

Description

@coderabbitai

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions