merge of '8a3fab47a669f61548d9807e8e047b19248a23ab'

and 'a3189032197fadc3ecba67c5568b8841e8a6105e'
This commit is contained in:
z3d
2009-07-07 00:04:03 +00:00
210 changed files with 532 additions and 419 deletions

View File

@ -65,7 +65,7 @@ cd $CWD/../../
ant distclean ant distclean
ant dist ant dist
ant tarball
tar xjvf i2p.tar.bz2 -C $TMP tar xjvf i2p.tar.bz2 -C $TMP

View File

@ -2,6 +2,6 @@
<project-private xmlns="http://www.netbeans.org/ns/project-private/1"> <project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/> <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/1"> <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/1">
<file>file:/root/NetBeansProjects/i2p.i2p/apps/BOB/src/net/i2p/BOB/MUXlisten.java</file> <file>file:/root/NetBeansProjects/i2p.i2p/apps/BOB/src/net/i2p/BOB/I2PtoTCP.java</file>
</open-files> </open-files>
</project-private> </project-private>

View File

@ -140,7 +140,7 @@ public class BitField
public String toString() public String toString()
{ {
// Not very efficient // Not very efficient
StringBuffer sb = new StringBuffer("BitField("); StringBuilder sb = new StringBuilder("BitField(");
sb.append(size).append(")["); sb.append(size).append(")[");
for (int i = 0; i < size; i++) for (int i = 0; i < size; i++)
if (get(i)) if (get(i))

View File

@ -362,7 +362,7 @@ public class MetaInfo
*/ */
private static String hexencode(byte[] bs) private static String hexencode(byte[] bs)
{ {
StringBuffer sb = new StringBuffer(bs.length*2); StringBuilder sb = new StringBuilder(bs.length*2);
for (int i = 0; i < bs.length; i++) for (int i = 0; i < bs.length; i++)
{ {
int c = bs[i] & 0xFF; int c = bs[i] & 0xFF;
@ -432,7 +432,7 @@ public class MetaInfo
private byte[] calculateInfoHash() private byte[] calculateInfoHash()
{ {
Map info = createInfoMap(); Map info = createInfoMap();
StringBuffer buf = new StringBuffer(128); StringBuilder buf = new StringBuilder(128);
buf.append("info: "); buf.append("info: ");
for (Iterator iter = info.entrySet().iterator(); iter.hasNext(); ) { for (Iterator iter = info.entrySet().iterator(); iter.hasNext(); ) {
Map.Entry entry = (Map.Entry)iter.next(); Map.Entry entry = (Map.Entry)iter.next();

View File

@ -190,7 +190,7 @@ public class PeerID implements Comparable
{ {
boolean leading_zeros = true; boolean leading_zeros = true;
StringBuffer sb = new StringBuffer(bs.length*2); StringBuilder sb = new StringBuilder(bs.length*2);
for (int i = 0; i < bs.length; i++) for (int i = 0; i < bs.length; i++)
{ {
int c = bs[i] & 0xFF; int c = bs[i] & 0xFF;

View File

@ -702,7 +702,7 @@ public class SnarkManager implements Snark.CompleteListener {
// , "mastertracker", "http://VzXD~stRKbL3MOmeTn1iaCQ0CFyTmuFHiKYyo0Rd~dFPZFCYH-22rT8JD7i-C2xzYFa4jT5U2aqHzHI-Jre4HL3Ri5hFtZrLk2ax3ji7Qfb6qPnuYkuiF2E2UDmKUOppI8d9Ye7tjdhQVCy0izn55tBaB-U7UWdcvSK2i85sauyw3G0Gfads1Rvy5-CAe2paqyYATcDmGjpUNLoxbfv9KH1KmwRTNH6k1v4PyWYYnhbT39WfKMbBjSxVQRdi19cyJrULSWhjxaQfJHeWx5Z8Ev4bSPByBeQBFl2~4vqy0S5RypINsRSa3MZdbiAAyn5tr5slWR6QdoqY3qBQgBJFZppy-3iWkFqqKgSxCPundF8gdDLC5ddizl~KYcYKl42y9SGFHIukH-TZs8~em0~iahzsqWVRks3zRG~tlBcX2U3M2~OJs~C33-NKhyfZT7-XFBREvb8Szmd~p66jDxrwOnKaku-G6DyoQipJqIz4VHmY9-y5T8RrUcJcM-5lVoMpAAAA.i2p/announce.php=http://tracker.mastertracker.i2p/" // , "mastertracker", "http://VzXD~stRKbL3MOmeTn1iaCQ0CFyTmuFHiKYyo0Rd~dFPZFCYH-22rT8JD7i-C2xzYFa4jT5U2aqHzHI-Jre4HL3Ri5hFtZrLk2ax3ji7Qfb6qPnuYkuiF2E2UDmKUOppI8d9Ye7tjdhQVCy0izn55tBaB-U7UWdcvSK2i85sauyw3G0Gfads1Rvy5-CAe2paqyYATcDmGjpUNLoxbfv9KH1KmwRTNH6k1v4PyWYYnhbT39WfKMbBjSxVQRdi19cyJrULSWhjxaQfJHeWx5Z8Ev4bSPByBeQBFl2~4vqy0S5RypINsRSa3MZdbiAAyn5tr5slWR6QdoqY3qBQgBJFZppy-3iWkFqqKgSxCPundF8gdDLC5ddizl~KYcYKl42y9SGFHIukH-TZs8~em0~iahzsqWVRks3zRG~tlBcX2U3M2~OJs~C33-NKhyfZT7-XFBREvb8Szmd~p66jDxrwOnKaku-G6DyoQipJqIz4VHmY9-y5T8RrUcJcM-5lVoMpAAAA.i2p/announce.php=http://tracker.mastertracker.i2p/"
// , "Galen", "http://5jpwQMI5FT303YwKa5Rd38PYSX04pbIKgTaKQsWbqoWjIfoancFdWCShXHLI5G5ofOb0Xu11vl2VEMyPsg1jUFYSVnu4-VfMe3y4TKTR6DTpetWrnmEK6m2UXh91J5DZJAKlgmO7UdsFlBkQfR2rY853-DfbJtQIFl91tbsmjcA5CGQi4VxMFyIkBzv-pCsuLQiZqOwWasTlnzey8GcDAPG1LDcvfflGV~6F5no9mnuisZPteZKlrv~~TDoXTj74QjByWc4EOYlwqK8sbU9aOvz~s31XzErbPTfwiawiaZ0RUI-IDrKgyvmj0neuFTWgjRGVTH8bz7cBZIc3viy6ioD-eMQOrXaQL0TCWZUelRwHRvgdPiQrxdYQs7ixkajeHzxi-Pq0EMm5Vbh3j3Q9kfUFW3JjFDA-MLB4g6XnjCbM5J1rC0oOBDCIEfhQkszru5cyLjHiZ5yeA0VThgu~c7xKHybv~OMXION7V8pBKOgET7ZgAkw1xgYe3Kkyq5syAAAA.i2p/tr/announce.php=http://galen.i2p/tr/" // , "Galen", "http://5jpwQMI5FT303YwKa5Rd38PYSX04pbIKgTaKQsWbqoWjIfoancFdWCShXHLI5G5ofOb0Xu11vl2VEMyPsg1jUFYSVnu4-VfMe3y4TKTR6DTpetWrnmEK6m2UXh91J5DZJAKlgmO7UdsFlBkQfR2rY853-DfbJtQIFl91tbsmjcA5CGQi4VxMFyIkBzv-pCsuLQiZqOwWasTlnzey8GcDAPG1LDcvfflGV~6F5no9mnuisZPteZKlrv~~TDoXTj74QjByWc4EOYlwqK8sbU9aOvz~s31XzErbPTfwiawiaZ0RUI-IDrKgyvmj0neuFTWgjRGVTH8bz7cBZIc3viy6ioD-eMQOrXaQL0TCWZUelRwHRvgdPiQrxdYQs7ixkajeHzxi-Pq0EMm5Vbh3j3Q9kfUFW3JjFDA-MLB4g6XnjCbM5J1rC0oOBDCIEfhQkszru5cyLjHiZ5yeA0VThgu~c7xKHybv~OMXION7V8pBKOgET7ZgAkw1xgYe3Kkyq5syAAAA.i2p/tr/announce.php=http://galen.i2p/tr/"
, "crstrack", "http://b4G9sCdtfvccMAXh~SaZrPqVQNyGQbhbYMbw6supq2XGzbjU4NcOmjFI0vxQ8w1L05twmkOvg5QERcX6Mi8NQrWnR0stLExu2LucUXg1aYjnggxIR8TIOGygZVIMV3STKH4UQXD--wz0BUrqaLxPhrm2Eh9Hwc8TdB6Na4ShQUq5Xm8D4elzNUVdpM~RtChEyJWuQvoGAHY3ppX-EJJLkiSr1t77neS4Lc-KofMVmgI9a2tSSpNAagBiNI6Ak9L1T0F9uxeDfEG9bBSQPNMOSUbAoEcNxtt7xOW~cNOAyMyGydwPMnrQ5kIYPY8Pd3XudEko970vE0D6gO19yoBMJpKx6Dh50DGgybLQ9CpRaynh2zPULTHxm8rneOGRcQo8D3mE7FQ92m54~SvfjXjD2TwAVGI~ae~n9HDxt8uxOecAAvjjJ3TD4XM63Q9TmB38RmGNzNLDBQMEmJFpqQU8YeuhnS54IVdUoVQFqui5SfDeLXlSkh4vYoMU66pvBfWbAAAA.i2p/tracker/announce.php=http://crstrack.i2p/tracker/" , "crstrack", "http://b4G9sCdtfvccMAXh~SaZrPqVQNyGQbhbYMbw6supq2XGzbjU4NcOmjFI0vxQ8w1L05twmkOvg5QERcX6Mi8NQrWnR0stLExu2LucUXg1aYjnggxIR8TIOGygZVIMV3STKH4UQXD--wz0BUrqaLxPhrm2Eh9Hwc8TdB6Na4ShQUq5Xm8D4elzNUVdpM~RtChEyJWuQvoGAHY3ppX-EJJLkiSr1t77neS4Lc-KofMVmgI9a2tSSpNAagBiNI6Ak9L1T0F9uxeDfEG9bBSQPNMOSUbAoEcNxtt7xOW~cNOAyMyGydwPMnrQ5kIYPY8Pd3XudEko970vE0D6gO19yoBMJpKx6Dh50DGgybLQ9CpRaynh2zPULTHxm8rneOGRcQo8D3mE7FQ92m54~SvfjXjD2TwAVGI~ae~n9HDxt8uxOecAAvjjJ3TD4XM63Q9TmB38RmGNzNLDBQMEmJFpqQU8YeuhnS54IVdUoVQFqui5SfDeLXlSkh4vYoMU66pvBfWbAAAA.i2p/tracker/announce.php=http://crstrack.i2p/tracker/"
, "Postman2", "http://lnQ6yoBTxQuQU8EQ1FlF395ITIQF-HGJxUeFvzETLFnoczNjQvKDbtSB7aHhn853zjVXrJBgwlB9sO57KakBDaJ50lUZgVPhjlI19TgJ-CxyHhHSCeKx5JzURdEW-ucdONMynr-b2zwhsx8VQCJwCEkARvt21YkOyQDaB9IdV8aTAmP~PUJQxRwceaTMn96FcVenwdXqleE16fI8CVFOV18jbJKrhTOYpTtcZKV4l1wNYBDwKgwPx5c0kcrRzFyw5~bjuAKO~GJ5dR7BQsL7AwBoQUS4k1lwoYrG1kOIBeDD3XF8BWb6K3GOOoyjc1umYKpur3G~FxBuqtHAsDRICkEbKUqJ9mPYQlTSujhNxiRIW-oLwMtvayCFci99oX8MvazPS7~97x0Gsm-onEK1Td9nBdmq30OqDxpRtXBimbzkLbR1IKObbg9HvrKs3L-kSyGwTUmHG9rSQSoZEvFMA-S0EXO~o4g21q1oikmxPMhkeVwQ22VHB0-LZJfmLr4SAAAA.i2p/announce.php=http://tracker2.postman.i2p/" , "Postman2", "http://tracker2.postman.i2p/announce.php=http://tracker2.postman.i2p/"
}; };
/** comma delimited list of name=announceURL=baseURL for the trackers to be displayed */ /** comma delimited list of name=announceURL=baseURL for the trackers to be displayed */

View File

@ -373,7 +373,7 @@ public class TrackerClient extends I2PAppThread
*/ */
public static String urlencode(byte[] bs) public static String urlencode(byte[] bs)
{ {
StringBuffer sb = new StringBuffer(bs.length*3); StringBuilder sb = new StringBuilder(bs.length*3);
for (int i = 0; i < bs.length; i++) for (int i = 0; i < bs.length; i++)
{ {
int c = bs[i] & 0xFF; int c = bs[i] & 0xFF;

View File

@ -398,7 +398,7 @@ public class I2PSnarkServlet extends HttpServlet {
return rv; return rv;
} }
private static final int MAX_DISPLAYED_FILENAME_LENGTH = 60; private static final int MAX_DISPLAYED_FILENAME_LENGTH = 44;
private static final int MAX_DISPLAYED_ERROR_LENGTH = 40; private static final int MAX_DISPLAYED_ERROR_LENGTH = 40;
private void displaySnark(PrintWriter out, Snark snark, String uri, int row, long stats[], boolean showPeers, boolean showDebug) throws IOException { private void displaySnark(PrintWriter out, Snark snark, String uri, int row, long stats[], boolean showPeers, boolean showDebug) throws IOException {
String filename = snark.torrent; String filename = snark.torrent;
@ -506,7 +506,7 @@ public class I2PSnarkServlet extends HttpServlet {
// temporarily hardcoded for postman* and anonymity, requires bytemonsoon patch for lookup by info_hash // temporarily hardcoded for postman* and anonymity, requires bytemonsoon patch for lookup by info_hash
String announce = snark.meta.getAnnounce(); String announce = snark.meta.getAnnounce();
if (announce.startsWith("http://YRgrgTLG") || announce.startsWith("http://8EoJZIKr") || if (announce.startsWith("http://YRgrgTLG") || announce.startsWith("http://8EoJZIKr") ||
announce.startsWith("http://lnQ6yoBT")) { announce.startsWith("http://lnQ6yoBT") || announce.startsWith("http://tracker2.postman.i2p/")) {
Map trackers = _manager.getTrackers(); Map trackers = _manager.getTrackers();
for (Iterator iter = trackers.entrySet().iterator(); iter.hasNext(); ) { for (Iterator iter = trackers.entrySet().iterator(); iter.hasNext(); ) {
Map.Entry entry = (Map.Entry)iter.next(); Map.Entry entry = (Map.Entry)iter.next();
@ -759,7 +759,7 @@ public class I2PSnarkServlet extends HttpServlet {
+ _manager.util().getI2CPHost() + "\" size=\"15\" /> "); + _manager.util().getI2CPHost() + "\" size=\"15\" /> ");
out.write("port: <input type=\"text\" name=\"i2cpPort\" value=\"" + out.write("port: <input type=\"text\" name=\"i2cpPort\" value=\"" +
+ _manager.util().getI2CPPort() + "\" size=\"5\" maxlength=\"5\" /> <br />\n"); + _manager.util().getI2CPPort() + "\" size=\"5\" maxlength=\"5\" /> <br />\n");
StringBuffer opts = new StringBuffer(64); StringBuilder opts = new StringBuilder(64);
Map options = new TreeMap(_manager.util().getI2CPOptions()); Map options = new TreeMap(_manager.util().getI2CPOptions());
for (Iterator iter = options.entrySet().iterator(); iter.hasNext(); ) { for (Iterator iter = options.entrySet().iterator(); iter.hasNext(); ) {
Map.Entry entry = (Map.Entry)iter.next(); Map.Entry entry = (Map.Entry)iter.next();

View File

@ -179,7 +179,7 @@ public class I2PTunnelConnectClient extends I2PTunnelClientBase implements Runna
out = s.getOutputStream(); out = s.getOutputStream();
in = s.getInputStream(); in = s.getInputStream();
String line, method = null, host = null, destination = null, restofline = null; String line, method = null, host = null, destination = null, restofline = null;
StringBuffer newRequest = new StringBuffer(); StringBuilder newRequest = new StringBuilder();
int ahelper = 0; int ahelper = 0;
while (true) { while (true) {
// Use this rather than BufferedReader because we can't have readahead, // Use this rather than BufferedReader because we can't have readahead,

View File

@ -240,7 +240,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
out = s.getOutputStream(); out = s.getOutputStream();
InputReader reader = new InputReader(s.getInputStream()); InputReader reader = new InputReader(s.getInputStream());
String line, method = null, protocol = null, host = null, destination = null; String line, method = null, protocol = null, host = null, destination = null;
StringBuffer newRequest = new StringBuffer(); StringBuilder newRequest = new StringBuilder();
int ahelper = 0; int ahelper = 0;
while ((line = reader.readLine(method)) != null) { while ((line = reader.readLine(method)) != null) {
line = line.trim(); line = line.trim();
@ -811,11 +811,14 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
* but inproxy/gateway ops would be wise to block proxy.i2p to prevent * but inproxy/gateway ops would be wise to block proxy.i2p to prevent
* exposing the docs/ directory or perhaps other issues through * exposing the docs/ directory or perhaps other issues through
* uncaught vulnerabilities. * uncaught vulnerabilities.
* Restrict to the /themes/ directory for now.
* *
* @param targetRequest "proxy.i2p/foo.png HTTP/1.1" * @param targetRequest "proxy.i2p/themes/foo.png HTTP/1.1"
*/ */
private static void serveLocalFile(OutputStream out, String method, String targetRequest) { private static void serveLocalFile(OutputStream out, String method, String targetRequest) {
if (method.equals("GET") || method.equals("HEAD")) { if ((method.equals("GET") || method.equals("HEAD")) &&
targetRequest.startsWith("proxy.i2p/themes/") &&
!targetRequest.contains("..")) {
int space = targetRequest.indexOf(' '); int space = targetRequest.indexOf(' ');
String filename = null; String filename = null;
try { try {

View File

@ -19,6 +19,7 @@ import net.i2p.data.DataHelper;
import net.i2p.util.EventDispatcher; import net.i2p.util.EventDispatcher;
import net.i2p.util.I2PThread; import net.i2p.util.I2PThread;
import net.i2p.util.Log; import net.i2p.util.Log;
import net.i2p.data.Base32;
/** /**
* Simple extension to the I2PTunnelServer that filters the HTTP * Simple extension to the I2PTunnelServer that filters the HTTP
@ -33,6 +34,8 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
/** what Host: should we seem to be to the webserver? */ /** what Host: should we seem to be to the webserver? */
private String _spoofHost; private String _spoofHost;
private static final String HASH_HEADER = "X-I2P-DestHash"; private static final String HASH_HEADER = "X-I2P-DestHash";
private static final String DEST64_HEADER = "X-I2P-DestB64";
private static final String DEST32_HEADER = "X-I2P-DestB32";
public I2PTunnelHTTPServer(InetAddress host, int port, String privData, String spoofHost, Logging l, EventDispatcher notifyThis, I2PTunnel tunnel) { public I2PTunnelHTTPServer(InetAddress host, int port, String privData, String spoofHost, Logging l, EventDispatcher notifyThis, I2PTunnel tunnel) {
super(host, port, privData, l, notifyThis, tunnel); super(host, port, privData, l, notifyThis, tunnel);
@ -71,9 +74,12 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
InputStream in = socket.getInputStream(); InputStream in = socket.getInputStream();
StringBuffer command = new StringBuffer(128); StringBuilder command = new StringBuilder(128);
Properties headers = readHeaders(in, command); Properties headers = readHeaders(in, command);
headers.setProperty(HASH_HEADER, socket.getPeerDestination().calculateHash().toBase64()); headers.setProperty(HASH_HEADER, socket.getPeerDestination().calculateHash().toBase64());
headers.setProperty(DEST32_HEADER, Base32.encode(socket.getPeerDestination().calculateHash().getData()) + ".b32.i2p" );
headers.setProperty(DEST64_HEADER, socket.getPeerDestination().toBase64());
if ( (_spoofHost != null) && (_spoofHost.trim().length() > 0) ) if ( (_spoofHost != null) && (_spoofHost.trim().length() > 0) )
headers.setProperty("Host", _spoofHost); headers.setProperty("Host", _spoofHost);
headers.setProperty("Connection", "close"); headers.setProperty("Connection", "close");
@ -303,8 +309,8 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
} }
} }
private String formatHeaders(Properties headers, StringBuffer command) { private String formatHeaders(Properties headers, StringBuilder command) {
StringBuffer buf = new StringBuffer(command.length() + headers.size() * 64); StringBuilder buf = new StringBuilder(command.length() + headers.size() * 64);
buf.append(command.toString().trim()).append("\r\n"); buf.append(command.toString().trim()).append("\r\n");
for (Iterator iter = headers.keySet().iterator(); iter.hasNext(); ) { for (Iterator iter = headers.keySet().iterator(); iter.hasNext(); ) {
String name = (String)iter.next(); String name = (String)iter.next();
@ -315,9 +321,9 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
return buf.toString(); return buf.toString();
} }
private Properties readHeaders(InputStream in, StringBuffer command) throws IOException { private Properties readHeaders(InputStream in, StringBuilder command) throws IOException {
Properties headers = new Properties(); Properties headers = new Properties();
StringBuffer buf = new StringBuffer(128); StringBuilder buf = new StringBuilder(128);
boolean ok = DataHelper.readLine(in, command); boolean ok = DataHelper.readLine(in, command);
if (!ok) throw new IOException("EOF reached while reading the HTTP command [" + command.toString() + "]"); if (!ok) throw new IOException("EOF reached while reading the HTTP command [" + command.toString() + "]");
@ -361,6 +367,10 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
name = "X-Accept-encoding"; name = "X-Accept-encoding";
else if (HASH_HEADER.equalsIgnoreCase(name)) else if (HASH_HEADER.equalsIgnoreCase(name))
continue; // Prevent spoofing continue; // Prevent spoofing
else if (DEST64_HEADER.equalsIgnoreCase(name))
continue; // Prevent spoofing
else if (DEST32_HEADER.equalsIgnoreCase(name))
continue; // Prevent spoofing
headers.setProperty(name, value); headers.setProperty(name, value);
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
_log.debug("Read the header [" + name + "] = [" + value + "]"); _log.debug("Read the header [" + name + "] = [" + value + "]");

View File

@ -82,7 +82,7 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase implements Runnable
try { try {
i2ps = createI2PSocket(dest); i2ps = createI2PSocket(dest);
i2ps.setReadTimeout(readTimeout); i2ps.setReadTimeout(readTimeout);
StringBuffer expectedPong = new StringBuffer(); StringBuilder expectedPong = new StringBuilder();
Thread in = new I2PThread(new IrcInboundFilter(s,i2ps, expectedPong), "IRC Client " + __clientId + " in"); Thread in = new I2PThread(new IrcInboundFilter(s,i2ps, expectedPong), "IRC Client " + __clientId + " in");
in.start(); in.start();
Thread out = new I2PThread(new IrcOutboundFilter(s,i2ps, expectedPong), "IRC Client " + __clientId + " out"); Thread out = new I2PThread(new IrcOutboundFilter(s,i2ps, expectedPong), "IRC Client " + __clientId + " out");
@ -121,9 +121,9 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase implements Runnable
private Socket local; private Socket local;
private I2PSocket remote; private I2PSocket remote;
private StringBuffer expectedPong; private StringBuilder expectedPong;
IrcInboundFilter(Socket _local, I2PSocket _remote, StringBuffer pong) { IrcInboundFilter(Socket _local, I2PSocket _remote, StringBuilder pong) {
local=_local; local=_local;
remote=_remote; remote=_remote;
expectedPong=pong; expectedPong=pong;
@ -195,9 +195,9 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase implements Runnable
private Socket local; private Socket local;
private I2PSocket remote; private I2PSocket remote;
private StringBuffer expectedPong; private StringBuilder expectedPong;
IrcOutboundFilter(Socket _local, I2PSocket _remote, StringBuffer pong) { IrcOutboundFilter(Socket _local, I2PSocket _remote, StringBuilder pong) {
local=_local; local=_local;
remote=_remote; remote=_remote;
expectedPong=pong; expectedPong=pong;
@ -266,7 +266,7 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase implements Runnable
* *
*/ */
public String inboundFilter(String s, StringBuffer expectedPong) { public String inboundFilter(String s, StringBuilder expectedPong) {
String field[]=s.split(" ",4); String field[]=s.split(" ",4);
String command; String command;
@ -353,7 +353,7 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase implements Runnable
return null; return null;
} }
public String outboundFilter(String s, StringBuffer expectedPong) { public String outboundFilter(String s, StringBuilder expectedPong) {
String field[]=s.split(" ",3); String field[]=s.split(" ",3);
String command; String command;

View File

@ -135,7 +135,7 @@ public class I2PTunnelIRCServer extends I2PTunnelServer implements Runnable {
/** keep reading until we see USER or SERVER */ /** keep reading until we see USER or SERVER */
private String filterRegistration(InputStream in, String newHostname) throws IOException { private String filterRegistration(InputStream in, String newHostname) throws IOException {
StringBuffer buf = new StringBuffer(128); StringBuilder buf = new StringBuilder(128);
int lineCount = 0; int lineCount = 0;
while (true) { while (true) {

View File

@ -211,7 +211,7 @@ public class I2Ping extends I2PTunnelTask implements Runnable {
int fail = 0; int fail = 0;
long totalTime = 0; long totalTime = 0;
int cnt = countPing ? CPING_COUNT : PING_COUNT; int cnt = countPing ? CPING_COUNT : PING_COUNT;
StringBuffer pingResults = new StringBuffer(2 * cnt + destination.length() + 3); StringBuilder pingResults = new StringBuilder(2 * cnt + destination.length() + 3);
for (int i = 0; i < cnt; i++) { for (int i = 0; i < cnt; i++) {
boolean sent; boolean sent;
sent = ping(dest); sent = ping(dest);

View File

@ -385,7 +385,7 @@ public class TunnelController implements Logging {
public String getI2CPHost() { return _config.getProperty("i2cpHost"); } public String getI2CPHost() { return _config.getProperty("i2cpHost"); }
public String getI2CPPort() { return _config.getProperty("i2cpPort"); } public String getI2CPPort() { return _config.getProperty("i2cpPort"); }
public String getClientOptions() { public String getClientOptions() {
StringBuffer opts = new StringBuffer(64); StringBuilder opts = new StringBuilder(64);
for (Iterator iter = _config.keySet().iterator(); iter.hasNext(); ) { for (Iterator iter = _config.keySet().iterator(); iter.hasNext(); ) {
String key = (String)iter.next(); String key = (String)iter.next();
String val = _config.getProperty(key); String val = _config.getProperty(key);
@ -447,7 +447,7 @@ public class TunnelController implements Logging {
return true; return true;
} }
public void getSummary(StringBuffer buf) { public void getSummary(StringBuilder buf) {
String type = getType(); String type = getType();
if ("httpclient".equals(type)) if ("httpclient".equals(type))
getHttpClientSummary(buf); getHttpClientSummary(buf);
@ -461,7 +461,7 @@ public class TunnelController implements Logging {
buf.append("Unknown type ").append(type); buf.append("Unknown type ").append(type);
} }
private void getHttpClientSummary(StringBuffer buf) { private void getHttpClientSummary(StringBuilder buf) {
String description = getDescription(); String description = getDescription();
if ( (description != null) && (description.trim().length() > 0) ) if ( (description != null) && (description.trim().length() > 0) )
buf.append("<i>").append(description).append("</i><br />\n"); buf.append("<i>").append(description).append("</i><br />\n");
@ -482,7 +482,7 @@ public class TunnelController implements Logging {
getOptionSummary(buf); getOptionSummary(buf);
} }
private void getClientSummary(StringBuffer buf) { private void getClientSummary(StringBuilder buf) {
String description = getDescription(); String description = getDescription();
if ( (description != null) && (description.trim().length() > 0) ) if ( (description != null) && (description.trim().length() > 0) )
buf.append("<i>").append(description).append("</i><br />\n"); buf.append("<i>").append(description).append("</i><br />\n");
@ -499,7 +499,7 @@ public class TunnelController implements Logging {
getOptionSummary(buf); getOptionSummary(buf);
} }
private void getServerSummary(StringBuffer buf) { private void getServerSummary(StringBuilder buf) {
String description = getDescription(); String description = getDescription();
if ( (description != null) && (description.trim().length() > 0) ) if ( (description != null) && (description.trim().length() > 0) )
buf.append("<i>").append(description).append("</i><br />\n"); buf.append("<i>").append(description).append("</i><br />\n");
@ -510,7 +510,7 @@ public class TunnelController implements Logging {
getOptionSummary(buf); getOptionSummary(buf);
} }
private void getHttpServerSummary(StringBuffer buf) { private void getHttpServerSummary(StringBuilder buf) {
String description = getDescription(); String description = getDescription();
if ( (description != null) && (description.trim().length() > 0) ) if ( (description != null) && (description.trim().length() > 0) )
buf.append("<i>").append(description).append("</i><br />\n"); buf.append("<i>").append(description).append("</i><br />\n");
@ -522,7 +522,7 @@ public class TunnelController implements Logging {
getOptionSummary(buf); getOptionSummary(buf);
} }
private void getOptionSummary(StringBuffer buf) { private void getOptionSummary(StringBuilder buf) {
String opts = getClientOptions(); String opts = getClientOptions();
if ( (opts != null) && (opts.length() > 0) ) if ( (opts != null) && (opts.length() > 0) )
buf.append("Network options: ").append(opts).append("<br />\n"); buf.append("Network options: ").append(opts).append("<br />\n");

View File

@ -245,7 +245,7 @@ public class TunnelControllerGroup {
map.putAll(cur); map.putAll(cur);
} }
StringBuffer buf = new StringBuffer(1024); StringBuilder buf = new StringBuilder(1024);
for (Iterator iter = map.keySet().iterator(); iter.hasNext(); ) { for (Iterator iter = map.keySet().iterator(); iter.hasNext(); ) {
String key = (String)iter.next(); String key = (String)iter.next();
String val = (String)map.get(key); String val = (String)map.get(key);

View File

@ -123,7 +123,7 @@ public class SOCKS4aServer extends SOCKSServer {
} }
private String readString(DataInputStream in) throws IOException { private String readString(DataInputStream in) throws IOException {
StringBuffer sb = new StringBuffer(16); StringBuilder sb = new StringBuilder(16);
char c; char c;
while ((c = (char) (in.readByte() & 0xff)) != 0) while ((c = (char) (in.readByte() & 0xff)) != 0)
sb.append(c); sb.append(c);

View File

@ -223,7 +223,7 @@ public class EditBean extends IndexBean {
if (tun != null) { if (tun != null) {
Properties opts = getOptions(tun); Properties opts = getOptions(tun);
if (opts == null) return ""; if (opts == null) return "";
StringBuffer buf = new StringBuffer(64); StringBuilder buf = new StringBuilder(64);
int i = 0; int i = 0;
for (Iterator iter = opts.keySet().iterator(); iter.hasNext(); ) { for (Iterator iter = opts.keySet().iterator(); iter.hasNext(); ) {
String key = (String)iter.next(); String key = (String)iter.next();

View File

@ -302,7 +302,7 @@ public class IndexBean {
if (_group == null) if (_group == null)
return ""; return "";
StringBuffer buf = new StringBuffer(512); StringBuilder buf = new StringBuilder(512);
if (_action != null) { if (_action != null) {
try { try {
buf.append(processAction()).append("\n"); buf.append(processAction()).append("\n");
@ -927,11 +927,11 @@ public class IndexBean {
} }
private String getMessages(List msgs) { private String getMessages(List msgs) {
StringBuffer buf = new StringBuffer(128); StringBuilder buf = new StringBuilder(128);
getMessages(msgs, buf); getMessages(msgs, buf);
return buf.toString(); return buf.toString();
} }
private void getMessages(List msgs, StringBuffer buf) { private void getMessages(List msgs, StringBuilder buf) {
if (msgs == null) return; if (msgs == null) return;
for (int i = 0; i < msgs.size(); i++) { for (int i = 0; i < msgs.size(); i++) {
buf.append((String)msgs.get(i)).append("\n"); buf.append((String)msgs.get(i)).append("\n");

View File

@ -18,7 +18,7 @@
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" /> <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<% if (editBean.allowCSS()) { <% if (editBean.allowCSS()) {
%><link href="images/favicon.ico" type="image/x-icon" rel="shortcut icon" /> %><link href="/themes/console/images/favicon.ico" type="image/x-icon" rel="shortcut icon" />
<link href="<%=editBean.getTheme()%>default.css" rel="stylesheet" type="text/css" /> <link href="<%=editBean.getTheme()%>default.css" rel="stylesheet" type="text/css" />
<link href="<%=editBean.getTheme()%>i2ptunnel.css" rel="stylesheet" type="text/css" /> <link href="<%=editBean.getTheme()%>i2ptunnel.css" rel="stylesheet" type="text/css" />
<% } <% }
@ -388,7 +388,7 @@
<label for="localDestination" accesskey="L"> <label for="localDestination" accesskey="L">
<span class="accessKey">L</span>ocal destination: <span class="accessKey">L</span>ocal destination:
</label> </label>
<textarea rows="1" cols="60" readonly="readonly" id="localDestination" title="Read Only: Local Destination (if known)" wrap="off"><%=editBean.getDestinationBase64(curTunnel)%></textarea> <textarea rows="1" style="height: 3em;" cols="60" readonly="readonly" id="localDestination" title="Read Only: Local Destination (if known)" wrap="off"><%=editBean.getDestinationBase64(curTunnel)%></textarea>
<span class="comment">(if known)</span> <span class="comment">(if known)</span>
</div> </div>

View File

@ -18,7 +18,7 @@
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" /> <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<% if (editBean.allowCSS()) { <% if (editBean.allowCSS()) {
%><link href="images/favicon.ico" type="image/x-icon" rel="shortcut icon" /> %><link href="/themes/console/images/favicon.ico" type="image/x-icon" rel="shortcut icon" />
<link href="<%=editBean.getTheme()%>default.css" rel="stylesheet" type="text/css" /> <link href="<%=editBean.getTheme()%>default.css" rel="stylesheet" type="text/css" />
<link href="<%=editBean.getTheme()%>i2ptunnel.css" rel="stylesheet" type="text/css" /> <link href="<%=editBean.getTheme()%>i2ptunnel.css" rel="stylesheet" type="text/css" />
<% } <% }
@ -148,7 +148,7 @@
<label for="localDestination" accesskey="L"> <label for="localDestination" accesskey="L">
<span class="accessKey">L</span>ocal destination: <span class="accessKey">L</span>ocal destination:
</label> </label>
<textarea rows="1" cols="60" readonly="readonly" id="localDestination" title="Read Only: Local Destination (if known)" wrap="off"><%=editBean.getDestinationBase64(curTunnel)%></textarea> <textarea rows="1" style="height: 3em;" cols="60" readonly="readonly" id="localDestination" title="Read Only: Local Destination (if known)" wrap="off"><%=editBean.getDestinationBase64(curTunnel)%></textarea>
<% if (!"".equals(editBean.getDestinationBase64(curTunnel))) { %> <% if (!"".equals(editBean.getDestinationBase64(curTunnel))) { %>
<a href="/susidns/addressbook.jsp?book=private&hostname=<%=editBean.getTunnelName(curTunnel)%>&destination=<%=editBean.getDestinationBase64(curTunnel)%>#add">Add to local addressbook</a> <a href="/susidns/addressbook.jsp?book=private&hostname=<%=editBean.getTunnelName(curTunnel)%>&destination=<%=editBean.getDestinationBase64(curTunnel)%>#add">Add to local addressbook</a>
<% } %> <% } %>
@ -270,7 +270,7 @@
<label for="encrypt" accesskey="e"> <label for="encrypt" accesskey="e">
Encryption Key: Encryption Key:
</label> </label>
<textarea rows="1" cols="44" id="portField" name="encryptKey" title="Encrypt Key" wrap="off"><%=editBean.getEncryptKey(curTunnel)%></textarea> <textarea rows="1" style="height: 3em;" cols="44" id="portField" name="encryptKey" title="Encrypt Key" wrap="off"><%=editBean.getEncryptKey(curTunnel)%></textarea>
</div> </div>
<div id="portField" class="rowItem"> <div id="portField" class="rowItem">
<label for="force" accesskey="c"> <label for="force" accesskey="c">
@ -299,7 +299,7 @@
<label for="accessList" accesskey="s"> <label for="accessList" accesskey="s">
Access List: Access List:
</label> </label>
<textarea rows="2" cols="60" id="hostField" name="accessList" title="Access List" wrap="off"><%=editBean.getAccessList(curTunnel)%></textarea> <textarea rows="2" style="height: 4em;" cols="60" id="hostField" name="accessList" title="Access List" wrap="off"><%=editBean.getAccessList(curTunnel)%></textarea>
<span class="comment">(Restrict to these clients only)</span> <span class="comment">(Restrict to these clients only)</span>
</div> </div>

View File

@ -11,7 +11,7 @@ p-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" /> <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<% if (indexBean.allowCSS()) { <% if (indexBean.allowCSS()) {
%><link href="images/favicon.ico" type="image/x-icon" rel="shortcut icon" /> %><link href="/themes/console/images/favicon.ico" type="image/x-icon" rel="shortcut icon" />
<link href="<%=indexBean.getTheme()%>default.css" rel="stylesheet" type="text/css" /> <link href="<%=indexBean.getTheme()%>default.css" rel="stylesheet" type="text/css" />
<link href="<%=indexBean.getTheme()%>i2ptunnel.css" rel="stylesheet" type="text/css" /> <link href="<%=indexBean.getTheme()%>i2ptunnel.css" rel="stylesheet" type="text/css" />
<% } <% }
@ -77,7 +77,7 @@ p-equiv="Content-Type" content="text/html; charset=UTF-8" />
%> %>
<div class="nameField rowItem"> <div class="nameField rowItem">
<label>Name:</label> <label>Name:</label>
<span class="text"><a href="edit.jsp?tunnel=<%=curClient%>" title="Edit Tunnel Settings for <%=indexBean.getTunnelName(curClient)%>"><%=indexBean.getTunnelName(curClient)%></a></span> <span class="text"><a href="edit.jsp?tunnel=<%=curClient%>" title="Edit Tunnel Settings for <%=indexBean.getTunnelName(curClient)%>"><%=indexBean.getTunnelName(curClient)%> (Edit)</a></span>
</div> </div>
<div class="portField rowItem"> <div class="portField rowItem">
<label>Port:</label> <label>Port:</label>
@ -193,7 +193,7 @@ p-equiv="Content-Type" content="text/html; charset=UTF-8" />
%> %>
<div class="nameField rowItem"> <div class="nameField rowItem">
<label>Name:</label> <label>Name:</label>
<span class="text"><a href="edit.jsp?tunnel=<%=curServer%>" title="Edit Server Tunnel Settings for <%=indexBean.getTunnelName(curServer)%>"><%=indexBean.getTunnelName(curServer)%></a></span> <span class="text"><a href="edit.jsp?tunnel=<%=curServer%>" title="Edit Server Tunnel Settings for <%=indexBean.getTunnelName(curServer)%>"><%=indexBean.getTunnelName(curServer)%> (Edit)</a></span>
</div> </div>
<div class="previewField rowItem"> <div class="previewField rowItem">
<label>Points at:</label> <label>Points at:</label>

View File

@ -88,7 +88,7 @@ public class I2PRequestLog extends NCSARequestLog
if (_fileOut==null) if (_fileOut==null)
return; return;
StringBuffer buf = new StringBuffer(160); StringBuilder buf = new StringBuilder(160);
String addr = request.getField("X-I2P-DestHash"); String addr = request.getField("X-I2P-DestHash");
if(addr != null) if(addr != null)

View File

@ -10,7 +10,7 @@ public class ConfigAdvancedHelper extends HelperBase {
public ConfigAdvancedHelper() {} public ConfigAdvancedHelper() {}
public String getSettings() { public String getSettings() {
StringBuffer buf = new StringBuffer(4*1024); StringBuilder buf = new StringBuilder(4*1024);
Set names = _context.router().getConfigSettings(); Set names = _context.router().getConfigSettings();
TreeSet sortedNames = new TreeSet(names); TreeSet sortedNames = new TreeSet(names);
for (Iterator iter = sortedNames.iterator(); iter.hasNext(); ) { for (Iterator iter = sortedNames.iterator(); iter.hasNext(); ) {

View File

@ -13,7 +13,7 @@ public class ConfigClientsHelper extends HelperBase {
public ConfigClientsHelper() {} public ConfigClientsHelper() {}
public String getForm1() { public String getForm1() {
StringBuffer buf = new StringBuffer(1024); StringBuilder buf = new StringBuilder(1024);
buf.append("<table border=\"1\">\n"); buf.append("<table border=\"1\">\n");
buf.append("<tr><th>Client</th><th>Run at Startup?</th><th>Start Now</th><th>Class and arguments</th></tr>\n"); buf.append("<tr><th>Client</th><th>Run at Startup?</th><th>Start Now</th><th>Class and arguments</th></tr>\n");
@ -29,7 +29,7 @@ public class ConfigClientsHelper extends HelperBase {
} }
public String getForm2() { public String getForm2() {
StringBuffer buf = new StringBuffer(1024); StringBuilder buf = new StringBuilder(1024);
buf.append("<table border=\"1\">\n"); buf.append("<table border=\"1\">\n");
buf.append("<tr><th>WebApp</th><th>Run at Startup?</th><th>Start Now</th><th>Description</th></tr>\n"); buf.append("<tr><th>WebApp</th><th>Run at Startup?</th><th>Start Now</th><th>Description</th></tr>\n");
Properties props = RouterConsoleRunner.webAppProperties(); Properties props = RouterConsoleRunner.webAppProperties();
@ -46,7 +46,7 @@ public class ConfigClientsHelper extends HelperBase {
return buf.toString(); return buf.toString();
} }
private void renderForm(StringBuffer buf, String index, String name, boolean urlify, boolean enabled, boolean ro, String desc) { private void renderForm(StringBuilder buf, String index, String name, boolean urlify, boolean enabled, boolean ro, String desc) {
buf.append("<tr><td>"); buf.append("<tr><td>");
if (urlify && enabled) { if (urlify && enabled) {
String link = "/"; String link = "/";

View File

@ -29,7 +29,7 @@ public class ConfigLoggingHelper extends HelperBase {
return (bytes/(1024)) + "k"; return (bytes/(1024)) + "k";
} }
public String getLogLevelTable() { public String getLogLevelTable() {
StringBuffer buf = new StringBuffer(32*1024); StringBuilder buf = new StringBuilder(32*1024);
Properties limits = _context.logManager().getLimits(); Properties limits = _context.logManager().getLimits();
TreeSet sortedLogs = new TreeSet(); TreeSet sortedLogs = new TreeSet();
for (Iterator iter = limits.keySet().iterator(); iter.hasNext(); ) { for (Iterator iter = limits.keySet().iterator(); iter.hasNext(); ) {
@ -51,7 +51,7 @@ public class ConfigLoggingHelper extends HelperBase {
} }
public String getDefaultLogLevelBox() { public String getDefaultLogLevelBox() {
String cur = _context.logManager().getDefaultLimit(); String cur = _context.logManager().getDefaultLimit();
StringBuffer buf = new StringBuffer(128); StringBuilder buf = new StringBuilder(128);
buf.append("<select name=\"defaultloglevel\">\n"); buf.append("<select name=\"defaultloglevel\">\n");
buf.append("<option value=\"DEBUG\" "); buf.append("<option value=\"DEBUG\" ");

View File

@ -190,7 +190,7 @@ public class ConfigNetHelper extends HelperBase {
} }
private static String getBurstFactor(int numSeconds, String name) { private static String getBurstFactor(int numSeconds, String name) {
StringBuffer buf = new StringBuffer(256); StringBuilder buf = new StringBuilder(256);
buf.append("<select name=\"").append(name).append("\">\n"); buf.append("<select name=\"").append(name).append("\">\n");
boolean found = false; boolean found = false;
for (int i = 10; i <= 70; i += 10) { for (int i = 10; i <= 70; i += 10) {
@ -220,7 +220,7 @@ public class ConfigNetHelper extends HelperBase {
public String getSharePercentageBox() { public String getSharePercentageBox() {
int pct = (int) (100 * _context.router().getSharePercentage()); int pct = (int) (100 * _context.router().getSharePercentage());
StringBuffer buf = new StringBuffer(256); StringBuilder buf = new StringBuilder(256);
buf.append("<select style=\"text-align: right;\" name=\"sharePercentage\">\n"); buf.append("<select style=\"text-align: right;\" name=\"sharePercentage\">\n");
boolean found = false; boolean found = false;
for (int i = 30; i <= 110; i += 10) { for (int i = 30; i <= 110; i += 10) {

View File

@ -71,7 +71,7 @@ public class ConfigRestartBean {
/** @param s value,label,... pairs */ /** @param s value,label,... pairs */
private static String buttons(String url, String nonce, String s) { private static String buttons(String url, String nonce, String s) {
StringBuffer buf = new StringBuffer(128); StringBuilder buf = new StringBuilder(128);
StringTokenizer tok = new StringTokenizer(s, ","); StringTokenizer tok = new StringTokenizer(s, ",");
buf.append("<form action=\"").append(url).append("\" method=\"GET\">\n"); buf.append("<form action=\"").append(url).append("\" method=\"GET\">\n");
buf.append("<input type=\"hidden\" name=\"consoleNonce\" value=\"").append(nonce).append("\" >\n"); buf.append("<input type=\"hidden\" name=\"consoleNonce\" value=\"").append(nonce).append("\" >\n");

View File

@ -102,7 +102,7 @@ public class ConfigStatsHandler extends FormHandler {
} }
} }
StringBuffer stats = new StringBuffer(); StringBuilder stats = new StringBuilder();
for (int i = 0; i < _stats.size(); i++) { for (int i = 0; i < _stats.size(); i++) {
stats.append((String)_stats.get(i)); stats.append((String)_stats.get(i));
if (i + 1 < _stats.size()) if (i + 1 < _stats.size())

View File

@ -13,7 +13,7 @@ public class ConfigTunnelsHelper extends HelperBase {
public String getForm() { public String getForm() {
StringBuffer buf = new StringBuffer(1024); StringBuilder buf = new StringBuilder(1024);
buf.append("<table border=\"1\">\n"); buf.append("<table border=\"1\">\n");
TunnelPoolSettings exploratoryIn = _context.tunnelManager().getInboundSettings(); TunnelPoolSettings exploratoryIn = _context.tunnelManager().getInboundSettings();
TunnelPoolSettings exploratoryOut = _context.tunnelManager().getOutboundSettings(); TunnelPoolSettings exploratoryOut = _context.tunnelManager().getOutboundSettings();
@ -54,7 +54,7 @@ public class ConfigTunnelsHelper extends HelperBase {
private static final int MAX_BACKUP_QUANTITY = 3; private static final int MAX_BACKUP_QUANTITY = 3;
private static final int MAX_VARIANCE = 2; private static final int MAX_VARIANCE = 2;
private static final int MIN_NEG_VARIANCE = -1; private static final int MIN_NEG_VARIANCE = -1;
private void renderForm(StringBuffer buf, int index, String prefix, String name, TunnelPoolSettings in, TunnelPoolSettings out) { private void renderForm(StringBuilder buf, int index, String prefix, String name, TunnelPoolSettings in, TunnelPoolSettings out) {
buf.append("<tr><th colspan=\"3\"><a name=\"").append(prefix).append("\">"); buf.append("<tr><th colspan=\"3\"><a name=\"").append(prefix).append("\">");
buf.append(name).append("</a></th></tr>\n"); buf.append(name).append("</a></th></tr>\n");
@ -179,7 +179,7 @@ public class ConfigTunnelsHelper extends HelperBase {
buf.append("<tr><td colspan=\"3\"><hr /></td></tr>\n"); buf.append("<tr><td colspan=\"3\"><hr /></td></tr>\n");
} }
private void renderOptions(StringBuffer buf, int min, int max, int now, String prefix, String name) { private void renderOptions(StringBuilder buf, int min, int max, int now, String prefix, String name) {
for (int i = min; i <= max; i++) { for (int i = min; i <= max; i++) {
buf.append("<option value=\"").append(i).append("\" "); buf.append("<option value=\"").append(i).append("\" ");
if (i == now) if (i == now)

View File

@ -58,7 +58,7 @@ public class ConfigUpdateHelper extends HelperBase {
ms = Long.parseLong(freq); ms = Long.parseLong(freq);
} catch (NumberFormatException nfe) {} } catch (NumberFormatException nfe) {}
StringBuffer buf = new StringBuffer(256); StringBuilder buf = new StringBuilder(256);
buf.append("<select name=\"refreshFrequency\">"); buf.append("<select name=\"refreshFrequency\">");
for (int i = 0; i < PERIODS.length; i++) { for (int i = 0; i < PERIODS.length; i++) {
buf.append("<option value=\"").append(PERIODS[i]); buf.append("<option value=\"").append(PERIODS[i]);
@ -77,7 +77,7 @@ public class ConfigUpdateHelper extends HelperBase {
public String getUpdatePolicySelectBox() { public String getUpdatePolicySelectBox() {
String policy = _context.getProperty(ConfigUpdateHandler.PROP_UPDATE_POLICY, ConfigUpdateHandler.DEFAULT_UPDATE_POLICY); String policy = _context.getProperty(ConfigUpdateHandler.PROP_UPDATE_POLICY, ConfigUpdateHandler.DEFAULT_UPDATE_POLICY);
StringBuffer buf = new StringBuffer(256); StringBuilder buf = new StringBuilder(256);
buf.append("<select name=\"updatePolicy\">"); buf.append("<select name=\"updatePolicy\">");
if ("notify".equals(policy)) if ("notify".equals(policy))

View File

@ -45,7 +45,7 @@ public class ContentHelper extends HelperBase {
if (str == null) if (str == null)
return ""; return "";
else { else {
StringBuffer sb = new StringBuffer(str.length()+11); StringBuilder sb = new StringBuilder(str.length()+11);
sb.append("<pre>"); sb.append("<pre>");
for (int i=0; i < str.length(); i++) { for (int i=0; i < str.length(); i++) {
char c = str.charAt(i); char c = str.charAt(i);

View File

@ -87,7 +87,7 @@ public class FormHandler {
process(); process();
if (_errors.size() <= 0 && _notices.size() <= 0) if (_errors.size() <= 0 && _notices.size() <= 0)
return ""; return "";
StringBuffer buf = new StringBuffer(512); StringBuilder buf = new StringBuilder(512);
buf.append("<div class=\"messages\" id=\"messages\"><p>"); buf.append("<div class=\"messages\" id=\"messages\"><p>");
if (_errors.size() > 0) { if (_errors.size() > 0) {
buf.append("<span class=\"error\">"); buf.append("<span class=\"error\">");
@ -178,7 +178,7 @@ public class FormHandler {
if (source.size() <= 0) { if (source.size() <= 0) {
return ""; return "";
} else { } else {
StringBuffer buf = new StringBuffer(512); StringBuilder buf = new StringBuilder(512);
buf.append("<ul>\n"); buf.append("<ul>\n");
for (int i = 0; i < source.size(); i++) { for (int i = 0; i < source.size(); i++) {
buf.append("<li>"); buf.append("<li>");

View File

@ -46,7 +46,7 @@ public class LogsHelper extends HelperBase {
private String formatMessages(List msgs) { private String formatMessages(List msgs) {
boolean colorize = Boolean.valueOf(_context.getProperty("routerconsole.logs.color")).booleanValue(); boolean colorize = Boolean.valueOf(_context.getProperty("routerconsole.logs.color")).booleanValue();
StringBuffer buf = new StringBuffer(16*1024); StringBuilder buf = new StringBuilder(16*1024);
buf.append("<ul>"); buf.append("<ul>");
buf.append("<code>\n"); buf.append("<code>\n");
for (int i = msgs.size(); i > 0; i--) { for (int i = msgs.size(); i > 0; i--) {

View File

@ -27,7 +27,7 @@ public class NavHelper extends HelperBase {
} }
public String getClientAppLinks() { public String getClientAppLinks() {
StringBuffer buf = new StringBuffer(1024); StringBuilder buf = new StringBuilder(1024);
for (Iterator iter = _apps.keySet().iterator(); iter.hasNext(); ) { for (Iterator iter = _apps.keySet().iterator(); iter.hasNext(); ) {
String name = (String)iter.next(); String name = (String)iter.next();
String path = (String)_apps.get(name); String path = (String)_apps.get(name);

View File

@ -144,7 +144,7 @@ public class NewsFetcher implements Runnable, EepGet.StatusListener {
FileInputStream in = null; FileInputStream in = null;
try { try {
in = new FileInputStream(_newsFile); in = new FileInputStream(_newsFile);
StringBuffer buf = new StringBuffer(128); StringBuilder buf = new StringBuilder(128);
while (DataHelper.readLine(in, buf)) { while (DataHelper.readLine(in, buf)) {
int index = buf.indexOf(VERSION_PREFIX); int index = buf.indexOf(VERSION_PREFIX);
if (index == -1) { if (index == -1) {

View File

@ -50,7 +50,7 @@ public class ServiceManager {
// InputStream StdoutStream = _shellCommand.getInputStream(); // InputStream StdoutStream = _shellCommand.getInputStream();
// InputStream StderrStream = _shellCommand.getErrorStream(); // InputStream StderrStream = _shellCommand.getErrorStream();
StringBuffer result = null; StringBuilder result = null;
if (_shellCommand.executeAndWait(command)) if (_shellCommand.executeAndWait(command))
return null; return null;

View File

@ -87,7 +87,7 @@ public class StatSummarizer implements Runnable {
removeDb(r); removeDb(r);
} }
// add new ones // add new ones
StringBuffer buf = new StringBuffer(); StringBuilder buf = new StringBuilder();
for (int i = 0; i < newSpecs.size(); i++) { for (int i = 0; i < newSpecs.size(); i++) {
Rate r = (Rate)newSpecs.get(i); Rate r = (Rate)newSpecs.get(i);
if (!old.contains(r)) if (!old.contains(r))

View File

@ -344,7 +344,7 @@ public class SummaryHelper extends HelperBase {
List clients = new ArrayList(_context.clientManager().listClients()); List clients = new ArrayList(_context.clientManager().listClients());
Collections.sort(clients, new AlphaComparator()); Collections.sort(clients, new AlphaComparator());
StringBuffer buf = new StringBuffer(512); StringBuilder buf = new StringBuilder(512);
buf.append("<u><b>Local destinations</b></u><br />"); buf.append("<u><b>Local destinations</b></u><br />");
for (Iterator iter = clients.iterator(); iter.hasNext(); ) { for (Iterator iter = clients.iterator(); iter.hasNext(); ) {

View File

@ -156,7 +156,7 @@ public class UpdateHandler {
// ignored // ignored
} }
public void bytesTransferred(long alreadyTransferred, int currentWrite, long bytesTransferred, long bytesRemaining, String url) { public void bytesTransferred(long alreadyTransferred, int currentWrite, long bytesTransferred, long bytesRemaining, String url) {
StringBuffer buf = new StringBuffer(64); StringBuilder buf = new StringBuilder(64);
buf.append("<b>Updating</b> "); buf.append("<b>Updating</b> ");
double pct = ((double)alreadyTransferred + (double)currentWrite) / double pct = ((double)alreadyTransferred + (double)currentWrite) /
((double)alreadyTransferred + (double)currentWrite + (double)bytesRemaining); ((double)alreadyTransferred + (double)currentWrite + (double)bytesRemaining);

View File

@ -43,7 +43,7 @@
<p> <p>
<table> <table>
<tr><td>Dest. name, hash, or full key: <tr><td>Dest. name, hash, or full key:
<td><textarea name="peer" cols="44" rows="1" wrap="off"></textarea> <td><textarea name="peer" cols="44" rows="1" style="height: 3em;" wrap="off"></textarea>
<tr><td align="right">Session Key: <tr><td align="right">Session Key:
<td><input type="text" size="55" name="key" /> <td><input type="text" size="55" name="key" />
<tr><td><td><input type="submit" name="action" value="Add key" /> <tr><td><td><input type="submit" name="action" value="Add key" />

View File

@ -155,7 +155,7 @@ public class SAMUtils {
String token, param; String token, param;
Properties props = new Properties(); Properties props = new Properties();
StringBuffer value = new StringBuffer(); StringBuilder value = new StringBuilder();
for (int i = 0; i < ntoks; ++i) { for (int i = 0; i < ntoks; ++i) {
token = tok.nextToken(); token = tok.nextToken();

View File

@ -899,7 +899,7 @@ public class Connection {
if (_log.shouldLog(Log.WARN)) if (_log.shouldLog(Log.WARN))
_log.warn("Closing connection due to inactivity"); _log.warn("Closing connection due to inactivity");
if (_log.shouldLog(Log.DEBUG)) { if (_log.shouldLog(Log.DEBUG)) {
StringBuffer buf = new StringBuffer(128); StringBuilder buf = new StringBuilder(128);
buf.append("last sent was: ").append(_context.clock().now() - _lastSendTime); buf.append("last sent was: ").append(_context.clock().now() - _lastSendTime);
buf.append("ms ago, last received was: ").append(_context.clock().now()-_lastReceivedOn); buf.append("ms ago, last received was: ").append(_context.clock().now()-_lastReceivedOn);
buf.append("ms ago, inactivity timeout is: ").append(_options.getInactivityTimeout()); buf.append("ms ago, inactivity timeout is: ").append(_options.getInactivityTimeout());
@ -934,7 +934,7 @@ public class Connection {
@Override @Override
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer(128); StringBuilder buf = new StringBuilder(128);
buf.append("[Connection "); buf.append("[Connection ");
if (_receiveStreamId > 0) if (_receiveStreamId > 0)
buf.append(Packet.toId(_receiveStreamId)); buf.append(Packet.toId(_receiveStreamId));

View File

@ -475,7 +475,7 @@ public class ConnectionOptions extends I2PSocketOptionsImpl {
@Override @Override
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer(128); StringBuilder buf = new StringBuilder(128);
buf.append("conDelay=").append(_connectDelay); buf.append("conDelay=").append(_connectDelay);
buf.append(" maxSize=").append(_maxMessageSize); buf.append(" maxSize=").append(_maxMessageSize);
buf.append(" rtt=").append(_rtt); buf.append(" rtt=").append(_rtt);

View File

@ -174,7 +174,7 @@ public class MessageInputStream extends InputStream {
public void closeReceived() { public void closeReceived() {
synchronized (_dataLock) { synchronized (_dataLock) {
if (_log.shouldLog(Log.DEBUG)) { if (_log.shouldLog(Log.DEBUG)) {
StringBuffer buf = new StringBuffer(128); StringBuilder buf = new StringBuilder(128);
buf.append("Close received, ready bytes: "); buf.append("Close received, ready bytes: ");
long available = 0; long available = 0;
for (int i = 0; i < _readyDataBlocks.size(); i++) for (int i = 0; i < _readyDataBlocks.size(); i++)

View File

@ -598,12 +598,12 @@ public class Packet {
@Override @Override
public String toString() { public String toString() {
StringBuffer str = formatAsString(); StringBuilder str = formatAsString();
return str.toString(); return str.toString();
} }
protected StringBuffer formatAsString() { protected StringBuilder formatAsString() {
StringBuffer buf = new StringBuffer(64); StringBuilder buf = new StringBuilder(64);
buf.append(toId(_sendStreamId)); buf.append(toId(_sendStreamId));
//buf.append("<-->"); //buf.append("<-->");
buf.append(toId(_receiveStreamId)).append(": #").append(_sequenceNum); buf.append(toId(_receiveStreamId)).append(": #").append(_sequenceNum);
@ -629,7 +629,7 @@ public class Packet {
} }
private final String toFlagString() { private final String toFlagString() {
StringBuffer buf = new StringBuffer(32); StringBuilder buf = new StringBuilder(32);
if (isFlagSet(FLAG_CLOSE)) buf.append(" CLOSE"); if (isFlagSet(FLAG_CLOSE)) buf.append(" CLOSE");
if (isFlagSet(FLAG_DELAY_REQUESTED)) buf.append(" DELAY ").append(_optionDelay); if (isFlagSet(FLAG_DELAY_REQUESTED)) buf.append(" DELAY ").append(_optionDelay);
if (isFlagSet(FLAG_ECHO)) buf.append(" ECHO"); if (isFlagSet(FLAG_ECHO)) buf.append(" ECHO");

View File

@ -112,7 +112,7 @@ public class PacketHandler {
private static final SimpleDateFormat _fmt = new SimpleDateFormat("HH:mm:ss.SSS"); private static final SimpleDateFormat _fmt = new SimpleDateFormat("HH:mm:ss.SSS");
void displayPacket(Packet packet, String prefix, String suffix) { void displayPacket(Packet packet, String prefix, String suffix) {
if (!_log.shouldLog(Log.INFO)) return; if (!_log.shouldLog(Log.INFO)) return;
StringBuffer buf = new StringBuffer(256); StringBuilder buf = new StringBuilder(256);
synchronized (_fmt) { synchronized (_fmt) {
buf.append(_fmt.format(new Date())); buf.append(_fmt.format(new Date()));
} }
@ -198,7 +198,7 @@ public class PacketHandler {
// someone is sending us a packet on the wrong stream // someone is sending us a packet on the wrong stream
if (_log.shouldLog(Log.ERROR)) { if (_log.shouldLog(Log.ERROR)) {
Set cons = _manager.listConnections(); Set cons = _manager.listConnections();
StringBuffer buf = new StringBuffer(512); StringBuilder buf = new StringBuilder(512);
buf.append("Received a packet on the wrong stream: "); buf.append("Received a packet on the wrong stream: ");
buf.append(packet); buf.append(packet);
buf.append(" connection: "); buf.append(" connection: ");
@ -275,7 +275,7 @@ public class PacketHandler {
_log.warn("Packet belongs to no other cons, putting on the syn queue: " + packet); _log.warn("Packet belongs to no other cons, putting on the syn queue: " + packet);
} }
if (_log.shouldLog(Log.DEBUG)) { if (_log.shouldLog(Log.DEBUG)) {
StringBuffer buf = new StringBuffer(128); StringBuilder buf = new StringBuilder(128);
Set cons = _manager.listConnections(); Set cons = _manager.listConnections();
for (Iterator iter = cons.iterator(); iter.hasNext(); ) { for (Iterator iter = cons.iterator(); iter.hasNext(); ) {
Connection con = (Connection)iter.next(); Connection con = (Connection)iter.next();

View File

@ -133,8 +133,8 @@ public class PacketLocal extends Packet implements MessageOutputStream.WriteStat
public void setResendPacketEvent(SimpleTimer2.TimedEvent evt) { _resendEvent = evt; } public void setResendPacketEvent(SimpleTimer2.TimedEvent evt) { _resendEvent = evt; }
@Override @Override
public StringBuffer formatAsString() { public StringBuilder formatAsString() {
StringBuffer buf = super.formatAsString(); StringBuilder buf = super.formatAsString();
Connection con = _connection; Connection con = _connection;
if (con != null) if (con != null)

View File

@ -83,7 +83,7 @@ public class ConfigBean implements Serializable {
{ {
File file = new File( configFileName ); File file = new File( configFileName );
if( file != null && file.isFile() ) { if( file != null && file.isFile() ) {
StringBuffer buf = new StringBuffer(); StringBuilder buf = new StringBuilder();
BufferedReader br = null; BufferedReader br = null;
try { try {
br = new BufferedReader( new FileReader( file ) ); br = new BufferedReader( new FileReader( file ) );

View File

@ -86,7 +86,7 @@ public class SubscriptionsBean
{ {
File file = new File( getFileName() ); File file = new File( getFileName() );
if( file != null && file.isFile() ) { if( file != null && file.isFile() ) {
StringBuffer buf = new StringBuffer(); StringBuilder buf = new StringBuilder();
BufferedReader br = null; BufferedReader br = null;
try { try {
br = new BufferedReader( new FileReader( file ) ); br = new BufferedReader( new FileReader( file ) );

View File

@ -143,7 +143,7 @@
<td class="names"><a href="http://${addr.name}/">${addr.name}</a> - <td class="names"><a href="http://${addr.name}/">${addr.name}</a> -
<span class="addrhlpr"><a href="http://${addr.name}/?i2paddresshelper=${addr.destination}">(addrhlpr)</a></span> <span class="addrhlpr"><a href="http://${addr.name}/?i2paddresshelper=${addr.destination}">(addrhlpr)</a></span>
</td> </td>
<td class="destinations"><textarea rows="1" cols="40" wrap="off" readonly="readonly" name="dest_${addr.name}" >${addr.destination}</textarea></td> <td class="destinations"><textarea rows="1" style="height: 3em;" cols="40" wrap="off" readonly="readonly" name="dest_${addr.name}" >${addr.destination}</textarea></td>
</tr> </tr>
</c:forEach> </c:forEach>
</table> </table>
@ -168,7 +168,7 @@
<p class="add"> <p class="add">
<h3>Add new destination:</h3> <h3>Add new destination:</h3>
<b>Hostname:</b> <input type="text" name="hostname" value="${book.hostname}" size="20"> <b>Hostname:</b> <input type="text" name="hostname" value="${book.hostname}" size="20">
<b>Destination:</b> <textarea name="destination" rows="1" cols="40" wrap="off" >${book.destination}</textarea><br/> <b>Destination:</b> <textarea name="destination" rows="1" style="height: 3em;" cols="40" wrap="off" >${book.destination}</textarea><br/>
</p><p> </p><p>
<input type="image" name="action" value="add" src="images/add.png" alt="Add destination" /> <input type="image" name="action" value="add" src="images/add.png" alt="Add destination" />
</p> </p>

View File

@ -142,7 +142,7 @@ public class Mail {
} }
return ok; return ok;
} }
public static void appendRecipients( StringBuffer buf, ArrayList recipients, String prefix ) public static void appendRecipients( StringBuilder buf, ArrayList recipients, String prefix )
{ {
for( Iterator it = recipients.iterator(); it.hasNext(); ) { for( Iterator it = recipients.iterator(); it.hasNext(); ) {
buf.append( prefix ); buf.append( prefix );

View File

@ -444,7 +444,7 @@ public class WebMail extends HttpServlet
boolean showBody = false; boolean showBody = false;
boolean prepareAttachment = false; boolean prepareAttachment = false;
String reason = ""; String reason = "";
StringBuffer body = null; StringBuilder body = null;
String ident = quoteHTML( String ident = quoteHTML(
( mailPart.description != null ? mailPart.description + ", " : "" ) + ( mailPart.description != null ? mailPart.description + ", " : "" ) +
@ -485,7 +485,7 @@ public class WebMail extends HttpServlet
try { try {
ReadBuffer decoded = e.decode( mailPart.buffer.content, mailPart.beginBody, mailPart.end - mailPart.beginBody ); ReadBuffer decoded = e.decode( mailPart.buffer.content, mailPart.beginBody, mailPart.end - mailPart.beginBody );
BufferedReader reader = new BufferedReader( new InputStreamReader( new ByteArrayInputStream( decoded.content, decoded.offset, decoded.length ), charset ) ); BufferedReader reader = new BufferedReader( new InputStreamReader( new ByteArrayInputStream( decoded.content, decoded.offset, decoded.length ), charset ) );
body = new StringBuffer(); body = new StringBuilder();
String line; String line;
while( ( line = reader.readLine() ) != null ) { while( ( line = reader.readLine() ) != null ) {
body.append( quoteHTML( line ) ); body.append( quoteHTML( line ) );
@ -782,7 +782,7 @@ public class WebMail extends HttpServlet
/* /*
* extract additional recipients * extract additional recipients
*/ */
StringBuffer buf = new StringBuffer(); StringBuilder buf = new StringBuilder();
String pad = ""; String pad = "";
if( mail.to != null ) { if( mail.to != null ) {
for( int i = 0; i < mail.to.length; i++ ) { for( int i = 0; i < mail.to.length; i++ ) {
@ -1429,7 +1429,7 @@ public class WebMail extends HttpServlet
} }
if( ok ) { if( ok ) {
StringBuffer body = new StringBuffer(); StringBuilder body = new StringBuilder();
body.append( "From: " + from + "\r\n" ); body.append( "From: " + from + "\r\n" );
Mail.appendRecipients( body, toList, "To: " ); Mail.appendRecipients( body, toList, "To: " );
Mail.appendRecipients( body, ccList, "To: " ); Mail.appendRecipients( body, ccList, "To: " );

View File

@ -70,7 +70,7 @@ public class Base64 implements Encoding {
*/ */
private String encode( InputStream in ) throws IOException, EncodingException private String encode( InputStream in ) throws IOException, EncodingException
{ {
StringBuffer strBuf = new StringBuffer(); StringBuilder strBuf = new StringBuilder();
int buf[] = new int[3]; int buf[] = new int[3];
int out[] = new int[4]; int out[] = new int[4];

View File

@ -55,7 +55,7 @@ public class HeaderLine implements Encoding {
private static final int BUFSIZE = 2; private static final int BUFSIZE = 2;
private String encode(InputStream in) throws IOException private String encode(InputStream in) throws IOException
{ {
StringBuffer out = new StringBuffer(); StringBuilder out = new StringBuilder();
int l = 0, buffered = 0, tmp[] = new int[BUFSIZE]; int l = 0, buffered = 0, tmp[] = new int[BUFSIZE];
boolean quoting = false; boolean quoting = false;
boolean quote = false; boolean quote = false;

View File

@ -69,7 +69,7 @@ public class QuotedPrintable implements Encoding {
*/ */
private static int BUFSIZE = 2; private static int BUFSIZE = 2;
private String encode( InputStream in ) throws EncodingException, IOException { private String encode( InputStream in ) throws EncodingException, IOException {
StringBuffer out = new StringBuffer(); StringBuilder out = new StringBuilder();
int l = 0; int l = 0;
int read = 0, buffered = 0, tmp[] = new int[BUFSIZE]; int read = 0, buffered = 0, tmp[] = new int[BUFSIZE];
while( true ) { while( true ) {

View File

@ -323,7 +323,7 @@ private static long bytesToLong(byte[] b) {
if(null == extensions || extensions.isEmpty()) if(null == extensions || extensions.isEmpty())
return ""; return "";
StringBuffer result = new StringBuffer(); StringBuilder result = new StringBuilder();
List<String> tempList; List<String> tempList;
boolean first = true; boolean first = true;

View File

@ -74,7 +74,7 @@ public class CPUID {
private static String getCPUVendorID() private static String getCPUVendorID()
{ {
CPUIDResult c = doCPUID(0); CPUIDResult c = doCPUID(0);
StringBuffer sb= new StringBuffer(13); StringBuilder sb= new StringBuilder(13);
sb.append((char)( c.EBX & 0xFF)); sb.append((char)( c.EBX & 0xFF));
sb.append((char)((c.EBX >> 8) & 0xFF)); sb.append((char)((c.EBX >> 8) & 0xFF));
sb.append((char)((c.EBX >> 16) & 0xFF)); sb.append((char)((c.EBX >> 16) & 0xFF));

View File

@ -124,7 +124,7 @@ public class PetName {
@Override @Override
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer(256); StringBuilder buf = new StringBuilder(256);
if (_name != null) buf.append(_name.trim()); if (_name != null) buf.append(_name.trim());
buf.append(':'); buf.append(':');
if (_network != null) buf.append(_network.trim()); if (_network != null) buf.append(_network.trim());

View File

@ -130,7 +130,7 @@ public class ElGamalEngine {
System.arraycopy(dbytes, 0, out, (dbytes.length < 257 ? 514 - dbytes.length : 257), System.arraycopy(dbytes, 0, out, (dbytes.length < 257 ? 514 - dbytes.length : 257),
(dbytes.length > 257 ? 257 : dbytes.length)); (dbytes.length > 257 ? 257 : dbytes.length));
/* /*
StringBuffer buf = new StringBuffer(1024); StringBuilder buf = new StringBuilder(1024);
buf.append("Timing\n"); buf.append("Timing\n");
buf.append("0-1: ").append(t1 - t0).append('\n'); buf.append("0-1: ").append(t1 - t0).append('\n');
buf.append("1-2: ").append(t2 - t1).append('\n'); buf.append("1-2: ").append(t2 - t1).append('\n');

View File

@ -179,7 +179,7 @@ public class SHA1Test {
} }
private static final String toHex(final byte[] bytes) { private static final String toHex(final byte[] bytes) {
StringBuffer buf = new StringBuffer(bytes.length * 2); StringBuilder buf = new StringBuilder(bytes.length * 2);
for (int i = 0; i < bytes.length; i++) { for (int i = 0; i < bytes.length; i++) {
if ((i & 3) == 0 && i != 0) if ((i & 3) == 0 && i != 0)
buf.append(' '); buf.append(' ');

View File

@ -452,12 +452,12 @@ public class TransientSessionKeyManager extends SessionKeyManager {
int removed = 0; int removed = 0;
int remaining = 0; int remaining = 0;
long now = _context.clock().now(); long now = _context.clock().now();
StringBuffer buf = null; StringBuilder buf = null;
StringBuffer bufSummary = null; StringBuilder bufSummary = null;
if (_log.shouldLog(Log.DEBUG)) { if (_log.shouldLog(Log.DEBUG)) {
buf = new StringBuffer(128); buf = new StringBuilder(128);
buf.append("Expiring inbound: "); buf.append("Expiring inbound: ");
bufSummary = new StringBuffer(1024); bufSummary = new StringBuilder(1024);
} }
synchronized (_inboundTagSets) { synchronized (_inboundTagSets) {
for (Iterator<SessionTag> iter = _inboundTagSets.keySet().iterator(); iter.hasNext();) { for (Iterator<SessionTag> iter = _inboundTagSets.keySet().iterator(); iter.hasNext();) {
@ -500,7 +500,7 @@ public class TransientSessionKeyManager extends SessionKeyManager {
} }
public String renderStatusHTML() { public String renderStatusHTML() {
StringBuffer buf = new StringBuffer(1024); StringBuilder buf = new StringBuilder(1024);
buf.append("<h2>Inbound sessions</h2>"); buf.append("<h2>Inbound sessions</h2>");
buf.append("<table border=\"1\">"); buf.append("<table border=\"1\">");
Set<TagSet> inbound = getInboundTagSets(); Set<TagSet> inbound = getInboundTagSets();

View File

@ -255,16 +255,16 @@ D8usM7Dxp5yrDrCYZ5AIijc=
} }
private static final String sanitize(String versionString) { private static final String sanitize(String versionString) {
StringBuffer versionStringBuffer = new StringBuffer(versionString); StringBuilder versionStringBuilder = new StringBuilder(versionString);
for (int i = 0; i < versionStringBuffer.length(); i++) { for (int i = 0; i < versionStringBuilder.length(); i++) {
if (VALID_VERSION_CHARS.indexOf(versionStringBuffer.charAt(i)) == -1) { if (VALID_VERSION_CHARS.indexOf(versionStringBuilder.charAt(i)) == -1) {
versionStringBuffer.deleteCharAt(i); versionStringBuilder.deleteCharAt(i);
i--; i--;
} }
} }
return versionStringBuffer.toString(); return versionStringBuilder.toString();
} }
private static final void showUsageCLI() { private static final void showUsageCLI() {
@ -328,7 +328,7 @@ D8usM7Dxp5yrDrCYZ5AIijc=
* delimited by CR LF line breaks. * delimited by CR LF line breaks.
*/ */
public String getTrustedKeysString() { public String getTrustedKeysString() {
StringBuffer buf = new StringBuffer(1024); StringBuilder buf = new StringBuilder(1024);
for (int i = 0; i < _trustedKeys.size(); i++) { for (int i = 0; i < _trustedKeys.size(); i++) {
// If something already buffered, first add line break. // If something already buffered, first add line break.
if (buf.length() > 0) buf.append("\r\n"); if (buf.length() > 0) buf.append("\r\n");

View File

@ -73,7 +73,7 @@ public class Address extends DataStructureImpl {
@Override @Override
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer(64); StringBuilder buf = new StringBuilder(64);
buf.append("[Address: "); buf.append("[Address: ");
buf.append("\n\tHostname: ").append(getHostname()); buf.append("\n\tHostname: ").append(getHostname());
buf.append("\n\tDestination: ").append(getDestination()); buf.append("\n\tDestination: ").append(getDestination());

View File

@ -137,7 +137,7 @@ public class Base32 {
} }
public static String encode(byte[] source) { public static String encode(byte[] source) {
StringBuffer buf = new StringBuffer((source.length + 7) * 8 / 5); StringBuilder buf = new StringBuilder((source.length + 7) * 8 / 5);
encodeBytes(source, buf); encodeBytes(source, buf);
return buf.toString(); return buf.toString();
} }
@ -149,7 +149,7 @@ public class Base32 {
* *
* @param source The data to convert * @param source The data to convert
*/ */
private static void encodeBytes(byte[] source, StringBuffer out) { private static void encodeBytes(byte[] source, StringBuilder out) {
int usedbits = 0; int usedbits = 0;
for (int i = 0; i < source.length; ) { for (int i = 0; i < source.length; ) {
int fivebits; int fivebits;

View File

@ -330,7 +330,7 @@ public class Base64 {
} // end switch } // end switch
} // end encode3to4 } // end encode3to4
private static void encode3to4(byte[] source, int srcOffset, int numSigBytes, StringBuffer buf, byte alpha[]) { private static void encode3to4(byte[] source, int srcOffset, int numSigBytes, StringBuilder buf, byte alpha[]) {
// 1 2 3 // 1 2 3
// 01234567890123456789012345678901 Bit position // 01234567890123456789012345678901 Bit position
// --------000000001111111122222222 Array position from threeBytes // --------000000001111111122222222 Array position from threeBytes
@ -394,7 +394,7 @@ public class Base64 {
private static String safeEncode(byte[] source, int off, int len, boolean useStandardAlphabet) { private static String safeEncode(byte[] source, int off, int len, boolean useStandardAlphabet) {
if (len + off > source.length) if (len + off > source.length)
throw new ArrayIndexOutOfBoundsException("Trying to encode too much! source.len=" + source.length + " off=" + off + " len=" + len); throw new ArrayIndexOutOfBoundsException("Trying to encode too much! source.len=" + source.length + " off=" + off + " len=" + len);
StringBuffer buf = new StringBuffer(len * 4 / 3); StringBuilder buf = new StringBuilder(len * 4 / 3);
if (useStandardAlphabet) if (useStandardAlphabet)
encodeBytes(source, off, len, false, buf, ALPHABET); encodeBytes(source, off, len, false, buf, ALPHABET);
else else
@ -446,7 +446,7 @@ public class Base64 {
******/ ******/
private static String encodeBytes(byte[] source, int off, int len, boolean breakLines) { private static String encodeBytes(byte[] source, int off, int len, boolean breakLines) {
StringBuffer buf = new StringBuffer( (len*4)/3 ); StringBuilder buf = new StringBuilder( (len*4)/3 );
encodeBytes(source, off, len, breakLines, buf, ALPHABET); encodeBytes(source, off, len, breakLines, buf, ALPHABET);
return buf.toString(); return buf.toString();
} }
@ -460,7 +460,7 @@ public class Base64 {
* @param breakLines Break lines at 80 characters or less. * @param breakLines Break lines at 80 characters or less.
* @since 1.4 * @since 1.4
*/ */
private static void encodeBytes(byte[] source, int off, int len, boolean breakLines, StringBuffer out, byte alpha[]) { private static void encodeBytes(byte[] source, int off, int len, boolean breakLines, StringBuilder out, byte alpha[]) {
//int len43 = len * 4 / 3; //int len43 = len * 4 / 3;
//byte[] outBuff = new byte[(len43) // Main 4:3 //byte[] outBuff = new byte[(len43) // Main 4:3
// + ((len % 3) > 0 ? 4 : 0) // Account for padding // + ((len % 3) > 0 ? 4 : 0) // Account for padding

View File

@ -149,7 +149,7 @@ public class Certificate extends DataStructureImpl {
} }
@Override @Override
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer(64); StringBuilder buf = new StringBuilder(64);
buf.append("[Certificate: type: "); buf.append("[Certificate: type: ");
if (getCertificateType() == CERTIFICATE_TYPE_NULL) if (getCertificateType() == CERTIFICATE_TYPE_NULL)
buf.append("Null certificate"); buf.append("Null certificate");

View File

@ -196,7 +196,7 @@ public class DataHelper {
* *
*/ */
public static String toString(Properties options) { public static String toString(Properties options) {
StringBuffer buf = new StringBuffer(); StringBuilder buf = new StringBuilder();
if (options != null) { if (options != null) {
for (Iterator iter = options.keySet().iterator(); iter.hasNext();) { for (Iterator iter = options.keySet().iterator(); iter.hasNext();) {
String key = (String) iter.next(); String key = (String) iter.next();
@ -273,7 +273,7 @@ public class DataHelper {
* *
*/ */
public static String toString(Collection col) { public static String toString(Collection col) {
StringBuffer buf = new StringBuffer(); StringBuilder buf = new StringBuilder();
if (col != null) { if (col != null) {
for (Iterator iter = col.iterator(); iter.hasNext();) { for (Iterator iter = col.iterator(); iter.hasNext();) {
Object o = iter.next(); Object o = iter.next();
@ -296,17 +296,17 @@ public class DataHelper {
public static String toString(byte buf[], int len) { public static String toString(byte buf[], int len) {
if (buf == null) buf = EMPTY_BUFFER; if (buf == null) buf = EMPTY_BUFFER;
StringBuffer out = new StringBuffer(); StringBuilder out = new StringBuilder();
if (len > buf.length) { if (len > buf.length) {
for (int i = 0; i < len - buf.length; i++) for (int i = 0; i < len - buf.length; i++)
out.append("00"); out.append("00");
} }
for (int i = 0; i < buf.length && i < len; i++) { for (int i = 0; i < buf.length && i < len; i++) {
StringBuffer temp = new StringBuffer(Integer.toHexString(buf[i])); StringBuilder temp = new StringBuilder(Integer.toHexString(buf[i]));
while (temp.length() < 2) { while (temp.length() < 2) {
temp.insert(0, '0'); temp.insert(0, '0');
} }
temp = new StringBuffer(temp.substring(temp.length() - 2)); temp = new StringBuilder(temp.substring(temp.length() - 2));
out.append(temp.toString()); out.append(temp.toString());
} }
return out.toString(); return out.toString();
@ -775,19 +775,27 @@ public class DataHelper {
/** /**
* Read a newline delimited line from the stream, returning the line (without * Read a newline delimited line from the stream, returning the line (without
* the newline), or null if EOF reached before the newline was found * the newline), or null if EOF reached before the newline was found
* Warning - strips \n but not \r
*/ */
public static String readLine(InputStream in) throws IOException { return readLine(in, (Sha256Standalone)null); } public static String readLine(InputStream in) throws IOException { return readLine(in, (Sha256Standalone)null); }
/** update the hash along the way */
/**
* update the hash along the way
* Warning - strips \n but not \r
*/
public static String readLine(InputStream in, Sha256Standalone hash) throws IOException { public static String readLine(InputStream in, Sha256Standalone hash) throws IOException {
StringBuffer buf = new StringBuffer(128); StringBuilder buf = new StringBuilder(128);
boolean ok = readLine(in, buf, hash); boolean ok = readLine(in, buf, hash);
if (ok) if (ok)
return buf.toString(); return buf.toString();
else else
return null; return null;
} }
/** /**
* Read in a line, placing it into the buffer (excluding the newline). * Read in a line, placing it into the buffer (excluding the newline).
* Warning - strips \n but not \r
* @deprecated use StringBuilder version
* *
* @return true if the line was read, false if eof was reached before a * @return true if the line was read, false if eof was reached before a
* newline was found * newline was found
@ -795,7 +803,12 @@ public class DataHelper {
public static boolean readLine(InputStream in, StringBuffer buf) throws IOException { public static boolean readLine(InputStream in, StringBuffer buf) throws IOException {
return readLine(in, buf, null); return readLine(in, buf, null);
} }
/** update the hash along the way */
/**
* update the hash along the way
* Warning - strips \n but not \r
* @deprecated use StringBuilder version
*/
public static boolean readLine(InputStream in, StringBuffer buf, Sha256Standalone hash) throws IOException { public static boolean readLine(InputStream in, StringBuffer buf, Sha256Standalone hash) throws IOException {
int c = -1; int c = -1;
while ( (c = in.read()) != -1) { while ( (c = in.read()) != -1) {
@ -810,6 +823,32 @@ public class DataHelper {
return true; return true;
} }
/**
* Read in a line, placing it into the buffer (excluding the newline).
* Warning - strips \n but not \r
*
* @return true if the line was read, false if eof was reached before a
* newline was found
*/
public static boolean readLine(InputStream in, StringBuilder buf) throws IOException {
return readLine(in, buf, null);
}
/**
* update the hash along the way
* Warning - strips \n but not \r
*/
public static boolean readLine(InputStream in, StringBuilder buf, Sha256Standalone hash) throws IOException {
int c = -1;
while ( (c = in.read()) != -1) {
if (hash != null) hash.update((byte)c);
if (c == '\n')
break;
buf.append((char)c);
}
return c != -1;
}
public static void write(OutputStream out, byte data[], Sha256Standalone hash) throws IOException { public static void write(OutputStream out, byte data[], Sha256Standalone hash) throws IOException {
hash.update(data); hash.update(data);
out.write(data); out.write(data);

View File

@ -145,7 +145,7 @@ public class Destination extends DataStructureImpl {
@Override @Override
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer(128); StringBuilder buf = new StringBuilder(128);
buf.append("[Destination: "); buf.append("[Destination: ");
buf.append("\n\tHash: ").append(calculateHash().toBase64()); buf.append("\n\tHash: ").append(calculateHash().toBase64());
buf.append("\n\tPublic Key: ").append(getPublicKey()); buf.append("\n\tPublic Key: ").append(getPublicKey());

View File

@ -104,7 +104,7 @@ public class Hash extends DataStructureImpl {
} }
if (_log.shouldLog(Log.DEBUG)) { if (_log.shouldLog(Log.DEBUG)) {
// explicit buffer, since the compiler can't guess how long it'll be // explicit buffer, since the compiler can't guess how long it'll be
StringBuffer buf = new StringBuffer(128); StringBuilder buf = new StringBuilder(128);
buf.append("miss [").append(cached).append("] from "); buf.append("miss [").append(cached).append("] from ");
buf.append(DataHelper.toHexString(getData())).append(" to "); buf.append(DataHelper.toHexString(getData())).append(" to ");
buf.append(DataHelper.toHexString(key.getData())); buf.append(DataHelper.toHexString(key.getData()));
@ -113,7 +113,7 @@ public class Hash extends DataStructureImpl {
} else { } else {
if (_log.shouldLog(Log.DEBUG)) { if (_log.shouldLog(Log.DEBUG)) {
// explicit buffer, since the compiler can't guess how long it'll be // explicit buffer, since the compiler can't guess how long it'll be
StringBuffer buf = new StringBuffer(128); StringBuilder buf = new StringBuilder(128);
buf.append("hit from "); buf.append("hit from ");
buf.append(DataHelper.toHexString(getData())).append(" to "); buf.append(DataHelper.toHexString(getData())).append(" to ");
buf.append(DataHelper.toHexString(key.getData())); buf.append(DataHelper.toHexString(key.getData()));
@ -155,7 +155,7 @@ public class Hash extends DataStructureImpl {
@Override @Override
public String toString() { public String toString() {
if (_stringified == null) { if (_stringified == null) {
StringBuffer buf = new StringBuffer(64); StringBuilder buf = new StringBuilder(64);
buf.append("[Hash: "); buf.append("[Hash: ");
if (_data == null) { if (_data == null) {
buf.append("null hash"); buf.append("null hash");

View File

@ -147,7 +147,7 @@ public class Lease extends DataStructureImpl {
@Override @Override
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer(128); StringBuilder buf = new StringBuilder(128);
buf.append("[Lease: "); buf.append("[Lease: ");
buf.append("\n\tEnd Date: ").append(getEndDate()); buf.append("\n\tEnd Date: ").append(getEndDate());
buf.append("\n\tGateway: ").append(getGateway()); buf.append("\n\tGateway: ").append(getGateway());

View File

@ -355,7 +355,7 @@ public class LeaseSet extends DataStructureImpl {
@Override @Override
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer(128); StringBuilder buf = new StringBuilder(128);
buf.append("[LeaseSet: "); buf.append("[LeaseSet: ");
buf.append("\n\tDestination: ").append(getDestination()); buf.append("\n\tDestination: ").append(getDestination());
buf.append("\n\tEncryptionKey: ").append(getEncryptionKey()); buf.append("\n\tEncryptionKey: ").append(getEncryptionKey());

View File

@ -108,7 +108,7 @@ public class Payload extends DataStructureImpl {
@Override @Override
public String toString() { public String toString() {
if (true) return "[Payload]"; if (true) return "[Payload]";
StringBuffer buf = new StringBuffer(128); StringBuilder buf = new StringBuilder(128);
buf.append("[Payload: "); buf.append("[Payload: ");
if (getUnencryptedData() != null) if (getUnencryptedData() != null)
buf.append("\n\tData: ").append(DataHelper.toString(getUnencryptedData(), 16)); buf.append("\n\tData: ").append(DataHelper.toString(getUnencryptedData(), 16));

View File

@ -77,7 +77,7 @@ public class PrivateKey extends DataStructureImpl {
@Override @Override
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer(64); StringBuilder buf = new StringBuilder(64);
buf.append("[PrivateKey: "); buf.append("[PrivateKey: ");
if (_data == null) { if (_data == null) {
buf.append("null key"); buf.append("null key");

View File

@ -263,7 +263,7 @@ public class PrivateKeyFile {
} }
public String toString() { public String toString() {
StringBuffer s = new StringBuffer(128); StringBuilder s = new StringBuilder(128);
s.append("Dest: "); s.append("Dest: ");
s.append(this.dest != null ? this.dest.toBase64() : "null"); s.append(this.dest != null ? this.dest.toBase64() : "null");
s.append("\nContains: "); s.append("\nContains: ");

View File

@ -79,7 +79,7 @@ public class PublicKey extends DataStructureImpl {
@Override @Override
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer(64); StringBuilder buf = new StringBuilder(64);
buf.append("[PublicKey: "); buf.append("[PublicKey: ");
if (_data == null) { if (_data == null) {
buf.append("null key"); buf.append("null key");

View File

@ -138,7 +138,7 @@ public class RouterAddress extends DataStructureImpl {
@Override @Override
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer(64); StringBuilder buf = new StringBuilder(64);
buf.append("[RouterAddress: "); buf.append("[RouterAddress: ");
buf.append("\n\tTransportStyle: ").append(getTransportStyle()); buf.append("\n\tTransportStyle: ").append(getTransportStyle());
buf.append("\n\tCost: ").append(getCost()); buf.append("\n\tCost: ").append(getCost());

View File

@ -109,7 +109,7 @@ public class RouterIdentity extends DataStructureImpl {
@Override @Override
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer(64); StringBuilder buf = new StringBuilder(64);
buf.append("[RouterIdentity: "); buf.append("[RouterIdentity: ");
buf.append("\n\tHash: ").append(getHash().toBase64()); buf.append("\n\tHash: ").append(getHash().toBase64());
buf.append("\n\tCertificate: ").append(getCertificate()); buf.append("\n\tCertificate: ").append(getCertificate());

View File

@ -382,7 +382,7 @@ public class RouterInfo extends DataStructureImpl {
} else if ((idx = caps.indexOf(cap)) == -1) { } else if ((idx = caps.indexOf(cap)) == -1) {
return; return;
} else { } else {
StringBuffer buf = new StringBuffer(caps); StringBuilder buf = new StringBuilder(caps);
while ( (idx = buf.indexOf(""+cap)) != -1) while ( (idx = buf.indexOf(""+cap)) != -1)
buf.deleteCharAt(idx); buf.deleteCharAt(idx);
_options.setProperty(PROP_CAPABILITIES, buf.toString()); _options.setProperty(PROP_CAPABILITIES, buf.toString());
@ -555,7 +555,7 @@ public class RouterInfo extends DataStructureImpl {
@Override @Override
public String toString() { public String toString() {
if (_stringified != null) return _stringified; if (_stringified != null) return _stringified;
StringBuffer buf = new StringBuffer(5*1024); StringBuilder buf = new StringBuilder(5*1024);
buf.append("[RouterInfo: "); buf.append("[RouterInfo: ");
buf.append("\n\tIdentity: ").append(getIdentity()); buf.append("\n\tIdentity: ").append(getIdentity());
buf.append("\n\tSignature: ").append(getSignature()); buf.append("\n\tSignature: ").append(getSignature());

View File

@ -84,7 +84,7 @@ public class SessionKey extends DataStructureImpl {
@Override @Override
public String toString() { public String toString() {
if (true) return super.toString(); if (true) return super.toString();
StringBuffer buf = new StringBuffer(64); StringBuilder buf = new StringBuilder(64);
buf.append("[SessionKey: "); buf.append("[SessionKey: ");
if (_data == null) { if (_data == null) {
buf.append("null key"); buf.append("null key");

View File

@ -69,7 +69,7 @@ public class Signature extends DataStructureImpl {
@Override @Override
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer(64); StringBuilder buf = new StringBuilder(64);
buf.append("[Signature: "); buf.append("[Signature: ");
if (_data == null) { if (_data == null) {
buf.append("null signature"); buf.append("null signature");

View File

@ -75,7 +75,7 @@ public class SigningPrivateKey extends DataStructureImpl {
@Override @Override
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer(64); StringBuilder buf = new StringBuilder(64);
buf.append("[SigningPrivateKey: "); buf.append("[SigningPrivateKey: ");
if (_data == null) { if (_data == null) {
buf.append("null key"); buf.append("null key");

View File

@ -74,7 +74,7 @@ public class SigningPublicKey extends DataStructureImpl {
@Override @Override
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer(64); StringBuilder buf = new StringBuilder(64);
buf.append("[SigningPublicKey: "); buf.append("[SigningPublicKey: ");
if (_data == null) { if (_data == null) {
buf.append("null key"); buf.append("null key");

View File

@ -155,7 +155,7 @@ public class VerifiedDestination extends Destination {
@Override @Override
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer(128); StringBuilder buf = new StringBuilder(128);
buf.append(super.toString()); buf.append(super.toString());
buf.append("\n\tVerified Certificate? ").append(verifyCert(true)); buf.append("\n\tVerified Certificate? ").append(verifyCert(true));
return buf.toString(); return buf.toString();

View File

@ -91,7 +91,7 @@ public class BandwidthLimitsMessage extends I2CPMessageImpl {
@Override @Override
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer(); StringBuilder buf = new StringBuilder();
buf.append("[BandwidthLimitsMessage"); buf.append("[BandwidthLimitsMessage");
buf.append("\n\tIn: ").append(data[0]); buf.append("\n\tIn: ").append(data[0]);
buf.append("\n\tOut: ").append(data[1]); buf.append("\n\tOut: ").append(data[1]);

View File

@ -128,7 +128,7 @@ public class CreateLeaseSetMessage extends I2CPMessageImpl {
@Override @Override
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer(); StringBuilder buf = new StringBuilder();
buf.append("[CreateLeaseSetMessage: "); buf.append("[CreateLeaseSetMessage: ");
buf.append("\n\tLeaseSet: ").append(getLeaseSet()); buf.append("\n\tLeaseSet: ").append(getLeaseSet());
buf.append("\n\tSigningPrivateKey: ").append(getSigningPrivateKey()); buf.append("\n\tSigningPrivateKey: ").append(getSigningPrivateKey());

View File

@ -84,7 +84,7 @@ public class CreateSessionMessage extends I2CPMessageImpl {
@Override @Override
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer(); StringBuilder buf = new StringBuilder();
buf.append("[CreateSessionMessage: "); buf.append("[CreateSessionMessage: ");
buf.append("\n\tConfig: ").append(getSessionConfig()); buf.append("\n\tConfig: ").append(getSessionConfig());
buf.append("]"); buf.append("]");

View File

@ -67,7 +67,7 @@ public class DestLookupMessage extends I2CPMessageImpl {
} }
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer(); StringBuilder buf = new StringBuilder();
buf.append("[DestLookupMessage: "); buf.append("[DestLookupMessage: ");
buf.append("\n\tHash: ").append(_hash); buf.append("\n\tHash: ").append(_hash);
buf.append("]"); buf.append("]");

View File

@ -69,7 +69,7 @@ public class DestReplyMessage extends I2CPMessageImpl {
} }
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer(); StringBuilder buf = new StringBuilder();
buf.append("[DestReplyMessage: "); buf.append("[DestReplyMessage: ");
buf.append("\n\tDestination: ").append(_dest); buf.append("\n\tDestination: ").append(_dest);
buf.append("]"); buf.append("]");

View File

@ -80,7 +80,7 @@ public class DestroySessionMessage extends I2CPMessageImpl {
@Override @Override
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer(); StringBuilder buf = new StringBuilder();
buf.append("[DestroySessionMessage: "); buf.append("[DestroySessionMessage: ");
buf.append("\n\tSessionId: ").append(getSessionId()); buf.append("\n\tSessionId: ").append(getSessionId());
buf.append("]"); buf.append("]");

View File

@ -76,7 +76,7 @@ public class DisconnectMessage extends I2CPMessageImpl {
@Override @Override
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer(); StringBuilder buf = new StringBuilder();
buf.append("[DisconnectMessage: "); buf.append("[DisconnectMessage: ");
buf.append("\n\tReason: ").append(getReason()); buf.append("\n\tReason: ").append(getReason());
buf.append("]"); buf.append("]");

View File

@ -49,7 +49,7 @@ public class GetBandwidthLimitsMessage extends I2CPMessageImpl {
@Override @Override
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer(); StringBuilder buf = new StringBuilder();
buf.append("[GetBandwidthLimitsMessage]"); buf.append("[GetBandwidthLimitsMessage]");
return buf.toString(); return buf.toString();
} }

View File

@ -52,7 +52,7 @@ public class GetDateMessage extends I2CPMessageImpl {
@Override @Override
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer(); StringBuilder buf = new StringBuilder();
buf.append("[GetDateMessage]"); buf.append("[GetDateMessage]");
return buf.toString(); return buf.toString();
} }

View File

@ -123,7 +123,7 @@ public class MessagePayloadMessage extends I2CPMessageImpl {
@Override @Override
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer(); StringBuilder buf = new StringBuilder();
buf.append("[MessagePayloadMessage: "); buf.append("[MessagePayloadMessage: ");
buf.append("\n\tSessionId: ").append(getSessionId()); buf.append("\n\tSessionId: ").append(getSessionId());
buf.append("\n\tMessageId: ").append(getMessageId()); buf.append("\n\tMessageId: ").append(getMessageId());

View File

@ -168,7 +168,7 @@ public class MessageStatusMessage extends I2CPMessageImpl {
@Override @Override
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer(); StringBuilder buf = new StringBuilder();
buf.append("[MessageStatusMessage: "); buf.append("[MessageStatusMessage: ");
buf.append("\n\tSessionId: ").append(getSessionId()); buf.append("\n\tSessionId: ").append(getSessionId());
buf.append("\n\tNonce: ").append(getNonce()); buf.append("\n\tNonce: ").append(getNonce());

View File

@ -102,7 +102,7 @@ public class ReceiveMessageBeginMessage extends I2CPMessageImpl {
@Override @Override
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer(); StringBuilder buf = new StringBuilder();
buf.append("[ReceiveMessageBeginMessage: "); buf.append("[ReceiveMessageBeginMessage: ");
buf.append("\n\tSessionId: ").append(getSessionId()); buf.append("\n\tSessionId: ").append(getSessionId());
buf.append("\n\tMessageId: ").append(getMessageId()); buf.append("\n\tMessageId: ").append(getMessageId());

View File

@ -86,7 +86,7 @@ public class ReceiveMessageEndMessage extends I2CPMessageImpl {
@Override @Override
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer(); StringBuilder buf = new StringBuilder();
buf.append("[ReceiveMessageEndMessage: "); buf.append("[ReceiveMessageEndMessage: ");
buf.append("\n\tSessionId: ").append(getSessionId()); buf.append("\n\tSessionId: ").append(getSessionId());
buf.append("\n\tMessageId: ").append(getMessageId()); buf.append("\n\tMessageId: ").append(getMessageId());

View File

@ -93,7 +93,7 @@ public class ReconfigureSessionMessage extends I2CPMessageImpl {
@Override @Override
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer(); StringBuilder buf = new StringBuilder();
buf.append("[ReconfigureSessionMessage: "); buf.append("[ReconfigureSessionMessage: ");
buf.append("\n\tSessionId: ").append(getSessionId()); buf.append("\n\tSessionId: ").append(getSessionId());
buf.append("\n\tSessionConfig: ").append(getSessionConfig()); buf.append("\n\tSessionConfig: ").append(getSessionConfig());

View File

@ -123,7 +123,7 @@ public class ReportAbuseMessage extends I2CPMessageImpl {
@Override @Override
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer(); StringBuilder buf = new StringBuilder();
buf.append("[ReportAbuseMessage: "); buf.append("[ReportAbuseMessage: ");
buf.append("\n\tSessionID: ").append(getSessionId()); buf.append("\n\tSessionID: ").append(getSessionId());
buf.append("\n\tSeverity: ").append(getSeverity()); buf.append("\n\tSeverity: ").append(getSeverity());

View File

@ -143,7 +143,7 @@ public class RequestLeaseSetMessage extends I2CPMessageImpl {
@Override @Override
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer(); StringBuilder buf = new StringBuilder();
buf.append("[RequestLeaseMessage: "); buf.append("[RequestLeaseMessage: ");
buf.append("\n\tSessionId: ").append(getSessionId()); buf.append("\n\tSessionId: ").append(getSessionId());
buf.append("\n\tTunnels:"); buf.append("\n\tTunnels:");

Some files were not shown because too many files have changed in this diff Show More