title: Read from file with BufferedReader
body: <p>Basically I've got an assignment which reads multiple lines from a .txt file. 
  There are 4 values in the text file per line and each value is separated by 2 spaces.
  There are about 10 lines of data in the file.</p>
  
  <p>After taking the input from the file the program then puts it onto a Database. The database connection functionality works fine.</p>
  
  <p>My issue now is with reading from the file using a BufferedReader.
  The issue is that if I uncomment any 1 of the 3 lines at the bottom the BufferedReader reads every other line. And if I don't use them then there's an exception as the next input is of type String. 
  I have contemplated using a Scanner with the .hasNextLine() method.</p>
  
  <p>Any thoughts on what could be the problem and how to fix it?
  Thanks.</p>
  
  <pre><code>File file = new File(FILE_INPUT_NAME);
  FileReader fr = new FileReader(file);
  BufferedReader readFile = new BufferedReader(fr);
  String line = null;
  while ((line = readFile.readLine()) != null) {
      String[] split = line.split("  ", 4);
  
      String id = split[0];
      nameFromFile = split[1];
      String year = split[2];
      String mark = split[3];
  
      idFromFile = Integer.parseInt(id);
      yearOfStudyFromFile = Integer.parseInt(year);
      markFromFile = Integer.parseInt(mark);
  
      //line = readFile.readLine();
      //readFile.readLine();
      //System.out.println(readFile.readLine());
  }
  </code></pre>
  
  <p>Edit: There was an error in the formatting of the .txt file. a missing value.
  But now I get an ArrayOutOfBoundsException. </p>
  
  <p>Edit edit: Another error in the .txt file! Turns out there was a single space instead of a double. It seems to be working now. But any advice on how to deal with file errors like this in the future?</p>