sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [sling-org-apache-sling-scripting-jsp-taglib] branch master updated: Adding fix for SLING-7641 to do an isBlank rather than just null check for determining if the default value should be used.
Date Wed, 02 May 2018 21:21:26 GMT
This is an automated email from the ASF dual-hosted git repository.

dklco pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-jsp-taglib.git


The following commit(s) were added to refs/heads/master by this push:
     new 48cd727  Adding fix for SLING-7641 to do an isBlank rather than just null check for
determining if the default value should be used.
48cd727 is described below

commit 48cd7272aac009022b0ccc3e7ff0fc9e36d872f0
Author: Dan Klco <dklco@apache.org>
AuthorDate: Wed May 2 17:21:01 2018 -0400

    Adding fix for SLING-7641 to do an isBlank rather than just null check
    for determining if the default value should be used.
---
 .../java/org/apache/sling/scripting/jsp/taglib/EncodeTag.java    | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/sling/scripting/jsp/taglib/EncodeTag.java b/src/main/java/org/apache/sling/scripting/jsp/taglib/EncodeTag.java
index eacdebf..8231000 100644
--- a/src/main/java/org/apache/sling/scripting/jsp/taglib/EncodeTag.java
+++ b/src/main/java/org/apache/sling/scripting/jsp/taglib/EncodeTag.java
@@ -21,6 +21,7 @@ import java.io.IOException;
 import javax.servlet.jsp.JspException;
 import javax.servlet.jsp.tagext.BodyTagSupport;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.sling.scripting.jsp.taglib.helpers.XSSSupport;
 import org.apache.sling.scripting.jsp.taglib.helpers.XSSSupport.ENCODING_MODE;
 import org.slf4j.Logger;
@@ -51,8 +52,7 @@ public class EncodeTag extends BodyTagSupport {
 
 		if (readBody) {
 			if (bodyContent != null && bodyContent.getString() != null) {
-				String encoded = XSSSupport.encode(bodyContent.getString(),
-						mode);
+				String encoded = XSSSupport.encode(bodyContent.getString(), mode);
 				write(encoded);
 			}
 		}
@@ -68,7 +68,7 @@ public class EncodeTag extends BodyTagSupport {
 	public int doStartTag() throws JspException {
 		int res = SKIP_BODY;
 		String unencoded = value;
-		if (unencoded == null) {
+		if (StringUtils.isBlank(unencoded)) {
 			unencoded = defaultValue;
 		}
 
@@ -140,8 +140,7 @@ public class EncodeTag extends BodyTagSupport {
 				pageContext.getOut().write(encoded);
 			} catch (IOException e) {
 				log.error("Exception writing escaped content to page", e);
-				throw new JspException(
-						"Exception writing escaped content to page", e);
+				throw new JspException("Exception writing escaped content to page", e);
 			}
 		}
 	}

-- 
To stop receiving notification emails like this one, please contact
dklco@apache.org.

Mime
View raw message