Program: 107075
Project: 107075
Buggy source:
protected void upgradeSsvm(Connection conn,long dataCenterId,long publicNetworkId,long managementNetworkId,long controlNetworkId,String zoneType) throws SQLException {
  s_logger.debug("String_Node_Str" + dataCenterId);
  PreparedStatement pstmt=conn.prepareStatement("String_Node_Str");
  pstmt.setLong(1,dataCenterId);
  ResultSet rs=pstmt.executeQuery();
  if (!rs.next()) {
    s_logger.debug("String_Node_Str" + dataCenterId);
    return;
  }
  long ssvmId=rs.getLong(1);
  String state=rs.getString(2);
  boolean running=state.equals("String_Node_Str") | state.equals("String_Node_Str") | state.equals("String_Node_Str");
  String privateMac=rs.getString(3);
  String privateIp=rs.getString(4);
  String privateNetmask=rs.getString(5);
  String publicMac=rs.getString(6);
  String publicIp=rs.getString(7);
  String publicNetmask=rs.getString(8);
  String guestMac=rs.getString(9);
  String guestIp=rs.getString(10);
  String guestNetmask=rs.getString(11);
  String gateway=rs.getString(12);
  String type=rs.getString(13);
  rs.close();
  pstmt.close();
  pstmt=conn.prepareStatement("String_Node_Str");
  pstmt.setLong(1,dataCenterId);
  rs=pstmt.executeQuery();
  if (!rs.next()) {
    s_logger.debug("String_Node_Str" + dataCenterId);
    return;
  }
  String podGateway=rs.getString(1);
  rs.close();
  pstmt.close();
  s_logger.debug("String_Node_Str" + podGateway);
  pstmt=conn.prepareStatement("String_Node_Str");
  pstmt.setString(1,publicIp);
  rs=pstmt.executeQuery();
  String publicVlan=null;
  while (rs.next()) {
    publicVlan=rs.getString(1);
  }
  rs.close();
  pstmt.close();
  if (zoneType.equalsIgnoreCase("String_Node_Str")) {
    insertNic(conn,publicNetworkId,ssvmId,running,publicMac,publicIp,publicNetmask,"String_Node_Str",gateway,publicVlan,"String_Node_Str",true,2,"String_Node_Str",null);
  }
 else {
    insertNic(conn,publicNetworkId,ssvmId,running,publicMac,publicIp,publicNetmask,"String_Node_Str",gateway,publicVlan,"String_Node_Str",true,2,"String_Node_Str",null);
  }
  long controlNicId=insertNic(conn,controlNetworkId,ssvmId,running,guestMac,guestIp,guestNetmask,"String_Node_Str","String_Node_Str",null,"String_Node_Str",false,0,"String_Node_Str",guestIp != null ? (ssvmId + guestIp) : null);
  if (guestIp != null) {
    pstmt=conn.prepareStatement("String_Node_Str");
    pstmt.setLong(1,controlNicId);
    pstmt.setString(2,guestIp);
    pstmt.setLong(3,dataCenterId);
    pstmt.executeUpdate();
    pstmt.close();
  }
  long mgmtNicId=insertNic(conn,managementNetworkId,ssvmId,running,privateMac,privateIp,privateNetmask,"String_Node_Str",podGateway,null,"String_Node_Str",false,1,"String_Node_Str",null);
  if (privateIp != null) {
    pstmt=conn.prepareStatement("String_Node_Str");
    pstmt.setLong(1,mgmtNicId);
    pstmt.setString(2,privateIp);
    pstmt.setLong(3,dataCenterId);
    pstmt.executeUpdate();
    pstmt.close();
  }
}

Fixed version (ground truth):
protected void upgradeSsvm(Connection conn,long dataCenterId,long publicNetworkId,long managementNetworkId,long controlNetworkId,String zoneType) throws SQLException {
  s_logger.debug("String_Node_Str" + dataCenterId);
  PreparedStatement pstmt=conn.prepareStatement("String_Node_Str");
  pstmt.setLong(1,dataCenterId);
  ResultSet rs=pstmt.executeQuery();
  if (!rs.next()) {
    s_logger.debug("String_Node_Str" + dataCenterId);
    return;
  }
  long ssvmId=rs.getLong(1);
  String state=rs.getString(2);
  boolean running=state.equals("String_Node_Str") | state.equals("String_Node_Str") | state.equals("String_Node_Str");
  String privateMac=rs.getString(3);
  String privateIp=rs.getString(4);
  String privateNetmask=rs.getString(5);
  String publicMac=rs.getString(6);
  String publicIp=rs.getString(7);
  String publicNetmask=rs.getString(8);
  String guestMac=rs.getString(9);
  String guestIp=rs.getString(10);
  String guestNetmask=rs.getString(11);
  String gateway=rs.getString(12);
  String type=rs.getString(13);
  rs.close();
  pstmt.close();
  pstmt=conn.prepareStatement("String_Node_Str");
  pstmt.setLong(1,dataCenterId);
  rs=pstmt.executeQuery();
  if (!rs.next()) {
    s_logger.debug("String_Node_Str" + dataCenterId);
    return;
  }
  String podGateway=rs.getString(1);
  rs.close();
  pstmt.close();
  pstmt=conn.prepareStatement("String_Node_Str");
  pstmt.setString(1,publicIp);
  rs=pstmt.executeQuery();
  String publicVlan=null;
  while (rs.next()) {
    publicVlan=rs.getString(1);
  }
  rs.close();
  pstmt.close();
  if (zoneType.equalsIgnoreCase("String_Node_Str")) {
    insertNic(conn,publicNetworkId,ssvmId,running,publicMac,publicIp,publicNetmask,"String_Node_Str",gateway,publicVlan,"String_Node_Str",true,2,"String_Node_Str",null);
  }
 else {
    insertNic(conn,publicNetworkId,ssvmId,running,publicMac,publicIp,publicNetmask,"String_Node_Str",gateway,publicVlan,"String_Node_Str",true,2,"String_Node_Str",null);
  }
  long controlNicId=insertNic(conn,controlNetworkId,ssvmId,running,guestMac,guestIp,guestNetmask,"String_Node_Str","String_Node_Str",null,"String_Node_Str",false,0,"String_Node_Str",guestIp != null ? (ssvmId + guestIp) : null);
  if (guestIp != null) {
    pstmt=conn.prepareStatement("String_Node_Str");
    pstmt.setLong(1,controlNicId);
    pstmt.setString(2,guestIp);
    pstmt.setLong(3,dataCenterId);
    pstmt.executeUpdate();
    pstmt.close();
  }
  long mgmtNicId=insertNic(conn,managementNetworkId,ssvmId,running,privateMac,privateIp,privateNetmask,"String_Node_Str",podGateway,null,"String_Node_Str",false,1,"String_Node_Str",null);
  if (privateIp != null) {
    pstmt=conn.prepareStatement("String_Node_Str");
    pstmt.setLong(1,mgmtNicId);
    pstmt.setString(2,privateIp);
    pstmt.setLong(3,dataCenterId);
    pstmt.executeUpdate();
    pstmt.close();
  }
}