nus-yam/ex-repair huggingface dataset:
Program: 108751
Project: 108751
Buggy source:
/** 
 * File->Import hierarchy
 */
public void actionMenuFileImportHierarchy(){
  if (model == null) {
    main.showInfoDialog(Resources.getMessage("String_Node_Str"),Resources.getMessage("String_Node_Str"));
    return;
  }
 else   if (model.getInputConfig().getInput() == null) {
    main.showInfoDialog(Resources.getMessage("String_Node_Str"),Resources.getMessage("String_Node_Str"));
    return;
  }
  final String path=actionShowOpenFileDialog("String_Node_Str");
  if (path != null) {
    DialogSeparator dialog=null;
    try {
      dialog=new DialogSeparator(main.getShell(),this,path,false);
      dialog.create();
      if (dialog.open() == Window.CANCEL) {
        return;
      }
    }
 catch (    Throwable error) {
      if (error instanceof RuntimeException) {
        if (error.getCause() != null) {
          error=error.getCause();
        }
      }
      if ((error instanceof IllegalArgumentException) || (error instanceof IOException)) {
        main.showInfoDialog("String_Node_Str",error.getMessage());
      }
 else {
        main.showErrorDialog(Resources.getMessage("String_Node_Str"),Resources.getMessage("String_Node_Str"),error);
      }
      return;
    }
    final char separator=dialog.getSeparator();
    final AttributeType h=actionImportHierarchy(path,separator);
    if (h != null)     update(new ModelEvent(this,ModelPart.HIERARCHY,h));
  }
}

Fixed version (ground truth):
/** 
 * File->Import hierarchy
 */
public void actionMenuFileImportHierarchy(){
  if (model == null) {
    main.showInfoDialog(Resources.getMessage("String_Node_Str"),Resources.getMessage("String_Node_Str"));
    return;
  }
 else   if (model.getInputConfig().getInput() == null) {
    main.showInfoDialog(Resources.getMessage("String_Node_Str"),Resources.getMessage("String_Node_Str"));
    return;
  }
  final String path=actionShowOpenFileDialog("String_Node_Str");
  if (path != null) {
    DialogSeparator dialog=null;
    try {
      dialog=new DialogSeparator(main.getShell(),this,path,false);
      dialog.create();
      if (dialog.open() == Window.CANCEL) {
        return;
      }
    }
 catch (    Throwable error) {
      if (error instanceof RuntimeException) {
        if (error.getCause() != null) {
          error=error.getCause();
        }
      }
      if ((error instanceof IllegalArgumentException) || (error instanceof IOException)) {
        main.showInfoDialog("String_Node_Str",error.getMessage());
      }
 else {
        main.showErrorDialog(Resources.getMessage("String_Node_Str"),Resources.getMessage("String_Node_Str"),error);
      }
      return;
    }
    final char separator=dialog.getSeparator();
    final Hierarchy h=actionImportHierarchy(path,separator);
    if (h != null)     update(new ModelEvent(this,ModelPart.HIERARCHY,h));
  }
}
Program: 108752
Project: 108752
Buggy source:
public ARXAnonymizer createAnonymizer(){
  this.anonymizer=new ARXAnonymizer();
  this.anonymizer.setHistorySize(getHistorySize());
  this.anonymizer.setMaximumSnapshotSizeDataset(getSnapshotSizeDataset());
  this.anonymizer.setSuppressionString(getSuppressionString());
  this.anonymizer.setMaximumSnapshotSizeSnapshot(getSnapshotSizeSnapshot());
  this.anonymizer.setRemoveOutliers(inputConfig.isRemoveOutliers());
  this.createCriteria(inputConfig);
  return anonymizer;
}

Fixed version (ground truth):
public ARXAnonymizer createAnonymizer(){
  this.anonymizer=new ARXAnonymizer();
  this.anonymizer.setHistorySize(getHistorySize());
  this.anonymizer.setMaximumSnapshotSizeDataset(getSnapshotSizeDataset());
  this.anonymizer.setSuppressionString(getSuppressionString());
  this.anonymizer.setMaximumSnapshotSizeSnapshot(getSnapshotSizeSnapshot());
  this.anonymizer.setRemoveOutliers(inputConfig.isRemoveOutliers());
  this.createCriteriaAndDefinition(inputConfig);
  return anonymizer;
}
Program: 108753
Project: 108753
Buggy source:
/** 
 * Updates the global hierarchy definition
 */
private void updateGlobalHierarchy(){
  updateMinAndMax();
  if (model == null) {
    return;
  }
  final DataDefinition definition=model.getInputConfig().getInput().getDefinition();
  final Hierarchy h=Hierarchy.create(hierarchy);
  if (definition.getAttributeType(attribute) instanceof Hierarchy) {
    model.getInputConfig().getInput().getDefinition().setAttributeType(attribute,h);
    updateMin();
    updateMax();
    controller.update(new ModelEvent(this,ModelPart.ATTRIBUTE_TYPE,attribute));
  }
  if (definition.getAttributeType(attribute) == AttributeType.SENSITIVE_ATTRIBUTE) {
    model.getInputConfig().setHierarchy(attribute,h);
    controller.update(new ModelEvent(this,ModelPart.ATTRIBUTE_TYPE,attribute));
  }
}

Fixed version (ground truth):
/** 
 * Updates the global hierarchy definition
 */
private void updateGlobalHierarchy(){
  updateMinAndMax();
  if (model == null || model.getInputConfig() == null) {
    return;
  }
  final Hierarchy h=Hierarchy.create(hierarchy);
  model.getInputConfig().setHierarchy(attribute,h);
}
Program: 108755
Project: 108755
Buggy source:
/** 
 * Writes the hierarchies to the file
 * @param zip
 * @throws IOException
 */
