nus-yam/ex-repair huggingface dataset:
Program: 108562
Project: 108562
Buggy source:
/** 
 * Creates a new instance of this object with given configuration Depending upon the file type it either uses HSSF or XSSF to access the file. In both cases   {@link #iterator} will be assigned a reference toan iterator, which can then be used to access the actual data on a row by row basis.
 * @param config {@link #config}
 * @throws IOException In case file doesn't contain actual data
 */
protected ImportAdapterExcel(ImportConfigurationExcel config) throws IOException {
  super(config);
  this.config=config;
  FileInputStream input=new FileInputStream(config.getFileLocation());
  Workbook workbook=null;
  if (config.getExcelFileType() == ExcelFileTypes.XLS) {
    workbook=new HSSFWorkbook(input);
  }
 else   if (config.getExcelFileType() == ExcelFileTypes.XLSX) {
    workbook=new XSSFWorkbook(input);
  }
 else {
    input.close();
    throw new IllegalArgumentException("String_Node_Str");
  }
  workbook.setMissingCellPolicy(Row.CREATE_NULL_AS_BLANK);
  Sheet sheet=workbook.getSheetAt(config.getSheetIndex());
  iterator=sheet.iterator();
  totalRows=sheet.getPhysicalNumberOfRows();
  if (iterator.hasNext()) {
    row=iterator.next();
    if (config.getContainsHeader()) {
      if (!iterator.hasNext()) {
        throw new IOException("String_Node_Str");
      }
    }
  }
 else {
    throw new IOException("String_Node_Str");
  }
  header=createHeader();
}

Fixed version (ground truth):
/** 
 * Creates a new instance of this object with given configuration Depending upon the file type it either uses HSSF or XSSF to access the file. In both cases   {@link #iterator} will be assigned a reference toan iterator, which can then be used to access the actual data on a row by row basis.
 * @param config {@link #config}
 * @throws IOException In case file doesn't contain actual data
 */
