basically its a logfile reader function using other logreader class and its functions like readLine() and hasMoreLines() I dont know why my while loop is not working properly as it is supossed to output the all tokens which i made using tokenizer
public void readLogFile() throws Exception {
LogReader lr = new LogReader();
LogEntry [] arr = new LogEntry[700];
String logLine;
int count = 0;
System.out.println("OUTSIDE WHILE LOOP"); // for testing
logLine = lr.fileReader.nextLine(); // objct log reader
System.out.println("A DAM LINE IN OUTER LOOP"); // for testing
while (lr.hasMoreLines()) {
StringTokenizer token = new StringTokenizer(lr.readLine());
String date = token.nextToken();
String time = token.nextToken();
String siteName = token.nextToken();
String computerName = token.nextToken();
String sIpAddress = token.nextToken();
String csMethod = token.nextToken();
String csUriStem = token.nextToken();
String csUriQuery = token.nextToken();
String sPort = token.nextToken();
String csUsername = token.nextToken();
String csIpAddress = token.nextToken();
String csVersion = token.nextToken();
String csUserAgent = token.nextToken();
String csCookie = token.nextToken();
String csReferer = token.nextToken();
String csHost = token.nextToken();
String scStatus = token.nextToken();
String scSubStatus = token.nextToken();
String scWin32Status = token.nextToken();
String scBytes = token.nextToken();
String csBytes = token.nextToken();
String timeTaken = token.nextToken();
//BASICALLY ITS NOT EXECUTING THIS PART BELOW
LogEntry le = new LogEntry(date, time, siteName, computerName,
csMethod, sIpAddress, csUriStem, csUriQuery, sPort,
csUsername, csIpAddress, csVersion, csUserAgent,
csCookie, csReferer, csHost, scStatus, scSubStatus,
scWin32Status, scBytes, csBytes, timeTaken);
arr[count++]=le;
System.out.println(le.toString());
System.out.println("A DAM LINE IN WHILE LOOP"); // for testing
}
lr is just initialised. I dont see any assigments to it, this the control is not entering the while loop
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.