From c22d9d59e5b86c33f91d7fa93d71cdc514c2edd9 Mon Sep 17 00:00:00 2001 From: Henri Yandell Date: Fri, 26 Oct 2007 06:08:54 +0000 Subject: [PATCH] Applying Scott Bassin's fix and test from LANG-363 git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@588534 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/commons/lang/StringEscapeUtils.java | 4 ++++ src/test/org/apache/commons/lang/StringEscapeUtilsTest.java | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/java/org/apache/commons/lang/StringEscapeUtils.java b/src/java/org/apache/commons/lang/StringEscapeUtils.java index 4fda091d4..db2d7bd47 100644 --- a/src/java/org/apache/commons/lang/StringEscapeUtils.java +++ b/src/java/org/apache/commons/lang/StringEscapeUtils.java @@ -233,6 +233,10 @@ public class StringEscapeUtils { out.write('\\'); out.write('\\'); break; + case '/': + out.write('\\'); + out.write('/'); + break; default : out.write(ch); break; diff --git a/src/test/org/apache/commons/lang/StringEscapeUtilsTest.java b/src/test/org/apache/commons/lang/StringEscapeUtilsTest.java index b6d66163b..946af2dc1 100644 --- a/src/test/org/apache/commons/lang/StringEscapeUtilsTest.java +++ b/src/test/org/apache/commons/lang/StringEscapeUtilsTest.java @@ -184,6 +184,8 @@ public class StringEscapeUtilsTest extends TestCase { } assertEquals("He didn\\'t say, \\\"stop!\\\"", StringEscapeUtils.escapeJavaScript("He didn't say, \"stop!\"")); + assertEquals("document.getElementById(\\\"test\\\").value = \\'';")); }