WHILE loop is incorrect
I have a WHILE statement : "while (s2.substring(k, l) != "<")" that does not work at the bottom of this program. The condition never stops the loop. The JDB does not find any of the fields e. g. PRINT S2
I am doing this in win XP in a DOS window. My CLASSPATH keeps going away for some reason. I set it as CLASSPATH=.;d:\program files\java\jre1.5.0_11\lib\ext\qtjava.zip;c:\program files\java2\java\jdk1.5.0_11
At one time JDB worked with this program. For some reason, now it does not. But the WHILE condition has never worked.
import java.util.*;
import java.io.*;
public class readfile4
{
public static void main(String args[])
{
// _
//
// Here we get a list of all files in the current directory
//
// _
String list[] = new File(".").list();
for (int i = 0; i < list.length; i++)
//__
//
//
//
//
//Here we take each file name and read all of its
//records into an array. At this point, we can
//determine the file size since all the rcds are
//in an array.
//If the file size is greater than the original file size
// then it has been updated, so we look at record 4 and get
// the name and display it to a screen.
//
//_
{
String s = list.substring(0, 06) ;
int orgsize = 13000 ;
if (s.equals("whats_"))
{
final int assumedLineLength = 50;
File file = new File(list);
List<String> fileList =
new ArrayList<String>((int)(file.length() / assumedLineLength) * 2);
BufferedReader reader = null;
int lineCount = 0;
try {
reader = new BufferedReader(new FileReader(file));
for (String line = reader.readLine(); line != null;
line = reader.readLine()) {
fileList.add(line);
lineCount++;
}
} catch (IOException e) {
System.err.format("Could not read %s: %s%n", file, e);
System.exit(1);
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e) {}
}
}
//
//At this point we have the the entire file in an array.
// The above loop has put all the records for the "i" file
// in an array.
//Now, if the filename is "whats_new_....." then extract
// the classmates name out of the 4th record and display it.
//Then return for the next record from the directory list.
//
String s2 = fileList.get(3) ;
String s2a = s2.substring(0, 5);
String s3 = "" ;
//__
//Only look at title records to get the name
//because some of the html records are
if (s2a.equals("<titl"))
{
int k = 7 ;
int l = k + 1 ;
while (s2.substring(k, l) != "<")
{
k++ ;
l++ ;
}
s3 = s2.substring(7, l) ;
}
else
{
s3 = "" ;
}
if (file.length() > orgsize)
{
System.out.println(s3 + "- has updated their bio ") ;
}
}
}
}
}

