Mercurial > dive4elements > river
changeset 4771:e21acb4f5c62
Simplified code.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Sat, 05 Jan 2013 12:13:16 +0100 |
parents | 28fa48986ae9 |
children | f939e1e6cfa4 |
files | flys-aft/src/main/java/de/intevation/aft/SyncContext.java |
diffstat | 1 files changed, 21 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-aft/src/main/java/de/intevation/aft/SyncContext.java Fri Jan 04 15:55:45 2013 +0100 +++ b/flys-aft/src/main/java/de/intevation/aft/SyncContext.java Sat Jan 05 12:13:16 2013 +0100 @@ -120,13 +120,11 @@ Map<TimeInterval, TimeInterval> intervals = new TreeMap<TimeInterval, TimeInterval>(); - ResultSet rs = null; + ResultSet rs = flysStatements + .getStatement("select.timeintervals") + .executeQuery(); try { - rs = flysStatements - .getStatement("select.timeintervals") - .executeQuery(); - while (rs.next()) { int id = rs.getInt("id"); Date start = rs.getDate("start_time"); @@ -143,9 +141,7 @@ } } finally { - if (rs != null) { - rs.close(); - } + rs.close(); } if (debug) { @@ -163,37 +159,34 @@ return old; } - ResultSet rs = null; + ResultSet rs = flysStatements + .getStatement("next.timeinterval.id") + .executeQuery(); + try { - rs = flysStatements.getStatement("next.timeinterval.id") - .executeQuery(); rs.next(); key.setId(rs.getInt("time_interval_id")); - rs.close(); rs = null; - - if (log.isDebugEnabled()) { - log.debug("FLYS: Created time interval id: " + key.getId()); - log.debug("FLYS: " + key); - } - - flysStatements.getStatement("insert.timeinterval") - .clearParameters() - .setInt("id", key.getId()) - .setObject("start_time", key.getStart()) - .setObject("stop_time", key.getStop()) - .execute(); } finally { - if (rs != null) { - rs.close(); - } + rs.close(); } + if (log.isDebugEnabled()) { + log.debug("FLYS: Created time interval id: " + key.getId()); + log.debug("FLYS: " + key); + } + + flysStatements.getStatement("insert.timeinterval") + .clearParameters() + .setInt("id", key.getId()) + .setObject("start_time", key.getStart()) + .setObject("stop_time", key.getStop()) + .execute(); + flysTimeIntervals.put(key, key); return key; } - } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :