Program: 10122
Project: 10122
Buggy source:
public synchronized void insert(Topic topic) throws ContentStoreException {
  try {
    for (    Post post : topic.getPosts()) {
      int c=1;
      updateStmt.setString(c++,post.getComment());
      updateStmt.setBoolean(c++,post.isDeleted());
      updateStmt.setString(c++,post.getMedia());
      updateStmt.setBoolean(c++,post.isSticky());
      updateStmt.setInt(c++,post.getNum());
      updateStmt.setInt(c++,post.getSubnum());
      updateStmt.addBatch();
      c=1;
      insertStmt.setInt(c++,post.getId());
      insertStmt.setInt(c++,post.getNum());
      insertStmt.setInt(c++,post.getSubnum());
      insertStmt.setInt(c++,post.getParent());
      insertStmt.setInt(c++,post.getDate());
      insertStmt.setString(c++,post.getPreview());
      insertStmt.setInt(c++,post.getPreviewW());
      insertStmt.setInt(c++,post.getPreviewH());
      insertStmt.setString(c++,post.getMedia());
      insertStmt.setInt(c++,post.getMediaW());
      insertStmt.setInt(c++,post.getMediaH());
      insertStmt.setInt(c++,post.getMediaSize());
      insertStmt.setString(c++,post.getMediaHash());
      insertStmt.setString(c++,post.getMediaFilename());
      insertStmt.setBoolean(c++,post.isSpoiler());
      insertStmt.setBoolean(c++,post.isDeleted());
      insertStmt.setString(c++,(post.getCapcode() != null) ? post.getCapcode() : "String_Node_Str");
      insertStmt.setString(c++,post.getEmail());
      insertStmt.setString(c++,post.getName());
      insertStmt.setString(c++,post.getTrip());
      insertStmt.setString(c++,post.getTitle());
      insertStmt.setString(c++,post.getComment());
      insertStmt.setString(c++,post.getDelpass());
      insertStmt.setBoolean(c++,post.isSticky());
      insertStmt.setInt(c++,post.getNum());
      insertStmt.setInt(c++,post.getSubnum());
      insertStmt.addBatch();
    }
    insertStmt.executeBatch();
    updateStmt.executeBatch();
  }
 catch (  SQLException e) {
    throw new ContentStoreException(e);
  }
}

Fixed version (ground truth):
public synchronized void insert(Topic topic) throws ContentStoreException {
  try {
    for (    Post post : topic.getPosts()) {
      int c=1;
      updateStmt.setString(c++,post.getComment());
      updateStmt.setBoolean(c++,post.isDeleted());
      updateStmt.setString(c++,post.getMedia());
      updateStmt.setBoolean(c++,post.isSticky());
      updateStmt.setInt(c++,post.getNum());
      updateStmt.setInt(c++,post.getSubnum());
      updateStmt.addBatch();
      c=1;
      insertStmt.setInt(c++,post.getId());
      insertStmt.setInt(c++,post.getNum());
      insertStmt.setInt(c++,post.getSubnum());
      insertStmt.setInt(c++,post.getParent());
      insertStmt.setInt(c++,post.getDate());
      insertStmt.setString(c++,post.getPreview());
      insertStmt.setInt(c++,post.getPreviewW());
      insertStmt.setInt(c++,post.getPreviewH());
      insertStmt.setString(c++,post.getMedia());
      insertStmt.setInt(c++,post.getMediaW());
      insertStmt.setInt(c++,post.getMediaH());
      insertStmt.setInt(c++,post.getMediaSize());
      insertStmt.setString(c++,post.getMediaHash());
      insertStmt.setString(c++,post.getMediaFilename());
      insertStmt.setBoolean(c++,post.isSpoiler());
      insertStmt.setBoolean(c++,post.isDeleted());
      insertStmt.setString(c++,(post.getCapcode() != null) ? post.getCapcode() : "String_Node_Str");
      insertStmt.setString(c++,post.getEmail());
      insertStmt.setString(c++,post.getName());
      insertStmt.setString(c++,post.getTrip());
      insertStmt.setString(c++,post.getTitle());
      insertStmt.setString(c++,post.getComment());
      insertStmt.setString(c++,post.getDelpass());
      insertStmt.setBoolean(c++,post.isSticky());
      insertStmt.setInt(c++,post.getNum());
      insertStmt.setInt(c++,post.getSubnum());
      insertStmt.addBatch();
    }
    insertStmt.executeBatch();
    updateStmt.executeBatch();
    conn.commit();
  }
 catch (  SQLException e) {
    try {
      conn.rollback();
    }
 catch (    SQLException e1) {
      e1.setNextException(e);
      throw new ContentStoreException(e1);
    }
    throw new ContentStoreException(e);
  }
}