protected ImportAdapterExcel(ImportConfigurationExcel config) throws IOException {
  super(config);
  this.config=config;
  input=new FileInputStream(config.getFileLocation());
  Workbook workbook=null;
  if (config.getExcelFileType() == ExcelFileTypes.XLS) {
    workbook=new HSSFWorkbook(input);
  }
 else   if (config.getExcelFileType() == ExcelFileTypes.XLSX) {
    workbook=new XSSFWorkbook(input);
  }
 else {
    input.close();
    throw new IllegalArgumentException("String_Node_Str");
  }
  workbook.setMissingCellPolicy(Row.CREATE_NULL_AS_BLANK);
  Sheet sheet=workbook.getSheetAt(config.getSheetIndex());
  iterator=sheet.iterator();
  totalRows=sheet.getPhysicalNumberOfRows();
  if (iterator.hasNext()) {
    row=iterator.next();
    if (config.getContainsHeader()) {
      if (!iterator.hasNext()) {
        throw new IOException("String_Node_Str");
      }
    }
  }
 else {
    throw new IOException("String_Node_Str");
  }
  header=createHeader();
}
Program: 108563
Project: 108563
Buggy source:
@Override public String[] next(){
  if (!headerReturned) {
    headerReturned=true;
    return header;
  }
  try {
    String[] result=new String[indexes.length];
    for (int i=0; i < indexes.length; i++) {
      result[i]=resultSet.getString(indexes[i]);
      if (!dataTypes[i].isValid(result[i])) {
        throw new IllegalArgumentException("String_Node_Str");
      }
    }
    hasNext=resultSet.next();
    return result;
  }
 catch (  SQLException e) {
    throw new RuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public String[] next(){
  if (!headerReturned) {
    headerReturned=true;
    return header;
  }
  try {
    String[] result=new String[indexes.length];
    for (int i=0; i < indexes.length; i++) {
      result[i]=resultSet.getString(indexes[i]);
      if (!dataTypes[i].isValid(result[i])) {
        throw new IllegalArgumentException("String_Node_Str");
      }
    }
    hasNext=resultSet.next();
    if (!hasNext) {
      try {
        if (!config.getConnection().isClosed()) {
          config.getConnection().close();
        }
      }
 catch (      Exception e) {
      }
    }
    return result;
  }
 catch (  SQLException e) {
    throw new RuntimeException("String_Node_Str");
  }
}
Program: 108565
Project: 108565
Buggy source:
/** 
 * Creates a new instance. Data points that are out of range are handled according to the given settings.
 * @param type
 * @param lowerRange
 * @param upperRange
 */
private HierarchyBuilderIntervalBased(DataType<T> type,Range<T> lowerRange,Range<T> upperRange){
  super(Type.INTERVAL_BASED,type);
  if (!(type instanceof DataTypeWithRatioScale)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.lowerRange=lowerRange;
  this.upperRange=upperRange;
}

Fixed version (ground truth):
/** 
 * Creates a new instance. Data points that are out of range are handled according to the given settings.
 * @param type
 * @param lowerRange
 * @param upperRange
 */
private HierarchyBuilderIntervalBased(DataType<T> type,Range<T> lowerRange,Range<T> upperRange){
  super(Type.INTERVAL_BASED,type);
  if (!(type instanceof DataTypeWithRatioScale)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.lowerRange=lowerRange;
  this.upperRange=upperRange;
  this.function=AggregateFunction.forType(type).createIntervalFunction();
}
Program: 108566
Project: 108566
Buggy source:
/** 
 * Creates a new instance
 * @param type The data type
 * @param comparator Use this comparator for ordering data items
 */
private HierarchyBuilderOrderBased(final DataType<T> type,final Comparator<T> comparator){
  super(Type.ORDER_BASED,type);
  if (!(comparator instanceof Serializable)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.comparator=new SerializableComparator<String>(){
    private static final long serialVersionUID=-487411642974218418L;
    @Override public int compare(    String o1,    String o2){
      try {
        return comparator.compare(type.parse(o1),type.parse(o2));
      }
 catch (      Exception e) {
        throw new IllegalArgumentException(e);
      }
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Creates a new instance
 * @param type The data type
 * @param comparator Use this comparator for ordering data items
 */
private HierarchyBuilderOrderBased(final DataType<T> type,final Comparator<T> comparator){
  super(Type.ORDER_BASED,type);
  if (!(comparator instanceof Serializable)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.comparator=new SerializableComparator<String>(){
    private static final long serialVersionUID=-487411642974218418L;
    @Override public int compare(    String o1,    String o2){
      try {
        return comparator.compare(type.parse(o1),type.parse(o2));
      }
 catch (      Exception e) {
        throw new IllegalArgumentException(e);
      }
    }
  }
;
  this.function=AggregateFunction.forType(type).createSetFunction();
}
Program: 108568
Project: 108568
Buggy source:
/** 
 * Creates a new instance
 * @param repeatBound
 * @param snapBound
 * @param labelBound
 */
public Range(U repeatBound,U snapBound,U labelBound){
  this.repeatBound=repeatBound;
  this.snapBound=snapBound;
  this.labelBound=labelBound;
}

Fixed version (ground truth):
/** 
 * Creates a new instance
 * @param repeatBound
 * @param snapBound
 * @param labelBound
 */
public Range(U repeatBound,U snapBound,U labelBound){
  if (!(repeatBound == null && snapBound == null && labelBound == null)) {
    if (repeatBound == null || snapBound == null || labelBound == null) {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
  this.repeatBound=repeatBound;
  this.snapBound=snapBound;
  this.labelBound=labelBound;
}
Program: 108569
Project: 108569
Buggy source:
@Override public String toString(){
  DataType<T> type=(DataType<T>)builder.getDataType();
  return "String_Node_Str" + type.format(min) + "String_Node_Str"+ type.format(max)+ "String_Node_Str"+ function.toString()+ "String_Node_Str";
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + repeatBound + "String_Node_Str"+ snapBound+ "String_Node_Str"+ labelBound+ "String_Node_Str";
}
Program: 108573
Project: 108573
Buggy source:
/** 
 * Creates a new instance for the given data type
 * @param dataType
 * @param data
 * @param builder 
 */
@SuppressWarnings("String_Node_Str") public HierarchyWizardModel(DataType<T> dataType,String[] data,HierarchyBuilder<?> builder){
  this.data=data;
  this.dataType=dataType;
  orderModel=new HierarchyWizardModelOrder<T>(dataType,getOrderData());
  if (dataType instanceof DataTypeWithRatioScale) {
    intervalModel=new HierarchyWizardModelIntervals<T>(dataType,data);
  }
  redactionModel=new HierarchyWizardModelRedaction<T>(dataType,data);
  if (equals(dataType,DataType.DATE)) {
    this.type=Type.INTERVAL_BASED;
  }
 else   if (equals(dataType,DataType.DECIMAL)) {
    this.type=Type.INTERVAL_BASED;
  }
 else   if (equals(dataType,DataType.INTEGER)) {
    this.type=Type.INTERVAL_BASED;
  }
 else   if (equals(dataType,DataType.ORDERED_STRING)) {
    this.type=Type.ORDER_BASED;
  }
 else   if (equals(dataType,DataType.STRING)) {
    this.type=Type.REDACTION_BASED;
  }
  try {
    if (builder != null) {
      this.setSpecification((HierarchyBuilder<T>)builder);
    }
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
/** 
 * Creates a new instance for the given data type
 * @param dataType
 * @param data
 * @param builder 
 */
public HierarchyWizardModel(DataType<T> dataType,String[] data){
  this.data=data;
  this.dataType=dataType;
  orderModel=new HierarchyWizardModelOrder<T>(dataType,getOrderData());
  if (dataType instanceof DataTypeWithRatioScale) {
    intervalModel=new HierarchyWizardModelIntervals<T>(dataType,data);
  }
  redactionModel=new HierarchyWizardModelRedaction<T>(dataType,data);
  if (equals(dataType,DataType.DATE)) {
    this.type=Type.INTERVAL_BASED;
  }
 else   if (equals(dataType,DataType.DECIMAL)) {
    this.type=Type.INTERVAL_BASED;
  }
 else   if (equals(dataType,DataType.INTEGER)) {
    this.type=Type.INTERVAL_BASED;
  }
 else   if (equals(dataType,DataType.ORDERED_STRING)) {
    this.type=Type.ORDER_BASED;
  }
 else   if (equals(dataType,DataType.STRING)) {
    this.type=Type.REDACTION_BASED;
  }
}
Program: 108574
Project: 108574
Buggy source:
@Override public boolean isVisible(){
  if (isNativeImplementationSupported()) {
    if (this.menu == null)     return false;
 else     return this.menu.isVisible();
  }
 else   return super.isVisible();
}

Fixed version (ground truth):
@Override public boolean isVisible(){
  if (isNativeImplementationSupported()) {
    return false;
  }
 else   return super.isVisible();
}
Program: 108575
Project: 108575
Buggy source:
@Override public void actionPerformed(ActionEvent e){
  if (string != null && !isVisible() && !popup.isVisible()) {
    Point p=MouseInfo.getPointerInfo().getLocation();
    if (p.x != oldX || p.y != oldY) {
      oldX=p.x;
      oldY=p.y;
      oldTime=System.currentTimeMillis();
    }
 else     if (System.currentTimeMillis() - oldTime > TIME) {
      if (isNativeImplementationSupported()) {
        tooltip.setLocation(oldX,oldY);
        tooltip.setVisible(true);
      }
 else {
        show(oldX,oldY);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent e){
synchronized (this) {
    if (string != null && !isVisible() && !popup.isVisible()) {
      Point p=MouseInfo.getPointerInfo().getLocation();
      if (p.x != oldX || p.y != oldY) {
        oldX=p.x;
        oldY=p.y;
        oldTime=System.currentTimeMillis();
      }
 else       if (System.currentTimeMillis() - oldTime > TIME) {
        if (isNativeImplementationSupported()) {
          Display.getDefault().asyncExec(new Runnable(){
            @Override public void run(){
              tooltip.setMessage(string);
              tooltip.setLocation(oldX,oldY);
              tooltip.setVisible(true);
            }
          }
);
        }
 else {
          show(oldX,oldY);
        }
      }
    }
  }
}
Program: 108576
Project: 108576
Buggy source:
/** 
 * Sets the options displayed by the popup
 * @param items
 * @param listener
 */
public void show(final String text){
  if (isNativeImplementationSupported()) {
    if (super.isVisible())     return;
    this.string=text;
  }
 else {
    if (super.isVisible())     return;
    this.string=text;
  }
}

Fixed version (ground truth):
/** 
 * Sets the options displayed by the popup
 * @param items
 * @param listener
 */
public void show(final String text){
synchronized (this) {
    if (isNativeImplementationSupported()) {
      this.string=text;
    }
 else {
      if (super.isVisible())       return;
      this.string=text;
    }
  }
}
Program: 108577
Project: 108577
Buggy source:
@Override public boolean isVisible(){
  if (isNativeImplementationSupported()) {
    return tooltip.isVisible();
  }
 else {
    return super.isVisible();
  }
}

Fixed version (ground truth):
@Override public boolean isVisible(){
  if (isNativeImplementationSupported()) {
    return false;
  }
 else {
    return super.isVisible();
  }
}
Program: 108578
Project: 108578
Buggy source:
/** 
 * Hides the tooltip
 */
public void unshow(){
  if (isNativeImplementationSupported()) {
    this.tooltip.setVisible(false);
    this.string=null;
  }
 else {
    if (super.isVisible())     return;
    this.string=null;
  }
}

Fixed version (ground truth):
/** 
 * Hides the tooltip
 */
public void unshow(){
synchronized (this) {
    if (isNativeImplementationSupported()) {
      this.string=null;
    }
 else {
      if (super.isVisible())       return;
      this.string=null;
    }
  }
}
Program: 108579
Project: 108579
Buggy source:
/** 
 * Creates a new instance
 * @param parent
 */
public MainToolTip(final Shell parent){
  super(parent);
  if (isNativeImplementationSupported()) {
    tooltip=new ToolTip(parent,SWT.ICON_INFORMATION);
    tooltip.setAutoHide(true);
  }
  new Timer(WAIT,new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      if (string != null && !isVisible() && !popup.isVisible()) {
        Point p=MouseInfo.getPointerInfo().getLocation();
        if (p.x != oldX || p.y != oldY) {
          oldX=p.x;
          oldY=p.y;
          oldTime=System.currentTimeMillis();
        }
 else         if (System.currentTimeMillis() - oldTime > TIME) {
          if (isNativeImplementationSupported()) {
            tooltip.setLocation(oldX,oldY);
            tooltip.setVisible(true);
          }
 else {
            show(oldX,oldY);
          }
        }
      }
    }
  }
).start();
}

Fixed version (ground truth):
/** 
 * Creates a new instance
 * @param parent
 */
public MainToolTip(final Shell parent){
  super(parent);
  if (isNativeImplementationSupported()) {
    tooltip=new ToolTip(parent,SWT.ICON_INFORMATION);
    tooltip.setAutoHide(true);
  }
  new Timer(WAIT,new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
synchronized (this) {
        if (string != null && !isVisible() && !popup.isVisible()) {
          Point p=MouseInfo.getPointerInfo().getLocation();
          if (p.x != oldX || p.y != oldY) {
            oldX=p.x;
            oldY=p.y;
            oldTime=System.currentTimeMillis();
          }
 else           if (System.currentTimeMillis() - oldTime > TIME) {
            if (isNativeImplementationSupported()) {
              Display.getDefault().asyncExec(new Runnable(){
                @Override public void run(){
                  tooltip.setMessage(string);
                  tooltip.setLocation(oldX,oldY);
                  tooltip.setVisible(true);
                }
              }
);
            }
 else {
              show(oldX,oldY);
            }
          }
        }
      }
    }
  }
).start();
}
Program: 108580
Project: 108580
Buggy source:
@Override public void handleEvent(final Event event){
  if (event.button == 3) {
    final TableItem i=getItemAt(event.x,event.y);
    if (i != null) {
      final ARXNode node=(ARXNode)i.getData();
      model.setSelectedNode(node);
      controller.update(new ModelEvent(ViewClipboard.this,ModelPart.SELECTED_NODE,node));
      selectedTableItem=i;
      Point point=table.toDisplay(event.x,event.y);
      Rectangle bounds=i.getBounds();
      bounds.x=table.toDisplay(bounds.x,bounds.y).x;
      bounds.y=table.toDisplay(bounds.x,bounds.y).y;
      controller.getPopup().show(menu,point.x,point.y);
    }
  }
}

Fixed version (ground truth):
@Override public void handleEvent(final Event event){
  if (event.button == 3) {
    final TableItem i=getItemAt(event.x,event.y);
    if (i != null) {
      final ARXNode node=(ARXNode)i.getData();
      model.setSelectedNode(node);
      controller.update(new ModelEvent(ViewClipboard.this,ModelPart.SELECTED_NODE,node));
      selectedTableItem=i;
      Point point=table.toDisplay(event.x,event.y);
      Rectangle bounds=i.getBounds();
      bounds.x=table.toDisplay(bounds.x,bounds.y).x;
      bounds.y=table.toDisplay(bounds.x,bounds.y).y;
      controller.getContextMenu().show(menu,point.x,point.y);
    }
  }
}
Program: 108582
Project: 108582
Buggy source:
/** 
 * Called when button 3 is clicked on a node
 * @param node
 * @param x
 * @param y
 */
private void actionButtonClicked3(ARXNode node,final int x,final int y){
  selectedNode=node;
  Display.getDefault().asyncExec(new Runnable(){
    @Override public void run(){
      model.setSelectedNode(selectedNode);
      controller.update(new ModelEvent(ViewLattice.this,ModelPart.SELECTED_NODE,selectedNode));
      repaint();
      controller.getPopup().show(menu,x,y);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Called when button 3 is clicked on a node
 * @param node
 * @param x
 * @param y
 */
private void actionButtonClicked3(ARXNode node,final int x,final int y){
  selectedNode=node;
  Display.getDefault().asyncExec(new Runnable(){
    @Override public void run(){
      model.setSelectedNode(selectedNode);
      controller.update(new ModelEvent(ViewLattice.this,ModelPart.SELECTED_NODE,selectedNode));
      repaint();
      controller.getContextMenu().show(menu,x,y);
    }
  }
);
}
Program: 108583
Project: 108583
Buggy source:
/** 
 * Returns a list of strings containing the data for the given column This will only return the   {@link #previewData} for the given columnrather than all of the preview data.
 * @param column Column the preview data should be returned for
 * @return Data for the given column
 * @see {@link #getPreviewData()}
 */
public List<String> getPreviewData(ImportWizardModelColumn column){
  List<String> result=new ArrayList<String>();
  int index=wizardColumns.indexOf(column);
  if (index != -1) {
    for (    String[] s : getPreviewData()) {
      result.add(s[((ImportColumnIndexed)column.getColumn()).getIndex()]);
    }
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Returns a list of strings containing the data for the given column This will only return the   {@link #previewData} for the given columnrather than all of the preview data.
 * @param column Column the preview data should be returned for
 * @return Data for the given column
 * @see {@link #getPreviewData()}
 */
public List<String> getPreviewData(ImportWizardModelColumn column){
  List<String> result=new ArrayList<String>();
  int index=wizardColumns.indexOf(column);
  if (index != -1) {
    for (    String[] s : getPreviewData()) {
      if (column.getColumn() instanceof ImportColumnIndexed) {
        result.add(s[((ImportColumnIndexed)column.getColumn()).getIndex()]);
      }
 else       if (column.getColumn() instanceof ImportColumnJDBC) {
        result.add(s[((ImportColumnJDBC)column.getColumn()).getIndex()]);
      }
    }
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
  return result;
}
Program: 108584
Project: 108584
Buggy source:
/** 
 * Creates a new editor for the given   {@link TableViewer}.
 * @param viewer The TableViewer this editor is implemented for
 */
public DatatypeEditingSupport(TableViewer viewer){
  super(viewer);
  List<String> labels=new ArrayList<String>();
  for (  DataTypeDescription<?> description : DataType.list()) {
    if (description.newInstance().getClass() == DataType.ORDERED_STRING.getClass()) {
      continue;
    }
    labels.add(description.getLabel());
  }
  choices=labels.toArray(new String[labels.size()]);
  editor=new ComboBoxCellEditor(viewer.getTable(),choices,SWT.READ_ONLY);
}

Fixed version (ground truth):
/** 
 * Creates a new editor for the given   {@link TableViewer}.
 * @param viewer The TableViewer this editor is implemented for
 */
public DatatypeEditingSupport(TableViewer viewer){
  super(viewer);
  List<String> labels=new ArrayList<String>();
  for (  DataTypeDescription<?> description : DataType.list()) {
    if (description.newInstance().getClass() == DataType.ORDERED_STRING.getClass()) {
      continue;
    }
    labels.add(description.getLabel());
  }
  choices=labels.toArray(new String[labels.size()]);
  editor=new AutoDropComboBoxViewerCellEditor(viewer.getTable());
  editor.setContentProvider(new ArrayContentProvider());
  editor.setInput(choices);
}
Program: 108586
Project: 108586
Buggy source:
@SuppressWarnings("String_Node_Str") private Interval<T> getInterval(IndexNode index,DataTypeWithRatioScale<T> type,T tValue){
  int shift=(int)Math.floor(type.ratio(type.subtract(tValue,index.min),type.subtract(index.max,index.min)));
  T offset=type.multiply(type.subtract(index.max,index.min),shift);
  Interval<T> interval=query(index,type.subtract(tValue,offset));
  if (interval == null) {
    throw new IllegalStateException("String_Node_Str" + type.format(tValue));
  }
  T lower=type.add(interval.min,offset);
  T upper=type.add(interval.max,offset);
  return new Interval<T>(this,(DataType<T>)type,lower,upper,interval.function);
}

Fixed version (ground truth):
/** 
 * Performs the index lookup
 * @param value
 * @return
 */
private Interval<T> getInterval(IndexNode node,T value){
  @SuppressWarnings("String_Node_Str") DataTypeWithRatioScale<T> type=(DataTypeWithRatioScale<T>)getDataType();
  if (node.isLeaf) {
    for (    Interval<T> leaf : node.leafs) {
      if (type.compare(leaf.min,value) <= 0 && type.compare(leaf.max,value) > 0) {
        return leaf;
      }
    }
  }
 else {
    for (    IndexNode child : node.children) {
      if (type.compare(child.min,value) <= 0 && type.compare(child.max,value) > 0) {
        return getInterval(child,value);
      }
    }
  }
  throw new IllegalStateException("String_Node_Str" + type.format(value));
}
Program: 108587
Project: 108587
Buggy source:
@Override protected void build(){
  super.hierarchy=null;
  super.error=null;
  super.groupsizes=null;
  HierarchyBuilderIntervalBased<T> builder=null;
  try {
    builder=getBuilder(false);
  }
 catch (  Exception e) {
    super.error=e.getMessage();
    return;
  }
  String error=builder.isValid();
  if (error != null) {
    super.error=error;
    return;
  }
  try {
    super.groupsizes=builder.prepare(data);
  }
 catch (  Exception e) {
    super.error=e.getMessage();
    return;
  }
  try {
    super.hierarchy=builder.build();
  }
 catch (  Exception e) {
    super.error=e.getMessage();
    return;
  }
}

Fixed version (ground truth):
@Override protected void build(){
  super.hierarchy=null;
  super.error=null;
  super.groupsizes=null;
  if (data == null)   return;
  HierarchyBuilderIntervalBased<T> builder=null;
  try {
    builder=getBuilder(false);
  }
 catch (  Exception e) {
    super.error=e.getMessage();
    return;
  }
  String error=builder.isValid();
  if (error != null) {
    super.error=error;
    return;
  }
  try {
    super.groupsizes=builder.prepare(data);
  }
 catch (  Exception e) {
    super.error=e.getMessage();
    return;
  }
  try {
    super.hierarchy=builder.build();
  }
 catch (  Exception e) {
    super.error=e.getMessage();
    return;
  }
}
Program: 108588
Project: 108588
Buggy source:
@Override protected void build(){
  super.hierarchy=null;
  super.error=null;
  super.groupsizes=null;
  HierarchyBuilderOrderBased<T> builder=null;
  try {
    builder=getBuilder(false);
  }
 catch (  Exception e) {
    super.error=e.getMessage();
    return;
  }
  String error=builder.isValid();
  if (error != null) {
    super.error=error;
    return;
  }
  try {
    super.groupsizes=builder.prepare(data);
  }
 catch (  Exception e) {
    super.error=e.getMessage();
    return;
  }
  try {
    super.hierarchy=builder.build();
  }
 catch (  Exception e) {
    super.error=e.getMessage();
    return;
  }
}

Fixed version (ground truth):
@Override protected void build(){
  super.hierarchy=null;
  super.error=null;
  super.groupsizes=null;
  if (data == null)   return;
  HierarchyBuilderOrderBased<T> builder=null;
  try {
    builder=getBuilder(false);
  }
 catch (  Exception e) {
    super.error=e.getMessage();
    return;
  }
  String error=builder.isValid();
  if (error != null) {
    super.error=error;
    return;
  }
  try {
    super.groupsizes=builder.prepare(data);
  }
 catch (  Exception e) {
    super.error=e.getMessage();
    return;
  }
  try {
    super.hierarchy=builder.build();
  }
 catch (  Exception e) {
    super.error=e.getMessage();
    return;
  }
}
Program: 108589
Project: 108589
Buggy source:
@Override protected void build(){
  super.hierarchy=null;
  super.error=null;
  super.groupsizes=null;
  HierarchyBuilderRedactionBased<T> builder=getBuilder(false);
  try {
    super.groupsizes=builder.prepare(data);
  }
 catch (  Exception e) {
    super.error="String_Node_Str";
    return;
  }
  try {
    super.hierarchy=builder.build();
  }
 catch (  Exception e) {
    super.error="String_Node_Str";
    return;
  }
}

Fixed version (ground truth):
@Override protected void build(){
  super.hierarchy=null;
  super.error=null;
  super.groupsizes=null;
  if (data == null)   return;
  HierarchyBuilderRedactionBased<T> builder=getBuilder(false);
  try {
    super.groupsizes=builder.prepare(data);
  }
 catch (  Exception e) {
    super.error="String_Node_Str";
    return;
  }
  try {
    super.hierarchy=builder.build();
  }
 catch (  Exception e) {
    super.error="String_Node_Str";
    return;
  }
}
Program: 108591
Project: 108591
Buggy source:
/** 
 * Returns the matching interval
 * @param index
 * @param type
 * @param tValue
 * @return
 */
@SuppressWarnings("String_Node_Str") private Interval<T> getIntervalUpperSnap(IndexNode index,DataTypeWithRatioScale<T> type,T tValue){
  int shift=(int)Math.floor(type.ratio(type.subtract(tValue,index.min),type.subtract(index.max,index.min)));
  T offset=type.multiply(type.subtract(index.max,index.min),shift);
  T value=type.subtract(tValue,offset);
  Interval<T> interval=null;
  for (int j=0; j < intervals.size(); j++) {
    Interval<T> i=intervals.get(j);
    if (type.compare(i.min,value) <= 0 && type.compare(i.max,value) > 0) {
      if (type.compare(value,i.min) == 0) {
        if (j > 0) {
          interval=intervals.get(j - 1);
          break;
        }
 else {
          interval=intervals.get(intervals.size() - 1);
          offset=type.multiply(type.subtract(index.max,index.min),shift - 1);
          break;
        }
      }
 else {
        interval=i;
        break;
      }
    }
  }
  if (interval == null) {
    throw new IllegalStateException("String_Node_Str" + type.format(tValue) + "String_Node_Str"+ type.format(value));
  }
  T lower=type.add(interval.min,offset);
  T upper=type.add(interval.max,offset);
  return new Interval<T>(this,(DataType<T>)type,lower,upper,interval.function);
}

Fixed version (ground truth):
/** 
 * Returns the matching interval
 * @param index
 * @param type
 * @param tValue
 * @return
 */
@SuppressWarnings("String_Node_Str") private Interval<T> getIntervalUpperSnap(IndexNode index,DataTypeWithRatioScale<T> type,T tValue){
  int shift=(int)Math.floor(type.ratio(type.subtract(tValue,index.min),type.subtract(index.max,index.min)));
  T offset=type.multiply(type.subtract(index.max,index.min),shift);
  T value=type.subtract(tValue,offset);
  Interval<T> interval=null;
  for (int j=0; j < intervals.size(); j++) {
    Interval<T> i=intervals.get(j);
    if (type.compare(i.min,value) <= 0 && type.compare(i.max,value) > 0) {
      if (type.compare(value,i.min) == 0) {
        if (j > 0) {
          interval=intervals.get(j - 1);
          break;
        }
 else {
          interval=intervals.get(intervals.size() - 1);
          offset=type.multiply(type.subtract(index.max,index.min),shift - 1);
          break;
        }
      }
 else {
        interval=i;
        break;
      }
    }
  }
  if (interval == null && intervals.size() == 1) {
    interval=intervals.get(0);
  }
  if (interval == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  T lower=type.add(interval.min,offset);
  T upper=type.add(interval.max,offset);
  return new Interval<T>(this,(DataType<T>)type,lower,upper,interval.function);
}
Program: 108593
Project: 108593
Buggy source:
/** 
 * Sort
 * @param type
 * @return successful, or not
 */
private boolean internalSort(final DataType<?> type){
  try {
    Arrays.sort(data,new Comparator<String>(){
      @Override public int compare(      String o1,      String o2){
        try {
          return type.compare(o1,o2);
        }
 catch (        NumberFormatException|ParseException e) {
          throw new RuntimeException(e);
        }
      }
    }
);
    return true;
  }
 catch (  Exception e) {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Sort
 * @param type
 * @return successful, or not
 */
private <U>boolean internalSort(final DataType<U> type){
  try {
    ArrayList<U> list=new ArrayList<U>();
    for (    String s : data)     list.add(type.parse(s));
    Collections.sort(list,type);
    for (int i=0; i < list.size(); i++) {
      data[i]=type.format(list.get(i));
    }
    return true;
  }
 catch (  Exception e) {
    return false;
  }
}
Program: 108594
Project: 108594
Buggy source:
/** 
 * This class demonstrates how to use the API to import data from a JDBC source (SQLite in this case). It is loosely based upon previous examples as the API is quite similar.
 * @throws ClassNotFoundException 
 */
private static void exampleJDBC() throws IOException, SQLException, ClassNotFoundException {
  Class.forName("String_Node_Str");
  DataSource source=DataSource.createJDBCSource("String_Node_Str","String_Node_Str");
  source.addColumn("String_Node_Str","String_Node_Str",DataType.INTEGER);
  source.addColumn(1,DataType.STRING);
  source.addColumn(2,DataType.STRING);
  final Data data=Data.create(source);
  print(data.getHandle());
}

Fixed version (ground truth):
/** 
 * This class demonstrates how to use the API to import data from a JDBC source (SQLite in this case). It is loosely based upon previous examples as the API is quite similar.
 * @throws ClassNotFoundException 
 */
private static void exampleJDBC() throws IOException, SQLException, ClassNotFoundException {
  Class.forName("String_Node_Str");
  DataSource source=DataSource.createJDBCSource("String_Node_Str","String_Node_Str");
  source.addColumn("String_Node_Str","String_Node_Str",DataType.INTEGER);
  source.addColumn(1,DataType.STRING);
  source.addColumn(2,DataType.STRING);
  final Data data=Data.create(source);
  print(data.getHandle());
  System.out.println("String_Node_Str");
}
Program: 108595
Project: 108595
Buggy source:
/** 
 * This class implements an example on how to use the API to import data from a CSV file. It uses more advanced features than   {@link #Example2}. Columns are renamed and could be ignored altogether.
 */
private static void exampleCSV() throws IOException {
  DataSource source=DataSource.createCSVSource("String_Node_Str",';',true);
  source.addColumn("String_Node_Str","String_Node_Str",DataType.INTEGER);
  source.addColumn(1,DataType.STRING);
  source.addColumn(2,DataType.STRING);
  final Data data=Data.create(source);
  print(data.getHandle());
}

Fixed version (ground truth):
/** 
 * This class implements an example on how to use the API to import data from a CSV file. It uses more advanced features than   {@link #Example2}. Columns are renamed and could be ignored altogether.
 */
private static void exampleCSV() throws IOException {
  DataSource source=DataSource.createCSVSource("String_Node_Str",';',true);
  source.addColumn("String_Node_Str","String_Node_Str",DataType.INTEGER);
  source.addColumn(1,DataType.STRING);
  source.addColumn(2,DataType.STRING);
  final Data data=Data.create(source);
  print(data.getHandle());
  System.out.println("String_Node_Str");
}
Program: 108596
Project: 108596
Buggy source:
/** 
 * This class demonstrates how to use the API to import data from an Excel source It is loosely based upon previous examples as the API is quite similar.
 */
private static void exampleExcel() throws IOException {
  DataSource source=DataSource.createExcelSource("String_Node_Str",0,true);
  source.addColumn(1,DataType.STRING);
  source.addColumn("String_Node_Str","String_Node_Str",DataType.INTEGER);
  source.addColumn(2,DataType.STRING);
  final Data data=Data.create(source);
  print(data.getHandle());
}

Fixed version (ground truth):
/** 
 * This class demonstrates how to use the API to import data from an Excel source It is loosely based upon previous examples as the API is quite similar.
 */
private static void exampleExcel() throws IOException {
  DataSource source=DataSource.createExcelSource("String_Node_Str",0,true);
  source.addColumn(1,DataType.STRING);
  source.addColumn("String_Node_Str","String_Node_Str",DataType.INTEGER);
  source.addColumn(2,DataType.STRING);
  final Data data=Data.create(source);
  print(data.getHandle());
  System.out.println("String_Node_Str");
}
Program: 108597
Project: 108597
Buggy source:
/** 
 * Creates a new instance of this object with given configuration
 * @param config {@link #config}
 * @throws IOException In case file doesn't contain actual data
 */
protected ImportAdapterCSV(ImportConfigurationCSV config) throws IOException {
  super(config);
  this.config=config;
  this.bytesTotal=new File(config.getFileLocation()).length();
  cin=new CountingInputStream(new FileInputStream(new File(config.getFileLocation())));
  in=new CSVDataInput(cin,config.getSeparator());
  it=in.iterator();
  if (it.hasNext()) {
    row=it.next();
    if (config.getContainsHeader()) {
      if (!it.hasNext()) {
        throw new IOException("String_Node_Str");
      }
    }
  }
 else {
    throw new IOException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Creates a new instance of this object with given configuration
 * @param config {@link #config}
 * @throws IOException In case file doesn't contain actual data
 */
protected ImportAdapterCSV(ImportConfigurationCSV config) throws IOException {
  super(config);
  this.config=config;
  this.bytesTotal=new File(config.getFileLocation()).length();
  cin=new CountingInputStream(new FileInputStream(new File(config.getFileLocation())));
  in=new CSVDataInput(cin,config.getSeparator());
  it=in.iterator();
  if (it.hasNext()) {
    row=it.next();
    if (config.getContainsHeader()) {
      if (!it.hasNext()) {
        throw new IOException("String_Node_Str");
      }
    }
  }
 else {
    throw new IOException("String_Node_Str");
  }
  header=createHeader();
}
Program: 108598
Project: 108598
Buggy source:
/** 
 * Returns the next row The returned element is sorted as defined by   {@link ImportColumn#index}and contains as many elements as there are columns selected to import from   {@link #indexes}. The first row will always contain the names of the columns.   {@link #headerReturned} is used to keep track of that.
 * @throws IllegalArgumentException In case defined datatypes don't match
 */
@Override public String[] next(){
  if (!headerReturned) {
    headerReturned=true;
    return createHeader();
  }
  String[] result=new String[indexes.length];
  for (int i=0; i < indexes.length; i++) {
    result[i]=row[indexes[i]];
    if (!dataTypes[i].isValid(result[i])) {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
  if (it.hasNext()) {
    row=it.next();
  }
 else {
    row=null;
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Returns the next row The returned element is sorted as defined by   {@link ImportColumn#index}and contains as many elements as there are columns selected to import from   {@link #indexes}. The first row will always contain the names of the columns.   {@link #headerReturned} is used to keep track of that.
 * @throws IllegalArgumentException In case defined datatypes don't match
 */
@Override public String[] next(){
  if (!headerReturned) {
    headerReturned=true;
    return header;
  }
  String[] result=new String[indexes.length];
  for (int i=0; i < indexes.length; i++) {
    result[i]=row[indexes[i]];
    if (!dataTypes[i].isValid(result[i])) {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
  if (it.hasNext()) {
    row=it.next();
  }
 else {
    row=null;
  }
  return result;
}
Program: 108599
Project: 108599
Buggy source:
/** 
 * Returns the next row The returned element is sorted as defined by   {@link ImportColumn#index}and contains as many elements as there are columns selected to import from   {@link #indexes}. The first row will always contain the names of the columns.   {@link #headerReturned} is used to keep track of that.
 * @throws IllegalArgumentException In case defined datatypes don't match
 */
@Override public String[] next(){
  if (!headerReturned) {
    headerReturned=true;
    return createHeader();
  }
  if (row.getPhysicalNumberOfCells() > numberOfColumns) {
    throw new IllegalArgumentException("String_Node_Str" + currentRow + "String_Node_Str");
  }
  String[] result=new String[indexes.length];
  for (int i=0; i < indexes.length; i++) {
    row.getCell(indexes[i]).setCellType(Cell.CELL_TYPE_STRING);
    result[i]=row.getCell(indexes[i]).getStringCellValue();
    if (!dataTypes[i].isValid(result[i])) {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
  if (iterator.hasNext()) {
    row=iterator.next();
    currentRow++;
  }
 else {
    row=null;
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Returns the next row The returned element is sorted as defined by   {@link ImportColumn#index}and contains as many elements as there are columns selected to import from   {@link #indexes}. The first row will always contain the names of the columns.   {@link #headerReturned} is used to keep track of that.
 * @throws IllegalArgumentException In case defined datatypes don't match
 */
@Override public String[] next(){
  if (!headerReturned) {
    headerReturned=true;
    return header;
  }
  if (row.getPhysicalNumberOfCells() > numberOfColumns) {
    throw new IllegalArgumentException("String_Node_Str" + currentRow + "String_Node_Str");
  }
  String[] result=new String[indexes.length];
  for (int i=0; i < indexes.length; i++) {
    row.getCell(indexes[i]).setCellType(Cell.CELL_TYPE_STRING);
    result[i]=row.getCell(indexes[i]).getStringCellValue();
    if (!dataTypes[i].isValid(result[i])) {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
  if (iterator.hasNext()) {
    row=iterator.next();
    currentRow++;
  }
 else {
    row=null;
  }
  return result;
}
Program: 108600
Project: 108600
Buggy source:
/** 
 * Creates a new instance of this object with given configuration Depending upon the file type it either uses HSSF or XSSF to access the file. In both cases   {@link #iterator} will be assigned a reference toan iterator, which can then be used to access the actual data on a row by row basis.
 * @param config {@link #config}
 * @throws IOException In case file doesn't contain actual data
 */
protected ImportAdapterExcel(ImportConfigurationExcel config) throws IOException {
  super(config);
  this.config=config;
  FileInputStream input=new FileInputStream(config.getFileLocation());
  Workbook workbook=null;
  if (config.getExcelFileType() == ExcelFileTypes.XLS) {
    workbook=new HSSFWorkbook(input);
  }
 else   if (config.getExcelFileType() == ExcelFileTypes.XLSX) {
    workbook=new XSSFWorkbook(input);
  }
 else {
    input.close();
    throw new IllegalArgumentException("String_Node_Str");
  }
  workbook.setMissingCellPolicy(Row.CREATE_NULL_AS_BLANK);
  Sheet sheet=workbook.getSheetAt(config.getSheetIndex());
  iterator=sheet.iterator();
  totalRows=sheet.getPhysicalNumberOfRows();
  if (iterator.hasNext()) {
    row=iterator.next();
    if (config.getContainsHeader()) {
      if (!iterator.hasNext()) {
        throw new IOException("String_Node_Str");
      }
    }
  }
 else {
    throw new IOException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Creates a new instance of this object with given configuration Depending upon the file type it either uses HSSF or XSSF to access the file. In both cases   {@link #iterator} will be assigned a reference toan iterator, which can then be used to access the actual data on a row by row basis.
 * @param config {@link #config}
 * @throws IOException In case file doesn't contain actual data
 */
protected ImportAdapterExcel(ImportConfigurationExcel config) throws IOException {
  super(config);
  this.config=config;
  FileInputStream input=new FileInputStream(config.getFileLocation());
  Workbook workbook=null;
  if (config.getExcelFileType() == ExcelFileTypes.XLS) {
    workbook=new HSSFWorkbook(input);
  }
 else   if (config.getExcelFileType() == ExcelFileTypes.XLSX) {
    workbook=new XSSFWorkbook(input);
  }
 else {
    input.close();
    throw new IllegalArgumentException("String_Node_Str");
  }
  workbook.setMissingCellPolicy(Row.CREATE_NULL_AS_BLANK);
  Sheet sheet=workbook.getSheetAt(config.getSheetIndex());
  iterator=sheet.iterator();
  totalRows=sheet.getPhysicalNumberOfRows();
  if (iterator.hasNext()) {
    row=iterator.next();
    if (config.getContainsHeader()) {
      if (!iterator.hasNext()) {
        throw new IOException("String_Node_Str");
      }
    }
  }
 else {
    throw new IOException("String_Node_Str");
  }
  header=createHeader();
}
Program: 108601
Project: 108601
Buggy source:
/** 
 * Creates a new instance of this object with given configuration
 * @param config {@link #config}
 * @throws IOException In case of communication errors with JDBC
 * @todo Fix IOException
 */
protected ImportAdapterJDBC(ImportConfigurationJDBC config) throws IOException {
  super(config);
  this.config=config;
  this.indexes=getIndexesToImport();
  this.dataTypes=getColumnDatatypes();
  try {
    Statement statement;
    statement=config.getConnection().createStatement();
    statement.execute("String_Node_Str" + config.getTable());
    resultSet=statement.getResultSet();
    if (resultSet.next()) {
      totalRows=resultSet.getInt(1);
      if (totalRows == 0) {
        throw new IOException("String_Node_Str");
      }
    }
 else {
      throw new IOException("String_Node_Str");
    }
    statement=config.getConnection().createStatement();
    statement.execute("String_Node_Str" + config.getTable());
    resultSet=statement.getResultSet();
    hasNext=resultSet.next();
  }
 catch (  SQLException e) {
    throw new IOException(e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Creates a new instance of this object with given configuration
 * @param config {@link #config}
 * @throws IOException In case of communication errors with JDBC
 * @todo Fix IOException
 */
protected ImportAdapterJDBC(ImportConfigurationJDBC config) throws IOException {
  super(config);
  this.config=config;
  this.indexes=getIndexesToImport();
  this.dataTypes=getColumnDatatypes();
  try {
    Statement statement;
    statement=config.getConnection().createStatement();
    statement.execute("String_Node_Str" + config.getTable());
    resultSet=statement.getResultSet();
    if (resultSet.next()) {
      totalRows=resultSet.getInt(1);
      if (totalRows == 0) {
        throw new IOException("String_Node_Str");
      }
    }
 else {
      throw new IOException("String_Node_Str");
    }
    statement=config.getConnection().createStatement();
    statement.execute("String_Node_Str" + config.getTable());
    resultSet=statement.getResultSet();
    hasNext=resultSet.next();
  }
 catch (  SQLException e) {
    throw new IOException(e.getMessage());
  }
  header=createHeader();
}
Program: 108602
Project: 108602
Buggy source:
@Override public String[] next(){
  if (!headerReturned) {
    return createHeader();
  }
  try {
    String[] result=new String[indexes.length];
    for (int i=0; i < indexes.length; i++) {
      result[i]=resultSet.getString(indexes[i]);
      if (!dataTypes[i].isValid(result[i])) {
        throw new IllegalArgumentException("String_Node_Str");
      }
    }
    hasNext=resultSet.next();
    return result;
  }
 catch (  SQLException e) {
    throw new RuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public String[] next(){
  if (!headerReturned) {
    headerReturned=true;
    return header;
  }
  try {
    String[] result=new String[indexes.length];
    for (int i=0; i < indexes.length; i++) {
      result[i]=resultSet.getString(indexes[i]);
      if (!dataTypes[i].isValid(result[i])) {
        throw new IllegalArgumentException("String_Node_Str");
      }
    }
    hasNext=resultSet.next();
    return result;
  }
 catch (  SQLException e) {
    throw new RuntimeException("String_Node_Str");
  }
}
Program: 108603
Project: 108603
Buggy source:
/** 
 * Creates the header row This returns a string array with the names of the columns that will be returned later on by iterating over this object. Depending upon whether or not names have been assigned explicitly either the appropriate values will be returned, or names from the JDBC metadata will be used.
 */
private String[] createHeader(){
  String[] header=new String[config.getColumns().size()];
  List<ImportColumn> columns=config.getColumns();
  for (int i=0, len=columns.size(); i < len; i++) {
    ImportColumn column=columns.get(i);
    if (column.getAliasName() != null && !column.getAliasName().equals("String_Node_Str")) {
      header[i]=column.getAliasName();
    }
 else {
      try {
        header[i]=resultSet.getMetaData().getColumnName(((ImportColumnJDBC)column).getIndex() + 1);
      }
 catch (      SQLException e) {
        throw new RuntimeException("String_Node_Str");
      }
    }
    column.setAliasName(header[i]);
  }
  headerReturned=true;
  return header;
}

Fixed version (ground truth):
/** 
 * Creates the header row This returns a string array with the names of the columns that will be returned later on by iterating over this object. Depending upon whether or not names have been assigned explicitly either the appropriate values will be returned, or names from the JDBC metadata will be used.
 */
private String[] createHeader(){
  String[] header=new String[config.getColumns().size()];
  List<ImportColumn> columns=config.getColumns();
  for (int i=0, len=columns.size(); i < len; i++) {
    ImportColumn column=columns.get(i);
    if (column.getAliasName() != null && !column.getAliasName().equals("String_Node_Str")) {
      header[i]=column.getAliasName();
    }
 else {
      try {
        header[i]=resultSet.getMetaData().getColumnName(((ImportColumnJDBC)column).getIndex() + 1);
      }
 catch (      SQLException e) {
        throw new RuntimeException("String_Node_Str");
      }
    }
    column.setAliasName(header[i]);
  }
  return header;
}