Program: 57869
Project: 57869
Buggy source:
/** 
 * Creates the dimensions from a previously prepared dimension definition.
 * @param loadDataParameters definition how to create the dimensions
 * @return <code>true</code>if the creation was successful, <code>false</code> otherwise
 */
public static boolean createColumns(LoadDataParameters loadDataParameters){
  ArrayList<Integer> columnIds=null;
  boolean createColumnsFromExistingIDs=false;
  if (loadDataParameters.getColumnIds() == null)   columnIds=new ArrayList<Integer>();
 else {
    columnIds=loadDataParameters.getColumnIds();
    createColumnsFromExistingIDs=true;
  }
  TabularDataParser reader=new TabularDataParser(null,loadDataParameters.getDataDomain());
  reader.setTokenPattern(loadDataParameters.getInputPattern());
  ArrayList<EColumnType> dataTypes=reader.getColumnDataTypes();
  boolean abort=false;
  Iterator<String> columnLabelIterator=loadDataParameters.getColumnLabels().iterator();
  CmdDataCreateColumn cmdCreateColumn;
  String columnLabel;
  ATableBasedDataDomain dataDomain=loadDataParameters.getDataDomain();
  AStringConverter columnHeaderStringConverter=loadDataParameters.getColumnHeaderStringConverter();
  IDMappingManager columnIDMappingManager;
  IDType columnIDType;
  IDType hrColumnIDType;
  if (dataDomain.isColumnDimension()) {
    columnIDMappingManager=dataDomain.getDimensionIDMappingManager();
    columnIDType=dataDomain.getDimensionIDType();
    hrColumnIDType=dataDomain.getHumanReadableDimensionIDType();
  }
 else {
    columnIDMappingManager=dataDomain.getRecordIDMappingManager();
    columnIDType=dataDomain.getRecordIDType();
    hrColumnIDType=dataDomain.getHumanReadableRecordIDType();
  }
  MappingType mappingType=columnIDMappingManager.createMap(columnIDType,hrColumnIDType,false);
  Map<Integer,String> columnIDMap=columnIDMappingManager.getMap(mappingType);
  int columnCount=0;
  for (  EColumnType dataType : dataTypes) {
switch (dataType) {
case FLOAT:
      cmdCreateColumn=(CmdDataCreateColumn)GeneralManager.get().getCommandManager().createCommandByType(CommandType.CREATE_COLUMN);
    if (createColumnsFromExistingIDs)     cmdCreateColumn.setAttributes(ManagedObjectType.COLUMN_NUMERICAL,columnIds.get(columnCount++));
 else     cmdCreateColumn.setAttributes(ManagedObjectType.COLUMN_NUMERICAL);
  cmdCreateColumn.doCommand();
columnLabel=columnLabelIterator.next();
if (columnHeaderStringConverter != null) columnLabel=columnHeaderStringConverter.convert(columnLabel);
NumericalColumn column=(NumericalColumn)cmdCreateColumn.getCreatedObject();
column.setLabel(columnLabel);
columnIDMap.put(column.getID(),columnLabel);
if (!createColumnsFromExistingIDs) columnIds.add(column.getID());
break;
case STRING:
cmdCreateColumn=(CmdDataCreateColumn)GeneralManager.get().getCommandManager().createCommandByType(CommandType.CREATE_COLUMN);
if (createColumnsFromExistingIDs) cmdCreateColumn.setAttributes(ManagedObjectType.COLUMN_NOMINAL,columnIds.get(columnCount++));
 else cmdCreateColumn.setAttributes(ManagedObjectType.COLUMN_NOMINAL);
cmdCreateColumn.doCommand();
columnLabel=columnLabelIterator.next();
NominalColumn<?> nominalColumn=(NominalColumn<?>)cmdCreateColumn.getCreatedObject();
nominalColumn.setLabel(columnLabel);
if (!createColumnsFromExistingIDs) columnIds.add(nominalColumn.getID());
case SKIP:
break;
case ABORT:
abort=true;
break;
default :
break;
}
if (abort) {
break;
}
}
columnIDMappingManager.createReverseMap(mappingType);
loadDataParameters.setDimensionIds(columnIds);
return true;
}

