From 0af8807af46bb8a3d69d9092cd701bf9a5cef871 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 17 Jan 2013 17:19:55 +0100 Subject: [PATCH] =?utf8?q?Replace=20utils=E2=80=99=20Hex=20by=20Guava?= =?utf8?q?=E2=80=99s=20BaseEncoding.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/main/java/net/pterodactylus/sone/template/JavascriptFilter.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/template/JavascriptFilter.java b/src/main/java/net/pterodactylus/sone/template/JavascriptFilter.java index fe3e130..9b8cd7e 100644 --- a/src/main/java/net/pterodactylus/sone/template/JavascriptFilter.java +++ b/src/main/java/net/pterodactylus/sone/template/JavascriptFilter.java @@ -19,10 +19,11 @@ package net.pterodactylus.sone.template; import java.util.Map; -import net.pterodactylus.util.number.Hex; import net.pterodactylus.util.template.Filter; import net.pterodactylus.util.template.TemplateContext; +import com.google.common.io.BaseEncoding; + /** * Escapes double quotes, backslashes, carriage returns and line feeds, and * additionally encloses a given string with double quotes to make it possible @@ -56,7 +57,7 @@ public class JavascriptFilter implements Filter { javascriptString.append('\\'); javascriptString.append(c); } else if (c < 32) { - javascriptString.append("\\x").append(Hex.toHex((byte) c)); + javascriptString.append("\\x").append(BaseEncoding.base16().lowerCase().encode(new byte[] { (byte) c })); } else { javascriptString.append(c); } -- 2.7.4