/[projects]/dao/DaoAdresseVedligehold/src/main/java/dk/daoas/adressevedligehold/AddressSourceBK.java
ViewVC logotype

Diff of /dao/DaoAdresseVedligehold/src/main/java/dk/daoas/adressevedligehold/AddressSourceBK.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2844 by torben, Mon Jan 25 21:43:59 2016 UTC revision 2861 by torben, Thu Jan 28 11:03:14 2016 UTC
# Line 44  public class AddressSourceBK implements Line 44  public class AddressSourceBK implements
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    
# Line 74  public class AddressSourceBK implements Line 79  public class AddressSourceBK implements
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] );

Legend:
Removed from v.2844  
changed lines
  Added in v.2861

  ViewVC Help
Powered by ViewVC 1.1.20