vaadin / portlet

Portlet support for Vaadin Flow
https://vaadin.com
Other
2 stars 3 forks source link

fix: Not write UIDL sync message when RPC handling throws #215

Closed mshabarov closed 2 years ago

mshabarov commented 2 years ago

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

Checklist

Additional for Feature type of change

vaadin-bot commented 2 years ago

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