Clean up single char indexOf()

This commit is contained in:
zzz
2016-12-02 18:52:37 +00:00
parent 5b31540fe8
commit 5be077e25d
29 changed files with 51 additions and 51 deletions

View File

@ -370,9 +370,9 @@ class PluginUpdateRunner extends UpdateRunner {
String appName = props.getProperty("name");
String version = props.getProperty("version");
if (appName == null || version == null || appName.length() <= 0 || version.length() <= 0 ||
appName.indexOf("<") >= 0 || appName.indexOf(">") >= 0 ||
version.indexOf("<") >= 0 || version.indexOf(">") >= 0 ||
appName.startsWith(".") || appName.indexOf("/") >= 0 || appName.indexOf("\\") >= 0) {
appName.indexOf('<') >= 0 || appName.indexOf('>') >= 0 ||
version.indexOf('<') >= 0 || version.indexOf('>') >= 0 ||
appName.startsWith(".") || appName.indexOf('/') >= 0 || appName.indexOf('\\') >= 0) {
to.delete();
statusDone("<b>" + _t("Plugin from {0} has invalid name or version", url) + "</b>");
return;

View File

@ -246,7 +246,7 @@ public class ConfigClientsHandler extends FormHandler {
isAdvanced()) {
String desc = getJettyString("nofilter_desc" + cur);
if (desc != null) {
int spc = desc.indexOf(" ");
int spc = desc.indexOf(' ');
String clss = desc;
String args = null;
if (spc >= 0) {
@ -267,7 +267,7 @@ public class ConfigClientsHandler extends FormHandler {
String newDesc = getJettyString("nofilter_desc" + newClient);
if (newDesc != null && newDesc.trim().length() > 0) {
// new entry
int spc = newDesc.indexOf(" ");
int spc = newDesc.indexOf(' ');
String clss = newDesc;
String args = null;
if (spc >= 0) {

View File

@ -250,7 +250,7 @@ public class ConfigClientsHelper extends HelperBase {
.append(_t("Signed by")).append("</b></td><td>");
String s = stripHTML(appProps, "signer");
if (s != null) {
if (s.indexOf("@") > 0)
if (s.indexOf('@') > 0)
desc.append("<a href=\"mailto:").append(s).append("\">").append(s).append("</a>");
else
desc.append(s);
@ -271,7 +271,7 @@ public class ConfigClientsHelper extends HelperBase {
if (s != null) {
desc.append("<tr><td><b>")
.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>");
else
desc.append(s);

View File

@ -61,7 +61,7 @@ public class LocaleWebAppHandler extends HandlerWrapper
if (pathInContext.equals("/") || pathInContext.equals("/index.html")) {
// home page
pathInContext = "/index.jsp";
} else if (pathInContext.indexOf("/", 1) < 0 &&
} else if (pathInContext.indexOf('/', 1) < 0 &&
(!pathInContext.endsWith(".jsp")) &&
(!pathInContext.endsWith(".log")) &&
(!pathInContext.endsWith(".txt"))) {

View File

@ -725,7 +725,7 @@ public class PluginStarter implements Runnable {
// argument array comparison in getClientApp() works.
// Do this after parsing so we don't need to worry about quoting
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("$CONFIG", ctx.getConfigDir().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
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("$CONFIG", ctx.getConfigDir().getAbsolutePath());
argVal[i] = argVal[i].replace("$PLUGIN", pluginDir.getAbsolutePath());
@ -774,7 +774,7 @@ public class PluginStarter implements Runnable {
ClassLoader cl = null;
if (app.classpath != null) {
String cp = app.classpath;
if (cp.indexOf("$") >= 0) {
if (cp.indexOf('$') >= 0) {
cp = cp.replace("$I2P", ctx.getBaseDir().getAbsolutePath());
cp = cp.replace("$CONFIG", ctx.getConfigDir().getAbsolutePath());
cp = cp.replace("$PLUGIN", pluginDir.getAbsolutePath());

View File

@ -52,7 +52,7 @@ class ProfileOrganizerRenderer {
continue;
if (mode == 2) {
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);
continue;
}