Fixed version (ground truth):
/** 
 * Creates the dimensions from a previously prepared dimension definition.
 * @param loadDataParameters definition how to create the dimensions
 * @return <code>true</code>if the creation was successful, <code>false</code> otherwise
 */
public static boolean createColumns(LoadDataParameters loadDataParameters){
  ArrayList<Integer> columnIDs=null;
  boolean createColumnsFromExistingIDs=false;
  if (loadDataParameters.getColumnIDs() == null)   columnIDs=new ArrayList<Integer>();
 else {
    columnIDs=loadDataParameters.getColumnIDs();
    createColumnsFromExistingIDs=true;
  }
  TabularDataParser reader=new TabularDataParser(null,loadDataParameters.getDataDomain());
  reader.setTokenPattern(loadDataParameters.getInputPattern());
  ArrayList<EColumnType> dataTypes=reader.getColumnDataTypes();
  boolean abort=false;
  Iterator<String> columnLabelIterator=loadDataParameters.getColumnLabels().iterator();
  CmdDataCreateColumn cmdCreateColumn;
  String columnLabel;
  ATableBasedDataDomain dataDomain=loadDataParameters.getDataDomain();
  AStringConverter columnHeaderStringConverter=loadDataParameters.getColumnHeaderStringConverter();
  IDMappingManager columnIDMappingManager;
  IDType columnIDType;
  IDType hrColumnIDType;
  if (dataDomain.isColumnDimension()) {
    columnIDMappingManager=dataDomain.getDimensionIDMappingManager();
    columnIDType=dataDomain.getDimensionIDType();
    hrColumnIDType=dataDomain.getHumanReadableDimensionIDType();
  }
 else {
    columnIDMappingManager=dataDomain.getRecordIDMappingManager();
    columnIDType=dataDomain.getRecordIDType();
    hrColumnIDType=dataDomain.getHumanReadableRecordIDType();
  }
  MappingType mappingType=columnIDMappingManager.createMap(columnIDType,hrColumnIDType,false);
  Map<Integer,String> columnIDMap=columnIDMappingManager.getMap(mappingType);
  int columnCount=0;
  for (  EColumnType dataType : dataTypes) {
switch (dataType) {
case FLOAT:
      cmdCreateColumn=(CmdDataCreateColumn)GeneralManager.get().getCommandManager().createCommandByType(CommandType.CREATE_COLUMN);
    if (createColumnsFromExistingIDs)     cmdCreateColumn.setAttributes(ManagedObjectType.COLUMN_NUMERICAL,columnIDs.get(columnCount++));
 else     cmdCreateColumn.setAttributes(ManagedObjectType.COLUMN_NUMERICAL);
  cmdCreateColumn.doCommand();
columnLabel=columnLabelIterator.next();
if (columnHeaderStringConverter != null) columnLabel=columnHeaderStringConverter.convert(columnLabel);
NumericalColumn column=(NumericalColumn)cmdCreateColumn.getCreatedObject();
column.setLabel(columnLabel);
columnIDMap.put(column.getID(),columnLabel);
if (!createColumnsFromExistingIDs) columnIDs.add(column.getID());
break;
case STRING:
cmdCreateColumn=(CmdDataCreateColumn)GeneralManager.get().getCommandManager().createCommandByType(CommandType.CREATE_COLUMN);
if (createColumnsFromExistingIDs) cmdCreateColumn.setAttributes(ManagedObjectType.COLUMN_NOMINAL,columnIDs.get(columnCount++));
 else cmdCreateColumn.setAttributes(ManagedObjectType.COLUMN_NOMINAL);
cmdCreateColumn.doCommand();
columnLabel=columnLabelIterator.next();
NominalColumn<?> nominalColumn=(NominalColumn<?>)cmdCreateColumn.getCreatedObject();
nominalColumn.setLabel(columnLabel);
if (!createColumnsFromExistingIDs) columnIDs.add(nominalColumn.getID());
case SKIP:
break;
case ABORT:
abort=true;
break;
default :
break;
}
if (abort) {
break;
}
}
columnIDMappingManager.createReverseMap(mappingType);
loadDataParameters.setColumnIDs(columnIDs);
return true;
}