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

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit a09e89703452693e3327a91bd5c2b96496e83fc0
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Mar 27 22:28:05 2020 +0000

    Refactor to fix false positive leak warning in Eclipse 2020.03
---
 java/org/apache/catalina/valves/ErrorReportValve.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/valves/ErrorReportValve.java 
b/java/org/apache/catalina/valves/ErrorReportValve.java
index 08ef2c7..c30ed15 100644
--- a/java/org/apache/catalina/valves/ErrorReportValve.java
+++ b/java/org/apache/catalina/valves/ErrorReportValve.java
@@ -165,7 +165,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) {


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to