Source:
<code>public static ClassLoader buildClassLoader(final List<String> hadoopDependencyCoordinates, final List<String> defaultHadoopCoordinates) { final List<String> finalHadoopDependencyCoordinates = hadoopDependencyCoordinates != null ? hadoopDependencyCoordinates : defaultHadoopCoordinates; <START> ClassLoader taskClassLoader = HadoopIndexTask.class.getClassLoader(); <END> final List<URL> jobURLs; if (taskClassLoader instanceof URLClassLoader) { jobURLs = Lists.newArrayList( Arrays.asList(((URLClassLoader) taskClassLoader).getURLs()) ); } else { jobURLs = parseSystemClassPath(); } final List<URL> extensionURLs = new ArrayList<>(); for (final File extension : Initialization.getExtensionFilesToLoad(EXTENSIONS_CONFIG)) { final URLClassLoader extensionLoader = Initialization.getClassLoaderForExtension(extension, false); extensionURLs.addAll(Arrays.asList(extensionLoader.getURLs())); } jobURLs.addAll(extensionURLs); final List<URL> localClassLoaderURLs = new ArrayList<>(jobURLs); for (final File hadoopDependency : Initialization.getHadoopDependencyFilesToLoad( finalHadoopDependencyCoordinates, EXTENSIONS_CONFIG )) { final URLClassLoader hadoopLoader = Initialization.getClassLoaderForExtension(hadoopDependency, false); localClassLoaderURLs.addAll(Arrays.asList(hadoopLoader.getURLs())); } final ClassLoader classLoader = new URLClassLoader( localClassLoaderURLs.toArray(new URL[0]), null ); final String hadoopContainerDruidClasspathJars; if (EXTENSIONS_CONFIG.getHadoopContainerDruidClasspath() == null) { hadoopContainerDruidClasspathJars = Joiner.on(File.pathSeparator).join(jobURLs); } else { List<URL> hadoopContainerURLs = Lists.newArrayList( Initialization.getURLsForClasspath(EXTENSIONS_CONFIG.getHadoopContainerDruidClasspath()) ); if (EXTENSIONS_CONFIG.getAddExtensionsToHadoopContainer()) { hadoopContainerURLs.addAll(extensionURLs); } hadoopContainerDruidClasspathJars = Joiner.on(File.pathSeparator) .join(hadoopContainerURLs); } log.info("Hadoop Container Druid Classpath is set to [%s]", hadoopContainerDruidClasspathJars); System.setProperty("druid.hadoop.internal.classpath", hadoopContainerDruidClasspathJars); return classLoader; }</code><technical_language>nice move this JvmUtils.systemClassPath()</technical_language>

Target:
public static ClassLoader buildClassLoader(final List<String> hadoopDependencyCoordinates, final List<String> defaultHadoopCoordinates) { final List<String> finalHadoopDependencyCoordinates = hadoopDependencyCoordinates != null ? hadoopDependencyCoordinates : defaultHadoopCoordinates; ClassLoader taskClassLoader = HadoopIndexTask.class.getClassLoader(); final List<URL> jobURLs; if (taskClassLoader instanceof URLClassLoader) { jobURLs = Lists.newArrayList( Arrays.asList(((URLClassLoader) taskClassLoader).getURLs()) ); } else { jobURLs = JvmUtils.systemClassPath(); } final List<URL> extensionURLs = new ArrayList<>(); for (final File extension : Initialization.getExtensionFilesToLoad(EXTENSIONS_CONFIG)) { final URLClassLoader extensionLoader = Initialization.getClassLoaderForExtension(extension, false); extensionURLs.addAll(Arrays.asList(extensionLoader.getURLs())); } jobURLs.addAll(extensionURLs); final List<URL> localClassLoaderURLs = new ArrayList<>(jobURLs); for (final File hadoopDependency : Initialization.getHadoopDependencyFilesToLoad( finalHadoopDependencyCoordinates, EXTENSIONS_CONFIG )) { final URLClassLoader hadoopLoader = Initialization.getClassLoaderForExtension(hadoopDependency, false); localClassLoaderURLs.addAll(Arrays.asList(hadoopLoader.getURLs())); } final ClassLoader classLoader = new URLClassLoader( localClassLoaderURLs.toArray(new URL[0]), null ); final String hadoopContainerDruidClasspathJars; if (EXTENSIONS_CONFIG.getHadoopContainerDruidClasspath() == null) { hadoopContainerDruidClasspathJars = Joiner.on(File.pathSeparator).join(jobURLs); } else { List<URL> hadoopContainerURLs = Lists.newArrayList( Initialization.getURLsForClasspath(EXTENSIONS_CONFIG.getHadoopContainerDruidClasspath()) ); if (EXTENSIONS_CONFIG.getAddExtensionsToHadoopContainer()) { hadoopContainerURLs.addAll(extensionURLs); } hadoopContainerDruidClasspathJars = Joiner.on(File.pathSeparator) .join(hadoopContainerURLs); } log.info("Hadoop Container Druid Classpath is set to [%s]", hadoopContainerDruidClasspathJars); System.setProperty("druid.hadoop.internal.classpath", hadoopContainerDruidClasspathJars); return classLoader; }