public static synchronized StudentList getStudentData(File file) {
    StudentList sl;
    try {
      if (file.createNewFile()) {
        sl = new StudentList(new ArrayList<Student>());
        XStream xstream = getXStream();
        xstream.toXML(sl, new FileOutputStream(file));
      } else {
        Object studentList = getXStream().fromXML(file);
        if (studentList == null || !(studentList instanceof StudentList)) throw new Error("Student data corrupted");
        sl = (StudentList) studentList;
        if (sl.studentList == null) throw new Error("Student data corrupted");
      }
    } catch (IOException e) {
      throw new Error(file.getAbsolutePath().toString(), e);
    }
    return sl;
  }