SLING-11744 : Allow configuration of include and exclude paths
diff --git a/src/main/java/org/apache/sling/i18n/impl/JcrResourceBundle.java b/src/main/java/org/apache/sling/i18n/impl/JcrResourceBundle.java
index b68d49f..9efd86c 100644
--- a/src/main/java/org/apache/sling/i18n/impl/JcrResourceBundle.java
+++ b/src/main/java/org/apache/sling/i18n/impl/JcrResourceBundle.java
@@ -335,8 +335,12 @@
final Iterator<Resource> bundles = resourceResolver.findResources(QUERY_LANGUAGE_ROOTS, "xpath");
while (bundles.hasNext()) {
final Resource bundle = bundles.next();
- if (filter.includePath(bundle.getPath()) && check.isResourceBundle(bundle)) {
- paths.add(bundle.getPath());
+ if (check.isResourceBundle(bundle)) {
+ if (filter.includePath(bundle.getPath())) {
+ paths.add(bundle.getPath());
+ } else {
+ log.warn("Ignoring i18n bundle for language {} at {} because it is not included by the path filter", locale, bundle.getPath());
+ }
}
}
@@ -349,6 +353,8 @@
if (parentResource != null) {
visitor.accept(parentResource, locator.getTraverseDepth());
}
+ } else {
+ log.warn("Ignoring i18n bundle for language {} at {} because it is not included by the path filter", locale, locator.getPath());
}
}
}
diff --git a/src/main/java/org/apache/sling/i18n/impl/JcrResourceBundleProvider.java b/src/main/java/org/apache/sling/i18n/impl/JcrResourceBundleProvider.java
index e1bef11..a5021de 100644
--- a/src/main/java/org/apache/sling/i18n/impl/JcrResourceBundleProvider.java
+++ b/src/main/java/org/apache/sling/i18n/impl/JcrResourceBundleProvider.java
@@ -631,15 +631,18 @@
final Set<Key> usedKeys = new HashSet<>();
while (bundles.hasNext()) {
final Map<String,Object> bundle = bundles.next();
- if (bundle.containsKey(PROP_LANGUAGE) && this.pathFilter.includePath(bundle.get(PROP_PATH).toString())) {
- final Locale locale = toLocale(bundle.get(PROP_LANGUAGE).toString());
- String baseName = null;
- if (bundle.containsKey(PROP_BASENAME)) {
- baseName = bundle.get(PROP_BASENAME).toString();
- }
- final Key key = new Key(baseName, locale);
- if (usedKeys.add(key)) {
- getResourceBundleInternal(resolver, baseName, locale);
+ if (bundle.containsKey(PROP_LANGUAGE) && bundle.containsKey(PROP_PATH)) {
+ final String path = bundle.get(PROP_PATH).toString();
+ final String language = bundle.get(PROP_LANGUAGE).toString();
+ if (this.pathFilter.includePath(path)) {
+ final Locale locale = toLocale(language);
+ final String baseName = bundle.containsKey(PROP_BASENAME) ? bundle.get(PROP_BASENAME).toString() : null;
+ final Key key = new Key(baseName, locale);
+ if (usedKeys.add(key)) {
+ getResourceBundleInternal(resolver, baseName, locale);
+ }
+ } else {
+ log.warn("Ignoring i18n bundle for language {} at {} because it is not included by the path filter", language, path);
}
}
}