Merge branch '3.0.x'

Closes gh-35221
This commit is contained in:
Phillip Webb
2023-05-01 15:35:23 -07:00
2 changed files with 21 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,7 +40,9 @@ class MainMethod {
}
private Method getMainMethod(Thread thread) {
for (StackTraceElement element : thread.getStackTrace()) {
StackTraceElement[] stackTrace = thread.getStackTrace();
for (int i = stackTrace.length - 1; i >= 0; i--) {
StackTraceElement element = stackTrace[i];
if ("main".equals(element.getMethodName())) {
Method method = getMainMethod(element);
if (method != null) {