Program: 12953
Project: 12953
Buggy source:
/** 
 * Clone a database
 * @throws SQLException error connecting
 * @throws DatabaseUnitException error
 * @throws IOException error resolving connections
 */
public void execute() throws SQLException, DatabaseUnitException, IOException {
  if (this.tableTypes == null || this.tableTypes.length == 0) {
    this.tableTypes=new String[]{"String_Node_Str"};
  }
  IDataSet data;
  if (this.db1 != null) {
    DatabaseConfig config=this.db1.getConfig();
    config.setProperty("String_Node_Str",this.tableTypes);
    if (this.dbUnitFeatures != null) {
      for (      String feature : this.dbUnitFeatures.keySet()) {
        Boolean b=Boolean.valueOf(this.dbUnitFeatures.get(feature));
        log.debug("String_Node_Str" + feature + "String_Node_Str"+ b);
        config.setProperty(feature,b);
      }
    }
    if (this.tables != null && this.tables.length > 0) {
      log.info("String_Node_Str");
    }
 else {
      log.info("String_Node_Str");
      Set<String> tableSet=new HashSet<String>();
      ResultSet tableRS=this.db1.getConnection().getMetaData().getTables(null,null,null,this.tableTypes);
      while (tableRS.next()) {
        tableSet.add(tableRS.getString("String_Node_Str"));
      }
      this.tables=tableSet.toArray(new String[]{});
    }
    QueryDataSet partialDataSet=new QueryDataSet(this.db1);
    for (    String table : this.tables) {
      log.debug("String_Node_Str" + table + "String_Node_Str");
      String sql="String_Node_Str" + table;
      log.trace("String_Node_Str" + table + "String_Node_Str"+ sql);
      partialDataSet.addTable(table,sql);
    }
    data=partialDataSet;
  }
 else   if (this.inFile != null) {
    if (this.dbUnitFeatures != null) {
      for (      String feature : this.dbUnitFeatures.keySet()) {
        log.warn("String_Node_Str" + feature + "String_Node_Str");
      }
    }
    data=new FlatDtdDataSet(this.inFile);
  }
 else {
    throw new IllegalStateException("String_Node_Str");
  }
  if (this.db2 != null) {
    log.info("String_Node_Str");
    Map<Integer,String> dbTypes=new HashMap<Integer,String>();
    Connection db2conn=this.db2.getConnection();
    ResultSet dbTypeInfo=db2conn.getMetaData().getTypeInfo();
    while (dbTypeInfo.next()) {
      Integer typeCode=Integer.valueOf(dbTypeInfo.getInt("String_Node_Str"));
      String typeName=dbTypeInfo.getString("String_Node_Str");
      if (!dbTypes.containsKey(typeCode)) {
        dbTypes.put(typeCode,typeName);
      }
    }
    ResultSet tableData=db2conn.getMetaData().getTables(db2conn.getCatalog(),null,"String_Node_Str",this.tableTypes);
    while (tableData.next()) {
      String db2tableName=tableData.getString("String_Node_Str");
      for (      String db1table : data.getTableNames()) {
        if (db1table.trim().equalsIgnoreCase(db2tableName.trim())) {
          log.debug("String_Node_Str" + db2tableName + "String_Node_Str");
          String sql="String_Node_Str" + db2tableName;
          log.trace("String_Node_Str" + sql);
          db2conn.createStatement().executeUpdate(sql);
        }
      }
    }
    for (    String table : data.getTableNames()) {
      log.debug("String_Node_Str" + table + "String_Node_Str");
      ResultSet columnRS=this.db1.getConnection().getMetaData().getColumns(null,null,table,null);
      int count=0;
      StringBuilder createTableSB=new StringBuilder();
      createTableSB.append("String_Node_Str" + table + "String_Node_Str");
      while (columnRS.next()) {
        if (columnRS.getString("String_Node_Str").equals(table)) {
          if (count != 0) {
            createTableSB.append(',');
          }
          createTableSB.append("String_Node_Str");
          createTableSB.append(columnRS.getString("String_Node_Str"));
          createTableSB.append("String_Node_Str");
          createTableSB.append(dbTypes.get(Integer.valueOf(columnRS.getInt("String_Node_Str"))));
          int size=columnRS.getInt("String_Node_Str");
          if (size != 0) {
            createTableSB.append("String_Node_Str");
            createTableSB.append(size);
            createTableSB.append("String_Node_Str");
          }
          count++;
        }
      }
      createTableSB.append("String_Node_Str");
      log.trace("String_Node_Str" + createTableSB);
      this.db2.getConnection().createStatement().executeUpdate(createTableSB.toString());
    }
    log.info("String_Node_Str");
    DatabaseOperation.INSERT.execute(this.db2,data);
    log.info("String_Node_Str");
  }
  if (this.outFile != null) {
    FlatDtdDataSet.write(data,this.outFile);
  }
}

