propagate from branch 'i2p.i2p.zzz.test3' (head d4461db52b7de97b89dafa6d6a2b18d9dc075b38)

to branch 'i2p.i2p' (head 5529edcb3dd730aa750302bb4267116c56c354da)
This commit is contained in:
zzz
2009-07-06 13:09:05 +00:00
206 changed files with 492 additions and 416 deletions

View File

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

View File

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

View File

@ -190,7 +190,7 @@ public class PeerID implements Comparable
{
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++)
{
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/"
// , "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/"
, "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 */

View File

@ -373,7 +373,7 @@ public class TrackerClient extends I2PAppThread
*/
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++)
{
int c = bs[i] & 0xFF;

View File

@ -398,7 +398,7 @@ public class I2PSnarkServlet extends HttpServlet {
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 void displaySnark(PrintWriter out, Snark snark, String uri, int row, long stats[], boolean showPeers, boolean showDebug) throws IOException {
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
String announce = snark.meta.getAnnounce();
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();
for (Iterator iter = trackers.entrySet().iterator(); iter.hasNext(); ) {
Map.Entry entry = (Map.Entry)iter.next();
@ -759,7 +759,7 @@ public class I2PSnarkServlet extends HttpServlet {
+ _manager.util().getI2CPHost() + "\" size=\"15\" /> ");
out.write("port: <input type=\"text\" name=\"i2cpPort\" value=\"" +
+ _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());
for (Iterator iter = options.entrySet().iterator(); iter.hasNext(); ) {
Map.Entry entry = (Map.Entry)iter.next();

View File

@ -179,7 +179,7 @@ public class I2PTunnelConnectClient extends I2PTunnelClientBase implements Runna
out = s.getOutputStream();
in = s.getInputStream();
String line, method = null, host = null, destination = null, restofline = null;
StringBuffer newRequest = new StringBuffer();
StringBuilder newRequest = new StringBuilder();
int ahelper = 0;
while (true) {
// 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();
InputReader reader = new InputReader(s.getInputStream());
String line, method = null, protocol = null, host = null, destination = null;
StringBuffer newRequest = new StringBuffer();
StringBuilder newRequest = new StringBuilder();
int ahelper = 0;
while ((line = reader.readLine(method)) != null) {
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
* exposing the docs/ directory or perhaps other issues through
* 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) {
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(' ');
String filename = null;
try {

View File

@ -74,7 +74,7 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
InputStream in = socket.getInputStream();
StringBuffer command = new StringBuffer(128);
StringBuilder command = new StringBuilder(128);
Properties headers = readHeaders(in, command);
headers.setProperty(HASH_HEADER, socket.getPeerDestination().calculateHash().toBase64());
headers.setProperty(DEST32_HEADER, Base32.encode(socket.getPeerDestination().calculateHash().getData()) + ".b32.i2p" );
@ -309,8 +309,8 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
}
}
private String formatHeaders(Properties headers, StringBuffer command) {
StringBuffer buf = new StringBuffer(command.length() + headers.size() * 64);
private String formatHeaders(Properties headers, StringBuilder command) {
StringBuilder buf = new StringBuilder(command.length() + headers.size() * 64);
buf.append(command.toString().trim()).append("\r\n");
for (Iterator iter = headers.keySet().iterator(); iter.hasNext(); ) {
String name = (String)iter.next();
@ -321,9 +321,9 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
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();
StringBuffer buf = new StringBuffer(128);
StringBuilder buf = new StringBuilder(128);
boolean ok = DataHelper.readLine(in, command);
if (!ok) throw new IOException("EOF reached while reading the HTTP command [" + command.toString() + "]");

View File

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

View File

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

View File

@ -211,7 +211,7 @@ public class I2Ping extends I2PTunnelTask implements Runnable {
int fail = 0;
long totalTime = 0;
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++) {
boolean sent;
sent = ping(dest);

View File

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

View File

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

View File

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

View File

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

View File

@ -302,7 +302,7 @@ public class IndexBean {
if (_group == null)
return "";
StringBuffer buf = new StringBuffer(512);
StringBuilder buf = new StringBuilder(512);
if (_action != null) {
try {
buf.append(processAction()).append("\n");
@ -927,11 +927,11 @@ public class IndexBean {
}
private String getMessages(List msgs) {
StringBuffer buf = new StringBuffer(128);
StringBuilder buf = new StringBuilder(128);
getMessages(msgs, buf);
return buf.toString();
}
private void getMessages(List msgs, StringBuffer buf) {
private void getMessages(List msgs, StringBuilder buf) {
if (msgs == null) return;
for (int i = 0; i < msgs.size(); i++) {
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" />
<% 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()%>i2ptunnel.css" rel="stylesheet" type="text/css" />
<% }
@ -388,7 +388,7 @@
<label for="localDestination" accesskey="L">
<span class="accessKey">L</span>ocal destination:
</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>
</div>

View File

@ -18,7 +18,7 @@
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<% 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()%>i2ptunnel.css" rel="stylesheet" type="text/css" />
<% }
@ -148,7 +148,7 @@
<label for="localDestination" accesskey="L">
<span class="accessKey">L</span>ocal destination:
</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))) { %>
<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">
Encryption Key:
</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 id="portField" class="rowItem">
<label for="force" accesskey="c">
@ -299,7 +299,7 @@
<label for="accessList" accesskey="s">
Access List:
</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>
</div>

View File

@ -10,7 +10,7 @@
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<% 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()%>i2ptunnel.css" rel="stylesheet" type="text/css" />
<% }
@ -76,7 +76,7 @@
%>
<div class="nameField rowItem">
<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 class="portField rowItem">
<label>Port:</label>
@ -192,7 +192,7 @@
%>
<div class="nameField rowItem">
<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 class="previewField rowItem">
<label>Points at:</label>

View File

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

View File

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

View File

@ -13,7 +13,7 @@ public class ConfigClientsHelper extends HelperBase {
public ConfigClientsHelper() {}
public String getForm1() {
StringBuffer buf = new StringBuffer(1024);
StringBuilder buf = new StringBuilder(1024);
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");
@ -29,7 +29,7 @@ public class ConfigClientsHelper extends HelperBase {
}
public String getForm2() {
StringBuffer buf = new StringBuffer(1024);
StringBuilder buf = new StringBuilder(1024);
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");
Properties props = RouterConsoleRunner.webAppProperties();
@ -46,7 +46,7 @@ public class ConfigClientsHelper extends HelperBase {
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>");
if (urlify && enabled) {
String link = "/";

View File

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

View File

@ -190,7 +190,7 @@ public class ConfigNetHelper extends HelperBase {
}
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");
boolean found = false;
for (int i = 10; i <= 70; i += 10) {
@ -220,7 +220,7 @@ public class ConfigNetHelper extends HelperBase {
public String getSharePercentageBox() {
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");
boolean found = false;
for (int i = 30; i <= 110; i += 10) {

View File

@ -71,7 +71,7 @@ public class ConfigRestartBean {
/** @param s value,label,... pairs */
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, ",");
buf.append("<form action=\"").append(url).append("\" method=\"GET\">\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++) {
stats.append((String)_stats.get(i));
if (i + 1 < _stats.size())

View File

@ -13,7 +13,7 @@ public class ConfigTunnelsHelper extends HelperBase {
public String getForm() {
StringBuffer buf = new StringBuffer(1024);
StringBuilder buf = new StringBuilder(1024);
buf.append("<table border=\"1\">\n");
TunnelPoolSettings exploratoryIn = _context.tunnelManager().getInboundSettings();
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_VARIANCE = 2;
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(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");
}
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++) {
buf.append("<option value=\"").append(i).append("\" ");
if (i == now)

View File

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

View File

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

View File

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

View File

@ -46,7 +46,7 @@ public class LogsHelper extends HelperBase {
private String formatMessages(List msgs) {
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("<code>\n");
for (int i = msgs.size(); i > 0; i--) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -156,7 +156,7 @@ public class UpdateHandler {
// ignored
}
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> ");
double pct = ((double)alreadyTransferred + (double)currentWrite) /
((double)alreadyTransferred + (double)currentWrite + (double)bytesRemaining);

View File

@ -43,7 +43,7 @@
<p>
<table>
<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:
<td><input type="text" size="55" name="key" />
<tr><td><td><input type="submit" name="action" value="Add key" />

View File

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

View File

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

View File

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

View File

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

View File

@ -598,12 +598,12 @@ public class Packet {
@Override
public String toString() {
StringBuffer str = formatAsString();
StringBuilder str = formatAsString();
return str.toString();
}
protected StringBuffer formatAsString() {
StringBuffer buf = new StringBuffer(64);
protected StringBuilder formatAsString() {
StringBuilder buf = new StringBuilder(64);
buf.append(toId(_sendStreamId));
//buf.append("<-->");
buf.append(toId(_receiveStreamId)).append(": #").append(_sequenceNum);
@ -629,7 +629,7 @@ public class Packet {
}
private final String toFlagString() {
StringBuffer buf = new StringBuffer(32);
StringBuilder buf = new StringBuilder(32);
if (isFlagSet(FLAG_CLOSE)) buf.append(" CLOSE");
if (isFlagSet(FLAG_DELAY_REQUESTED)) buf.append(" DELAY ").append(_optionDelay);
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");
void displayPacket(Packet packet, String prefix, String suffix) {
if (!_log.shouldLog(Log.INFO)) return;
StringBuffer buf = new StringBuffer(256);
StringBuilder buf = new StringBuilder(256);
synchronized (_fmt) {
buf.append(_fmt.format(new Date()));
}
@ -198,7 +198,7 @@ public class PacketHandler {
// someone is sending us a packet on the wrong stream
if (_log.shouldLog(Log.ERROR)) {
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(packet);
buf.append(" connection: ");
@ -275,7 +275,7 @@ public class PacketHandler {
_log.warn("Packet belongs to no other cons, putting on the syn queue: " + packet);
}
if (_log.shouldLog(Log.DEBUG)) {
StringBuffer buf = new StringBuffer(128);
StringBuilder buf = new StringBuilder(128);
Set cons = _manager.listConnections();
for (Iterator iter = cons.iterator(); iter.hasNext(); ) {
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; }
@Override
public StringBuffer formatAsString() {
StringBuffer buf = super.formatAsString();
public StringBuilder formatAsString() {
StringBuilder buf = super.formatAsString();
Connection con = _connection;
if (con != null)

View File

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

View File

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

View File

@ -143,7 +143,7 @@
<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>
</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>
</c:forEach>
</table>
@ -168,7 +168,7 @@
<p class="add">
<h3>Add new destination:</h3>
<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>
<input type="image" name="action" value="add" src="images/add.png" alt="Add destination" />
</p>

View File

@ -142,7 +142,7 @@ public class Mail {
}
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(); ) {
buf.append( prefix );

View File

@ -444,7 +444,7 @@ public class WebMail extends HttpServlet
boolean showBody = false;
boolean prepareAttachment = false;
String reason = "";
StringBuffer body = null;
StringBuilder body = null;
String ident = quoteHTML(
( mailPart.description != null ? mailPart.description + ", " : "" ) +
@ -485,7 +485,7 @@ public class WebMail extends HttpServlet
try {
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 ) );
body = new StringBuffer();
body = new StringBuilder();
String line;
while( ( line = reader.readLine() ) != null ) {
body.append( quoteHTML( line ) );
@ -782,7 +782,7 @@ public class WebMail extends HttpServlet
/*
* extract additional recipients
*/
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();
String pad = "";
if( mail.to != null ) {
for( int i = 0; i < mail.to.length; i++ ) {
@ -1429,7 +1429,7 @@ public class WebMail extends HttpServlet
}
if( ok ) {
StringBuffer body = new StringBuffer();
StringBuilder body = new StringBuilder();
body.append( "From: " + from + "\r\n" );
Mail.appendRecipients( body, toList, "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
{
StringBuffer strBuf = new StringBuffer();
StringBuilder strBuf = new StringBuilder();
int buf[] = new int[3];
int out[] = new int[4];

View File

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

View File

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