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

fix: check the component belongs to UI before task execution #11726

Merged
merged 3 commits into from
Sep 7, 2021

Conversation

mshabarov
Copy link
Contributor

@mshabarov mshabarov commented Sep 2, 2021

Description

Adds an assumption that the given component belongs to UI instance on which the task is going to be executed. This is needed to fail-fast and detect errors earlier before the actual task is executed and throws because of inconsistency in StateTree.

Related-to #11599

Type of change

  • Bugfix
  • Feature

Checklist

  • I have read the contribution guide: https://vaadin.com/docs/latest/guide/contributing/overview/
  • I have added a description following the guideline.
  • The issue is created in the corresponding repository and I have referenced it.
  • I have added tests to ensure my change is effective and works as intended.
  • New and existing tests are passing locally with my change.
  • I have performed self-review and corrected misspellings.

Additional for Feature type of change

  • Enhancement / new feature was discussed in a corresponding GitHub issue and Acceptance Criteria were created.

@@ -995,6 +995,8 @@ public Router getRouter() {
*
* @return a registration that can be used to cancel the execution of the
* task
* @throws IllegalArgumentException
* if the given component doesn't belong to this UI
*/
public ExecutionRegistration beforeClientResponse(Component component,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the method should have throws: javadoc is not necessary but if you extend javadocs then the method should throws .

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@vaadin-bot
Copy link
Collaborator

SonarQube analysis reported 3 issues

  1. MAJOR UI.java#L1014: Call "Optional#isPresent()" before accessing the value. rule
  2. MINOR UI.java#L1003: Remove the declaration of thrown exception 'java.lang.IllegalArgumentException' which is a runtime exception. rule
  3. INFO UI.java#L968: Do not forget to remove this deprecated code someday. rule

@vaadin-bot vaadin-bot added +0.1.0 and removed +0.0.1 labels Sep 6, 2021
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with platform 21.0.2.

@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with platform 14.7.1.

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

Successfully merging this pull request may close these issues.

3 participants