This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new e0cc43f719 Explicitly close streams
e0cc43f719 is described below
commit e0cc43f719881f57585895120aff56d9acd0f220
Author: Mark Thomas <[email protected]>
AuthorDate: Tue Jul 4 20:09:51 2023 +0100
Explicitly close streams
---
java/org/apache/catalina/ssi/SSIExec.java | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/java/org/apache/catalina/ssi/SSIExec.java
b/java/org/apache/catalina/ssi/SSIExec.java
index 605f7fa6db..d05eb3ee23 100644
--- a/java/org/apache/catalina/ssi/SSIExec.java
+++ b/java/org/apache/catalina/ssi/SSIExec.java
@@ -60,13 +60,12 @@ public class SSIExec implements SSICommand {
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec(substitutedValue);
foundProgram = true;
- BufferedReader stdOutReader = new BufferedReader(
- new InputStreamReader(proc.getInputStream()));
- BufferedReader stdErrReader = new BufferedReader(
- new InputStreamReader(proc.getErrorStream()));
char[] buf = new char[BUFFER_SIZE];
- IOTools.flow(stdErrReader, writer, buf);
- IOTools.flow(stdOutReader, writer, buf);
+ try (BufferedReader stdOutReader = new BufferedReader(new
InputStreamReader(proc.getInputStream()));
+ BufferedReader stdErrReader = new BufferedReader(new
InputStreamReader(proc.getErrorStream()));) {
+ IOTools.flow(stdErrReader, writer, buf);
+ IOTools.flow(stdOutReader, writer, buf);
+ }
proc.waitFor();
lastModified = System.currentTimeMillis();
} catch (InterruptedException e) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]