con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(LOAD_THREAD);
pstmt.setInt(1, id);
ResultSet rs = pstmt.executeQuery();
if (!rs.next()) {
throw new ForumThreadNotFoundException("Thread " + id + " could not be loaded from the database.");
}
//try {
rootMessageID = rs.getInt("rootMessageID");
//}
//catch (ForumMessageNotFoundException fmnfe) {
// log("Error: could not load root message of thread "
// + id + ". The database record could be corrupt.");
//
//}
creationDate = new java.util.Date(Long.parseLong(rs.getString("creationDate").trim()));
modifiedDate = new java.util.Date(Long.parseLong(rs.getString("modifiedDate").trim()));
approved = rs.getInt("approved")==1;
pstmt.close();
} catch (SQLException sqle) {
log.error("load",sqle);
throw new ForumThreadNotFoundException("Thread " + id + " could not be loaded from the database.");
} catch (NumberFormatException nfe) {
log.error(
"WARNING: In DbForumThread.loadFromDb() -- there "
+ "was an error parsing the dates returned from the database. Ensure "
+ "that they're being stored correctly.");