I am taking in CSV files from Nasdaq and am using Apache Commons CSV to parse it. For some reason I am getting a NullPointerException and I can't seem to figure out why.
These are my lines where I create the reader and parser
data = new URL("http://www.nasdaq.com/screening/companies-by-industry.aspx?industry=Health%20Care&render=download");
Reader dataReader= new InputStreamReader(new BOMInputStream(data.openStream()), "UTF-8");
CSVParser dataParse= new CSVParser(dataReader, CSVFormat.EXCEL.withHeader());
I am then adding to an ArrayList to store the values:
for (final CSVRecord record : dataParse) {
myArrayList.add(new MyClass(record.get("Symbol"),
record.get("Industry")));
}
It seems to me like the CSV file is fine, so not sure why this would be happening. Thanks