You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 10:13:57 UTC

[sling-org-apache-sling-scripting-thymeleaf] 46/50: SLING-5075 Upgrade Thymeleaf to 3.0

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git

commit d11e55111ce87fe360bd880938c74654f0922e5f
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Fri Jul 1 15:05:46 2016 +0000

    SLING-5075 Upgrade Thymeleaf to 3.0
    
    add null checks for key and resource bundle
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1750957 13f79535-47bb-0310-9956-ffa450edef68
---
 .../scripting/thymeleaf/internal/ResourceBundleMessageResolver.java | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/ResourceBundleMessageResolver.java b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/ResourceBundleMessageResolver.java
index 65298bf..e4e4443 100644
--- a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/ResourceBundleMessageResolver.java
+++ b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/ResourceBundleMessageResolver.java
@@ -133,8 +133,14 @@ public class ResourceBundleMessageResolver implements IMessageResolver {
     public String resolveMessage(final ITemplateContext templateContext, final Class<?> origin, final String key, final Object[] messageParameters) {
         logger.debug("resolving message for '{}' ({}) with message parameters {}", key, origin, messageParameters);
         // TODO can origin be useful with Sling i18n?
+        if (key == null) {
+            return null;
+        }
         final Locale locale = templateContext.getLocale();
         final ResourceBundle resourceBundle = resourceBundleProvider.getResourceBundle(locale);
+        if (resourceBundle == null) {
+            return null;
+        }
         final String string = resourceBundle.getString(key);
         final MessageFormat messageFormat = new MessageFormat(string, locale);
         final String message = messageFormat.format((messageParameters != null ? messageParameters : EMPTY_MESSAGE_PARAMETERS));

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.