Up until now, my program has been working fine. For some reason despite having not changed anything to do with the code below, I am recieveing an out of bounds error. So basically my program is reading data from an excel sheet and putting this data into a combo box. For example the excel sheet data is something like this: firstName, lastName, emailAddress, phoneNumber etc. When I run my code, "data[0]" is accepted, however anything beyond this apparently out of bounds. Despite the fact that it tells me it is out of bounds, it still reads the data and does what it should, why am I getting this error?
try {
br = new BufferedReader(new FileReader("Clients.csv"));
} catch (FileNotFoundException e1) {
e1.printStackTrace();
}
String line = "";
String cvsSplitBy = ",";
String fullName = null;
try {
br = new BufferedReader(new FileReader("Clients.csv"));
while ((line = br.readLine()) != null) {
String[] data = line.split(cvsSplitBy);
fullName = data[0]+" "+data[1];
comboBox_1.addItem(fullName);
}
br.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();