nus-yam/ex-repair huggingface dataset:
Program: 21978
Project: 21978
Buggy source:
protected List<String> fieldWarnings(){
  List<String> warnings=new ArrayList<String>(2);
  if (rules != null && !canManageMultipleRules()) {
    Rule soleRule=soleRule();
    if (soleRule != null) {
      String dysfunctionReason=soleRule.dysfunctionReason();
      if (dysfunctionReason != null) {
        warnings.add(dysfunctionReason);
      }
    }
  }
  if (unreferencedVariables == null || unreferencedVariables.isEmpty()) {
    return warnings;
  }
  warnings.add("String_Node_Str" + unreferencedVariables.toArray(new String[unreferencedVariables.size()]));
  return warnings;
}

Fixed version (ground truth):
protected List<String> fieldWarnings(){
  List<String> warnings=new ArrayList<String>(2);
  if (rules != null && !canManageMultipleRules()) {
    Rule soleRule=soleRule();
    if (soleRule != null) {
      String dysfunctionReason=soleRule.dysfunctionReason();
      if (dysfunctionReason != null) {
        warnings.add(dysfunctionReason);
      }
    }
  }
  if (unreferencedVariables == null || unreferencedVariables.isEmpty()) {
    return warnings;
  }
  warnings.add("String_Node_Str" + unreferencedVariables);
  return warnings;
}
Program: 21979
Project: 21979
Buggy source:
public boolean equals(Object other){
  if (this == other)   return true;
  if (other.getClass() != getClass())   return false;
  PriorityDescriptor otherOne=(PriorityDescriptor)other;
  return priority.equals(otherOne.priority) && StringUtil.isSame(label,otherOne.label,false,false,false) && shape.equals(otherOne.shape)&& StringUtil.isSame(description,otherOne.description,false,false,false)&& StringUtil.isSame(filterText,otherOne.filterText,false,false,false)&& StringUtil.isSame(iconId,otherOne.iconId,false,false,false);
}

Fixed version (ground truth):
public boolean equals(Object other){
  if (other == null)   return false;
  if (this == other)   return true;
  if (other.getClass() != getClass())   return false;
  PriorityDescriptor otherOne=(PriorityDescriptor)other;
  return priority.equals(otherOne.priority) && StringUtil.isSame(label,otherOne.label,false,false,false) && shape.equals(otherOne.shape)&& StringUtil.isSame(description,otherOne.description,false,false,false)&& StringUtil.isSame(filterText,otherOne.filterText,false,false,false)&& StringUtil.isSame(iconId,otherOne.iconId,false,false,false);
}
Program: 21980
Project: 21980
Buggy source:
/** 
 * Checks for an XML-Structure in a File
 * @param file
 * @return true, if the File is a XML-File we can use, false otherwise
 */
protected final boolean checkForXMLFile(File file){
  boolean isXmlFile=false;
  BufferedReader contentReader=null;
  try {
    contentReader=new BufferedReader(new FileReader(file));
    while (contentReader.ready()) {
      final String line=contentReader.readLine();
      if (line.length() != 0) {
        isXmlFile=XML_PREFIX.equalsIgnoreCase(line);
        break;
      }
    }
  }
 catch (  FileNotFoundException fnfe) {
    PMDPlugin.getDefault().logError(StringKeys.ERROR_FILE_NOT_FOUND + file.toString() + "String_Node_Str"+ this.toString(),fnfe);
  }
catch (  IOException ioe) {
    PMDPlugin.getDefault().logError(StringKeys.ERROR_IO_EXCEPTION + this.toString(),ioe);
  }
 finally {
    if (contentReader != null) {
      try {
        contentReader.close();
      }
 catch (      IOException e) {
      }
    }
  }
  return isXmlFile;
}

Fixed version (ground truth):
/** 
 * Checks for an XML-Structure in a File
 * @param file
 * @return true, if the File is a XML-File we can use, false otherwise
 */
protected final boolean checkForXMLFile(File file){
  boolean isXmlFile=false;
  BufferedReader contentReader=null;
  try {
    contentReader=new BufferedReader(new FileReader(file));
    while (contentReader.ready()) {
      String line=contentReader.readLine();
      if (line != null && line.length() != 0) {
        isXmlFile=XML_PREFIX.equalsIgnoreCase(line);
        break;
      }
    }
  }
 catch (  FileNotFoundException fnfe) {
    PMDPlugin.getDefault().logError(StringKeys.ERROR_FILE_NOT_FOUND + file.toString() + "String_Node_Str"+ this.toString(),fnfe);
  }
catch (  IOException ioe) {
    PMDPlugin.getDefault().logError(StringKeys.ERROR_IO_EXCEPTION + this.toString(),ioe);
  }
 finally {
    if (contentReader != null) {
      try {
        contentReader.close();
      }
 catch (      IOException e) {
      }
    }
  }
  return isXmlFile;
}
Program: 21981
Project: 21981
Buggy source:
@Override protected void clearControls(){
  nameField.setText("String_Node_Str");
  ruleSetNameField.select(-1);
  implementationClassField.setType(null);
  ruleSetNameField.setText("String_Node_Str");
  languageCombo.select(-1);
  priorityCombo.select(-1);
  priorityDisplay.setItems(null);
  minLanguageVersionCombo.select(-1);
  maxLanguageVersionCombo.select(-1);
  usesDfaButton.setSelection(false);
  usesTypeResolutionButton.setSelection(false);
}

Fixed version (ground truth):
@Override protected void clearControls(){
  nameField.setText("String_Node_Str");
  ruleSetNameField.select(-1);
  implementationClassField.setType(null);
  ruleSetNameField.setText("String_Node_Str");
  languageCombo.select(-1);
  priorityCombo.select(-1);
  priorityDisplay.setItems(null);
  usesDfaButton.setSelection(false);
  usesTypeResolutionButton.setSelection(false);
  clearLanguageVersionCombos();
}
Program: 21982
Project: 21982
Buggy source:
private Combo buildLanguageVersionCombo(Composite parent,final boolean isMinVersion){
  int style=creatingNewRule() ? SWT.SINGLE | SWT.BORDER : SWT.READ_ONLY | SWT.BORDER;
  final Combo combo=new Combo(parent,style);
  combo.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent event){
      if (rules == null)       return;
      final LanguageVersion version=selectedLanguage().getVersions().get(combo.getSelectionIndex());
      RuleVisitor visitor=new RuleVisitor(){
        public boolean accept(        Rule rule){
          if (isMinVersion) {
            rule.setMinimumLanguageVersion(version);
          }
 else {
            rule.setMaximumLanguageVersion(version);
          }
          return true;
        }
      }
;
      rules.rulesDo(visitor);
      valueChanged(null,version.getName());
    }
  }
);
  return combo;
}

