-
Type:
Bug
-
Status: Resolved
-
Resolution: Fixed
-
Affects Version/s: 7.4.3.10 CE GA10, 7.4.13 DXP U6
-
Fix Version/s: Master
-
Labels:
-
Fix Priority:1
-
Git Pull Request:
Problem Background
The Javadoc for MimeResponse.reset() states:
Clears any data that exists in the buffer as well as the properties set. If the response has been committed, this method throws an IllegalStateException.
However, Liferay's implementation of this method only implements the IllegalStateException requirement. It does not clear response output and header properties:
@Override public void reset() { if (_calledFlushBuffer) { throw new IllegalStateException( "Unable to reset a buffer that has been flushed"); } }
One important reason why this problem has gone unnoticed, is because the Portlet 3.0 TCK does not properly test these requirements.
Steps to Reproduce
1. Deploy the attached com.liferay.faces.test.bridge.tck.main.portlet.war artifact to $LIFERAY_HOME/deploy
2. Create a page named "Test"
3. Add the portlet named "chapter6_1_3_3Tests-responseResetTest-portlet" to the page
4. Click the "Run Test" button
Expected Results
The portlet renders a success message:
PPR Result:Test: responseResetTest Status: SUCCESS Detail: externalContext.responseReset() functioned properly
Actual Results
The portlet renders a failure message:
Response header 'foo' was incorrectly present and had a value of '1234' The span containing text 'This will not be present in the output' was incorrectly present