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

@@ -187,8 +187,8 @@ class Mail {
address = address.trim();
if( address.indexOf( "\n" ) != -1 ||
address.indexOf( "\r" ) != -1 )
if( address.indexOf('\n') != -1 ||
address.indexOf('\r') != -1 )
return false;
String[] tokens = DataHelper.split(address, "[ \t]+");

View File

@@ -213,7 +213,7 @@ class MailPart {
String result = null;
int i = line.indexOf( ": " );
if( i != - 1 ) {
int j = line.indexOf( ";", i + 2 );
int j = line.indexOf(';', i + 2 );
if( j == -1 )
result = line.substring( i + 2 );
else
@@ -234,11 +234,11 @@ class MailPart {
if( i == -1 )
break;
h = i + l;
int j = line.indexOf( "=", i + l );
int j = line.indexOf('=', i + l );
// System.err.println( "j=" + j );
if( j != -1 ) {
int k = line.indexOf( "\"", j + 1 );
int m = line.indexOf( ";", j + 1 );
int k = line.indexOf('"', j + 1 );
int m = line.indexOf(';', j + 1 );
// System.err.println( "k=" + k );
if( k != -1 && ( m == -1 || k < m ) ) {
/*
@@ -249,7 +249,7 @@ class MailPart {
m = -1;
int k2 = k + 1;
while( true ) {
m = line.indexOf( "\"", k2 );
m = line.indexOf('"', k2 );
// System.err.println( "m=" + m + " '" + line.substring( m ) + "'" );
if( m == -1 ) {
break;

View File

@@ -1197,10 +1197,10 @@ public class WebMail extends HttpServlet
if (filename != null &&
(buttonPressed(request, NEW_UPLOAD) || buttonPressed(request, SEND))) {
Debug.debug(Debug.DEBUG, "Got filename in compose form: " + filename);
int i = filename.lastIndexOf( "/" );
int i = filename.lastIndexOf('/');
if( i != - 1 )
filename = filename.substring( i + 1 );
i = filename.lastIndexOf( "\\" );
i = filename.lastIndexOf('\\');
if( i != -1 )
filename = filename.substring( i + 1 );
if( filename != null && filename.length() > 0 ) {

View File

@@ -490,7 +490,7 @@ public class POP3MailBox implements NewMailListener {
}
response = response.trim();
try {
int i = response.indexOf(" ", 5);
int i = response.indexOf(' ', 5);
mails =
Integer.parseInt(
i != -1
@@ -510,7 +510,7 @@ public class POP3MailBox implements NewMailListener {
uidlToID.clear();
if (lines != null) {
for (String line : lines) {
int j = line.indexOf( " " );
int j = line.indexOf(' ');
if( j != -1 ) {
try {
int n = Integer.parseInt( line.substring( 0, j ) );
@@ -541,7 +541,7 @@ public class POP3MailBox implements NewMailListener {
sizes.clear();
if (lines != null) {
for (String line : lines) {
int j = line.indexOf(" ");
int j = line.indexOf(' ');
if (j != -1) {
try {
int key = Integer.parseInt(line.substring(0, j));