Fixed version (ground truth):
private Combo buildLanguageVersionCombo(Composite parent,final boolean isMinVersion){
  int style=creatingNewRule() ? SWT.SINGLE | SWT.BORDER : SWT.READ_ONLY | SWT.BORDER;
  final Combo combo=new Combo(parent,style);
  combo.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent event){
      if (rules == null)       return;
      final int selIdx=combo.getSelectionIndex();
      final LanguageVersion version=selIdx == 0 ? null : selectedLanguage().getVersions().get(selIdx - 1);
      RuleVisitor visitor=new RuleVisitor(){
        public boolean accept(        Rule rule){
          if (isMinVersion) {
            rule.setMinimumLanguageVersion(version);
          }
 else {
            rule.setMaximumLanguageVersion(version);
          }
          return true;
        }
      }
;
      rules.rulesDo(visitor);
      valueChanged(null,version == null ? "String_Node_Str" : version.getName());
    }
  }
);
  return combo;
}
Program: 21983
Project: 21983
Buggy source:
private void showLanguageVersionFields(Language language){
  int versionCount=language == null ? 0 : language.getVersions().size();
  boolean hasVersions=versionCount > 1;
  minLanguageLabel.setVisible(hasVersions);
  maxLanguageLabel.setVisible(hasVersions);
  minLanguageVersionCombo.setVisible(hasVersions);
  maxLanguageVersionCombo.setVisible(hasVersions);
  if (hasVersions) {
    List<LanguageVersion> versions=language.getVersions();
    populate(minLanguageVersionCombo,versions);
    populate(maxLanguageVersionCombo,versions);
  }
}

Fixed version (ground truth):
private void showLanguageVersionFields(Language language){
  int versionCount=language == null ? 0 : language.getVersions().size();
  boolean hasVersions=versionCount > 1;
  minLanguageLabel.setVisible(hasVersions);
  maxLanguageLabel.setVisible(hasVersions);
  minLanguageVersionCombo.setVisible(hasVersions);
  maxLanguageVersionCombo.setVisible(hasVersions);
  if (hasVersions) {
    List<LanguageVersion> versions=new ArrayList<LanguageVersion>();
    versions.add(null);
    versions.addAll(language.getVersions());
    populate(minLanguageVersionCombo,versions);
    populate(maxLanguageVersionCombo,versions);
  }
}
Program: 21984
Project: 21984
Buggy source:
private void populate(Combo field,List<LanguageVersion> versions){
  field.removeAll();
  for (  LanguageVersion version : versions) {
    field.add(version.getName());
  }
}

Fixed version (ground truth):
private void populate(Combo field,List<LanguageVersion> versions){
  field.removeAll();
  for (  LanguageVersion version : versions) {
    field.add(version == null ? "String_Node_Str" : version.getName());
  }
}
Program: 21985
Project: 21985
Buggy source:
public static String textValueOf(Collection<FilterHolder> holders,Accessor textAccessor){
  Set<String> values=new HashSet<String>();
  for (  FilterHolder fh : holders)   values.add(textAccessor.textValueFor(fh));
  return values.size() > 1 ? "String_Node_Str" : values.iterator().next();
}

Fixed version (ground truth):
public static String textValueOf(Collection<FilterHolder> holders,Accessor textAccessor){
  Set<String> values=new HashSet<String>();
  for (  FilterHolder fh : holders)   values.add(textAccessor.textValueFor(fh));
  return (values.size() == 1) ? values.iterator().next() : "String_Node_Str";
}
Program: 21986
Project: 21986
Buggy source:
public static Boolean boolValueOf(Collection<FilterHolder> holders,Accessor boolAccessor){
  Set<Boolean> values=new HashSet<Boolean>();
  for (  FilterHolder fh : holders)   values.add(boolAccessor.boolValueFor(fh));
  return values.size() == 2 ? null : values.iterator().next();
}

Fixed version (ground truth):
public static Boolean boolValueOf(Collection<FilterHolder> holders,Accessor boolAccessor){
  Set<Boolean> values=new HashSet<Boolean>();
  for (  FilterHolder fh : holders)   values.add(boolAccessor.boolValueFor(fh));
  int valueCount=values.size();
  return (valueCount == 2 || valueCount == 0) ? null : values.iterator().next();
}
Program: 21987
Project: 21987
Buggy source:
public Control newEditorOn(Composite parent,final PropertyDescriptor<?> desc,final PropertySource source,final ValueChangeListener listener,SizeChangeListener sizeListener){
  final FilePicker picker=new FilePicker(parent,SWT.SINGLE | SWT.BORDER,"String_Node_Str",null);
  picker.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  fillWidget(picker,desc,source);
  final FileProperty fp=filePropertyFrom(desc);
  picker.addListener(SWT.FocusOut,new Listener(){
    public void handleEvent(    Event event){
      File newValue=picker.getFile();
      File existingValue=(File)valueFor(source,fp);
      if (areSemanticEquals(existingValue,newValue))       return;
      setValue(source,fp,newValue);
      fillWidget(picker,desc,source);
      listener.changed(source,desc,newValue);
    }
  }
);
  return picker;
}

Fixed version (ground truth):
public Control newEditorOn(Composite parent,final PropertyDescriptor<?> desc,final PropertySource source,final ValueChangeListener listener,SizeChangeListener sizeListener){
  final FilePicker picker=new FilePicker(parent,SWT.SINGLE | SWT.BORDER,"String_Node_Str",null);
  picker.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  fillWidget(picker,desc,source);
  final FileProperty fp=filePropertyFrom(desc);
  picker.addFocusOutListener(new Listener(){
    public void handleEvent(    Event event){
      File newValue=picker.getFile();
      File existingValue=(File)valueFor(source,fp);
      if (areSemanticEquals(existingValue,newValue))       return;
      setValue(source,fp,newValue);
      fillWidget(picker,desc,source);
      listener.changed(source,desc,newValue);
    }
  }
);
  return picker;
}
Program: 21988
Project: 21988
Buggy source:
public File getFile(){
  String name=fileField.getText();
  if (StringUtil.isEmpty(name))   return null;
  File file=new File(name);
  return file.exists() ? file : null;
}

Fixed version (ground truth):
public File getFile(){
  String name=fileField.getText();
  return StringUtil.isEmpty(name) ? null : new File(name);
}
Program: 21989
Project: 21989
Buggy source:
private void openFileDialog(Shell shell){
  FileDialog fd=new FileDialog(shell,SWT.OPEN);
  fd.setText(dialogTitle);
  fd.setFilterPath("String_Node_Str");
  if (filterExtensions != null)   fd.setFilterExtensions(filterExtensions);
  String selected=fd.open();
  fileField.setText(selected == null ? "String_Node_Str" : selected);
}

