diff --git a/router/java/src/net/i2p/router/Blocklist.java b/router/java/src/net/i2p/router/Blocklist.java index 1c50eaa65..4e94d7709 100644 --- a/router/java/src/net/i2p/router/Blocklist.java +++ b/router/java/src/net/i2p/router/Blocklist.java @@ -754,37 +754,36 @@ public class Blocklist { // We already shitlisted in shitlist(peer), that's good enough } + /** write directly to the stream so we don't OOM on a huge list */ public void renderStatusHTML(Writer out) throws IOException { - StringBuffer buf = new StringBuffer(1024); - buf.append("

IP Blocklist

"); + out.write("

IP Blocklist

"); Set singles = new TreeSet(); synchronized(_singleIPBlocklist) { singles.addAll(_singleIPBlocklist); } if (singles.size() > 0) { - buf.append(""); + out.write("
Transient IPs
"); for (Iterator iter = singles.iterator(); iter.hasNext(); ) { int ip = ((Integer) iter.next()).intValue(); - buf.append("\n"); + out.write("\n"); } - buf.append("
Transient IPs
").append(toStr(ip)).append("
"); out.write(toStr(ip)); out.write("
"); + out.write(""); } if (_blocklistSize > 0) { - buf.append(""); + out.write("
IPs from Blocklist File
FromTo
"); for (int i = 0; i < _blocklistSize; i++) { int from = getFrom(_blocklist[i]); - buf.append("\n"); - else - buf.append(" \n"); + if (to != from) { + out.write(toStr(to)); out.write("\n"); + } else + out.write(" \n"); } - buf.append("
IPs from Blocklist File
FromTo
").append(toStr(from)).append(""); + out.write("
"); out.write(toStr(from)); out.write(""); int to = getTo(_blocklist[i]); - if (to != from) - buf.append(toStr(to)).append("
"); + out.write(""); } else { - buf.append("
No blocklist file entries"); + out.write("
No blocklist file entries"); } - out.write(buf.toString()); out.flush(); }