URL (@NotNull ClassLoader loader, @NonNls @NotNull String basePath, @NonNls @NotNull String fileName) { String fixedPath = Strings.trimStart(Strings.trimEnd(basePath, "/"), "/"); List<String> bundles = calculateBundleNames(fixedPath, Locale.getDefault()); for (String bundle : bundles) { URL url = loader.getResource(bundle + "/" + fileName); if (url == null) { continue; } try { url.openConnection(); } catch (IOException e) { continue; } return url; } return loader.getResource(fixedPath + "/" + fileName); }