if(mediaRs != null)
mediaRs.close();
} catch(SQLException e1) {
e.setNextException(e1);
}
throw new ContentGetException(e);
}
}
try {
if(mediaRs.next()) {
media = new Media(
mediaRs.getInt("media_id"),
mediaRs.getString("media_hash"),
mediaRs.getString("media"),
mediaRs.getString("preview_op"),
mediaRs.getString("preview_reply"),
mediaRs.getInt("total"),
mediaRs.getInt("banned"));
}
} catch(SQLException e) {
throw new ContentGetException(e);
} finally {
try {
mediaRs.close();
} catch(SQLException e) {
System.err.println("Error closing result set" + e.getMessage());
}
}
if(media == null) {
// Somehow, we got ahead of the post insertion. Oh well, we'll get it next time.
// Getting here means something isn't right with our transaction isolation mode
// (Or maybe the DB we're using just sucks)
throw new ContentGetException("Media hash " + post.getMediaHash() + " not found in media DB table");
}
boolean mediaUpdate = media.getMedia() == null;
boolean previewOpUpdate = media.getPreviewOp() == null && post.isOp();
boolean previewReplyUpdate = media.getPreviewReply() == null && !post.isOp();