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: Not write UIDL sync message when RPC handling throws #215

Merged
merged 4 commits into from
Mar 23, 2022

Conversation

mshabarov
Copy link
Contributor

@mshabarov mshabarov commented Mar 22, 2022

Description

Liferay container is so strict regards ServletResponse::setContentLength comparing to normal servlet containers and Apache Pluto portal, thus the PortalUidlRequestHandler works incorrectly in case of exception in the server-side listener: it writes the error meta info JSON into response, then appends sync UIDL JSON message, then calls setContentLength with the length of the sync UIDL message. Which in turn leads to an unpredictable JSON sent to client.

When this change is applied, UidlRequestHandler doesn't write sync UIDL message to the response once the RPC handler execution throws, but instead sends only an error message to the client.

No IT tests added, because this is covered by LiferayErrorHandlingIT being added afterwards within Liferay tests PR.

Fixes #213

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.

@vaadin-bot
Copy link

SonarQube analysis reported 5 issues

  1. MAJOR DefaultPortletErrorHandler.java#L29: Invoke method(s) only conditionally. rule
  2. MAJOR PortletUidlRequestHandler.java#L162: Add the "@OverRide" annotation above this method signature rule
  3. MAJOR PortletUidlRequestHandler.java#L166: Add the "@OverRide" annotation above this method signature rule
  4. MINOR VaadinPortletService.java#L77: Rename this field "DEFAULT_HANDLER" to match the regular expression '^[a-z][a-zA-Z0-9]*$'. rule
  5. INFO VaadinPortletService.java#L256: Complete the task associated to this TODO comment. rule

@mshabarov mshabarov requested a review from caalador March 23, 2022 12:41
@mshabarov mshabarov merged commit 2d330c5 into master Mar 23, 2022
@mshabarov mshabarov deleted the fix/skip-uidl-upon-error branch March 23, 2022 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UIDL response is corrupted when a system error occurs on the server side
3 participants