From a905514669a94acbacbdc8e4cc7061e6a18b7d44 Mon Sep 17 00:00:00 2001 From: lihan Date: Wed, 2 Nov 2022 10:09:18 +0800 Subject: [PATCH] Fix BZ 66331 Fix a regression in refactoring for Stack on the SystemLogHandler which caught incorrect exception. --- java/org/apache/tomcat/util/log/SystemLogHandler.java | 4 ++-- webapps/docs/changelog.xml | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/java/org/apache/tomcat/util/log/SystemLogHandler.java b/java/org/apache/tomcat/util/log/SystemLogHandler.java index 2293f349afaa..946d9d6d9bfc 100644 --- a/java/org/apache/tomcat/util/log/SystemLogHandler.java +++ b/java/org/apache/tomcat/util/log/SystemLogHandler.java @@ -20,7 +20,7 @@ import java.io.PrintStream; import java.util.ArrayDeque; import java.util.Deque; -import java.util.EmptyStackException; +import java.util.NoSuchElementException; import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; @@ -83,7 +83,7 @@ public static void startCapture() { if (!reuse.isEmpty()) { try { log = reuse.remove(); - } catch (EmptyStackException e) { + } catch (NoSuchElementException e) { log = new CaptureLog(); } } else { diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 6754b87f3389..bd62a89331e3 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -112,6 +112,11 @@ use of fully qualified class names in 10.1.14 that broke the jdbc-pool. (markt) + + 66331: Fix a regression in refactoring for Stack + on the SystemLogHandler which caught incorrect exception. + (lihan) +