Program: 89671
Project: 89671
Buggy source:
protected void upgradeDomR(Connection conn,long dcId,long domrId,Long publicNetworkId,long guestNetworkId,long controlNetworkId,String zoneType) throws SQLException {
  s_logger.debug("String_Node_Str" + domrId);
  PreparedStatement pstmt=conn.prepareStatement("String_Node_Str");
  pstmt.setLong(1,domrId);
  ResultSet rs=pstmt.executeQuery();
  if (!rs.next()) {
    throw new CloudRuntimeException("String_Node_Str" + domrId);
  }
  long id=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 vnet=rs.getString(12);
  String gateway=rs.getString(13);
  String type=rs.getString(14);
  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);
  }
  if (zoneType.equalsIgnoreCase("String_Node_Str")) {
    long controlNicId=insertNic(conn,controlNetworkId,domrId,running,privateMac,privateIp,privateNetmask,"String_Node_Str","String_Node_Str",null,"String_Node_Str",false,1,"String_Node_Str",privateIp != null ? (domrId + privateIp) : null);
    if (privateIp != null) {
      pstmt=conn.prepareStatement("String_Node_Str");
      pstmt.setLong(1,controlNicId);
      pstmt.setString(2,privateIp);
      pstmt.setLong(3,dcId);
      pstmt.executeUpdate();
      pstmt.close();
    }
    insertNic(conn,guestNetworkId,domrId,running,guestMac,guestIp,guestNetmask,"String_Node_Str",gateway,vnet,"String_Node_Str",true,0,"String_Node_Str",null);
  }
 else {
    insertNic(conn,publicNetworkId,domrId,running,publicMac,publicIp,publicNetmask,"String_Node_Str",gateway,publicVlan,"String_Node_Str",true,2,"String_Node_Str",null);
    long controlNicId=insertNic(conn,controlNetworkId,domrId,running,privateMac,privateIp,privateNetmask,"String_Node_Str","String_Node_Str",null,"String_Node_Str",false,1,"String_Node_Str",privateIp != null ? (domrId + privateIp) : null);
    if (privateIp != null) {
      pstmt=conn.prepareStatement("String_Node_Str");
      pstmt.setLong(1,controlNicId);
      pstmt.setString(2,privateIp);
      pstmt.setLong(3,dcId);
      pstmt.executeUpdate();
      pstmt.close();
    }
    insertNic(conn,guestNetworkId,domrId,running,guestMac,guestIp,guestNetmask,"String_Node_Str",null,vnet,"String_Node_Str",false,0,"String_Node_Str",null);
  }
}

Fixed version (ground truth):
protected void upgradeDomR(Connection conn,long dcId,long domrId,Long publicNetworkId,long guestNetworkId,long controlNetworkId,String zoneType) throws SQLException {
  s_logger.debug("String_Node_Str" + domrId);
  PreparedStatement pstmt=conn.prepareStatement("String_Node_Str");
  pstmt.setLong(1,domrId);
  ResultSet rs=pstmt.executeQuery();
  if (!rs.next()) {
    throw new CloudRuntimeException("String_Node_Str" + domrId);
  }
  long id=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 vnet=rs.getString(12);
  String gateway=rs.getString(13);
  String type=rs.getString(14);
  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);
  }
  if (zoneType.equalsIgnoreCase("String_Node_Str")) {
    long controlNicId=insertNic(conn,controlNetworkId,domrId,running,privateMac,privateIp,privateNetmask,"String_Node_Str","String_Node_Str",null,"String_Node_Str",false,1,"String_Node_Str",privateIp != null ? (domrId + privateIp) : null);
    if (privateIp != null) {
      pstmt=conn.prepareStatement("String_Node_Str");
      pstmt.setLong(1,controlNicId);
      pstmt.setString(2,privateIp);
      pstmt.setLong(3,dcId);
      pstmt.executeUpdate();
      pstmt.close();
    }
    insertNic(conn,guestNetworkId,domrId,running,guestMac,guestIp,guestNetmask,"String_Node_Str",gateway,vnet,"String_Node_Str",true,0,"String_Node_Str",null);
  }
 else   if (publicIp != null) {
    insertNic(conn,publicNetworkId,domrId,running,publicMac,publicIp,publicNetmask,"String_Node_Str",gateway,publicVlan,"String_Node_Str",true,2,"String_Node_Str",null);
    long controlNicId=insertNic(conn,controlNetworkId,domrId,running,privateMac,privateIp,privateNetmask,"String_Node_Str","String_Node_Str",null,"String_Node_Str",false,1,"String_Node_Str",privateIp != null ? (domrId + privateIp) : null);
    if (privateIp != null) {
      pstmt=conn.prepareStatement("String_Node_Str");
      pstmt.setLong(1,controlNicId);
      pstmt.setString(2,privateIp);
      pstmt.setLong(3,dcId);
      pstmt.executeUpdate();
      pstmt.close();
    }
    insertNic(conn,guestNetworkId,domrId,running,guestMac,guestIp,guestNetmask,"String_Node_Str",null,vnet,"String_Node_Str",false,0,"String_Node_Str",null);
  }
}