Program: 49241
Project: 49241
Buggy source:
/** 
 * Migrates product data. Must be called per-org.
 * @param orgid The id of the owner/organization for which to migrate product data
 */
@SuppressWarnings("String_Node_Str") protected void migrateProductData(String orgid) throws DatabaseException, SQLException {
  this.logger.info("String_Node_Str");
  this.checkForMalformedPoolsAndSubscriptions(orgid);
  List<Object[]> productRows=new LinkedList<Object[]>();
  Set<String> uuidCache=new HashSet<String>();
  ResultSet productInfo=this.executeQuery("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",orgid,orgid,orgid,orgid,orgid,orgid,orgid);
  while (productInfo.next()) {
    String productId=productInfo.getString(1);
    String productUuid=this.migratedProducts.get(productId);
    if (productUuid == null) {
      this.logger.info("String_Node_Str",productId);
      productUuid=this.generateUUID();
      productRows.add(new Object[]{productUuid,productInfo.getObject(2),productInfo.getObject(3),productInfo.getObject(4),productId,productInfo.getObject(5),0});
      this.migratedProducts.put(productId,productUuid);
    }
    uuidCache.add(productUuid);
  }
  productInfo.close();
  if (productRows.size() > 0) {
    PreparedStatement statement=this.generateBulkInsertStatement("String_Node_Str",productRows.size(),"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
    int index=0;
    for (    Object[] row : productRows) {
      for (      Object col : row) {
        this.setParameter(statement,++index,col);
      }
    }
    int count=statement.executeUpdate();
    if (count != productRows.size()) {
      String errmsg=String.format("String_Node_Str",productRows.size(),count);
      this.logger.error(errmsg);
      throw new DatabaseException(errmsg);
    }
    this.logger.info("String_Node_Str",count);
    statement.close();
  }
  if (uuidCache.size() > 0) {
    PreparedStatement statement=this.generateBulkInsertStatement("String_Node_Str",uuidCache.size(),"String_Node_Str","String_Node_Str");
    int index=0;
    for (    String uuid : uuidCache) {
      this.setParameter(statement,++index,orgid);
      this.setParameter(statement,++index,uuid);
    }
    int count=statement.executeUpdate();
    if (count != uuidCache.size()) {
      String errmsg=String.format("String_Node_Str",orgid,uuidCache.size(),count);
      this.logger.error(errmsg);
      throw new DatabaseException(errmsg);
    }
    this.logger.info("String_Node_Str",count);
    statement.close();
  }
}

Fixed version (ground truth):
/** 
 * Migrates product data. Must be called per-org.
 * @param orgid The id of the owner/organization for which to migrate product data
 */
@SuppressWarnings("String_Node_Str") protected void migrateProductData(String orgid) throws DatabaseException, SQLException {
  this.logger.info("String_Node_Str");
  this.checkForMalformedPoolsAndSubscriptions(orgid);
  List<Object[]> productRows=new LinkedList<Object[]>();
  Set<String> uuidCache=new HashSet<String>();
  ResultSet productInfo=this.executeQuery("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",orgid,orgid,orgid,orgid,orgid,orgid,orgid);
  int maxrows=MAX_PARAMETERS_PER_STATEMENT / 7;
  while (productInfo.next()) {
    String productId=productInfo.getString(1);
    String productUuid=this.migratedProducts.get(productId);
    if (productUuid == null) {
      this.logger.info("String_Node_Str",productId);
      productUuid=this.generateUUID();
      productRows.add(new Object[]{productUuid,productInfo.getObject(2),productInfo.getObject(3),productInfo.getObject(4),productId,productInfo.getObject(5),0});
      if (productRows.size() > maxrows) {
        this.bulkInsertProductData(productRows);
        productRows.clear();
      }
      this.migratedProducts.put(productId,productUuid);
    }
    uuidCache.add(productUuid);
  }
  productInfo.close();
  bulkInsertProductData(productRows);
  productRows.clear();
  if (uuidCache.size() > 0) {
    maxrows=MAX_PARAMETERS_PER_STATEMENT / 2;
    int lastBlock=0;
    int blockSize=maxrows / 2;
    Iterator<String> uuidIterator=uuidCache.iterator();
    PreparedStatement statement=null;
    for (int offset=0; offset < uuidCache.size(); offset+=blockSize) {
      int remaining=Math.min(uuidCache.size() - offset,blockSize);
      if (remaining != lastBlock) {
        if (statement != null) {
          statement.close();
        }
        statement=this.generateBulkInsertStatement("String_Node_Str",remaining,"String_Node_Str","String_Node_Str");
        lastBlock=remaining;
      }
      int index=0;
      while (remaining-- > 0) {
        this.setParameter(statement,++index,orgid);
        this.setParameter(statement,++index,uuidIterator.next());
      }
      int count=statement.executeUpdate();
      if (count != uuidCache.size()) {
        String errmsg=String.format("String_Node_Str",orgid,uuidCache.size(),count);
        this.logger.error(errmsg);
        throw new DatabaseException(errmsg);
      }
    }
    this.logger.info("String_Node_Str",uuidCache.size());
    statement.close();
  }
}