Program: 89692
Project: 89692
Buggy source:
private void upadteUserStats(Connection conn){
  try {
    PreparedStatement pstmt=conn.prepareStatement("String_Node_Str");
    pstmt.executeUpdate();
    pstmt.close();
    s_logger.debug("String_Node_Str");
    pstmt=conn.prepareStatement("String_Node_Str");
    ResultSet rs=pstmt.executeQuery();
    while (rs.next()) {
      Long id=rs.getLong(1);
      Long accountId=rs.getLong(2);
      Long dataCenterId=rs.getLong(3);
      pstmt=conn.prepareStatement("String_Node_Str");
      pstmt.setLong(1,dataCenterId);
      ResultSet dcSet=pstmt.executeQuery();
      if (!dcSet.next()) {
        s_logger.error("String_Node_Str");
        throw new CloudRuntimeException("String_Node_Str");
      }
      String dataCenterType=dcSet.getString(1);
      if (dataCenterType.equalsIgnoreCase("String_Node_Str")) {
        accountId=1L;
      }
      pstmt=conn.prepareStatement("String_Node_Str");
      pstmt.setLong(1,accountId);
      pstmt.setLong(2,dataCenterId);
      s_logger.debug("String_Node_Str" + pstmt);
      ResultSet rs1=pstmt.executeQuery();
      if (!rs1.next()) {
        pstmt=conn.prepareStatement("String_Node_Str");
        pstmt.setLong(1,accountId);
        pstmt.setLong(2,dataCenterId);
        ResultSet nonRemovedVms=pstmt.executeQuery();
        if (nonRemovedVms.next()) {
          s_logger.error("String_Node_Str");
          throw new CloudRuntimeException("String_Node_Str");
        }
 else {
          s_logger.debug("String_Node_Str" + accountId + "String_Node_Str");
          continue;
        }
      }
      Long deviceId=rs1.getLong(1);
      pstmt=conn.prepareStatement("String_Node_Str");
      pstmt.setLong(1,deviceId);
      pstmt.setLong(2,id);
      s_logger.debug("String_Node_Str" + pstmt);
      pstmt.executeUpdate();
      pstmt=conn.prepareStatement("String_Node_Str");
    }
    s_logger.debug("String_Node_Str");
  }
 catch (  Exception e) {
    throw new CloudRuntimeException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
private void upadteUserStats(Connection conn){
  try {
    PreparedStatement pstmt=conn.prepareStatement("String_Node_Str");
    pstmt.executeUpdate();
    pstmt.close();
    s_logger.debug("String_Node_Str");
    pstmt=conn.prepareStatement("String_Node_Str");
    ResultSet rs=pstmt.executeQuery();
    while (rs.next()) {
      Long id=rs.getLong(1);
      Long accountId=rs.getLong(2);
      Long dataCenterId=rs.getLong(3);
      pstmt=conn.prepareStatement("String_Node_Str");
      pstmt.setLong(1,dataCenterId);
      ResultSet dcSet=pstmt.executeQuery();
      if (!dcSet.next()) {
        s_logger.error("String_Node_Str");
        throw new CloudRuntimeException("String_Node_Str");
      }
      String dataCenterType=dcSet.getString(1);
      if (dataCenterType.equalsIgnoreCase("String_Node_Str")) {
        accountId=1L;
      }
      pstmt=conn.prepareStatement("String_Node_Str");
      pstmt.setLong(1,accountId);
      pstmt.setLong(2,dataCenterId);
      ResultSet rs1=pstmt.executeQuery();
      if (!rs1.next()) {
        pstmt=conn.prepareStatement("String_Node_Str");
        pstmt.setLong(1,accountId);
        pstmt.setLong(2,dataCenterId);
        ResultSet nonRemovedVms=pstmt.executeQuery();
        if (nonRemovedVms.next()) {
          s_logger.error("String_Node_Str");
          throw new CloudRuntimeException("String_Node_Str");
        }
 else {
          s_logger.debug("String_Node_Str" + accountId + "String_Node_Str");
          continue;
        }
      }
      Long deviceId=rs1.getLong(1);
      pstmt=conn.prepareStatement("String_Node_Str");
      pstmt.setLong(1,deviceId);
      pstmt.setLong(2,id);
      pstmt.executeUpdate();
      pstmt=conn.prepareStatement("String_Node_Str");
    }
    s_logger.debug("String_Node_Str");
  }
 catch (  Exception e) {
    throw new CloudRuntimeException("String_Node_Str",e);
  }
}