forked from I2P_Developers/i2p.i2p
Clean up single char indexOf()
This commit is contained in:
@ -165,7 +165,7 @@ public class BOB implements Runnable, ClientApp {
|
|||||||
if (classResource != null) {
|
if (classResource != null) {
|
||||||
String classPath = classResource.toString();
|
String classPath = classResource.toString();
|
||||||
if (classPath.startsWith("jar")) {
|
if (classPath.startsWith("jar")) {
|
||||||
String manifestPath = classPath.substring(0, classPath.lastIndexOf("!") + 1) +
|
String manifestPath = classPath.substring(0, classPath.lastIndexOf('!') + 1) +
|
||||||
"/META-INF/MANIFEST.MF";
|
"/META-INF/MANIFEST.MF";
|
||||||
try {
|
try {
|
||||||
Manifest manifest = new Manifest(new URL(manifestPath).openStream());
|
Manifest manifest = new Manifest(new URL(manifestPath).openStream());
|
||||||
|
@ -76,7 +76,7 @@ class HostTxtParser {
|
|||||||
public static HostTxtEntry parse(String inputLine, boolean allowCommandOnly) {
|
public static HostTxtEntry parse(String inputLine, boolean allowCommandOnly) {
|
||||||
if (inputLine.startsWith(";"))
|
if (inputLine.startsWith(";"))
|
||||||
return null;
|
return null;
|
||||||
int comment = inputLine.indexOf("#");
|
int comment = inputLine.indexOf('#');
|
||||||
String kv;
|
String kv;
|
||||||
String sprops;
|
String sprops;
|
||||||
if (comment >= 0) {
|
if (comment >= 0) {
|
||||||
|
@ -958,7 +958,7 @@ public class TrackerClient implements Runnable {
|
|||||||
{
|
{
|
||||||
announce = a;
|
announce = a;
|
||||||
String s = a.substring(7);
|
String s = a.substring(7);
|
||||||
host = s.substring(0, s.indexOf("/"));
|
host = s.substring(0, s.indexOf('/'));
|
||||||
isPrimary = p;
|
isPrimary = p;
|
||||||
interval = INITIAL_SLEEP;
|
interval = INITIAL_SLEEP;
|
||||||
}
|
}
|
||||||
|
@ -1466,7 +1466,7 @@ public class I2PSnarkServlet extends BasicServlet {
|
|||||||
String fullBasename = basename;
|
String fullBasename = basename;
|
||||||
if (basename.length() > MAX_DISPLAYED_FILENAME_LENGTH) {
|
if (basename.length() > MAX_DISPLAYED_FILENAME_LENGTH) {
|
||||||
String start = basename.substring(0, MAX_DISPLAYED_FILENAME_LENGTH);
|
String start = basename.substring(0, MAX_DISPLAYED_FILENAME_LENGTH);
|
||||||
if (start.indexOf(" ") < 0 && start.indexOf("-") < 0) {
|
if (start.indexOf(' ') < 0 && start.indexOf('-') < 0) {
|
||||||
// browser has nowhere to break it
|
// browser has nowhere to break it
|
||||||
basename = start + HELLIP;
|
basename = start + HELLIP;
|
||||||
}
|
}
|
||||||
@ -3086,7 +3086,7 @@ public class I2PSnarkServlet extends BasicServlet {
|
|||||||
: tx + ": " + directory);
|
: tx + ": " + directory);
|
||||||
if (showSort)
|
if (showSort)
|
||||||
buf.append("</a>");
|
buf.append("</a>");
|
||||||
int dirSlash = directory.indexOf("/");
|
int dirSlash = directory.indexOf('/');
|
||||||
if (dirSlash > 0) {
|
if (dirSlash > 0) {
|
||||||
buf.append(" ");
|
buf.append(" ");
|
||||||
buf.append(DataHelper.escapeHTML(directory.substring(dirSlash + 1)));
|
buf.append(DataHelper.escapeHTML(directory.substring(dirSlash + 1)));
|
||||||
|
@ -96,7 +96,7 @@ public class InclusiveByteRange
|
|||||||
long first = -1;
|
long first = -1;
|
||||||
long last = -1;
|
long last = -1;
|
||||||
int d = t.indexOf('-');
|
int d = t.indexOf('-');
|
||||||
if (d < 0 || t.indexOf("-",d + 1) >= 0)
|
if (d < 0 || t.indexOf('-',d + 1) >= 0)
|
||||||
{
|
{
|
||||||
if ("bytes".equals(t))
|
if ("bytes".equals(t))
|
||||||
continue;
|
continue;
|
||||||
|
@ -105,7 +105,7 @@ class MimeTypes
|
|||||||
int i=-1;
|
int i=-1;
|
||||||
while(type==null)
|
while(type==null)
|
||||||
{
|
{
|
||||||
i=filename.indexOf(".",i+1);
|
i=filename.indexOf('.',i+1);
|
||||||
|
|
||||||
if (i<0 || i>=filename.length())
|
if (i<0 || i>=filename.length())
|
||||||
break;
|
break;
|
||||||
|
@ -380,8 +380,8 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void runCommand(String cmd, Logging l) {
|
public void runCommand(String cmd, Logging l) {
|
||||||
if (cmd.indexOf(" ") == -1) cmd += " ";
|
if (cmd.indexOf(' ') == -1) cmd += ' ';
|
||||||
int iii = cmd.indexOf(" ");
|
int iii = cmd.indexOf(' ');
|
||||||
String cmdname = cmd.substring(0, iii).toLowerCase(Locale.US);
|
String cmdname = cmd.substring(0, iii).toLowerCase(Locale.US);
|
||||||
String allargs = cmd.substring(iii + 1);
|
String allargs = cmd.substring(iii + 1);
|
||||||
String[] args = split(allargs, " "); // .split(" "); // java 1.4
|
String[] args = split(allargs, " "); // .split(" "); // java 1.4
|
||||||
|
@ -166,14 +166,14 @@ public class I2PTunnelConnectClient extends I2PTunnelHTTPClientBase implements R
|
|||||||
_log.debug(getPrefix(requestId) + "Line=[" + line + "]");
|
_log.debug(getPrefix(requestId) + "Line=[" + line + "]");
|
||||||
|
|
||||||
if (method == null) { // first line CONNECT blah.i2p:80 HTTP/1.1
|
if (method == null) { // first line CONNECT blah.i2p:80 HTTP/1.1
|
||||||
int pos = line.indexOf(" ");
|
int pos = line.indexOf(' ');
|
||||||
if (pos == -1) break; // empty first line
|
if (pos == -1) break; // empty first line
|
||||||
method = line.substring(0, pos);
|
method = line.substring(0, pos);
|
||||||
String request = line.substring(pos + 1);
|
String request = line.substring(pos + 1);
|
||||||
|
|
||||||
pos = request.indexOf(":");
|
pos = request.indexOf(':');
|
||||||
if (pos == -1)
|
if (pos == -1)
|
||||||
pos = request.indexOf(" ");
|
pos = request.indexOf(' ');
|
||||||
if (pos == -1) {
|
if (pos == -1) {
|
||||||
host = request;
|
host = request;
|
||||||
restofline = "";
|
restofline = "";
|
||||||
@ -185,7 +185,7 @@ public class I2PTunnelConnectClient extends I2PTunnelHTTPClientBase implements R
|
|||||||
if (host.toLowerCase(Locale.US).endsWith(".i2p")) {
|
if (host.toLowerCase(Locale.US).endsWith(".i2p")) {
|
||||||
// Destination gets the host name
|
// Destination gets the host name
|
||||||
destination = host;
|
destination = host;
|
||||||
} else if (host.indexOf(".") != -1) {
|
} else if (host.indexOf('.') != -1) {
|
||||||
// The request must be forwarded to a outproxy
|
// The request must be forwarded to a outproxy
|
||||||
currentProxy = selectProxy();
|
currentProxy = selectProxy();
|
||||||
if (currentProxy == null) {
|
if (currentProxy == null) {
|
||||||
|
@ -430,7 +430,7 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
|
|||||||
try {
|
try {
|
||||||
int myPort = Integer.parseInt(key);
|
int myPort = Integer.parseInt(key);
|
||||||
String host = (String) e.getValue();
|
String host = (String) e.getValue();
|
||||||
int colon = host.indexOf(":");
|
int colon = host.indexOf(':');
|
||||||
int port = Integer.parseInt(host.substring(colon + 1));
|
int port = Integer.parseInt(host.substring(colon + 1));
|
||||||
host = host.substring(0, colon);
|
host = host.substring(0, colon);
|
||||||
InetSocketAddress isa = new InetSocketAddress(host, port);
|
InetSocketAddress isa = new InetSocketAddress(host, port);
|
||||||
|
@ -167,8 +167,8 @@ public class I2Ping extends I2PTunnelClientBase {
|
|||||||
if (line.startsWith("#")) continue; // comments
|
if (line.startsWith("#")) continue; // comments
|
||||||
if (line.startsWith(";")) continue;
|
if (line.startsWith(";")) continue;
|
||||||
if (line.startsWith("!")) continue;
|
if (line.startsWith("!")) continue;
|
||||||
if (line.indexOf("=") != -1) { // maybe file is hosts.txt?
|
if (line.indexOf('=') != -1) { // maybe file is hosts.txt?
|
||||||
line = line.substring(0, line.indexOf("="));
|
line = line.substring(0, line.indexOf('='));
|
||||||
}
|
}
|
||||||
PingHandler ph = new PingHandler(line, count, localPort, remotePort,
|
PingHandler ph = new PingHandler(line, count, localPort, remotePort,
|
||||||
timeout, countPing, reportTimes);
|
timeout, countPing, reportTimes);
|
||||||
|
@ -380,7 +380,7 @@ abstract class IRCFilter {
|
|||||||
if("USER".equals(command)) {
|
if("USER".equals(command)) {
|
||||||
if (field.length < 3)
|
if (field.length < 3)
|
||||||
return s; // invalid, allow server response
|
return s; // invalid, allow server response
|
||||||
int idx = field[2].lastIndexOf(":");
|
int idx = field[2].lastIndexOf(':');
|
||||||
if(idx<0)
|
if(idx<0)
|
||||||
return "USER user hostname localhost :realname";
|
return "USER user hostname localhost :realname";
|
||||||
String realname = field[2].substring(idx+1);
|
String realname = field[2].substring(idx+1);
|
||||||
|
@ -139,7 +139,7 @@ public class RequestWrapper {
|
|||||||
String key = e.getKey();
|
String key = e.getKey();
|
||||||
if( key.toLowerCase(Locale.US).compareToIgnoreCase( "content-type") == 0 ) {
|
if( key.toLowerCase(Locale.US).compareToIgnoreCase( "content-type") == 0 ) {
|
||||||
String value = e.getValue();
|
String value = e.getValue();
|
||||||
int i = value.indexOf( ";" );
|
int i = value.indexOf( ';' );
|
||||||
if( i != -1 )
|
if( i != -1 )
|
||||||
result = value.substring( 0, i );
|
result = value.substring( 0, i );
|
||||||
else
|
else
|
||||||
|
@ -31,7 +31,7 @@ public class I2PSocketAddress extends SocketAddress {
|
|||||||
*/
|
*/
|
||||||
public I2PSocketAddress(String host) {
|
public I2PSocketAddress(String host) {
|
||||||
int port = 0;
|
int port = 0;
|
||||||
int colon = host.indexOf(":");
|
int colon = host.indexOf(':');
|
||||||
if (colon > 0) {
|
if (colon > 0) {
|
||||||
try {
|
try {
|
||||||
port = Integer.parseInt(host.substring(colon + 1));
|
port = Integer.parseInt(host.substring(colon + 1));
|
||||||
|
@ -128,7 +128,7 @@ public class I2PSocketEepGet extends EepGet {
|
|||||||
if ("i2p".equals(host)) {
|
if ("i2p".equals(host)) {
|
||||||
String file = url.getRawPath();
|
String file = url.getRawPath();
|
||||||
try {
|
try {
|
||||||
int slash = 1 + file.substring(1).indexOf("/");
|
int slash = 1 + file.substring(1).indexOf('/');
|
||||||
host = file.substring(1, slash);
|
host = file.substring(1, slash);
|
||||||
_actualURL = "http://" + host + file.substring(slash);
|
_actualURL = "http://" + host + file.substring(slash);
|
||||||
String query = url.getRawQuery();
|
String query = url.getRawQuery();
|
||||||
|
@ -370,9 +370,9 @@ class PluginUpdateRunner extends UpdateRunner {
|
|||||||
String appName = props.getProperty("name");
|
String appName = props.getProperty("name");
|
||||||
String version = props.getProperty("version");
|
String version = props.getProperty("version");
|
||||||
if (appName == null || version == null || appName.length() <= 0 || version.length() <= 0 ||
|
if (appName == null || version == null || appName.length() <= 0 || version.length() <= 0 ||
|
||||||
appName.indexOf("<") >= 0 || appName.indexOf(">") >= 0 ||
|
appName.indexOf('<') >= 0 || appName.indexOf('>') >= 0 ||
|
||||||
version.indexOf("<") >= 0 || version.indexOf(">") >= 0 ||
|
version.indexOf('<') >= 0 || version.indexOf('>') >= 0 ||
|
||||||
appName.startsWith(".") || appName.indexOf("/") >= 0 || appName.indexOf("\\") >= 0) {
|
appName.startsWith(".") || appName.indexOf('/') >= 0 || appName.indexOf('\\') >= 0) {
|
||||||
to.delete();
|
to.delete();
|
||||||
statusDone("<b>" + _t("Plugin from {0} has invalid name or version", url) + "</b>");
|
statusDone("<b>" + _t("Plugin from {0} has invalid name or version", url) + "</b>");
|
||||||
return;
|
return;
|
||||||
|
@ -246,7 +246,7 @@ public class ConfigClientsHandler extends FormHandler {
|
|||||||
isAdvanced()) {
|
isAdvanced()) {
|
||||||
String desc = getJettyString("nofilter_desc" + cur);
|
String desc = getJettyString("nofilter_desc" + cur);
|
||||||
if (desc != null) {
|
if (desc != null) {
|
||||||
int spc = desc.indexOf(" ");
|
int spc = desc.indexOf(' ');
|
||||||
String clss = desc;
|
String clss = desc;
|
||||||
String args = null;
|
String args = null;
|
||||||
if (spc >= 0) {
|
if (spc >= 0) {
|
||||||
@ -267,7 +267,7 @@ public class ConfigClientsHandler extends FormHandler {
|
|||||||
String newDesc = getJettyString("nofilter_desc" + newClient);
|
String newDesc = getJettyString("nofilter_desc" + newClient);
|
||||||
if (newDesc != null && newDesc.trim().length() > 0) {
|
if (newDesc != null && newDesc.trim().length() > 0) {
|
||||||
// new entry
|
// new entry
|
||||||
int spc = newDesc.indexOf(" ");
|
int spc = newDesc.indexOf(' ');
|
||||||
String clss = newDesc;
|
String clss = newDesc;
|
||||||
String args = null;
|
String args = null;
|
||||||
if (spc >= 0) {
|
if (spc >= 0) {
|
||||||
|
@ -250,7 +250,7 @@ public class ConfigClientsHelper extends HelperBase {
|
|||||||
.append(_t("Signed by")).append("</b></td><td>");
|
.append(_t("Signed by")).append("</b></td><td>");
|
||||||
String s = stripHTML(appProps, "signer");
|
String s = stripHTML(appProps, "signer");
|
||||||
if (s != null) {
|
if (s != null) {
|
||||||
if (s.indexOf("@") > 0)
|
if (s.indexOf('@') > 0)
|
||||||
desc.append("<a href=\"mailto:").append(s).append("\">").append(s).append("</a>");
|
desc.append("<a href=\"mailto:").append(s).append("\">").append(s).append("</a>");
|
||||||
else
|
else
|
||||||
desc.append(s);
|
desc.append(s);
|
||||||
@ -271,7 +271,7 @@ public class ConfigClientsHelper extends HelperBase {
|
|||||||
if (s != null) {
|
if (s != null) {
|
||||||
desc.append("<tr><td><b>")
|
desc.append("<tr><td><b>")
|
||||||
.append(_t("Author")).append("</b></td><td>");
|
.append(_t("Author")).append("</b></td><td>");
|
||||||
if (s.indexOf("@") > 0)
|
if (s.indexOf('@') > 0)
|
||||||
desc.append("<a href=\"mailto:").append(s).append("\">").append(s).append("</a>");
|
desc.append("<a href=\"mailto:").append(s).append("\">").append(s).append("</a>");
|
||||||
else
|
else
|
||||||
desc.append(s);
|
desc.append(s);
|
||||||
|
@ -61,7 +61,7 @@ public class LocaleWebAppHandler extends HandlerWrapper
|
|||||||
if (pathInContext.equals("/") || pathInContext.equals("/index.html")) {
|
if (pathInContext.equals("/") || pathInContext.equals("/index.html")) {
|
||||||
// home page
|
// home page
|
||||||
pathInContext = "/index.jsp";
|
pathInContext = "/index.jsp";
|
||||||
} else if (pathInContext.indexOf("/", 1) < 0 &&
|
} else if (pathInContext.indexOf('/', 1) < 0 &&
|
||||||
(!pathInContext.endsWith(".jsp")) &&
|
(!pathInContext.endsWith(".jsp")) &&
|
||||||
(!pathInContext.endsWith(".log")) &&
|
(!pathInContext.endsWith(".log")) &&
|
||||||
(!pathInContext.endsWith(".txt"))) {
|
(!pathInContext.endsWith(".txt"))) {
|
||||||
|
@ -725,7 +725,7 @@ public class PluginStarter implements Runnable {
|
|||||||
// argument array comparison in getClientApp() works.
|
// argument array comparison in getClientApp() works.
|
||||||
// Do this after parsing so we don't need to worry about quoting
|
// Do this after parsing so we don't need to worry about quoting
|
||||||
for (int i = 0; i < argVal.length; i++) {
|
for (int i = 0; i < argVal.length; i++) {
|
||||||
if (argVal[i].indexOf("$") >= 0) {
|
if (argVal[i].indexOf('$') >= 0) {
|
||||||
argVal[i] = argVal[i].replace("$I2P", ctx.getBaseDir().getAbsolutePath());
|
argVal[i] = argVal[i].replace("$I2P", ctx.getBaseDir().getAbsolutePath());
|
||||||
argVal[i] = argVal[i].replace("$CONFIG", ctx.getConfigDir().getAbsolutePath());
|
argVal[i] = argVal[i].replace("$CONFIG", ctx.getConfigDir().getAbsolutePath());
|
||||||
argVal[i] = argVal[i].replace("$PLUGIN", pluginDir.getAbsolutePath());
|
argVal[i] = argVal[i].replace("$PLUGIN", pluginDir.getAbsolutePath());
|
||||||
@ -764,7 +764,7 @@ public class PluginStarter implements Runnable {
|
|||||||
}
|
}
|
||||||
// do this after parsing so we don't need to worry about quoting
|
// do this after parsing so we don't need to worry about quoting
|
||||||
for (int i = 0; i < argVal.length; i++) {
|
for (int i = 0; i < argVal.length; i++) {
|
||||||
if (argVal[i].indexOf("$") >= 0) {
|
if (argVal[i].indexOf('$') >= 0) {
|
||||||
argVal[i] = argVal[i].replace("$I2P", ctx.getBaseDir().getAbsolutePath());
|
argVal[i] = argVal[i].replace("$I2P", ctx.getBaseDir().getAbsolutePath());
|
||||||
argVal[i] = argVal[i].replace("$CONFIG", ctx.getConfigDir().getAbsolutePath());
|
argVal[i] = argVal[i].replace("$CONFIG", ctx.getConfigDir().getAbsolutePath());
|
||||||
argVal[i] = argVal[i].replace("$PLUGIN", pluginDir.getAbsolutePath());
|
argVal[i] = argVal[i].replace("$PLUGIN", pluginDir.getAbsolutePath());
|
||||||
@ -774,7 +774,7 @@ public class PluginStarter implements Runnable {
|
|||||||
ClassLoader cl = null;
|
ClassLoader cl = null;
|
||||||
if (app.classpath != null) {
|
if (app.classpath != null) {
|
||||||
String cp = app.classpath;
|
String cp = app.classpath;
|
||||||
if (cp.indexOf("$") >= 0) {
|
if (cp.indexOf('$') >= 0) {
|
||||||
cp = cp.replace("$I2P", ctx.getBaseDir().getAbsolutePath());
|
cp = cp.replace("$I2P", ctx.getBaseDir().getAbsolutePath());
|
||||||
cp = cp.replace("$CONFIG", ctx.getConfigDir().getAbsolutePath());
|
cp = cp.replace("$CONFIG", ctx.getConfigDir().getAbsolutePath());
|
||||||
cp = cp.replace("$PLUGIN", pluginDir.getAbsolutePath());
|
cp = cp.replace("$PLUGIN", pluginDir.getAbsolutePath());
|
||||||
|
@ -52,7 +52,7 @@ class ProfileOrganizerRenderer {
|
|||||||
continue;
|
continue;
|
||||||
if (mode == 2) {
|
if (mode == 2) {
|
||||||
RouterInfo info = _context.netDb().lookupRouterInfoLocally(peer);
|
RouterInfo info = _context.netDb().lookupRouterInfoLocally(peer);
|
||||||
if (info != null && info.getCapabilities().indexOf("f") >= 0)
|
if (info != null && info.getCapabilities().indexOf('f') >= 0)
|
||||||
order.add(prof);
|
order.add(prof);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ class SAMHandlerFactory {
|
|||||||
private static int getMajor(String ver) {
|
private static int getMajor(String ver) {
|
||||||
if (ver == null)
|
if (ver == null)
|
||||||
return -1;
|
return -1;
|
||||||
int dot = ver.indexOf(".");
|
int dot = ver.indexOf('.');
|
||||||
if (dot == 0)
|
if (dot == 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (dot > 0)
|
if (dot > 0)
|
||||||
@ -189,7 +189,7 @@ class SAMHandlerFactory {
|
|||||||
if ( (ver == null) || (ver.indexOf('.') < 0) )
|
if ( (ver == null) || (ver.indexOf('.') < 0) )
|
||||||
return -1;
|
return -1;
|
||||||
try {
|
try {
|
||||||
String major = ver.substring(ver.indexOf(".") + 1);
|
String major = ver.substring(ver.indexOf('.') + 1);
|
||||||
return Integer.parseInt(major);
|
return Integer.parseInt(major);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -187,8 +187,8 @@ class Mail {
|
|||||||
|
|
||||||
address = address.trim();
|
address = address.trim();
|
||||||
|
|
||||||
if( address.indexOf( "\n" ) != -1 ||
|
if( address.indexOf('\n') != -1 ||
|
||||||
address.indexOf( "\r" ) != -1 )
|
address.indexOf('\r') != -1 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
String[] tokens = DataHelper.split(address, "[ \t]+");
|
String[] tokens = DataHelper.split(address, "[ \t]+");
|
||||||
|
@ -213,7 +213,7 @@ class MailPart {
|
|||||||
String result = null;
|
String result = null;
|
||||||
int i = line.indexOf( ": " );
|
int i = line.indexOf( ": " );
|
||||||
if( i != - 1 ) {
|
if( i != - 1 ) {
|
||||||
int j = line.indexOf( ";", i + 2 );
|
int j = line.indexOf(';', i + 2 );
|
||||||
if( j == -1 )
|
if( j == -1 )
|
||||||
result = line.substring( i + 2 );
|
result = line.substring( i + 2 );
|
||||||
else
|
else
|
||||||
@ -234,11 +234,11 @@ class MailPart {
|
|||||||
if( i == -1 )
|
if( i == -1 )
|
||||||
break;
|
break;
|
||||||
h = i + l;
|
h = i + l;
|
||||||
int j = line.indexOf( "=", i + l );
|
int j = line.indexOf('=', i + l );
|
||||||
// System.err.println( "j=" + j );
|
// System.err.println( "j=" + j );
|
||||||
if( j != -1 ) {
|
if( j != -1 ) {
|
||||||
int k = line.indexOf( "\"", j + 1 );
|
int k = line.indexOf('"', j + 1 );
|
||||||
int m = line.indexOf( ";", j + 1 );
|
int m = line.indexOf(';', j + 1 );
|
||||||
// System.err.println( "k=" + k );
|
// System.err.println( "k=" + k );
|
||||||
if( k != -1 && ( m == -1 || k < m ) ) {
|
if( k != -1 && ( m == -1 || k < m ) ) {
|
||||||
/*
|
/*
|
||||||
@ -249,7 +249,7 @@ class MailPart {
|
|||||||
m = -1;
|
m = -1;
|
||||||
int k2 = k + 1;
|
int k2 = k + 1;
|
||||||
while( true ) {
|
while( true ) {
|
||||||
m = line.indexOf( "\"", k2 );
|
m = line.indexOf('"', k2 );
|
||||||
// System.err.println( "m=" + m + " '" + line.substring( m ) + "'" );
|
// System.err.println( "m=" + m + " '" + line.substring( m ) + "'" );
|
||||||
if( m == -1 ) {
|
if( m == -1 ) {
|
||||||
break;
|
break;
|
||||||
|
@ -1197,10 +1197,10 @@ public class WebMail extends HttpServlet
|
|||||||
if (filename != null &&
|
if (filename != null &&
|
||||||
(buttonPressed(request, NEW_UPLOAD) || buttonPressed(request, SEND))) {
|
(buttonPressed(request, NEW_UPLOAD) || buttonPressed(request, SEND))) {
|
||||||
Debug.debug(Debug.DEBUG, "Got filename in compose form: " + filename);
|
Debug.debug(Debug.DEBUG, "Got filename in compose form: " + filename);
|
||||||
int i = filename.lastIndexOf( "/" );
|
int i = filename.lastIndexOf('/');
|
||||||
if( i != - 1 )
|
if( i != - 1 )
|
||||||
filename = filename.substring( i + 1 );
|
filename = filename.substring( i + 1 );
|
||||||
i = filename.lastIndexOf( "\\" );
|
i = filename.lastIndexOf('\\');
|
||||||
if( i != -1 )
|
if( i != -1 )
|
||||||
filename = filename.substring( i + 1 );
|
filename = filename.substring( i + 1 );
|
||||||
if( filename != null && filename.length() > 0 ) {
|
if( filename != null && filename.length() > 0 ) {
|
||||||
|
@ -490,7 +490,7 @@ public class POP3MailBox implements NewMailListener {
|
|||||||
}
|
}
|
||||||
response = response.trim();
|
response = response.trim();
|
||||||
try {
|
try {
|
||||||
int i = response.indexOf(" ", 5);
|
int i = response.indexOf(' ', 5);
|
||||||
mails =
|
mails =
|
||||||
Integer.parseInt(
|
Integer.parseInt(
|
||||||
i != -1
|
i != -1
|
||||||
@ -510,7 +510,7 @@ public class POP3MailBox implements NewMailListener {
|
|||||||
uidlToID.clear();
|
uidlToID.clear();
|
||||||
if (lines != null) {
|
if (lines != null) {
|
||||||
for (String line : lines) {
|
for (String line : lines) {
|
||||||
int j = line.indexOf( " " );
|
int j = line.indexOf(' ');
|
||||||
if( j != -1 ) {
|
if( j != -1 ) {
|
||||||
try {
|
try {
|
||||||
int n = Integer.parseInt( line.substring( 0, j ) );
|
int n = Integer.parseInt( line.substring( 0, j ) );
|
||||||
@ -541,7 +541,7 @@ public class POP3MailBox implements NewMailListener {
|
|||||||
sizes.clear();
|
sizes.clear();
|
||||||
if (lines != null) {
|
if (lines != null) {
|
||||||
for (String line : lines) {
|
for (String line : lines) {
|
||||||
int j = line.indexOf(" ");
|
int j = line.indexOf(' ');
|
||||||
if (j != -1) {
|
if (j != -1) {
|
||||||
try {
|
try {
|
||||||
int key = Integer.parseInt(line.substring(0, j));
|
int key = Integer.parseInt(line.substring(0, j));
|
||||||
|
@ -117,7 +117,7 @@ public class HostTxtEntry {
|
|||||||
String[] entries = DataHelper.split(line, "#");
|
String[] entries = DataHelper.split(line, "#");
|
||||||
for (int i = 0; i < entries.length; i++) {
|
for (int i = 0; i < entries.length; i++) {
|
||||||
String kv = entries[i];
|
String kv = entries[i];
|
||||||
int eq = kv.indexOf("=");
|
int eq = kv.indexOf('=');
|
||||||
if (eq <= 0 || eq == kv.length() - 1)
|
if (eq <= 0 || eq == kv.length() - 1)
|
||||||
throw new IllegalArgumentException("No value: \"" + kv + '"');
|
throw new IllegalArgumentException("No value: \"" + kv + '"');
|
||||||
String k = kv.substring(0, eq);
|
String k = kv.substring(0, eq);
|
||||||
|
@ -190,7 +190,7 @@ public abstract class Addresses {
|
|||||||
* @since IPv6
|
* @since IPv6
|
||||||
*/
|
*/
|
||||||
private static String stripScope(String ip) {
|
private static String stripScope(String ip) {
|
||||||
int pct = ip.indexOf("%");
|
int pct = ip.indexOf('%');
|
||||||
if (pct > 0)
|
if (pct > 0)
|
||||||
ip = ip.substring(0, pct);
|
ip = ip.substring(0, pct);
|
||||||
return ip;
|
return ip;
|
||||||
|
@ -58,7 +58,7 @@ public class CommandLine {
|
|||||||
protected static void exec(String args[], List<String> classes) {
|
protected static void exec(String args[], List<String> classes) {
|
||||||
String cmd = args[0].toLowerCase(Locale.US);
|
String cmd = args[0].toLowerCase(Locale.US);
|
||||||
for (String cls : classes) {
|
for (String cls : classes) {
|
||||||
String ccmd = cls.substring(cls.lastIndexOf(".") + 1).toLowerCase(Locale.US);
|
String ccmd = cls.substring(cls.lastIndexOf('.') + 1).toLowerCase(Locale.US);
|
||||||
if (cmd.equals(ccmd)) {
|
if (cmd.equals(ccmd)) {
|
||||||
try {
|
try {
|
||||||
String[] cargs = new String[args.length - 1];
|
String[] cargs = new String[args.length - 1];
|
||||||
@ -85,7 +85,7 @@ public class CommandLine {
|
|||||||
System.err.println("Available commands:");
|
System.err.println("Available commands:");
|
||||||
List<String> cmds = new ArrayList<String>(classes.size());
|
List<String> cmds = new ArrayList<String>(classes.size());
|
||||||
for (String cls : classes) {
|
for (String cls : classes) {
|
||||||
String ccmd = cls.substring(cls.lastIndexOf(".") + 1).toLowerCase(Locale.US);
|
String ccmd = cls.substring(cls.lastIndexOf('.') + 1).toLowerCase(Locale.US);
|
||||||
cmds.add(ccmd);
|
cmds.add(ccmd);
|
||||||
}
|
}
|
||||||
Collections.sort(cmds);
|
Collections.sort(cmds);
|
||||||
|
@ -170,7 +170,7 @@ class FloodfillMonitorJob extends JobImpl {
|
|||||||
if (wasFF)
|
if (wasFF)
|
||||||
ffcount++;
|
ffcount++;
|
||||||
int good = ffcount - failcount;
|
int good = ffcount - failcount;
|
||||||
boolean happy = getContext().router().getRouterInfo().getCapabilities().indexOf("R") >= 0;
|
boolean happy = getContext().router().getRouterInfo().getCapabilities().indexOf('R') >= 0;
|
||||||
// TODO - limit may still be too high
|
// TODO - limit may still be too high
|
||||||
// For reference, the avg lifetime job lag on my Pi is 6.
|
// For reference, the avg lifetime job lag on my Pi is 6.
|
||||||
// Should we consider avg. dropped ff jobs?
|
// Should we consider avg. dropped ff jobs?
|
||||||
|
Reference in New Issue
Block a user