Fixed version (ground truth):
private void openFileDialog(Shell shell){
  FileDialog fd=new FileDialog(shell,SWT.OPEN);
  fd.setText(dialogTitle);
  fd.setFilterPath("String_Node_Str");
  if (filterExtensions != null)   fd.setFilterExtensions(filterExtensions);
  String selected=fd.open();
  fileField.setText(selected == null ? "String_Node_Str" : selected);
  fileField.setFocus();
}
Program: 21990
Project: 21990
Buggy source:
private Renderer[] knownRenderers(){
  Properties props=new Properties();
  return new Renderer[]{new HTMLRenderer(props),new CSVRenderer(props),new XMLRenderer(props),new TextRenderer(props),new VBHTMLRenderer(props)};
}

Fixed version (ground truth):
private Renderer[] knownRenderers(){
  Properties props=new Properties();
  return new Renderer[]{new HTMLRenderer(props),new SummaryHTMLRenderer(props),new CSVRenderer(props),new XMLRenderer(props),new TextRenderer(props),new VBHTMLRenderer(props)};
}
Program: 21991
Project: 21991
Buggy source:
public static String[] sourceLinesFrom(Match match,boolean trimLeadingWhitespace){
  final String text=match.getSourceCodeSlice().replaceAll("String_Node_Str","String_Node_Str");
  final StringTokenizer lines=new StringTokenizer(text,"String_Node_Str");
  List<String> sourceLines=new ArrayList<String>();
  for (int i=0; lines.hasMoreTokens(); i++) {
    String line=lines.nextToken();
    sourceLines.add(line);
  }
  String[] lineArr=new String[sourceLines.size()];
  lineArr=sourceLines.toArray(lineArr);
  if (trimLeadingWhitespace) {
    int trimDepth=StringUtil.maxCommonLeadingWhitespaceForAll(lineArr);
    if (trimDepth > 0) {
      lineArr=StringUtil.trimStartOn(lineArr,trimDepth);
    }
  }
  return lineArr;
}

Fixed version (ground truth):
public static String[] sourceLinesFrom(Match match,boolean trimLeadingWhitespace){
  final String text=match.getSourceCodeSlice().replaceAll("String_Node_Str",TabEquivalent);
  final StringTokenizer lines=new StringTokenizer(text,"String_Node_Str");
  List<String> sourceLines=new ArrayList<String>();
  for (int i=0; lines.hasMoreTokens(); i++) {
    String line=lines.nextToken();
    sourceLines.add(line);
  }
  String[] lineArr=new String[sourceLines.size()];
  lineArr=sourceLines.toArray(lineArr);
  if (trimLeadingWhitespace) {
    int trimDepth=StringUtil.maxCommonLeadingWhitespaceForAll(lineArr);
    if (trimDepth > 0) {
      lineArr=StringUtil.trimStartOn(lineArr,trimDepth);
    }
  }
  return lineArr;
}
Program: 21992
Project: 21992
Buggy source:
@Override public void createPartControl(Composite parent){
  int treeStyle=SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI| SWT.FULL_SELECTION;
  treeViewer=new TreeViewer(parent,treeStyle);
  treeViewer.setUseHashlookup(true);
  Tree tree=treeViewer.getTree();
  tree.addListener(SWT.Move,measureListener);
  tree.addListener(SWT.Resize,resizeListener);
  tree.setHeaderVisible(true);
  tree.setLinesVisible(true);
  addPainters(tree);
  treeViewer.setContentProvider(contentProvider);
  treeViewer.setLabelProvider(labelProvider);
  createColumns(tree);
  CPDViewTooltipListener2 tooltipListener=new CPDViewTooltipListener2(this);
  tree.addListener(SWT.MouseMove,tooltipListener);
  tree.addListener(SWT.MouseHover,tooltipListener);
  tree.addListener(SWT.MouseDown,tooltipListener);
  Display disp=tree.getDisplay();
  classColor=disp.getSystemColor(SWT.COLOR_BLUE);
  packageColor=disp.getSystemColor(SWT.COLOR_GRAY);
}

Fixed version (ground truth):
@Override public void createPartControl(Composite parent){
  int treeStyle=SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI| SWT.FULL_SELECTION;
  treeViewer=new TreeViewer(parent,treeStyle);
  treeViewer.setUseHashlookup(true);
  Tree tree=treeViewer.getTree();
  tree.addListener(SWT.Move,measureListener);
  tree.addListener(SWT.Resize,resizeListener);
  tree.setHeaderVisible(true);
  tree.setLinesVisible(true);
  addPainters(tree);
  treeViewer.setContentProvider(contentProvider);
  treeViewer.setLabelProvider(labelProvider);
  addDeleteListener(treeViewer.getControl());
  createColumns(tree);
  CPDViewTooltipListener2 tooltipListener=new CPDViewTooltipListener2(this);
  tree.addListener(SWT.MouseMove,tooltipListener);
  tree.addListener(SWT.MouseHover,tooltipListener);
  tree.addListener(SWT.MouseDown,tooltipListener);
  Display disp=tree.getDisplay();
  classColor=disp.getSystemColor(SWT.COLOR_BLUE);
  packageColor=disp.getSystemColor(SWT.COLOR_GRAY);
}
Program: 21993
Project: 21993
Buggy source:
private TokenEntry itemAt(TreeItem treeItem,Point location,GC gc){
  if (treeItem == null)   return null;
  Object item=((TreeNode)treeItem.getData()).getValue();
  String[] names=null;
  if (item instanceof Match) {
    names=CPDViewLabelProvider2.sourcesFor((Match)item);
  }
 else {
    return null;
  }
  location.x-=view.widthOf(0);
  int colWidth=view.widthOf(CPDView2.SourceColumnIdx);
  int cellWidth=colWidth / names.length;
  for (int i=0; i < names.length; i++) {
    int rightEdge=colWidth - (cellWidth * i);
    int[] widths=view.widthsFor(names[i]);
    int classWidth=widths[1];
    if (location.x > rightEdge - classWidth && location.x < rightEdge) {
      return CPDViewLabelProvider2.entriesFor((Match)item)[i];
    }
  }
  return null;
}

