Shinsuke Sugaya пре 3 година
родитељ
комит
b4f01b5f81

+ 1 - 1
src/main/java/org/codelibs/fess/helper/ViewHelper.java

@@ -238,7 +238,7 @@ public class ViewHelper {
             final Matcher matcher = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE).matcher(value);
             final StringBuffer buf = new StringBuffer(value.length() + 100);
             while (matcher.find()) {
-                matcher.appendReplacement(buf, highlightTagPre + matcher.group(0) + highlightTagPost);
+                matcher.appendReplacement(buf, Matcher.quoteReplacement(highlightTagPre + matcher.group(0) + highlightTagPost));
             }
             matcher.appendTail(buf);
             return buf.toString();

+ 4 - 0
src/test/java/org/codelibs/fess/helper/ViewHelperTest.java

@@ -369,5 +369,9 @@ public class ViewHelperTest extends UnitFessTestCase {
         document.put("title", "on 111 strong on aaaa");
         assertEquals("<strong>on</strong> 111 str<strong>on</strong>g <strong>on</strong> <strong>aaa</strong>a",
                 viewHelper.getContentTitle(document));
+
+        querySet.add("$");
+        document.put("title", "$test");
+        assertEquals("<strong>$</strong>test", viewHelper.getContentTitle(document));
     }
 }