Escaping javascript string in java
Looks like it was moved in Apache Commons Lang 3 to ESCAPE_ECMASCRIPT in StringEscapeUtils.
https://commons.apache.org/proper/commons-lang/javadocs/api-3.4/src-html/org/apache/commons/lang3/StringEscapeUtils.html#line.74
Apache commons have a methods just for this in StringEscapeUtils : the escapeJavaScript
method.