From f685030713b42d5f1f1127c88c2f935e288ef9e5 Mon Sep 17 00:00:00 2001 From: cramakri <cramakri> Date: Tue, 9 Nov 2010 15:11:54 +0000 Subject: [PATCH] LMS-1767 Specified some properties that should never be escaped. SVN: 18607 --- .../utilities/ReflectingStringEscaper.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/common/source/java/ch/systemsx/cisd/common/utilities/ReflectingStringEscaper.java b/common/source/java/ch/systemsx/cisd/common/utilities/ReflectingStringEscaper.java index fee68b0dde0..b60a47d4a59 100644 --- a/common/source/java/ch/systemsx/cisd/common/utilities/ReflectingStringEscaper.java +++ b/common/source/java/ch/systemsx/cisd/common/utilities/ReflectingStringEscaper.java @@ -157,10 +157,24 @@ class ReflectingStringEscaperUnrestricted<T> extends ReflectingStringEscaperImpl private static class Visitor implements ReflectionStringTraverser.ReflectionFieldVisitor { + private final HashSet<String> unescapedProperties; + + private Visitor() + { + unescapedProperties = new HashSet<String>(); + // Don't escape these properties + unescapedProperties.add("permlink"); + } + public String tryVisit(String value, Object object, Field fieldOrNull) { - // Only change the value if the name of the field is in the list provided if (null == fieldOrNull) + { + return StringEscapeUtils.escapeHtml(value); + } + + // Don't escape the ones that are specified as not to be escaped + if (unescapedProperties.contains(fieldOrNull.getName())) { return null; } -- GitLab