Alright my program is giving me a hard time and I will have to briefly explain what it does and when the exception is thrown to give you a better understanding.
My program goes off and reads a csv file, once it reads it, it adds the information to my bean and then displays the bean on my main program. The csv file is constantly changing with what is inside it, thus I set a timer on the part where my program reads the csv file.
Here is an example of where the exception is not thrown. Lets say in my csv file there are only 2 lines of data. Then I change the csv file to contain 6 lines of data, the main program updates the beans and runs fine without exceptions or warnings.
Here is an example of where the exception is thrown. When the csv file starts out with 6 lines of data and then I remove some lines (any amount) then the main program does not update my beans and throws this exception: ArrayIndexOutOfBoundsException: 1
My csv file always contains only 3 columns of information, however the lines (rows) will vary.
I will post the source where this exception happens. And hopefully you guys will be able to help out.
public ParseResult[] parseResult(BufferedReader reader) throws FileNotFoundException, IOException {
ParseResult[] out;
ArrayList<ParseResult> infoFound = new ArrayList<ParseResult>();
try {
boolean bHeadersDone = false;
while (reader.ready()) {
String beanInfo = reader.readLine();
if (!bHeadersDone) {
if (beanInfo.contains("Ping")) {
bHeadersDone = true;
}
}
else {
String[] values = beanInfo.split("," , 3);
infoA = values[0];
[B] infoB = values[1];[/B]
infoC = values[2];
if (!infoC.contains("[n/a]")) {
ParseResult pr = new ParseResult(hostname, ip);
infoFound.add(pr);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
out = (ParseResult[])infoFound.toArray(new ParseResult[infoFound.size()]);
return out;
}
I have bolded the source where this exception 'supposedly' happens.