1 |
package dk.daoas.adressevedligehold; |
package dk.daoas.adressevedligehold.fileupload; |
2 |
|
|
3 |
import java.io.BufferedReader; |
import java.io.BufferedReader; |
4 |
import java.io.IOException; |
import java.io.IOException; |
11 |
|
|
12 |
import com.google.common.base.Splitter; |
import com.google.common.base.Splitter; |
13 |
|
|
14 |
|
import dk.daoas.adressevedligehold.tasks.TaskLogger; |
15 |
import dk.daoas.adressevedligehold.util.DeduplicateHelper; |
import dk.daoas.adressevedligehold.util.DeduplicateHelper; |
16 |
|
|
17 |
public abstract class AbstractAddressSource implements AddressSource { |
public abstract class AbstractAddressSource implements AddressSource { |
18 |
|
|
19 |
|
private TaskLogger logger = TaskLogger.getInstance(); |
20 |
|
|
21 |
protected DeduplicateHelper<String> dirigeringsCache = new DeduplicateHelper<String>(); |
protected DeduplicateHelper<String> dirigeringsCache = new DeduplicateHelper<String>(); |
22 |
|
|
23 |
protected FileItem file; |
protected FileItem file; |
40 |
|
|
41 |
@Override //AutoCloseable |
@Override //AutoCloseable |
42 |
public void close() throws Exception { |
public void close() throws Exception { |
43 |
System.out.println("Closing BK after lines " + lineCount); |
logger.info("Closing BK after lines " + lineCount); |
44 |
try { |
try { |
45 |
if (br != null) |
if (br != null) |
46 |
br.close(); |
br.close(); |
52 |
file.delete(); |
file.delete(); |
53 |
|
|
54 |
} catch (Exception e) { |
} catch (Exception e) { |
55 |
System.out.println("Error on closing " + e.getMessage() ); |
logger.warning("Error on closing ", e ); |
56 |
} |
} |
57 |
} |
} |
58 |
/** |
/** |
112 |
isr.close(); |
isr.close(); |
113 |
is.close(); |
is.close(); |
114 |
} catch (Exception e2) { |
} catch (Exception e2) { |
115 |
System.out.println("Error cleaning up resources"); |
logger.warning("Error cleaning up resources", e2); |
116 |
} |
} |
117 |
|
|
118 |
throw e; // Re-throw |
throw e; // Re-throw |