This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
commit 9e0693fd45a89a6f6dc395663939e4da892ac886 Author: Gary Gregory <[email protected]> AuthorDate: Wed Jan 19 07:59:05 2022 -0500 Use classic toArray() trick. --- log4j-api/src/main/java/org/apache/logging/log4j/util/LoaderUtil.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/LoaderUtil.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/LoaderUtil.java index 8cd313b..9974a8e 100644 --- a/log4j-api/src/main/java/org/apache/logging/log4j/util/LoaderUtil.java +++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/LoaderUtil.java @@ -36,6 +36,8 @@ import java.util.Objects; */ public final class LoaderUtil { + private static final ClassLoader[] EMPTY_CLASS_LOADER_ARRAY = {}; + /** * System property to set to ignore the thread context ClassLoader. * @@ -170,7 +172,7 @@ public final class LoaderUtil { } } } - return classLoaders.toArray(new ClassLoader[0]); + return classLoaders.toArray(EMPTY_CLASS_LOADER_ARRAY); } private static void accumulateLayerClassLoaders(final ModuleLayer layer, final Collection<ClassLoader> classLoaders) {
