This is an automated email from the ASF dual-hosted git repository. joerghoh pushed a commit to branch SLING-13171 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-i18n.git
commit a7a842631be756ba7315e4ca5c2367fcf5f1517a Author: Joerg Hoh <[email protected]> AuthorDate: Tue Apr 21 18:34:32 2026 +0200 SLING-13171 handle invalid JSON --- src/main/java/org/apache/sling/i18n/impl/JcrResourceBundle.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 ad9585c..9b8e686 100644 --- a/src/main/java/org/apache/sling/i18n/impl/JcrResourceBundle.java +++ b/src/main/java/org/apache/sling/i18n/impl/JcrResourceBundle.java @@ -23,6 +23,7 @@ import java.io.InputStream; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.EmptyStackException; import java.util.Enumeration; import java.util.HashSet; import java.util.Iterator; @@ -294,12 +295,14 @@ public class JcrResourceBundle extends ResourceBundle { parser.parse(stream, encoding); - } catch (IOException e) { + } catch (IOException | EmptyStackException e) { + // catch the EmptyStackException until the JsonParser catches it as well log.warn("Could not parse i18n json dictionary {}: {}", resource.getPath(), e.getMessage()); } finally { try { stream.close(); } catch (IOException ignore) { + // ignore } } } else {
