--- dao/DaoAdresseVedligehold/src/main/java/dk/daoas/adressevedligehold/AddressSourceNS.java 2016/01/28 10:57:26 2860 +++ dao/DaoAdresseVedligehold/src/main/java/dk/daoas/adressevedligehold/AddressSourceNS.java 2016/01/28 11:03:14 2861 @@ -10,7 +10,6 @@ import dk.daoas.adressevedligehold.AddressSourceEntry.EntryType; import dk.daoas.adressevedligehold.util.DeduplicateHelper; -import dk.daoas.adressevedligehold.util.SafeParsers; public class AddressSourceNS implements AddressSource { @@ -49,10 +48,14 @@ BufferedReader br1 = new BufferedReader(isr1) ) { String line = br1.readLine(); + + if (line == null) { + throw new IOException("Can't read 1st line - is file empty?"); + } + String[] parts = line.split(","); - int numFields = parts.length; - if (numFields != 22) { - throw new IOException("Not enough fields in CSV file. Found " + numFields + ", expected 22"); + if (parts.length != 22) { + throw new IOException("Not enough fields in CSV file. Found " + parts.length + ", expected 22"); } }