Fixed version (ground truth):
private TokenEntry itemAt(TreeItem treeItem,Point location,GC gc){
  if (treeItem == null)   return null;
  Object item=((TreeNode)treeItem.getData()).getValue();
  String[] names=null;
  if (item instanceof Match) {
    names=CPDViewLabelProvider2.sourcesFor((Match)item);
  }
 else {
    return null;
  }
  location.x-=view.widthOf(0);
  int colWidth=view.widthOf(CPDView2.SourceColumnIdx);
  int cellWidth=colWidth / names.length;
  for (int i=0; i < names.length; i++) {
    int rightEdge=colWidth - (cellWidth * i);
    int[] widths=view.widthsFor(names[i]);
    if (widths == null)     continue;
    int classWidth=widths[1];
    if (location.x > rightEdge - classWidth && location.x < rightEdge) {
      return CPDViewLabelProvider2.entriesFor((Match)item)[i];
    }
  }
  return null;
}
Program: 21994
Project: 21994
Buggy source:
public String labelFor(Rule rule){
  List<String> types=new ArrayList<String>(3);
  if (rule.hasDescriptor(XPathRule.XPATH_DESCRIPTOR))   types.add(ruleTypeXPath[1]);
  if (rule.usesDFA())   types.add(ruleTypeDFlow[1]);
  if (rule.usesTypeResolution())   types.add(ruleTypeTypeRes[1]);
  if (types.isEmpty())   types.add(ruleTypeGeneric[1]);
  return Util.asString(types,"String_Node_Str");
}

Fixed version (ground truth):
public String labelFor(Rule rule){
  return rule.getLanguage().getName();
}
Program: 21995
Project: 21995
Buggy source:
public void handleEvent(Event event){
  if (event.index != columnIndex)   return;
  Object value=valueFor((TreeItem)event.item,getter);
  if (value instanceof RuleCollection)   return;
  String text=String.valueOf(value);
  Point size=event.gc.textExtent(text);
  event.width=size.x + 2 * (3);
}

Fixed version (ground truth):
public void handleEvent(Event event){
  if (event.index != columnIndex)   return;
  String text=textFor((TreeItem)event.item,getter);
  Point size=event.gc.textExtent(text);
  event.width=size.x + 2 * (3);
}
Program: 21996
Project: 21996
Buggy source:
public void addPainterFor(final Tree tree,final int columnIndex,final RuleFieldAccessor getter,Map<Integer,List<Listener>> paintListeners){
  Listener paintListener=new Listener(){
    public void handleEvent(    Event event){
      if (event.index != columnIndex)       return;
      Object value=((TreeItem)event.item).getData();
      if (value instanceof RuleCollection)       return;
      GC gc=event.gc;
      int imgOffset=0;
      Rule rule=(Rule)value;
      gc.setFont(fontFor(tree,rule));
      imgOffset=rule.dysfunctionReason() != null ? ImgOffset : 0;
      value=valueFor((TreeItem)event.item,getter);
      String text=String.valueOf(value);
      int descent=gc.getFontMetrics().getDescent();
      gc.drawString(text,event.x + imgOffset,event.y + descent,true);
    }
  }
;
  Listener measureListener=new Listener(){
    public void handleEvent(    Event event){
      if (event.index != columnIndex)       return;
      Object value=valueFor((TreeItem)event.item,getter);
      if (value instanceof RuleCollection)       return;
      String text=String.valueOf(value);
      Point size=event.gc.textExtent(text);
      event.width=size.x + 2 * (3);
    }
  }
;
  Util.addListener(tree,SWT.PaintItem,paintListener,paintListeners);
  Util.addListener(tree,SWT.MeasureItem,measureListener,paintListeners);
}

Fixed version (ground truth):
public void addPainterFor(final Tree tree,final int columnIndex,final RuleFieldAccessor getter,Map<Integer,List<Listener>> paintListeners){
  Listener paintListener=new Listener(){
    public void handleEvent(    Event event){
      if (event.index != columnIndex)       return;
      Object value=((TreeItem)event.item).getData();
      if (value instanceof RuleCollection)       return;
      GC gc=event.gc;
      int imgOffset=0;
      Rule rule=(Rule)value;
      gc.setFont(fontFor(tree,rule));
      imgOffset=rule.dysfunctionReason() != null ? ImgOffset : 0;
      String text=textFor((TreeItem)event.item,getter);
      int descent=gc.getFontMetrics().getDescent();
      gc.drawString(text,event.x + imgOffset,event.y + descent,true);
    }
  }
;
  Listener measureListener=new Listener(){
    public void handleEvent(    Event event){
      if (event.index != columnIndex)       return;
      String text=textFor((TreeItem)event.item,getter);
      Point size=event.gc.textExtent(text);
      event.width=size.x + 2 * (3);
    }
  }
;
  Util.addListener(tree,SWT.PaintItem,paintListener,paintListeners);
  Util.addListener(tree,SWT.MeasureItem,measureListener,paintListeners);
}
Program: 21997
Project: 21997
Buggy source:
public Control newEditorOn(Composite parent,final PropertyDescriptor<?> desc,final Rule rule,final ValueChangeListener listener,SizeChangeListener sizeListener){
  final Button butt=new Button(parent,SWT.CHECK);
  butt.setText("String_Node_Str");
  final BooleanProperty bp=booleanPropertyFrom(desc);
  boolean set=((Boolean)valueFor(rule,desc)).booleanValue();
  butt.setSelection(set);
  butt.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent event){
      boolean selected=butt.getSelection();
      if (selected == (((Boolean)valueFor(rule,bp))).booleanValue())       return;
      rule.setProperty(bp,Boolean.valueOf(selected));
      listener.changed(rule,desc,Boolean.valueOf(selected));
      adjustRendering(rule,desc,butt);
    }
  }
);
  return butt;
}

Fixed version (ground truth):
public Control newEditorOn(Composite parent,final PropertyDescriptor<?> desc,final Rule rule,final ValueChangeListener listener,SizeChangeListener sizeListener){
  final Button butt=new Button(parent,SWT.CHECK);
  butt.setText("String_Node_Str");
  final BooleanProperty bp=booleanPropertyFrom(desc);
  boolean set=((Boolean)valueFor(rule,desc)).booleanValue();
  butt.setSelection(set);
  SelectionAdapter sa=new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent event){
      boolean selected=butt.getSelection();
      if (selected == (((Boolean)valueFor(rule,bp))).booleanValue())       return;
      rule.setProperty(bp,Boolean.valueOf(selected));
      listener.changed(rule,desc,Boolean.valueOf(selected));
      adjustRendering(rule,desc,butt);
    }
  }
;
  butt.addSelectionListener(sa);
  return butt;
}
Program: 21999
Project: 21999
Buggy source:
/** 
 * Build the group of review preferences
 * @param parent the parent composite
 * @return the group widget
 */
