@@ -0,0 +1,2031 @@
+/*%0A * Licensed to the Apache Software Foundation (ASF) under one or more%0A * contributor license agreements. See the NOTICE file distributed with%0A * this work for additional information regarding copyright ownership.%0A * The ASF licenses this file to You under the Apache license, Version 2.0%0A * (the %22License%22); you may not use this file except in compliance with%0A * the License. You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the license for the specific language governing permissions and%0A * limitations under the license.%0A */%0Apackage org.apache.logging.log4j.util;%0A%0Aimport java.security.AccessController;%0Aimport java.security.PrivilegedAction;%0A%0A/**%0A * Utility class for ClassLoaders. Consider this class private.%0A */%0A// TODO: migrate any other useful methods from Loader in log4j-core%0Apublic final class LoaderUtil %7B%0A    private LoaderUtil() %7B%7D%0A%0A    private static final PrivilegedAction%3CClassLoader%3E TCCL_GETTER = new ThreadContextClassLoaderGetter();%0A%0A    static %7B%0A        final SecurityManager sm = System.getSecurityManager();%0A        if (sm != null) %7B%0A            sm.checkPermission(new RuntimePermission(%22getClassLoader%22));%0A        %7D%0A    %7D%0A%0A    public static ClassLoader getThreadContextClassLoader() %7B%0A        return System.getSecurityManager() == null%0A            ? TCCL_GETTER.run()%0A            : AccessController.doPrivileged(TCCL_GETTER);%0A    %7D%0A%0A    private static class ThreadContextClassLoaderGetter implements PrivilegedAction%3CClassLoader%3E %7B%0A        @Override%0A        public ClassLoader run() %7B%0A            final ClassLoader cl = Thread.currentThread().getContextClassLoader();%0A            // if the TCCL is null, that means we're using the system CL%0A            return cl == null ? ClassLoader.getSystemClassLoader() : cl;%0A        %7D%0A    %7D%0A%7D%0A

Add LoaderUtil class to isolate ClassLoader utility class.