InputStream (@NotNull ClassLoader loader, @NonNls @NotNull String basePath, @NonNls @NotNull String fileName) { String fixedPath = Strings.trimStart(Strings.trimEnd(basePath, "/"), "/"); if (fixedPath.isEmpty()) { return loader.getResourceAsStream(fileName); } List<String> bundles = calculateBundleNames(fixedPath, Locale.getDefault()); for (String bundle : bundles) { InputStream stream = loader.getResourceAsStream(bundle + "/" + fileName); if (stream == null) { continue; } return stream; } return loader.getResourceAsStream(fixedPath + "/" + fileName); }