private Group buildReviewGroup(final Composite parent){
  Group group=new Group(parent,SWT.SHADOW_IN);
  group.setText(getMessage(StringKeys.MSGKEY_PREF_GENERAL_GROUP_REVIEW));
  group.setLayout(new GridLayout(1,false));
  this.reviewPmdStyleBox=buildReviewPmdStyleBoxButton(group);
  Label separator=new Label(group,SWT.SEPARATOR | SWT.SHADOW_IN | SWT.HORIZONTAL);
  buildLabel(group,StringKeys.MSGKEY_PREF_GENERAL_LABEL_ADDCOMMENT);
  this.additionalCommentText=buildAdditionalCommentText(group);
  buildLabel(group,StringKeys.MSGKEY_PREF_GENERAL_LABEL_SAMPLE);
  this.sampleLabel=buildSampleLabel(group);
  updateSampleLabel();
  GridData data=new GridData();
  data.horizontalAlignment=GridData.FILL;
  data.grabExcessHorizontalSpace=true;
  this.reviewPmdStyleBox.setLayoutData(data);
  data=new GridData();
  data.horizontalAlignment=GridData.FILL;
  data.grabExcessHorizontalSpace=true;
  separator.setLayoutData(data);
  data=new GridData();
  data.horizontalAlignment=GridData.FILL;
  data.grabExcessHorizontalSpace=true;
  this.additionalCommentText.setLayoutData(data);
  data=new GridData();
  data.horizontalAlignment=GridData.FILL;
  data.grabExcessHorizontalSpace=true;
  sampleLabel.setLayoutData(data);
  return group;
}

Fixed version (ground truth):
/** 
 * Build the group of review preferences
 * @param parent the parent composite
 * @return the group widget
 */
private Group buildReviewGroup(final Composite parent){
  Group group=new Group(parent,SWT.SHADOW_IN);
  group.setText(getMessage(StringKeys.MSGKEY_PREF_GENERAL_GROUP_REVIEW));
  group.setLayout(new GridLayout(1,false));
  this.reviewPmdStyleBox=buildReviewPmdStyleBoxButton(group);
  Label separator=new Label(group,SWT.SEPARATOR | SWT.SHADOW_IN | SWT.HORIZONTAL);
  buildLabel(group,StringKeys.MSGKEY_PREF_GENERAL_LABEL_ADDCOMMENT);
  additionalCommentText=buildAdditionalCommentText(group);
  buildLabel(group,StringKeys.MSGKEY_PREF_GENERAL_LABEL_SAMPLE);
  sampleLabel=buildSampleLabel(group);
  updateSampleLabel();
  GridData data=new GridData();
  data.horizontalAlignment=GridData.FILL;
  data.grabExcessHorizontalSpace=true;
  reviewPmdStyleBox.setLayoutData(data);
  data=new GridData();
  data.horizontalAlignment=GridData.FILL;
  data.grabExcessHorizontalSpace=true;
  separator.setLayoutData(data);
  data=new GridData();
  data.horizontalAlignment=GridData.FILL;
  data.grabExcessHorizontalSpace=true;
  additionalCommentText.setLayoutData(data);
  data=new GridData();
  data.horizontalAlignment=GridData.FILL;
  data.grabExcessHorizontalSpace=true;
  sampleLabel.setLayoutData(data);
  return group;
}
Program: 22000
Project: 22000
Buggy source:
/** 
 * Build the check box for showing the PMD perspective
 * @param viewGroup the parent composite
 */
private Button buildCheckCodeOnSaveButton(Composite viewGroup){
  Button button=new Button(viewGroup,SWT.CHECK);
  button.setText("String_Node_Str");
  button.setSelection(preferences.isCheckAfterSaveEnabled());
  return button;
}

Fixed version (ground truth):
/** 
 * Build the check box for showing the PMD perspective
 * @param viewGroup the parent composite
 */
private Button buildCheckCodeOnSaveButton(Composite viewGroup){
  Button button=new Button(viewGroup,SWT.CHECK);
  button.setText("String_Node_Str");
  button.setSelection(preferences.isCheckAfterSaveEnabled());
  button.setEnabled(false);
  return button;
}
Program: 22001
Project: 22001
Buggy source:
/** 
 * Build the group of general preferences
 * @param parent the parent composite
 * @return the group widget
 */
private Group buildGeneralGroup(final Composite parent){
  Group group=new Group(parent,SWT.SHADOW_IN);
  group.setText(getMessage(StringKeys.MSGKEY_PREF_GENERAL_GROUP_GENERAL));
  group.setLayout(new GridLayout(1,false));
  showPerspectiveBox=buildShowPerspectiveBoxButton(group);
  useProjectBuildPath=buildUseProjectBuildPathButton(group);
  checkCodeOnSave=buildCheckCodeOnSaveButton(group);
  Label separator=new Label(group,SWT.SEPARATOR | SWT.SHADOW_IN | SWT.HORIZONTAL);
  maxViolationsPerFilePerRule=buildMaxViolationsPerFilePerRuleText(group);
  GridData data=new GridData();
  data.horizontalAlignment=GridData.FILL;
  data.grabExcessHorizontalSpace=true;
  this.showPerspectiveBox.setLayoutData(data);
  data=new GridData();
  data.horizontalAlignment=GridData.FILL;
  data.grabExcessHorizontalSpace=true;
  this.useProjectBuildPath.setLayoutData(data);
  data=new GridData();
  data.horizontalAlignment=GridData.FILL;
  data.grabExcessHorizontalSpace=true;
  separator.setLayoutData(data);
  data=new GridData();
  data.horizontalAlignment=GridData.FILL;
  data.grabExcessHorizontalSpace=true;
  maxViolationsPerFilePerRule.setLayoutData(data);
  return group;
}

Fixed version (ground truth):
/** 
 * Build the group of general preferences
 * @param parent the parent composite
 * @return the group widget
 */
