projects
/
org.ibex.mail.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
917976c
)
be more careful about closing ResultSets in Graylist
author
adam
<adam@megacz.com>
Mon, 22 Jun 2009 00:11:07 +0000
(
00:11
+0000)
committer
adam
<adam@megacz.com>
Mon, 22 Jun 2009 00:11:07 +0000
(
00:11
+0000)
darcs-hash:
20090622001107
-5007d-
1a40a7d97a74966401da2c1b6e5ea988eb0786b8
.gz
src/org/ibex/mail/Graylist.java
patch
|
blob
|
history
diff --git
a/src/org/ibex/mail/Graylist.java
b/src/org/ibex/mail/Graylist.java
index
1f65dd4
..
d31ae00
100644
(file)
--- a/
src/org/ibex/mail/Graylist.java
+++ b/
src/org/ibex/mail/Graylist.java
@@
-28,8
+28,13
@@
public class Graylist extends SqliteDB {
try {
PreparedStatement check = conn.prepareStatement("select * from 'whitelist' where ip=?");
check.setString(1, ip.getHostAddress());
try {
PreparedStatement check = conn.prepareStatement("select * from 'whitelist' where ip=?");
check.setString(1, ip.getHostAddress());
- ResultSet rs = check.executeQuery();
- return !rs.isAfterLast();
+ ResultSet rs = null;
+ boolean ret;
+ try {
+ rs = check.executeQuery();
+ ret = !rs.isAfterLast();
+ } finally { close(rs); }
+ return ret;
} catch (SQLException e) { throw new RuntimeException(e); }
}
} catch (SQLException e) { throw new RuntimeException(e); }
}
@@
-40,9
+45,12
@@
public class Graylist extends SqliteDB {
check.setString(1, graylistAddress(ip));
check.setString(2, from);
check.setString(3, to);
check.setString(1, graylistAddress(ip));
check.setString(2, from);
check.setString(3, to);
- ResultSet rs = check.executeQuery();
- if (rs.isAfterLast()) return 0;
- return rs.getTimestamp(1).getTime();
+ ResultSet rs = null;
+ try {
+ rs = check.executeQuery();
+ if (rs.isAfterLast()) return 0;
+ return rs.getTimestamp(1).getTime();
+ } finally { close(rs); }
} catch (SQLException e) { throw new RuntimeException(e); }
}
} catch (SQLException e) { throw new RuntimeException(e); }
}