This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/master by this push: new 03f9d50 Refactor to silence some false positives leak warnings in Eclipse 03f9d50 is described below commit 03f9d50283b25c1dd3f371d2f0757ef036d726f7 Author: Mark Thomas <ma...@apache.org> AuthorDate: Fri Mar 27 21:59:45 2020 +0000 Refactor to silence some false positives leak warnings in Eclipse --- java/org/apache/catalina/startup/CatalinaBaseConfigurationSource.java | 3 ++- java/org/apache/catalina/valves/ErrorReportValve.java | 4 +++- java/org/apache/tomcat/util/file/ConfigurationSource.java | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/java/org/apache/catalina/startup/CatalinaBaseConfigurationSource.java b/java/org/apache/catalina/startup/CatalinaBaseConfigurationSource.java index 134b6a4..53fb91f 100644 --- a/java/org/apache/catalina/startup/CatalinaBaseConfigurationSource.java +++ b/java/org/apache/catalina/startup/CatalinaBaseConfigurationSource.java @@ -85,7 +85,8 @@ public class CatalinaBaseConfigurationSource implements ConfigurationSource { f = new File(catalinaBaseFile, name); } if (f.isFile()) { - return new Resource(new FileInputStream(f), f.toURI()); + FileInputStream fis = new FileInputStream(f); + return new Resource(fis, f.toURI()); } // Try classloader diff --git a/java/org/apache/catalina/valves/ErrorReportValve.java b/java/org/apache/catalina/valves/ErrorReportValve.java index 007f10f..b669ba2 100644 --- a/java/org/apache/catalina/valves/ErrorReportValve.java +++ b/java/org/apache/catalina/valves/ErrorReportValve.java @@ -197,7 +197,9 @@ public class ErrorReportValve extends ValveBase { if (throwable != null) { String exceptionMessage = throwable.getMessage(); if (exceptionMessage != null && exceptionMessage.length() > 0) { - message = Escape.htmlElementContent((new Scanner(exceptionMessage)).nextLine()); + try (Scanner scanner = new Scanner(exceptionMessage)) { + message = Escape.htmlElementContent(scanner.nextLine()); + } } } if (message == null) { diff --git a/java/org/apache/tomcat/util/file/ConfigurationSource.java b/java/org/apache/tomcat/util/file/ConfigurationSource.java index 38228f9..2df11bc 100644 --- a/java/org/apache/tomcat/util/file/ConfigurationSource.java +++ b/java/org/apache/tomcat/util/file/ConfigurationSource.java @@ -44,7 +44,8 @@ public interface ConfigurationSource { f = new File(userDir, name); } if (f.isFile()) { - return new Resource(new FileInputStream(f), f.toURI()); + FileInputStream fis = new FileInputStream(f); + return new Resource(fis, f.toURI()); } URI uri = null; try { --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org