private Group buildGeneralGroup(final Composite parent){
  Group group=new Group(parent,SWT.SHADOW_IN);
  group.setText(getMessage(StringKeys.MSGKEY_PREF_GENERAL_GROUP_GENERAL));
  group.setLayout(new GridLayout(1,false));
  showPerspectiveBox=buildShowPerspectiveBoxButton(group);
  useProjectBuildPath=buildUseProjectBuildPathButton(group);
  checkCodeOnSave=buildCheckCodeOnSaveButton(group);
  Label separator=new Label(group,SWT.SEPARATOR | SWT.SHADOW_IN | SWT.HORIZONTAL);
  maxViolationsPerFilePerRule=buildMaxViolationsPerFilePerRuleText(group);
  GridData data=new GridData();
  data.horizontalAlignment=GridData.FILL;
  data.grabExcessHorizontalSpace=true;
  showPerspectiveBox.setLayoutData(data);
  data=new GridData();
  data.horizontalAlignment=GridData.FILL;
  data.grabExcessHorizontalSpace=true;
  useProjectBuildPath.setLayoutData(data);
  data=new GridData();
  data.horizontalAlignment=GridData.FILL;
  data.grabExcessHorizontalSpace=true;
  separator.setLayoutData(data);
  data=new GridData();
  data.horizontalAlignment=GridData.FILL;
  data.grabExcessHorizontalSpace=true;
  maxViolationsPerFilePerRule.setLayoutData(data);
  return group;
}
Program: 22002
Project: 22002
Buggy source:
private Text buildNameText(Composite parent){
  int style=usageMode == EditorUsageMode.CreateNew ? SWT.SINGLE | SWT.BORDER : SWT.READ_ONLY | SWT.BORDER;
  final Text nameField=new Text(parent,style);
  nameField.setFocus();
  Listener validateListener=new Listener(){
    public void handleEvent(    Event event){
      validateRuleParams();
    }
  }
;
  nameField.addListener(SWT.Modify,validateListener);
  nameField.addListener(SWT.DefaultSelection,validateListener);
  return nameField;
}

Fixed version (ground truth):
private Text buildNameText(Composite parent){
  int style=creatingNewRule() ? SWT.SINGLE | SWT.BORDER : SWT.READ_ONLY | SWT.BORDER;
  final Text nameField=new Text(parent,style);
  nameField.setFocus();
  Listener validateListener=new Listener(){
    public void handleEvent(    Event event){
      validateRuleParams();
    }
  }
;
  nameField.addListener(SWT.Modify,validateListener);
  nameField.addListener(SWT.DefaultSelection,validateListener);
  return nameField;
}
Program: 22003
Project: 22003
Buggy source:
private void validateRuleParams(){
  boolean isOk=validate();
  if (isOk && usageMode == EditorUsageMode.CreateNew) {
    populateRuleInstance();
  }
  if (inSetup)   return;
  if (target != null) {
    target.rule(isOk ? rules.soleRule() : null);
  }
}

Fixed version (ground truth):
private void validateRuleParams(){
  boolean isOk=validate();
  if (isOk && creatingNewRule()) {
    populateRuleInstance();
  }
  if (inSetup)   return;
  if (target != null) {
    target.rule(isOk ? rules.soleRule() : null);
  }
}
Program: 22004
Project: 22004
Buggy source:
private Combo buildRuleSetNameField(Composite parent){
  int style=usageMode == EditorUsageMode.CreateNew ? SWT.BORDER : SWT.READ_ONLY;
  Combo field=new Combo(parent,style);
  Set<RuleSet> rs=PMDPlugin.getDefault().getRuleSetManager().getRegisteredRuleSets();
  RuleSet[] ruleSets=rs.toArray(new RuleSet[rs.size()]);
  Arrays.sort(ruleSets,byNameComparator);
  for (  RuleSet ruleSet : ruleSets) {
    field.add(ruleSet.getName());
  }
  Listener validateListener=new Listener(){
    public void handleEvent(    Event event){
      validateRuleParams();
    }
  }
;
  field.addListener(SWT.Modify,validateListener);
  field.addListener(SWT.DefaultSelection,validateListener);
  return field;
}

Fixed version (ground truth):
private Combo buildRuleSetNameField(Composite parent){
  int style=creatingNewRule() ? SWT.BORDER : SWT.READ_ONLY;
  Combo field=new Combo(parent,style);
  Set<RuleSet> rs=PMDPlugin.getDefault().getRuleSetManager().getRegisteredRuleSets();
  RuleSet[] ruleSets=rs.toArray(new RuleSet[rs.size()]);
  Arrays.sort(ruleSets,byNameComparator);
  for (  RuleSet ruleSet : ruleSets) {
    field.add(ruleSet.getName());
  }
  Listener validateListener=new Listener(){
    public void handleEvent(    Event event){
      validateRuleParams();
    }
  }
;
  field.addListener(SWT.Modify,validateListener);
  field.addListener(SWT.DefaultSelection,validateListener);
  return field;
}
Program: 22005
Project: 22005
Buggy source:
private TypeText buildImplementationClassField(Composite parent){
  int style=usageMode == EditorUsageMode.CreateNew ? SWT.SINGLE | SWT.BORDER : SWT.READ_ONLY | SWT.BORDER;
  final TypeText classField=new TypeText(parent,style,true,"String_Node_Str");
  classField.setEnabled(false);
  Listener validateListener=new Listener(){
    public void handleEvent(    Event event){
      validateRuleParams();
    }
  }
;
  classField.addListener(SWT.FocusOut,validateListener);
  classField.addListener(SWT.DefaultSelection,validateListener);
  return classField;
}

Fixed version (ground truth):
private TypeText buildImplementationClassField(Composite parent){
  int style=creatingNewRule() ? SWT.SINGLE | SWT.BORDER : SWT.READ_ONLY | SWT.BORDER;
  final TypeText classField=new TypeText(parent,style,true,"String_Node_Str");
  classField.setEnabled(false);
  Listener validateListener=new Listener(){
    public void handleEvent(    Event event){
      validateRuleParams();
    }
  }
;
  classField.addListener(SWT.FocusOut,validateListener);
  classField.addListener(SWT.DefaultSelection,validateListener);
  return classField;
}
Program: 22007
Project: 22007
Buggy source:
protected List<String> fieldErrors(){
  List<String> errors=new ArrayList<String>();
  if (!hasValidRuleType())   errors.add("String_Node_Str");
  if (!hasValidRuleName())   errors.add("String_Node_Str");
  if (!hasValidRulesetName())   errors.add("String_Node_Str");
  if (languageCombo.getSelectionIndex() < 0)   errors.add("String_Node_Str");
  return errors;
}

