44 |
BufferedReader br1 = new BufferedReader(isr1) |
BufferedReader br1 = new BufferedReader(isr1) |
45 |
) { |
) { |
46 |
String line = br1.readLine(); |
String line = br1.readLine(); |
47 |
|
|
48 |
|
if (line == null) { |
49 |
|
throw new IOException("Can't read 1st line - is file empty?"); |
50 |
|
} |
51 |
|
|
52 |
String[] parts = line.split(";"); |
String[] parts = line.split(";"); |
53 |
int numFields = parts.length; |
|
54 |
if (numFields != 13) { |
if (parts.length != 13) { |
55 |
throw new IOException("Not enough fields in CSV file. Found " + numFields + ", expected 13"); |
throw new IOException("Not enough fields in CSV file. Found " + parts.length + ", expected 13"); |
56 |
} |
} |
57 |
} |
} |
58 |
|
|
79 |
entry.distributor = "BK"; |
entry.distributor = "BK"; |
80 |
|
|
81 |
String[] parts = line.split(";"); |
String[] parts = line.split(";"); |
82 |
|
|
83 |
|
if (parts.length != 13) { |
84 |
|
throw new IOException("Not enough fields in CSV file. Found " + parts.length + ", expected 13"); |
85 |
|
} |
86 |
|
|
87 |
entry.postnr = Short.parseShort( parts[0]); |
entry.postnr = Short.parseShort( parts[0]); |
88 |
entry.vejnavn = parts[1].replace("\"", ""); |
entry.vejnavn = parts[1].replace("\"", ""); |
89 |
entry.husnr = Short.parseShort( parts[2] ); |
entry.husnr = Short.parseShort( parts[2] ); |