From: David ‘Bombe’ Roden Date: Thu, 17 Jan 2013 16:19:55 +0000 (+0100) Subject: Replace utils’ Hex by Guava’s BaseEncoding. X-Git-Tag: 0.8.5^2~3^2~64 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=0af8807af46bb8a3d69d9092cd701bf9a5cef871;p=Sone.git Replace utils’ Hex by Guava’s BaseEncoding. --- 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); }