private void writeHierarchies(final ModelConfiguration config,final String prefix,final ZipOutputStream zip) throws IOException {
  Set<String> done=new HashSet<String>();
  if (config.getInput() != null) {
    if (config.getInput().getDefinition() != null) {
      for (      final String a : config.getInput().getDefinition().getQuasiIdentifyingAttributes()) {
        final String[][] h=config.getInput().getDefinition().getHierarchy(a);
        if (h != null) {
          zip.putNextEntry(new ZipEntry(prefix + "String_Node_Str" + toFileName(a)+ "String_Node_Str"));
          final CSVDataOutput out=new CSVDataOutput(zip,model.getSeparator());
          out.write(h);
          done.add(a);
        }
      }
    }
  }
  for (  Entry<String,Hierarchy> entry : config.getHierarchies().entrySet()) {
    final String[][] h=entry.getValue().getHierarchy();
    String a=entry.getKey();
    if (!done.contains(a)) {
      if (h != null) {
        zip.putNextEntry(new ZipEntry(prefix + "String_Node_Str" + toFileName(a)+ "String_Node_Str"));
        final CSVDataOutput out=new CSVDataOutput(zip,model.getSeparator());
        out.write(h);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Writes the hierarchies to the file
 * @param zip
 * @throws IOException
 */
private void writeHierarchies(final ModelConfiguration config,final String prefix,final ZipOutputStream zip) throws IOException {
  for (  Entry<String,Hierarchy> entry : config.getHierarchies().entrySet()) {
    zip.putNextEntry(new ZipEntry(prefix + "String_Node_Str" + toFileName(entry.getKey())+ "String_Node_Str"));
    final CSVDataOutput out=new CSVDataOutput(zip,model.getSeparator());
    out.write(entry.getValue().getHierarchy());
  }
}
Program: 108757
Project: 108757
Buggy source:
@Override public void reset(){
  table.reset();
  groupsButton.setEnabled(false);
  subsetButton.setEnabled(false);
}

Fixed version (ground truth):
@Override public void reset(){
  table.reset();
  groupsButton.setEnabled(false);
  subsetButton.setEnabled(false);
  ascendingButton.setEnabled(false);
  descendingButton.setEnabled(false);
}
Program: 108758
Project: 108758
Buggy source:
/** 
 * Creates a new data view
 * @param parent
 * @param controller
 */
public ViewDataInput(final Composite parent,final Controller controller){
  super(parent,controller,Resources.getMessage("String_Node_Str"));
  controller.addListener(ModelPart.RESEARCH_SUBSET,this);
  controller.addListener(ModelPart.INPUT,this);
  controller.addListener(ModelPart.RESULT,this);
  controller.addListener(ModelPart.ATTRIBUTE_TYPE,this);
}

Fixed version (ground truth):
/** 
 * Creates a new data view
 * @param parent
 * @param controller
 */
public ViewDataInput(final Composite parent,final Controller controller){
  super(parent,controller,Resources.getMessage("String_Node_Str"));
  controller.addListener(ModelPart.RESEARCH_SUBSET,this);
  controller.addListener(ModelPart.RESULT,this);
  controller.addListener(ModelPart.ATTRIBUTE_TYPE,this);
}
Program: 108760
Project: 108760
Buggy source:
@Override public void update(final ModelEvent event){
  super.update(event);
  if (event.part == ModelPart.INPUT) {
    reset();
    return;
  }
  if (event.part == ModelPart.OUTPUT) {
    if (event.data == null) {
      reset();
      return;
    }
    DataDefinition definition=getDefinition();
    if (definition == null) {
      reset();
      return;
    }
    DataHandle handle=getHandle();
    if (handle == null) {
      reset();
      return;
    }
    table.setResearchSubset(getSubset());
    table.setGroups(model.getGroups());
    table.setData(handle);
    table.getHeaderImages().clear();
    for (int i=0; i < handle.getNumColumns(); i++) {
      updateHeaderImage(i,definition.getAttributeType(handle.getAttributeName(i)));
    }
    table.setEnabled(true);
    table.redraw();
  }
 else   if (event.part == ModelPart.RESEARCH_SUBSET) {
    table.setResearchSubset((RowSet)event.data);
    table.redraw();
  }
 else   if (event.part == ModelPart.VIEW_CONFIG || event.part == ModelPart.RESULT) {
    DataHandle handle=getHandle();
    if (handle == null) {
      reset();
      return;
    }
    table.setData(handle);
    table.setGroups(model.getGroups());
    table.setResearchSubset(getSubset());
    table.redraw();
  }
}

Fixed version (ground truth):
@Override public void update(final ModelEvent event){
  super.update(event);
  if (event.part == ModelPart.INPUT) {
    reset();
    return;
  }
  if (event.part == ModelPart.OUTPUT) {
    if (event.data == null) {
      reset();
      return;
    }
    DataDefinition definition=getDefinition();
    if (definition == null) {
      reset();
      return;
    }
    DataHandle handle=getHandle();
    if (handle == null) {
      reset();
      return;
    }
    table.setResearchSubset(getSubset());
    table.setGroups(model.getGroups());
    table.setData(handle);
    table.getHeaderImages().clear();
    for (int i=0; i < handle.getNumColumns(); i++) {
      updateHeaderImage(i,definition.getAttributeType(handle.getAttributeName(i)));
    }
    table.setEnabled(true);
    table.redraw();
    this.enableSorting();
  }
 else   if (event.part == ModelPart.RESEARCH_SUBSET) {
    table.setResearchSubset((RowSet)event.data);
    table.redraw();
  }
 else   if (event.part == ModelPart.VIEW_CONFIG || event.part == ModelPart.RESULT) {
    DataHandle handle=getHandle();
    if (handle == null) {
      reset();
      return;
    }
    table.setData(handle);
    table.setGroups(model.getGroups());
    table.setResearchSubset(getSubset());
    table.redraw();
  }
}
Program: 108761
Project: 108761
Buggy source:
/** 
 * Creates a new data view
 * @param parent
 * @param controller
 */
public ViewDataOutput(final Composite parent,final Controller controller){
  super(parent,controller,Resources.getMessage("String_Node_Str"));
  controller.addListener(ModelPart.INPUT,this);
  controller.addListener(ModelPart.OUTPUT,this);
}

Fixed version (ground truth):
/** 
 * Creates a new data view
 * @param parent
 * @param controller
 */
public ViewDataOutput(final Composite parent,final Controller controller){
  super(parent,controller,Resources.getMessage("String_Node_Str"));
}
Program: 108762
Project: 108762
Buggy source:
/** 
 * A negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second. It uses the specified data types for comparison. If no datatype is specified for a specific column it uses string comparison.
 * @param row1
 * @param row2
 * @param columns
 * @param ascending
 * @return
 */
protected int internalCompare(final int row1,final int row2,final int[] columns,final boolean ascending){
  checkRegistry();
  try {
    for (int i=0; i < columns.length; i++) {
      int index=columns[i];
      int cmp=dataTypes[0][index].compare(internalGetValue(row1,index),internalGetValue(row2,index));
      if (cmp != 0) {
        return ascending ? -cmp : cmp;
      }
    }
    return 0;
  }
 catch (  final Exception e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
/** 
 * A negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second. It uses the specified data types for comparison. If no datatype is specified for a specific column it uses string comparison.
 * @param row1
 * @param row2
 * @param columns
 * @param ascending
 * @return
 */
protected int internalCompare(final int row1,final int row2,final int[] columns,final boolean ascending){
  checkRegistry();
  try {
    for (int i=0; i < columns.length; i++) {
      int index=columns[i];
      int cmp=dataTypes[0][index].compare(internalGetValue(row1,index),internalGetValue(row2,index));
      if (cmp != 0) {
        return ascending ? cmp : -cmp;
      }
    }
    return 0;
  }
 catch (  final Exception e) {
    throw new RuntimeException(e);
  }
}
Program: 108763
Project: 108763
Buggy source:
/** 
 * A negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second. It uses the specified data types for comparison if no generalization was applied, otherwise it uses string comparison.
 * @param row1 the row1
 * @param row2 the row2
 * @param columns the columns
 * @param ascending the ascending
 * @return the int
 */
@Override protected int internalCompare(final int row1,final int row2,final int[] columns,final boolean ascending){
  for (  final int index : columns) {
    final int attributeType=inverseMap[index] >>> AttributeType.SHIFT;
    final int indexMap=inverseMap[index] & AttributeType.MASK;
    if (attributeType == AttributeType.ATTR_TYPE_ID)     return 0;
    int cmp=0;
    try {
      String s1=internalGetValue(row1,index);
      String s2=internalGetValue(row2,index);
      cmp=(s1 == suppressionString && s2 == suppressionString) ? 0 : (s1 == suppressionString ? +1 : (s2 == suppressionString ? -1 : dataTypes[attributeType][indexMap].compare(s1,s2)));
    }
 catch (    final Exception e) {
      throw new RuntimeException(e);
    }
    if (cmp != 0) {
      if (ascending) {
        return -cmp;
      }
 else {
        return cmp;
      }
    }
  }
  return 0;
}

Fixed version (ground truth):
/** 
 * A negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second. It uses the specified data types for comparison if no generalization was applied, otherwise it uses string comparison.
 * @param row1 the row1
 * @param row2 the row2
 * @param columns the columns
 * @param ascending the ascending
 * @return the int
 */
@Override protected int internalCompare(final int row1,final int row2,final int[] columns,final boolean ascending){
  for (  final int index : columns) {
    final int attributeType=inverseMap[index] >>> AttributeType.SHIFT;
    final int indexMap=inverseMap[index] & AttributeType.MASK;
    if (attributeType == AttributeType.ATTR_TYPE_ID)     return 0;
    int cmp=0;
    try {
      String s1=internalGetValue(row1,index);
      String s2=internalGetValue(row2,index);
      cmp=(s1 == suppressionString && s2 == suppressionString) ? 0 : (s1 == suppressionString ? +1 : (s2 == suppressionString ? -1 : dataTypes[attributeType][indexMap].compare(s1,s2)));
    }
 catch (    final Exception e) {
      throw new RuntimeException(e);
    }
    if (cmp != 0) {
      return ascending ? cmp : -cmp;
    }
  }
  return 0;
}
Program: 108765
Project: 108765
Buggy source:
public void createCriteria(ModelConfiguration config){
  config.removeAllCriteria();
  if (this.kAnonymityModel != null && this.kAnonymityModel.isActive() && this.kAnonymityModel.isEnabled()) {
    config.addCriterion(this.kAnonymityModel.getCriterion(this));
  }
  if (this.dPresenceModel != null && this.dPresenceModel.isActive() && this.dPresenceModel.isEnabled()) {
    config.addCriterion(this.dPresenceModel.getCriterion(this));
  }
  for (  Entry<String,ModelLDiversityCriterion> entry : this.lDiversityModel.entrySet()) {
    if (entry.getValue() != null && entry.getValue().isActive() && entry.getValue().isEnabled()) {
      config.addCriterion(entry.getValue().getCriterion(this));
    }
  }
  for (  Entry<String,ModelTClosenessCriterion> entry : this.tClosenessModel.entrySet()) {
    if (entry.getValue() != null && entry.getValue().isActive() && entry.getValue().isEnabled()) {
      config.addCriterion(entry.getValue().getCriterion(this));
    }
  }
  if (!config.containsCriterion(DPresence.class)) {
    DataSubset subset=DataSubset.create(getInputConfig().getInput(),getInputConfig().getResearchSubset());
    config.addCriterion(new Inclusion(subset));
  }
}

Fixed version (ground truth):
public void createCriteria(ModelConfiguration config){
  config.removeAllCriteria();
  if (this.kAnonymityModel != null && this.kAnonymityModel.isActive() && this.kAnonymityModel.isEnabled()) {
    config.addCriterion(this.kAnonymityModel.getCriterion(this));
  }
  if (this.dPresenceModel != null && this.dPresenceModel.isActive() && this.dPresenceModel.isEnabled()) {
    config.addCriterion(this.dPresenceModel.getCriterion(this));
  }
  for (  Entry<String,ModelLDiversityCriterion> entry : this.lDiversityModel.entrySet()) {
    if (entry.getValue() != null && entry.getValue().isActive() && entry.getValue().isEnabled()) {
      config.addCriterion(entry.getValue().getCriterion(this));
    }
  }
  for (  Entry<String,ModelTClosenessCriterion> entry : this.tClosenessModel.entrySet()) {
    if (entry.getValue() != null && entry.getValue().isActive() && entry.getValue().isEnabled()) {
      config.addCriterion(entry.getValue().getCriterion(this));
    }
  }
  if (!config.containsCriterion(DPresence.class)) {
    if (getInputConfig() != null && getInputConfig().getInput() != null && getInputConfig().getResearchSubset() != null) {
      DataSubset subset=DataSubset.create(getInputConfig().getInput(),getInputConfig().getResearchSubset());
      config.addCriterion(new Inclusion(subset));
    }
  }
}
Program: 108766
Project: 108766
Buggy source:
@SuppressWarnings("String_Node_Str") private Interval<T> getInterval(IndexNode index,String sValue){
  DataTypeWithRatioScale<T> type=(DataTypeWithRatioScale<T>)getDataType();
  T tValue=type.parse(sValue);
  if (adjustment == DynamicAdjustment.OUT_OF_BOUNDS_LABEL) {
    if (type.compare(tValue,min) < 0) {
      return OUT_OF_BOUNDS_MIN;
    }
 else     if (type.compare(tValue,max) > 0) {
      return OUT_OF_BOUNDS_MAX;
    }
  }
  int iindex=(int)Math.floor(type.ratio(type.subtract(tValue,index.min),type.subtract(index.max,index.min)));
  T lower;
  T upper;
  AggregateFunction<T> function;
  if (iindex < 0) {
    if (adjustment != DynamicAdjustment.SNAP_TO_BOUNDS) {
      throw new IllegalStateException("String_Node_Str" + sValue);
    }
 else {
      lower=min;
      upper=intervals.get(0).max;
      function=intervals.get(0).function;
    }
  }
 else {
    T offset=type.multiply(type.subtract(index.max,index.min),iindex);
    Interval<T> interval=query(index,type.subtract(tValue,offset));
    if (interval == null) {
      throw new IllegalStateException("String_Node_Str" + sValue);
    }
    function=interval.function;
    if (interval.equals(intervals.get(0)) && iindex == 0) {
      lower=min;
      upper=intervals.get(0).max;
    }
 else {
      lower=type.add(interval.min,offset);
      upper=type.add(interval.max,offset);
    }
    if (type.compare(upper,max) > 0) {
      upper=max;
    }
  }
  return new Interval<T>((DataType<T>)type,lower,upper,function);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private Interval<T> getInterval(IndexNode index,T actualMax,String sValue){
  DataTypeWithRatioScale<T> type=(DataTypeWithRatioScale<T>)getDataType();
  T tValue=type.parse(sValue);
  if (adjustment == DynamicAdjustment.OUT_OF_BOUNDS_LABEL) {
    if (type.compare(tValue,min) < 0) {
      return OUT_OF_BOUNDS_MIN;
    }
 else     if (type.compare(tValue,max) > 0) {
      return OUT_OF_BOUNDS_MAX;
    }
  }
  int iindex=(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),iindex);
  Interval<T> interval=query(index,type.subtract(tValue,offset));
  if (interval == null) {
    throw new IllegalStateException("String_Node_Str" + sValue);
  }
  AggregateFunction<T> function=interval.function;
  T lower=type.add(interval.min,offset);
  T upper=type.add(interval.max,offset);
  if (type.compare(tValue,max) > 0) {
    if (adjustment != DynamicAdjustment.SNAP_TO_BOUNDS) {
      throw new IllegalArgumentException("String_Node_Str" + sValue);
    }
 else {
      if (type.compare(lower,tValue) <= 0 && type.compare(upper,tValue) > 0) {
        upper=actualMax;
      }
    }
  }
  return new Interval<T>((DataType<T>)type,lower,upper,function);
}
Program: 108769
Project: 108769
Buggy source:
protected synchronized void hide(){
  Display.getDefault().asyncExec(new Runnable(){
    @Override public void run(){
      tip.setVisible(false);
      visible=false;
      text=null;
      bounds=null;
      currentX=-1;
      currentY=-1;
    }
  }
);
}

Fixed version (ground truth):
protected synchronized void hide(){
  Display.getDefault().asyncExec(new Runnable(){
    @Override public void run(){
      shell.setVisible(false);
      visible=false;
      text=null;
      bounds=null;
      currentX=-1;
      currentY=-1;
    }
  }
);
}
Program: 108770
Project: 108770
Buggy source:
private synchronized void show(){
  if (this.text != null) {
    Display.getDefault().asyncExec(new Runnable(){
      @Override public void run(){
        tip.setMessage(text);
        tip.setVisible(true);
        visible=true;
      }
    }
);
  }
}

Fixed version (ground truth):
private synchronized void show(){
  if (this.text != null) {
    Display.getDefault().asyncExec(new Runnable(){
      @Override public void run(){
        shellText.setText(text);
        shell.pack();
        shell.setLocation(currentX,currentY);
        shell.setVisible(true);
        visible=true;
      }
    }
);
  }
}
Program: 108771
Project: 108771
Buggy source:
@Override public void run(){
  tip.setVisible(false);
  visible=false;
  text=null;
  bounds=null;
  currentX=-1;
  currentY=-1;
}

Fixed version (ground truth):
@Override public void run(){
  shell.setVisible(false);
  visible=false;
  text=null;
  bounds=null;
  currentX=-1;
  currentY=-1;
}
Program: 108772
Project: 108772
Buggy source:
/** 
 * Creates a new instance
 * @param parent
 */
public MainToolTip(final Shell parent){
  tip=new ToolTip(parent,SWT.ICON_INFORMATION);
  tip.setAutoHide(false);
  Thread t=new Thread(new Runnable(){
    @Override public void run(){
      while (true) {
synchronized (this) {
          if (!visible && bounds != null) {
            Point p=MouseInfo.getPointerInfo().getLocation();
            if (p.x != currentX || p.y != currentY) {
              currentTime=System.currentTimeMillis();
              currentX=p.x;
              currentY=p.y;
            }
 else {
              if (System.currentTimeMillis() - currentTime > THRESHOLD) {
                if (bounds.contains(currentX,currentY)) {
                  show();
                }
              }
            }
          }
          if (visible && bounds != null) {
            Point p=MouseInfo.getPointerInfo().getLocation();
            if (!bounds.contains(p)) {
              hide();
            }
          }
        }
        try {
          Thread.sleep(WAIT);
        }
 catch (        InterruptedException e) {
        }
      }
    }
  }
);
  t.setDaemon(true);
  t.start();
}

Fixed version (ground truth):
/** 
 * Creates a new instance
 * @param parent
 */
public MainToolTip(final Shell parent){
  shell=new Shell(parent,SWT.TOOL | SWT.ON_TOP);
  shell.setLayout(new GridLayout());
  shell.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
  shellText=new Text(shell,SWT.MULTI);
  shellText.setLayoutData(SWTUtil.createFillGridData());
  shellText.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
  shellText.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
  shell.pack();
  shell.setVisible(false);
  Thread t=new Thread(new Runnable(){
    @Override public void run(){
      while (true) {
synchronized (this) {
          if (!visible && bounds != null) {
            Point p=MouseInfo.getPointerInfo().getLocation();
            if (p.x != currentX || p.y != currentY) {
              currentTime=System.currentTimeMillis();
              currentX=p.x;
              currentY=p.y;
            }
 else {
              if (System.currentTimeMillis() - currentTime > THRESHOLD) {
                if (bounds.contains(currentX,currentY)) {
                  show();
                }
              }
            }
          }
          if (visible && bounds != null) {
            Point p=MouseInfo.getPointerInfo().getLocation();
            if (!bounds.contains(p)) {
              hide();
            }
          }
        }
        try {
          Thread.sleep(WAIT);
        }
 catch (        InterruptedException e) {
        }
      }
    }
  }
);
  t.setDaemon(true);
  t.start();
}
Program: 108773
Project: 108773
Buggy source:
protected synchronized void hide(){
  Display.getDefault().asyncExec(new Runnable(){
    @Override public void run(){
      shell.setVisible(false);
      visible=false;
      text=null;
      bounds=null;
      currentX=-1;
      currentY=-1;
    }
  }
);
}

Fixed version (ground truth):
protected void hide(){
synchronized (this) {
    Display.getDefault().asyncExec(new Runnable(){
      @Override public void run(){
        shell.setVisible(false);
        visible=false;
        text=null;
        bounds=null;
        currentX=-1;
        currentY=-1;
      }
    }
);
  }
}
Program: 108774
Project: 108774
Buggy source:
private synchronized void show(){
  if (this.text != null) {
    Display.getDefault().asyncExec(new Runnable(){
      @Override public void run(){
        shellText.setText(text);
        shell.pack();
        shell.setLocation(currentX,currentY);
        shell.setVisible(true);
        visible=true;
      }
    }
);
  }
}

Fixed version (ground truth):
private void show(){
synchronized (this) {
    if (this.text != null) {
      Display.getDefault().asyncExec(new Runnable(){
        @Override public void run(){
          shellText.setText(text);
          shell.pack();
          shell.setLocation(currentX,currentY);
          shell.setVisible(true);
          visible=true;
        }
      }
);
    }
  }
}
Program: 108775
Project: 108775
Buggy source:
public synchronized void setText(String text,org.eclipse.swt.graphics.Rectangle bounds){
  if (this.visible)   return;
  this.text=text;
  this.bounds=new Rectangle(bounds.x,bounds.y,bounds.width,bounds.height);
}

Fixed version (ground truth):
public void setText(String text,org.eclipse.swt.graphics.Rectangle bounds){
synchronized (this) {
    if (this.visible)     return;
    this.text=text;
    this.bounds=new Rectangle(bounds.x,bounds.y,bounds.width,bounds.height);
  }
}
Program: 108776
Project: 108776
Buggy source:
protected void hide(){
synchronized (this) {
    Display.getDefault().asyncExec(new Runnable(){
      @Override public void run(){
        shell.setVisible(false);
        visible=false;
        text=null;
        bounds=null;
        currentX=-1;
        currentY=-1;
      }
    }
);
  }
}

Fixed version (ground truth):
protected void hide(){
synchronized (this) {
    Display.getDefault().syncExec(new Runnable(){
      @Override public void run(){
        shell.setVisible(false);
        visible=false;
        text=null;
        bounds=null;
        currentX=-1;
        currentY=-1;
      }
    }
);
  }
}
Program: 108777
Project: 108777
Buggy source:
private void show(){
synchronized (this) {
    if (this.text != null) {
      Display.getDefault().asyncExec(new Runnable(){
        @Override public void run(){
          shellText.setText(text);
          shell.pack();
          shell.setLocation(currentX,currentY);
          shell.setVisible(true);
          visible=true;
        }
      }
);
    }
  }
}

Fixed version (ground truth):
private void show(){
synchronized (this) {
    if (this.text != null) {
      Display.getDefault().syncExec(new Runnable(){
        @Override public void run(){
          shellText.setText(text);
          shell.pack();
          shell.setLocation(currentX,currentY);
          shell.setVisible(true);
          visible=true;
        }
      }
);
    }
  }
}
Program: 108781
Project: 108781
Buggy source:
/** 
 * Sets the hierarchy displayed by this view
 * @param type
 */
public void setHierarchy(final AttributeType.Hierarchy type){
  hierarchy=type.getHierarchy();
  table.setRedraw(false);
  for (  final TableColumn t : table.getColumns()) {
    t.dispose();
  }
  for (  final TableItem i : table.getItems()) {
    i.dispose();
  }
  if ((type.getHierarchy() == null) || (type.getHierarchy().length == 0)) {
    table.setRedraw(true);
    table.redraw();
    return;
  }
  final TableColumn[] column=new TableColumn[type.getHierarchy()[0].length];
  for (int i=0; i < column.length; i++) {
    column[i]=new TableColumn(table,SWT.NONE);
    column[i].setText(Resources.getMessage("String_Node_Str") + (i + 1));
    column[i].pack();
  }
  for (int i=0; i < type.getHierarchy().length; i++) {
    final TableItem item=new TableItem(table,SWT.NONE);
    item.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));
    for (int j=0; j < type.getHierarchy()[i].length; j++) {
      item.setText(j,type.getHierarchy()[i][j]);
    }
  }
  for (  final TableColumn t : table.getColumns()) {
    t.pack();
  }
  table.setRedraw(true);
  table.redraw();
  updateGlobalHierarchy();
}

Fixed version (ground truth):
/** 
 * Sets the hierarchy displayed by this view
 * @param type
 */
public void setHierarchy(final AttributeType.Hierarchy type){
  hierarchy=type.getHierarchy();
  if (table.isDisposed())   return;
  table.setRedraw(false);
  for (  final TableColumn t : table.getColumns()) {
    t.dispose();
  }
  for (  final TableItem i : table.getItems()) {
    i.dispose();
  }
  if ((type.getHierarchy() == null) || (type.getHierarchy().length == 0)) {
    table.setRedraw(true);
    table.redraw();
    return;
  }
  final TableColumn[] column=new TableColumn[type.getHierarchy()[0].length];
  for (int i=0; i < column.length; i++) {
    column[i]=new TableColumn(table,SWT.NONE);
    column[i].setText(Resources.getMessage("String_Node_Str") + (i + 1));
    column[i].pack();
  }
  for (int i=0; i < type.getHierarchy().length; i++) {
    final TableItem item=new TableItem(table,SWT.NONE);
    item.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));
    for (int j=0; j < type.getHierarchy()[i].length; j++) {
      item.setText(j,type.getHierarchy()[i][j]);
    }
  }
  for (  final TableColumn t : table.getColumns()) {
    t.pack();
  }
  table.setRedraw(true);
  table.redraw();
  updateGlobalHierarchy();
}
Program: 108782
Project: 108782
Buggy source:
/** 
 * Scales the given string array
 * @param values
 * @param factor
 * @return
 */
private String[] getScaledValues(String[] values,double factor){
  String[] result=new String[(int)Math.round(factor * (double)values.length)];
  int previous=-1;
  List<String> toAggregate=new ArrayList<String>();
  for (int i=0; i < values.length; i++) {
    int index=(int)Math.round((double)i * factor);
    if (index == previous) {
      toAggregate.add(values[i]);
    }
 else     if (previous != -1) {
      result[previous]=AggregateFunction.SET.aggregate(toAggregate.toArray(new String[toAggregate.size()]),DataType.STRING);
      toAggregate.clear();
      previous=index;
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Scales the given string array
 * @param values
 * @param factor
 * @return
 */
private String[] getScaledValues(String[] values,double factor){
  AggregateFunction<String> function=AggregateFunction.SET(DataType.STRING);
  String[] result=new String[(int)Math.round(factor * (double)values.length)];
  int previous=-1;
  List<String> toAggregate=new ArrayList<String>();
  for (int i=0; i < values.length; i++) {
    int index=(int)Math.round((double)i * factor);
    if (index == previous) {
      toAggregate.add(values[i]);
    }
 else     if (previous != -1) {
      result[previous]=function.aggregate(toAggregate.toArray(new String[toAggregate.size()]));
      toAggregate.clear();
      previous=index;
    }
  }
  return result;
}
Program: 108783
Project: 108783
Buggy source:
/** 
 * Create a date with a format string. Format strings must be valid formats for <code>SimpleDateFormat</code>.
 * @param format
 * @see <a href="http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html">SimpleDateFormat</a>
 */
private ARXDate(final String format){
  this.format=new SimpleDateFormat(format);
  this.string=format;
}

Fixed version (ground truth):
/** 
 * Create a date with a format string. Format strings must be valid formats for <code>SimpleDateFormat</code>.
 * @param format
 * @see <a href="http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html">SimpleDateFormat</a>
 */
private ARXDate(final String formatString){
  if (format == null || format.equals("String_Node_Str")) {
    string="String_Node_Str";
    format=new SimpleDateFormat(string);
  }
 else {
    this.format=new SimpleDateFormat(formatString);
    this.string=formatString;
  }
}
Program: 108784
Project: 108784
Buggy source:
/** 
 * Create a numeric with a format string. Format strings must be valid formats for <code>DecimalFormat</code>.
 * @param format
 * @see <a href="http://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html">DecimalFormat</a>
 */
private ARXInteger(String format){
  if (format != null) {
    this.format=new DecimalFormat(format);
    this.string=format;
  }
 else {
    this.format=null;
    this.string=null;
  }
}

Fixed version (ground truth):
/** 
 * Create a numeric with a format string. Format strings must be valid formats for <code>DecimalFormat</code>.
 * @param format
 * @see <a href="http://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html">DecimalFormat</a>
 */
private ARXInteger(String format){
  if (format == null || format.equals("String_Node_Str")) {
    this.format=null;
    this.string=null;
  }
 else {
    this.format=new DecimalFormat(format);
    this.string=format;
  }
}
Program: 108785
Project: 108785
Buggy source:
/** 
 * Create a numeric with a format string. Format strings must be valid formats for <code>DecimalFormat</code>.
 * @param format
 * @see <a href="http://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html">DecimalFormat</a>
 */
private ARXDecimal(String format){
  if (format != null) {
    this.format=new DecimalFormat(format);
    this.string=format;
  }
 else {
    this.format=null;
    this.string=null;
  }
}

Fixed version (ground truth):
/** 
 * Create a numeric with a format string. Format strings must be valid formats for <code>DecimalFormat</code>.
 * @param format
 * @see <a href="http://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html">DecimalFormat</a>
 */
private ARXDecimal(String format){
  if (format == null || format.equals("String_Node_Str")) {
    this.format=null;
    this.string=null;
  }
 else {
    this.format=new DecimalFormat(format);
    this.string=format;
  }
}
Program: 108786
Project: 108786
Buggy source:
/** 
 * Create a date with a format string. Format strings must be valid formats for <code>SimpleDateFormat</code>.
 * @param format
 * @see <a href="http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html">SimpleDateFormat</a>
 */
private ARXDate(final String format){
  this.format=new SimpleDateFormat(format);
  this.string=format;
}

Fixed version (ground truth):
/** 
 * Create a date with a format string. Format strings must be valid formats for <code>SimpleDateFormat</code>.
 * @param format
 * @see <a href="http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html">SimpleDateFormat</a>
 */
private ARXDate(final String formatString){
  if (format == null || format.equals("String_Node_Str")) {
    string="String_Node_Str";
    format=new SimpleDateFormat(string);
  }
 else {
    this.format=new SimpleDateFormat(formatString);
    this.string=formatString;
  }
}
Program: 108787
Project: 108787
Buggy source:
/** 
 * Create a numeric with a format string. Format strings must be valid formats for <code>DecimalFormat</code>.
 * @param format
 * @see <a href="http://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html">DecimalFormat</a>
 */
private ARXInteger(String format){
  if (format != null) {
    this.format=new DecimalFormat(format);
    this.string=format;
  }
 else {
    this.format=null;
    this.string=null;
  }
}

Fixed version (ground truth):
/** 
 * Create a numeric with a format string. Format strings must be valid formats for <code>DecimalFormat</code>.
 * @param format
 * @see <a href="http://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html">DecimalFormat</a>
 */
private ARXInteger(String format){
  if (format == null || format.equals("String_Node_Str")) {
    this.format=null;
    this.string=null;
  }
 else {
    this.format=new DecimalFormat(format);
    this.string=format;
  }
}
Program: 108788
Project: 108788
Buggy source:
/** 
 * Create a numeric with a format string. Format strings must be valid formats for <code>DecimalFormat</code>.
 * @param format
 * @see <a href="http://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html">DecimalFormat</a>
 */
private ARXDecimal(String format){
  if (format != null) {
    this.format=new DecimalFormat(format);
    this.string=format;
  }
 else {
    this.format=null;
    this.string=null;
  }
}

Fixed version (ground truth):
/** 
 * Create a numeric with a format string. Format strings must be valid formats for <code>DecimalFormat</code>.
 * @param format
 * @see <a href="http://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html">DecimalFormat</a>
 */
private ARXDecimal(String format){
  if (format == null || format.equals("String_Node_Str")) {
    this.format=null;
    this.string=null;
  }
 else {
    this.format=new DecimalFormat(format);
    this.string=format;
  }
}
Program: 108789
Project: 108789
Buggy source:
/** 
 * Returns the next row The returned element is sorted as defined by   {@link Column#index} andcontains as many elements as there are columns selected to import from {@link #indexes}. The first row   {@link #firstRowReturned}contains the names of the columns.
 */
@Override public String[] next(){
  if (!firstRowReturned) {
    firstRowReturned=true;
    String[] header=lastRow;
    int i=0;
    for (    Column column : config.getColumns()) {
      if (!config.isContainsHeader()) {
        header[i]="String_Node_Str" + column.getIndex();
      }
 else {
        header[i]=lastRow[column.getIndex()];
      }
      if (column.getName() != null) {
        header[i]=column.getName();
      }
      column.setName(header[i]);
      i++;
    }
    return header;
  }
  lastRow=it.next();
  String[] result=new String[indexes.length];
  for (int i=0; i < indexes.length; i++) {
    result[i]=lastRow[indexes[i]];
    if (!types[i].isValid(result[i])) {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Returns the next row The returned element is sorted as defined by   {@link Column#index} andcontains as many elements as there are columns selected to import from {@link #indexes}. The first row   {@link #headerReturned}contains the names of the columns.
 */
@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 (!types[i].isValid(result[i])) {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
  if (it.hasNext()) {
    row=it.next();
  }
 else {
    row=null;
  }
  return result;
}
Program: 108790
Project: 108790
Buggy source:
/** 
 * Indicates whether there is another element to return This returns true when the CSV file has another line and there are actually columns to import from   {@link #columns}.
 * @return Boolean value, see above
 */
@Override public boolean hasNext(){
  return it.hasNext() && (config.getColumns().size() != 0);
}

Fixed version (ground truth):
/** 
 * Indicates whether there is another element to return This returns true when the CSV file has another line and there are actually columns to import from   {@link #columns}.
 * @return Boolean value, see above
 */
@Override public boolean hasNext(){
  return row != null;
}
Program: 108791
Project: 108791
Buggy source:
/** 
 * Creates a new instance
 * @param config
 */
protected CSVImportAdapter(CSVConfiguration config) throws IOException {
  super(config);
  this.config=config;
  this.bytesTotal=new File(config.getFile()).length();
  this.indexes=getIndexesToImport();
  this.types=getColumnDatatypes();
  cin=new CountingInputStream(new FileInputStream(new File(config.getFile())));
  in=new CSVDataInput(cin,config.getSeparator());
  it=in.iterator();
  if (it.hasNext()) {
    lastRow=it.next();
    if (config.isContainsHeader()) {
      if (!it.hasNext()) {
        throw new IOException("String_Node_Str");
      }
    }
  }
 else {
    throw new IOException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Creates a new instance
 * @param config
 */
protected CSVImportAdapter(CSVConfiguration config) throws IOException {
  super(config);
  this.config=config;
  this.bytesTotal=new File(config.getFile()).length();
  this.indexes=getIndexesToImport();
  this.types=getColumnDatatypes();
  cin=new CountingInputStream(new FileInputStream(new File(config.getFile())));
  in=new CSVDataInput(cin,config.getSeparator());
  it=in.iterator();
  if (it.hasNext()) {
    row=it.next();
    if (config.fileContainsHeader()) {
      if (!it.hasNext()) {
        throw new IOException("String_Node_Str");
      }
    }
  }
 else {
    throw new IOException("String_Node_Str");
  }
}
Program: 108792
Project: 108792
Buggy source:
/** 
 * Creates a new instance
 * @param config
 */
protected DataSourceImportAdapter(DataSourceConfiguration config){
  this.columns=config.getColumns();
  if (this.columns.isEmpty()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Creates a new instance
 * @param config
 */
protected DataSourceImportAdapter(DataSourceConfiguration config){
  this.columns=config.getColumns();
  this.config=config;
  if (this.columns.isEmpty()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
}
Program: 108793
Project: 108793
Buggy source:
/** 
 * Returns some debug data
 * @param Model The model
 * @return
 */
protected String getData(Model model){
  if (model == null || model.getInputConfig() == null || model.getInputConfig().getInput() == null) {
    return "String_Node_Str";
  }
  StringBuilder builder=new StringBuilder();
  builder.append("String_Node_Str");
  builder.append("String_Node_Str");
  builder.append("String_Node_Str").append(getDebugData(model.getInputConfig().getInput().getDefinition()));
  builder.append("String_Node_Str");
  builder.append("String_Node_Str").append(getDebugData("String_Node_Str",model.getInputConfig().getInput().getHandle()));
  if (model.getOutput() != null) {
    builder.append("String_Node_Str");
    builder.append("String_Node_Str").append(getDebugData("String_Node_Str",model.getOutputConfig().getInput().getHandle()));
    builder.append("String_Node_Str").append(getDebugData("String_Node_Str",model.getOutput()));
  }
  builder.append("String_Node_Str");
  builder.append("String_Node_Str");
  builder.append("String_Node_Str").append(model.isVisualizationEnabled()).append("String_Node_Str");
  builder.append("String_Node_Str").append(model.getHideVisualizationAt()).append("String_Node_Str");
  builder.append("String_Node_Str");
  builder.append("String_Node_Str");
  if (eventBuffer.isEmpty()) {
    builder.append("String_Node_Str");
  }
 else {
    for (    String s : eventBuffer) {
      builder.append(s).append("String_Node_Str");
    }
  }
  return builder.toString();
}

Fixed version (ground truth):
/** 
 * Returns some debug data
 * @param Model The model
 * @return
 */
protected String getData(Model model){
  if (model == null || model.getInputConfig() == null || model.getInputConfig().getInput() == null) {
    return "String_Node_Str";
  }
  StringBuilder builder=new StringBuilder();
  builder.append("String_Node_Str");
  builder.append("String_Node_Str");
  builder.append("String_Node_Str").append(getDebugData(model.getInputConfig().getInput().getDefinition()));
  builder.append("String_Node_Str");
  builder.append("String_Node_Str").append(getDebugData("String_Node_Str",model.getInputConfig().getInput().getHandle(),false));
  if (model.getOutput() != null) {
    builder.append("String_Node_Str");
    builder.append("String_Node_Str").append(getDebugData("String_Node_Str",model.getOutputConfig().getInput().getHandle(),false));
    builder.append("String_Node_Str").append(getDebugData("String_Node_Str",model.getOutput(),false));
  }
  builder.append("String_Node_Str");
  builder.append("String_Node_Str");
  builder.append("String_Node_Str").append(model.isVisualizationEnabled()).append("String_Node_Str");
  builder.append("String_Node_Str").append(model.getHideVisualizationAt()).append("String_Node_Str");
  builder.append("String_Node_Str");
  builder.append("String_Node_Str");
  if (eventBuffer.isEmpty()) {
    builder.append("String_Node_Str");
  }
 else {
    for (    String s : eventBuffer) {
      builder.append(s).append("String_Node_Str");
    }
  }
  return builder.toString();
}
Program: 108794
Project: 108794
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + part + "String_Node_Str"+ source.getClass().getSimpleName()+ "String_Node_Str"+ source.hashCode()+ "String_Node_Str"+ data.getClass().getSimpleName()+ "String_Node_Str"+ data.hashCode()+ "String_Node_Str";
}

Fixed version (ground truth):
@Override public String toString(){
  String sourceLabel="String_Node_Str";
  if (source != null)   sourceLabel=source.getClass().getSimpleName() + "String_Node_Str" + source.hashCode();
  String dataLabel="String_Node_Str";
  if (data != null)   dataLabel=data.getClass().getSimpleName() + "String_Node_Str" + data.hashCode();
  return "String_Node_Str" + part + "String_Node_Str"+ sourceLabel+ "String_Node_Str"+ dataLabel+ "String_Node_Str";
}