You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/11/19 16:29:10 UTC
(commons-logging) 02/02: Use try-with-resources
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-logging.git
commit b01ad472ae8e5a3ca85b4ed859fcd4486b7fb840
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Nov 19 11:20:00 2023 -0500
Use try-with-resources
---
src/main/java/org/apache/commons/logging/impl/SimpleLog.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/commons/logging/impl/SimpleLog.java b/src/main/java/org/apache/commons/logging/impl/SimpleLog.java
index 4fd0f3c..78ae890 100644
--- a/src/main/java/org/apache/commons/logging/impl/SimpleLog.java
+++ b/src/main/java/org/apache/commons/logging/impl/SimpleLog.java
@@ -574,9 +574,9 @@ public class SimpleLog implements Log, Serializable {
buf.append(">");
final StringWriter sw = new StringWriter(1024);
- final PrintWriter pw = new PrintWriter(sw);
- t.printStackTrace(pw);
- pw.close();
+ try (PrintWriter pw = new PrintWriter(sw)) {
+ t.printStackTrace(pw);
+ }
buf.append(sw.toString());
}