Fixed version (ground truth):
/** 
 * Clone a database
 * @throws SQLException error connecting
 * @throws DatabaseUnitException error
 * @throws IOException error resolving connections
 */
public void execute() throws SQLException, DatabaseUnitException, IOException {
  if (this.tableTypes == null || this.tableTypes.length == 0) {
    this.tableTypes=new String[]{"String_Node_Str"};
  }
  IDataSet data=getDataSet();
  if (this.db2 != null) {
    log.info("String_Node_Str");
    Connection db1conn=this.db1.getConnection();
    Connection db2conn=this.db2.getConnection();
    Map<Integer,Map<String,String>> inputDbTypes=getDbTypes(db1conn,"String_Node_Str");
    Map<Integer,Map<String,String>> outputDbTypes=getDbTypes(db2conn,"String_Node_Str");
    ResultSet tableData=db2conn.getMetaData().getTables(db2conn.getCatalog(),null,"String_Node_Str",this.tableTypes);
    while (tableData.next()) {
      String db2tableName=tableData.getString("String_Node_Str");
      for (      String db1table : data.getTableNames()) {
        if (db1table.trim().equalsIgnoreCase(db2tableName.trim())) {
          log.debug("String_Node_Str" + db2tableName + "String_Node_Str");
          String sql="String_Node_Str" + db2tableName;
          log.trace("String_Node_Str" + sql);
          db2conn.createStatement().executeUpdate(sql);
        }
      }
    }
    for (    String table : data.getTableNames()) {
      log.debug("String_Node_Str" + table + "String_Node_Str");
      ResultSet columnRS=db1conn.getMetaData().getColumns(null,null,table,null);
      int count=0;
      StringBuilder createTableSB=new StringBuilder();
      createTableSB.append("String_Node_Str" + table + "String_Node_Str");
      while (columnRS.next()) {
        if (columnRS.getString("String_Node_Str").equals(table)) {
          String colName=columnRS.getString("String_Node_Str");
          log.debug("String_Node_Str" + colName + "String_Node_Str");
          Integer typeCode=Integer.valueOf(columnRS.getInt("String_Node_Str"));
          int size=columnRS.getInt("String_Node_Str");
          if (!outputDbTypes.containsKey(typeCode)) {
            if (typeCode.intValue() == Types.BIT) {
              typeCode=Integer.valueOf(Types.BOOLEAN);
              size=0;
            }
 else {
              if (inputDbTypes.containsKey(typeCode)) {
                log.warn("String_Node_Str" + inputDbTypes.get(typeCode).get("String_Node_Str") + "String_Node_Str");
              }
 else {
                log.error("String_Node_Str" + typeCode + "String_Node_Str");
              }
              typeCode=Integer.valueOf(12);
            }
          }
 else {
            log.trace("String_Node_Str" + typeCode);
          }
          Map<String,String> map=outputDbTypes.get(typeCode);
          String typeName=map.get("String_Node_Str");
          String params=map.get("String_Node_Str");
          if (StringUtils.isBlank(params)) {
            params=map.get("String_Node_Str");
          }
          boolean needParam=(StringUtils.isNotBlank(params) && (size != 0));
          log.trace("String_Node_Str" + colName + "String_Node_Str"+ typeCode+ "String_Node_Str"+ typeName+ ((needParam) ? "String_Node_Str" + size + "String_Node_Str" : "String_Node_Str")+ "String_Node_Str");
          if (count != 0) {
            createTableSB.append(',');
          }
          createTableSB.append("String_Node_Str");
          createTableSB.append(colName);
          createTableSB.append("String_Node_Str");
          createTableSB.append(typeName);
          if (needParam) {
            createTableSB.append("String_Node_Str");
            createTableSB.append(size);
            createTableSB.append("String_Node_Str");
          }
          count++;
        }
      }
      createTableSB.append("String_Node_Str");
      log.trace("String_Node_Str" + createTableSB);
      db2conn.createStatement().executeUpdate(createTableSB.toString());
    }
    log.info("String_Node_Str");
    DatabaseOperation.INSERT.execute(this.db2,data);
    log.info("String_Node_Str");
  }
  if (this.outFile != null) {
    FlatDtdDataSet.write(data,this.outFile);
  }
}