arturobernalg commented on code in PR #207:
URL: https://github.com/apache/jspwiki/pull/207#discussion_r1233123166
##########
jspwiki-main/src/main/java/org/apache/wiki/tags/AttachmentsIteratorTag.java:
##########
@@ -108,8 +108,9 @@ public final int doStartTag() {
public final int doAfterBody() {
if( bodyContent != null ) {
try {
- final JspWriter out = getPreviousOut();
- out.print(bodyContent.getString());
+ try (JspWriter out = getPreviousOut()) {
Review Comment:
Hi @juanpablo-santos
You are absolutely right. After reviewing the JSPWriter documentation and
the code again, I agree that closing the JSPWriter stream within the
doAfterBody() method could potentially cause an IOException in the subsequent
operations by the JSP engine.
I had introduced the try-with-resources to ensure proper resource handling.
However, in this context, the JSP engine manages the lifecycle of the JSPWriter
stream, and it is best not to interfere with this management.
Therefore, I will revert the try-with-resources change for the JspWriter out
stream. Thank you for catching this and for your valuable feedback.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]