Commit 3a764fd3 authored by tordinge's avatar tordinge
Browse files

since no regex involved, replace() should be faster than replaceAll() since no...

since no regex involved, replace() should be faster than replaceAll() since no Pattern.compile().matcher() will be needed behind the scenes
parent d756133d
......@@ -228,7 +228,7 @@ public class ExoneraTorDatabaseImporter {
try {
fingerprintBase64 = Base64.encodeBase64String(
Hex.decodeHex(entry.getFingerprint().toCharArray()))
.replaceAll("=", "");
.replace("=", "");
} catch (DecoderException e) {
logger.warn("Unable to decode hex fingerprint {} to convert it back "
+ "to base64. Aborting import.", entry.getFingerprint(), e);
......@@ -295,7 +295,7 @@ public class ExoneraTorDatabaseImporter {
+ "s", "0"));
if (!addressHexString.contains("x")
&& addressHexString.length() == 32) {
orAddress24 = addressHexString.replaceAll(" ", "0")
orAddress24 = addressHexString.replace(" ", "0")
.toLowerCase().substring(0, 6);
}
}
......@@ -327,7 +327,7 @@ public class ExoneraTorDatabaseImporter {
try {
fingerprintBase64 = Base64.encodeBase64String(
Hex.decodeHex(entry.getFingerprint().toCharArray()))
.replaceAll("=", "");
.replace("=", "");
} catch (DecoderException ex) {
logger.warn("Unable to decode hex fingerprint {} to convert to "
+ "base64. Aborting import.", entry.getFingerprint(), ex);
......
......@@ -480,7 +480,7 @@ public class ExoneraTorServlet extends HttpServlet {
if (addressInSameNetwork.contains(":")) {
address = addressInSameNetwork.replaceAll("[\\[\\]]", "");
link = String.format("%s?ip=[%s]&timestamp=%s&lang=%s",
requestUri, address.replaceAll(":", "%3A"), timestampStr, langStr);
requestUri, address.replace(":", "%3A"), timestampStr, langStr);
address = "[" + address + "]";
} else {
link = String.format("%s?ip=%s&timestamp=%s&lang=%s",
......@@ -609,7 +609,7 @@ public class ExoneraTorServlet extends HttpServlet {
String permanentLinkUrl, String relayIp, String timestampStr,
String langStr) {
String encodedAddress = relayIp.contains(":")
? "[" + relayIp.replaceAll(":", "%3A") + "]" : relayIp;
? "[" + relayIp.replace(":", "%3A") + "]" : relayIp;
out.printf(" <div class=\"row\">\n"
+ " <div class=\"col-xs-12\">\n"
+ " <h2>%s</h2>\n"
......
......@@ -214,7 +214,7 @@ public class QueryServlet extends HttpServlet {
+ "s", "0"));
if (!addressHexString.contains("x")
&& addressHexString.length() == 32) {
address48 = addressHexString.replaceAll(" ", "0")
address48 = addressHexString.replace(" ", "0")
.toLowerCase();
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment