JCgH4164838Gh792C124B5 commented on a change in pull request #445:
URL: https://github.com/apache/struts/pull/445#discussion_r523474534



##########
File path: 
plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/Parser.java
##########
@@ -324,7 +324,6 @@ private String parseScriptText(String tx) {
                 ++i;
             }
         }
-        cw.close();

Review comment:
       And here.

##########
File path: 
plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/JspReader.java
##########
@@ -595,7 +594,6 @@ private void pushFile(String file, String encoding,
             char buf[] = new char[1024];
             for (int i = 0 ; (i = reader.read(buf)) != -1 ;)
                 caw.write(buf, 0, i);
-            caw.close();

Review comment:
       Same goes for here.

##########
File path: 
plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/JspReader.java
##########
@@ -209,7 +209,6 @@ String getText(Mark start, Mark stop) throws 
JasperException {
         CharArrayWriter caw = new CharArrayWriter();
         while (!stop.equals(mark()))
             caw.write(nextChar());
-        caw.close();

Review comment:
       The API Docs and JDK source confirm that for `CharArrayWriter` 
instances, calls to `close()` are no-ops (no effect).
   So I think this should be a safe change.

##########
File path: 
plugins/portlet-mocks/src/test/java/org/apache/struts2/StrutsSpringPortletMockObjectsTest.java
##########
@@ -222,7 +222,8 @@ public void testMockClientDataRequest() {
         assertEquals("Content-type not as expected ?", TEST_CONTENT_TYPE, 
mockClientDataRequest.getContentType());
         mockClientDataRequest.setMethod(TEST_METHOD);
         assertEquals("Method not as expected ?", TEST_METHOD, 
mockClientDataRequest.getMethod());
-        try ( InputStream inputStream = 
mockClientDataRequest.getPortletInputStream() ) {
+       InputStream inputStream = mockClientDataRequest.getPortletInputStream();

Review comment:
       This change in the PR should probably be reverted.  The previous 
try-with-resources call is safer, and restoring that code should eliminate the 
`IOException` issue currently being reported during the compilation.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to