Fixed version (ground truth):
protected List<String> fieldErrors(){
  List<String> errors=new ArrayList<String>();
  if (!hasValidRuleType())   errors.add("String_Node_Str");
  if (!hasValidRuleName())   errors.add("String_Node_Str");
  if (creatingNewRule() && hasExistingRuleName())   errors.add("String_Node_Str");
  if (!hasValidRulesetName())   errors.add("String_Node_Str");
  if (languageCombo.getSelectionIndex() < 0)   errors.add("String_Node_Str");
  return errors;
}
Program: 22008
Project: 22008
Buggy source:
@Override protected void adapt(){
  show(ruleSetNameField,RuleUtil.commonRuleset(rules));
  Language language=RuleUtil.commonLanguage(rules);
  show(languageCombo,language == null ? "String_Node_Str" : language.getName());
  ImplementationType impType=rules == null ? ImplementationType.Mixed : rules.implementationType();
  implementationType(impType);
  implementationTypeCombo.setEnabled(usageMode == EditorUsageMode.CreateNew);
  Class<?> impClass=RuleUtil.commonImplementationClass(rules);
  show(implementationClassField,impClass);
  implementationClassField.setEnabled(impClass != null);
  show(priorityCombo,commonPriorityName());
  priorityDisplay.setItems(uniquePriorities().toArray());
  show(usesTypeResolutionButton,allRulesUseTypeResolution());
  show(usesDfaButton,allRulesUseDfa());
  showLanguageVersionFields(language);
  show(minLanguageVersionCombo,commonLanguageMinVersionName());
  show(maxLanguageVersionCombo,commonLanguageMaxVersionName());
  Rule soleRule=soleRule();
  if (soleRule == null) {
    shutdown(nameField);
  }
 else {
    show(nameField,asCleanString(soleRule.getName()));
  }
  validate();
}

Fixed version (ground truth):
@Override protected void adapt(){
  show(ruleSetNameField,RuleUtil.commonRuleset(rules));
  Language language=RuleUtil.commonLanguage(rules);
  show(languageCombo,language == null ? "String_Node_Str" : language.getName());
  ImplementationType impType=rules == null ? ImplementationType.Mixed : rules.implementationType();
  implementationType(impType);
  implementationTypeCombo.setEnabled(creatingNewRule());
  Class<?> impClass=RuleUtil.commonImplementationClass(rules);
  show(implementationClassField,impClass);
  implementationClassField.setEnabled(impClass != null);
  show(priorityCombo,commonPriorityName());
  priorityDisplay.setItems(uniquePriorities().toArray());
  show(usesTypeResolutionButton,allRulesUseTypeResolution());
  show(usesDfaButton,allRulesUseDfa());
  showLanguageVersionFields(language);
  show(minLanguageVersionCombo,commonLanguageMinVersionName());
  show(maxLanguageVersionCombo,commonLanguageMaxVersionName());
  Rule soleRule=soleRule();
  if (soleRule == null) {
    shutdown(nameField);
  }
 else {
    show(nameField,asCleanString(soleRule.getName()));
  }
  validate();
}
Program: 22009
Project: 22009
Buggy source:
private Combo buildLanguageVersionCombo(Composite parent,final boolean isMinVersion){
  int style=usageMode == EditorUsageMode.CreateNew ? SWT.SINGLE | SWT.BORDER : SWT.READ_ONLY | SWT.BORDER;
  final Combo combo=new Combo(parent,style);
  combo.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent event){
      if (rules == null)       return;
      final LanguageVersion version=selectedLanguage().getVersions().get(combo.getSelectionIndex());
      RuleVisitor visitor=new RuleVisitor(){
        public boolean accept(        Rule rule){
          if (isMinVersion) {
            rule.setMinimumLanguageVersion(version);
          }
 else {
            rule.setMaximumLanguageVersion(version);
          }
          return true;
        }
      }
;
      rules.rulesDo(visitor);
      valueChanged(null,version.getName());
    }
  }
);
  return combo;
}

Fixed version (ground truth):
private Combo buildLanguageVersionCombo(Composite parent,final boolean isMinVersion){
  int style=creatingNewRule() ? SWT.SINGLE | SWT.BORDER : SWT.READ_ONLY | SWT.BORDER;
  final Combo combo=new Combo(parent,style);
  combo.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent event){
      if (rules == null)       return;
      final LanguageVersion version=selectedLanguage().getVersions().get(combo.getSelectionIndex());
      RuleVisitor visitor=new RuleVisitor(){
        public boolean accept(        Rule rule){
          if (isMinVersion) {
            rule.setMinimumLanguageVersion(version);
          }
 else {
            rule.setMaximumLanguageVersion(version);
          }
          return true;
        }
      }
;
      rules.rulesDo(visitor);
      valueChanged(null,version.getName());
    }
  }
);
  return combo;
}
Program: 22010
Project: 22010
Buggy source:
private void implementationType(ImplementationType type){
switch (type) {
case XPath:
{
      implementationClassField.setEnabled(false);
      usesTypeResolutionButton.setEnabled(false);
      usesTypeResolutionButton.setSelection(true);
      usesDfaButton.setEnabled(false);
      usesDfaButton.setSelection(false);
      implementationTypeCombo.select(0);
      if (usageMode == EditorUsageMode.CreateNew) {
        implementationClassField.setType(XPathRule.class);
      }
      break;
    }
case Java:
{
    implementationClassField.setEnabled(true);
    usesTypeResolutionButton.setEnabled(true);
    usesTypeResolutionButton.setSelection(true);
    usesDfaButton.setEnabled(true);
    usesDfaButton.setSelection(false);
    implementationTypeCombo.select(1);
    if (usageMode == EditorUsageMode.CreateNew) {
      implementationClassField.setType(null);
    }
    break;
  }
case Mixed:
{
  implementationTypeCombo.deselectAll();
}
}
validateRuleParams();
}

Fixed version (ground truth):
private void implementationType(ImplementationType type){
switch (type) {
case XPath:
{
      implementationClassField.setEnabled(false);
      usesTypeResolutionButton.setEnabled(false);
      usesTypeResolutionButton.setSelection(true);
      usesDfaButton.setEnabled(false);
      usesDfaButton.setSelection(false);
      implementationTypeCombo.select(0);
      if (creatingNewRule()) {
        implementationClassField.setType(XPathRule.class);
      }
      break;
    }
case Java:
{
    implementationClassField.setEnabled(true);
    usesTypeResolutionButton.setEnabled(true);
    usesTypeResolutionButton.setSelection(true);
    usesDfaButton.setEnabled(true);
    usesDfaButton.setSelection(false);
    implementationTypeCombo.select(1);
    if (creatingNewRule()) {
      implementationClassField.setType(null);
    }
    break;
  }
case Mixed:
{
  implementationTypeCombo.deselectAll();
}
}
validateRuleParams();
}
Program: 22011
Project: 22011
Buggy source:
public void addListener(int eventType,Listener listener){
  text.addListener(eventType,listener);
}

Fixed version (ground truth):
public void addListener(int eventType,Listener listener){
  super.addListener(eventType,listener);
  if (text == null)   return;
  text.addListener(eventType,listener);
}
Program: 22012
Project: 22012
Buggy source:
/** 
 * Gets the fileRecord from the currently active editor (if it is one).
 * @param part IWorkbenchPart
 * @return a new FileRecord
 */
