in src/main/java/org/apache/sling/scripting/core/impl/bundled/BundleRenderUnitFinderImpl.java [102:119]
private BundledRenderUnit findUnit(@NotNull BundleContext context, @NotNull Bundle bundle, @NotNull String path, String scriptEngineName,
@NotNull String scriptExtension, @NotNull Set<TypeProvider> providers) {
String className = JavaEscapeHelper.makeJavaPackage(path);
ServiceCache serviceCache = perContextServiceCache.computeIfAbsent(context, ServiceCache::new);
try {
Class<?> clazz = bundle.loadClass(className);
return new PrecompiledScript(providers, context, bundle, path, clazz, scriptEngineName, scriptExtension,
scriptContextProvider, serviceCache);
} catch (ClassNotFoundException | NoClassDefFoundError ignored) {
URL bundledScriptURL = bundle.getEntry(NS_JAVAX_SCRIPT_CAPABILITY + (path.startsWith("/") ? "" : SLASH) + path);
if (bundledScriptURL != null) {
return new Script(providers, context, bundle, path, bundledScriptURL, scriptEngineName, scriptExtension,
scriptContextProvider, serviceCache);
}
}
return null;
}