This is an automated email from the ASF dual-hosted git repository.

tv pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/turbine-core.git

commit 5c17490a0ec49cee51a7991c766b3cf60693bb8f
Author: Thomas Vandahl <[email protected]>
AuthorDate: Sun Dec 14 20:47:39 2025 +0100

    Better try-with-resources
---
 .../apache/turbine/services/velocity/TurbineVelocityService.java    | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git 
a/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java 
b/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java
index 4872418b..fce69f17 100644
--- a/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java
+++ b/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java
@@ -290,13 +290,11 @@ public class TurbineVelocityService
         throws TurbineException
     {
         String results = null;
-        OutputStreamWriter writer = null;
         Charset charset = getOutputCharSet(context);
 
-        try (ByteArrayOutputStream bytes = new ByteArrayOutputStream())
+        try (ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+             OutputStreamWriter writer = new OutputStreamWriter(bytes, 
charset))
         {
-            writer = new OutputStreamWriter(bytes, charset);
-
             executeRequest(context, filename, writer);
             writer.flush();
             results = bytes.toString(charset.name());

Reply via email to