This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new 2d932ec02c Use try-with-resources
2d932ec02c is described below
commit 2d932ec02c19110e20b32b46e29c1aee1d08f7c0
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Jul 5 14:08:47 2023 +0100
Use try-with-resources
Stop Coverity Scan complaining
---
.../apache/tomcat/buildutil/MimeTypeMappings.java | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/java/org/apache/tomcat/buildutil/MimeTypeMappings.java
b/java/org/apache/tomcat/buildutil/MimeTypeMappings.java
index 1190a628f6..3f467ad7d5 100644
--- a/java/org/apache/tomcat/buildutil/MimeTypeMappings.java
+++ b/java/org/apache/tomcat/buildutil/MimeTypeMappings.java
@@ -52,21 +52,19 @@ public class MimeTypeMappings {
SortedMap<String, String> sortedWebXmlMimeMappings = new
TreeMap<>(webXmlMimeMappings);
File f = new
File("java/org/apache/catalina/startup/MimeTypeMappings.properties");
- FileOutputStream fos = new FileOutputStream(f);
- Writer w = new OutputStreamWriter(fos, StandardCharsets.US_ASCII);
+ try (FileOutputStream fos = new FileOutputStream(f);
+ Writer w = new OutputStreamWriter(fos,
StandardCharsets.US_ASCII)) {
- Utils.insertLicense(w);
+ Utils.insertLicense(w);
- w.write(System.lineSeparator());
-
- for (Map.Entry<String, String> mapping :
sortedWebXmlMimeMappings.entrySet()) {
- w.write(mapping.getKey());
- w.write("=");
- w.write(mapping.getValue());
w.write(System.lineSeparator());
- }
- w.close();
- fos.close();
+ for (Map.Entry<String, String> mapping :
sortedWebXmlMimeMappings.entrySet()) {
+ w.write(mapping.getKey());
+ w.write("=");
+ w.write(mapping.getValue());
+ w.write(System.lineSeparator());
+ }
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]