private List<AirLocation> readAirLocationFile(File locationFile) { List<AirLocation> locationList = new ArrayList<AirLocation>(3000); BufferedReader bufferedReader = null; long id = 0L; try { bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(locationFile), "UTF-8")); for (String line = bufferedReader.readLine(); line != null; line = bufferedReader.readLine()) { String[] tokens = line.split(";"); if (tokens.length != 5) { throw new IllegalArgumentException( "The line (" + line + ") does not have 5 tokens (" + tokens.length + ")."); } AirLocation location = new AirLocation(); location.setId(id); id++; location.setLatitude(Double.parseDouble(tokens[2])); location.setLongitude(Double.parseDouble(tokens[3])); location.setName(tokens[4]); locationList.add(location); } } catch (IOException e) { throw new IllegalArgumentException( "Could not read the locationFile (" + locationFile + ").", e); } finally { IOUtils.closeQuietly(bufferedReader); } logger.info("Read {} cities.", locationList.size()); return locationList; }