public FileRecord getFileRecordFromWorkbenchPart(IWorkbenchPart part){
  FileRecord record=tryForFileRecordFrom(part);
  if (record != null)   return record;
  IEditorPart editorPart=getSite().getPage().getActiveEditor();
  return editorPart == null ? null : getFileRecordFromWorkbenchPart(editorPart);
}

Fixed version (ground truth):
/** 
 * Gets the fileRecord from the currently active editor.
 * @param part IWorkbenchPart
 * @return a new FileRecord
 */
private FileRecord getFileRecordFromWorkbenchPart(IWorkbenchPart part){
  if (part instanceof IEditorPart) {
    IEditorInput input=((IEditorPart)part).getEditorInput();
    if (input != null && input instanceof IFileEditorInput) {
      IFile file=((IFileEditorInput)input).getFile();
      return AbstractDefaultCommand.isJavaFile(file) ? new FileRecord(file) : null;
    }
  }
 else {
    IEditorPart editorPart=getSite().getPage().getActiveEditor();
    if (editorPart != null) {
      return getFileRecordFromWorkbenchPart(editorPart);
    }
  }
  return null;
}
Program: 22013
Project: 22013
Buggy source:
private void setupResources(Display display){
  textLayout=new TextLayout(display);
  renderFont=new Font(display,"String_Node_Str",10,SWT.NORMAL);
  italicFont=new Font(display,"String_Node_Str",10,SWT.ITALIC);
  labelStyle=new TextStyle(renderFont,display.getSystemColor(SWT.COLOR_BLACK),null);
  imageStyle=new TextStyle(renderFont,display.getSystemColor(SWT.COLOR_BLUE),null);
  derivedStyle=new TextStyle(italicFont,display.getSystemColor(SWT.COLOR_DARK_MAGENTA),null);
}

Fixed version (ground truth):
private void setupResources(Display display){
  textLayout=new TextLayout(display);
  renderFont=new Font(display,"String_Node_Str",10,SWT.NORMAL);
  italicFont=new Font(display,"String_Node_Str",10,SWT.ITALIC);
  labelStyle=new TextStyle(renderFont,display.getSystemColor(SWT.COLOR_BLACK),null);
  imageStyle=new TextStyle(renderFont,display.getSystemColor(SWT.COLOR_BLUE),null);
  derivedStyle=new TextStyle(italicFont,display.getSystemColor(SWT.COLOR_GRAY),null);
}
Program: 22015
Project: 22015
Buggy source:
/** 
 * Build the text for maximum violations per file per rule
 * @param parent
 * @return
 */
private Spinner buildMaxViolationsPerFilePerRuleText(Composite parent){
  buildLabel(parent,StringKeys.MSGKEY_PREF_GENERAL_LABEL_MAX_VIOLATIONS_PFPR);
  final Spinner spinner=new Spinner(parent,SWT.SINGLE | SWT.BORDER);
  spinner.setMinimum(preferences.getMaxViolationsPerFilePerRule());
  spinner.setToolTipText(getMessage(StringKeys.MSGKEY_PREF_GENERAL_TOOLTIP_MAX_VIOLATIONS_PFPR));
  return spinner;
}

Fixed version (ground truth):
/** 
 * Build the text for maximum violations per file per rule
 * @param parent
 * @return
 */
private Spinner buildMaxViolationsPerFilePerRuleText(Composite parent){
  Composite comp=new Composite(parent,0);
  comp.setLayout(new GridLayout(2,false));
  Label label=buildLabel(comp,StringKeys.MSGKEY_PREF_GENERAL_LABEL_MAX_VIOLATIONS_PFPR);
  label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING,GridData.VERTICAL_ALIGN_CENTER,false,false,1,1));
  final Spinner spinner=new Spinner(comp,SWT.SINGLE | SWT.BORDER);
  spinner.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING,GridData.VERTICAL_ALIGN_CENTER,true,false,1,1));
  spinner.setMinimum(preferences.getMaxViolationsPerFilePerRule());
  spinner.setToolTipText(getMessage(StringKeys.MSGKEY_PREF_GENERAL_TOOLTIP_MAX_VIOLATIONS_PFPR));
  return spinner;
}
Program: 22016
Project: 22016
Buggy source:
public void selection(RuleSelection selection){
  for (  RulePropertyManager manager : rulePropertyManagers) {
    manager.manage(selection);
    manager.validate();
  }
}

Fixed version (ground truth):
public void selection(RuleSelection selection){
  if (rulePropertyManagers == null)   return;
  for (  RulePropertyManager manager : rulePropertyManagers) {
    manager.manage(selection);
    manager.validate();
  }
}
Program: 22017
Project: 22017
Buggy source:
/** 
 * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(Object,int)
 */
public Image getColumnImage(Object element,int columnIndex){
  if (element instanceof RuleCollection) {
    return columnDescriptors[columnIndex].imageFor((RuleCollection)element);
  }
  if (element instanceof Rule) {
    return columnDescriptors[columnIndex].imageFor((Rule)element);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(Object,int)
 */
public Image getColumnImage(Object element,int columnIndex){
  if (columnIndex <= 0)   return null;
  if (element instanceof RuleCollection) {
    return columnDescriptors[columnIndex - 1].imageFor((RuleCollection)element);
  }
  if (element instanceof Rule) {
    return columnDescriptors[columnIndex - 1].imageFor((Rule)element);
  }
  return null;
}
Program: 22018
Project: 22018
Buggy source:
/** 
 * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(Object,int)
 */
public String getColumnText(Object element,int columnIndex){
  if (element instanceof RuleCollection) {
    if (columnIndex == 0) {
      RuleGroup rg=(RuleGroup)element;
      String label=rg.label();
      return standardized(label,rg.ruleCount());
    }
    return columnDescriptors[columnIndex].stringValueFor((RuleCollection)element);
  }
  if (element instanceof Rule) {
    return columnDescriptors[columnIndex].stringValueFor((Rule)element);
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(Object,int)
 */
public String getColumnText(Object element,int columnIndex){
  if (columnIndex <= 0)   return "String_Node_Str";
  if (element instanceof RuleCollection) {
    if (columnIndex == 1) {
      RuleGroup rg=(RuleGroup)element;
      String label=rg.label();
      return standardized(label,rg.ruleCount());
    }
    return columnDescriptors[columnIndex - 1].stringValueFor((RuleCollection)element);
  }
  if (element instanceof Rule) {
    String text=columnDescriptors[columnIndex - 1].stringValueFor((Rule)element);
    return columnIndex == 1 ? "String_Node_Str" + text : text;
  }
  return "String_Node_Str";
}