nus-yam/ex-repair huggingface dataset:
Program: 22061
Project: 22061
Buggy source:
/** 
 * @param parent Composite
 * @param columnIndex int
 * @param desc PropertyDescriptor
 * @param rule Rule
 * @return Control
 * @see net.sourceforge.pmd.ui.preferences.br.EditorFactory#newEditorOn(Composite,int,PropertyDescriptor,Rule)
 */
public Control newEditorOn(Composite parent,int columnIndex,final PropertyDescriptor<?> desc,final Rule rule,final ValueChangeListener listener){
  if (columnIndex == 0)   return addLabel(parent,desc);
  if (columnIndex == 1) {
    final Spinner spinner=new Spinner(parent,SWT.SINGLE | SWT.BORDER);
    final IntegerProperty ip=intPropertyFrom(desc);
    int val=((Number)rule.getProperty(desc)).intValue();
    spinner.setMinimum(ip.lowerLimit().intValue());
    spinner.setMaximum(ip.upperLimit().intValue());
    spinner.setSelection(val);
    spinner.addModifyListener(new ModifyListener(){
      public void modifyText(      ModifyEvent event){
        int newValue=spinner.getSelection();
        if (newValue == rule.getProperty(ip))         return;
        rule.setProperty(ip,Integer.valueOf(newValue));
        listener.changed(desc,Integer.valueOf(newValue));
      }
    }
);
    return spinner;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * @param parent Composite
 * @param columnIndex int
 * @param desc PropertyDescriptor
 * @param rule Rule
 * @return Control
 * @see net.sourceforge.pmd.ui.preferences.br.EditorFactory#newEditorOn(Composite,int,PropertyDescriptor,Rule)
 */
public Control newEditorOn(Composite parent,int columnIndex,final PropertyDescriptor<?> desc,final Rule rule,final ValueChangeListener listener){
  if (columnIndex == 0)   return addLabel(parent,desc);
  if (columnIndex == 1) {
    final Spinner spinner=new Spinner(parent,SWT.SINGLE | SWT.BORDER);
    final IntegerProperty ip=intPropertyFrom(desc);
    int val=((Number)rule.getProperty(desc)).intValue();
    spinner.setMinimum(ip.lowerLimit().intValue());
    spinner.setMaximum(ip.upperLimit().intValue());
    spinner.setSelection(val);
    spinner.addModifyListener(new ModifyListener(){
      public void modifyText(      ModifyEvent event){
        int newValue=spinner.getSelection();
        if (newValue == rule.getProperty(ip))         return;
        rule.setProperty(ip,Integer.valueOf(newValue));
        listener.changed(rule,desc,Integer.valueOf(newValue));
      }
    }
);
    return spinner;
  }
  return null;
}
Program: 22062
Project: 22062
Buggy source:
public void handleEvent(Event event){
  Integer[] newValue=currentIntegers(textWidget);
  Integer[] existingValue=rule.getProperty(tmp);
  if (Util.areSemanticEquals(existingValue,newValue))   return;
  rule.setProperty(tmp,newValue);
  fillWidget(textWidget,desc,rule);
  listener.changed(desc,newValue);
}

Fixed version (ground truth):
public void handleEvent(Event event){
  Integer[] newValue=currentIntegers(textWidget);
  Integer[] existingValue=rule.getProperty(tmp);
  if (Util.areSemanticEquals(existingValue,newValue))   return;
  rule.setProperty(tmp,newValue);
  fillWidget(textWidget,desc,rule);
  listener.changed(rule,desc,newValue);
}
Program: 22063
Project: 22063
Buggy source:
protected void configure(final Text textWidget,final PropertyDescriptor<?> desc,final Rule rule,final ValueChangeListener listener){
  final IntegerMultiProperty tmp=multiIntegerPropertyFrom(desc);
  textWidget.addListener(SWT.FocusOut,new Listener(){
    public void handleEvent(    Event event){
      Integer[] newValue=currentIntegers(textWidget);
      Integer[] existingValue=rule.getProperty(tmp);
      if (Util.areSemanticEquals(existingValue,newValue))       return;
      rule.setProperty(tmp,newValue);
      fillWidget(textWidget,desc,rule);
      listener.changed(desc,newValue);
    }
  }
);
}

Fixed version (ground truth):
protected void configure(final Text textWidget,final PropertyDescriptor<?> desc,final Rule rule,final ValueChangeListener listener){
  final IntegerMultiProperty tmp=multiIntegerPropertyFrom(desc);
  textWidget.addListener(SWT.FocusOut,new Listener(){
    public void handleEvent(    Event event){
      Integer[] newValue=currentIntegers(textWidget);
      Integer[] existingValue=rule.getProperty(tmp);
      if (Util.areSemanticEquals(existingValue,newValue))       return;
      rule.setProperty(tmp,newValue);
      fillWidget(textWidget,desc,rule);
      listener.changed(rule,desc,newValue);
    }
  }
);
}
Program: 22064
Project: 22064
Buggy source:
public void handleEvent(Event event){
  String[] newValues=textWidgetValues(textWidget);
  String[] existingValues=rule.getProperty(smp);
  if (Util.areSemanticEquals(existingValues,newValues))   return;
  rule.setProperty(smp,newValues);
  fillWidget(textWidget,desc,rule);
  listener.changed(desc,newValues);
}

Fixed version (ground truth):
public void handleEvent(Event event){
  String[] newValues=textWidgetValues(textWidget);
  String[] existingValues=rule.getProperty(smp);
  if (Util.areSemanticEquals(existingValues,newValues))   return;
  rule.setProperty(smp,newValues);
  fillWidget(textWidget,desc,rule);
  listener.changed(rule,desc,newValues);
}
Program: 22065
Project: 22065
Buggy source:
protected void configure(final Text textWidget,final PropertyDescriptor<?> desc,final Rule rule,final ValueChangeListener listener){
  final StringMultiProperty smp=multiStringPropertyFrom(desc);
  textWidget.addListener(SWT.FocusOut,new Listener(){
    public void handleEvent(    Event event){
      String[] newValues=textWidgetValues(textWidget);
      String[] existingValues=rule.getProperty(smp);
      if (Util.areSemanticEquals(existingValues,newValues))       return;
      rule.setProperty(smp,newValues);
      fillWidget(textWidget,desc,rule);
      listener.changed(desc,newValues);
    }
  }
);
}

Fixed version (ground truth):
protected void configure(final Text textWidget,final PropertyDescriptor<?> desc,final Rule rule,final ValueChangeListener listener){
  final StringMultiProperty smp=multiStringPropertyFrom(desc);
  textWidget.addListener(SWT.FocusOut,new Listener(){
    public void handleEvent(    Event event){
      String[] newValues=textWidgetValues(textWidget);
      String[] existingValues=rule.getProperty(smp);
      if (Util.areSemanticEquals(existingValues,newValues))       return;
      rule.setProperty(smp,newValues);
      fillWidget(textWidget,desc,rule);
      listener.changed(rule,desc,newValues);
    }
  }
);
}
Program: 22066
Project: 22066
Buggy source:
public void handleEvent(Event event){
  Class<?>[] newValue=currentTypes(textWidget);
  Class<?>[] existingValue=rule.getProperty(tmp);
  if (Util.areSemanticEquals(existingValue,newValue))   return;
  rule.setProperty(tmp,newValue);
  fillWidget(textWidget,desc,rule);
  listener.changed(desc,newValue);
}

Fixed version (ground truth):
public void handleEvent(Event event){
  Class<?>[] newValue=currentTypes(textWidget);
  Class<?>[] existingValue=rule.getProperty(tmp);
  if (Util.areSemanticEquals(existingValue,newValue))   return;
  rule.setProperty(tmp,newValue);
  fillWidget(textWidget,desc,rule);
  listener.changed(rule,desc,newValue);
}
Program: 22067
Project: 22067
Buggy source:
protected void configure(final Text textWidget,final PropertyDescriptor<?> desc,final Rule rule,final ValueChangeListener listener){
  final TypeMultiProperty tmp=multiTypePropertyFrom(desc);
  textWidget.addListener(SWT.FocusOut,new Listener(){
    public void handleEvent(    Event event){
      Class<?>[] newValue=currentTypes(textWidget);
      Class<?>[] existingValue=rule.getProperty(tmp);
      if (Util.areSemanticEquals(existingValue,newValue))       return;
      rule.setProperty(tmp,newValue);
      fillWidget(textWidget,desc,rule);
      listener.changed(desc,newValue);
    }
  }
);
}

Fixed version (ground truth):
protected void configure(final Text textWidget,final PropertyDescriptor<?> desc,final Rule rule,final ValueChangeListener listener){
  final TypeMultiProperty tmp=multiTypePropertyFrom(desc);
  textWidget.addListener(SWT.FocusOut,new Listener(){
    public void handleEvent(    Event event){
      Class<?>[] newValue=currentTypes(textWidget);
      Class<?>[] existingValue=rule.getProperty(tmp);
      if (Util.areSemanticEquals(existingValue,newValue))       return;
      rule.setProperty(tmp,newValue);
      fillWidget(textWidget,desc,rule);
      listener.changed(rule,desc,newValue);
    }
  }
);
}
Program: 22068
Project: 22068
Buggy source:
/** 
 * This method is called upon plug-in activation
 */
public void start(BundleContext context) throws Exception {
  super.start(context);
  configureLogs();
}

Fixed version (ground truth):
/** 
 * This method is called upon plug-in activation
 */
public void start(BundleContext context) throws Exception {
  super.start(context);
  configureLogs(loadPreferences());
}
Program: 22069
Project: 22069
Buggy source:
/** 
 * Configure the logging
 */
private void configureLogs(){
  try {
    IPreferences preferences=loadPreferences();
    Layout layout=new PatternLayout("String_Node_Str");
    RollingFileAppender appender=new RollingFileAppender(layout,preferences.getLogFileName());
    appender.setName(PMD_ECLIPSE_APPENDER_NAME);
    appender.setMaxBackupIndex(1);
    appender.setMaxFileSize("String_Node_Str");
    Logger.getRootLogger().addAppender(new ConsoleAppender(layout));
    Logger.getRootLogger().setLevel(Level.WARN);
    Logger.getRootLogger().setAdditivity(false);
    Logger.getLogger(ROOT_LOG_ID).addAppender(appender);
    Logger.getLogger(ROOT_LOG_ID).setLevel(preferences.getLogLevel());
    Logger.getLogger(ROOT_LOG_ID).setAdditivity(false);
  }
 catch (  IOException e) {
    logError("String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Configure the logging
 */
private void configureLogs(IPreferences preferences){
  try {
    Layout layout=new PatternLayout("String_Node_Str");
    RollingFileAppender appender=new RollingFileAppender(layout,preferences.getLogFileName());
    appender.setName(PMD_ECLIPSE_APPENDER_NAME);
    appender.setMaxBackupIndex(1);
    appender.setMaxFileSize("String_Node_Str");
    Logger.getRootLogger().addAppender(new ConsoleAppender(layout));
    Logger.getRootLogger().setLevel(Level.WARN);
    Logger.getRootLogger().setAdditivity(false);
    Logger.getLogger(ROOT_LOG_ID).addAppender(appender);
    Logger.getLogger(ROOT_LOG_ID).setLevel(preferences.getLogLevel());
    Logger.getLogger(ROOT_LOG_ID).setAdditivity(false);
  }
 catch (  IOException e) {
    logError("String_Node_Str",e);
  }
}
Program: 22070
Project: 22070
Buggy source:
/** 
 * Apply the log preferencs
 */
public void applyLogPreferences(IPreferences preferences){
  Logger log=Logger.getLogger(ROOT_LOG_ID);
  log.setLevel(preferences.getLogLevel());
  RollingFileAppender appender=(RollingFileAppender)log.getAppender(PMD_ECLIPSE_APPENDER_NAME);
  if (!appender.getFile().equals(preferences.getLogFileName())) {
    appender.setFile(preferences.getLogFileName());
    appender.activateOptions();
  }
}

Fixed version (ground truth):
/** 
 * Apply the log preferencs
 */
public void applyLogPreferences(IPreferences preferences){
  Logger log=Logger.getLogger(ROOT_LOG_ID);
  log.setLevel(preferences.getLogLevel());
  RollingFileAppender appender=(RollingFileAppender)log.getAppender(PMD_ECLIPSE_APPENDER_NAME);
  if (appender == null) {
    configureLogs(preferences);
  }
 else   if (!appender.getFile().equals(preferences.getLogFileName())) {
    appender.setFile(preferences.getLogFileName());
    appender.activateOptions();
  }
}
Program: 22071
Project: 22071
Buggy source:
/** 
 * @see net.sourceforge.pmd.runtime.properties.IProjectProperties#setProjectWorkingSet(org.eclipse.ui.IWorkingSet)
 */
public void setProjectWorkingSet(final IWorkingSet projectWorkingSet){
  log.debug("String_Node_Str" + this.project.getName() + "String_Node_Str"+ (projectWorkingSet == null ? "String_Node_Str" : projectWorkingSet.getName()));
  this.projectWorkingSet=projectWorkingSet;
}

Fixed version (ground truth):
/** 
 * @see net.sourceforge.pmd.runtime.properties.IProjectProperties#setProjectWorkingSet(org.eclipse.ui.IWorkingSet)
 */
public void setProjectWorkingSet(final IWorkingSet projectWorkingSet){
  log.debug("String_Node_Str" + this.project.getName() + "String_Node_Str"+ (projectWorkingSet == null ? "String_Node_Str" : projectWorkingSet.getName()));
  this.needRebuild|=(this.projectWorkingSet == null) ? (projectWorkingSet != null) : !this.projectWorkingSet.equals(projectWorkingSet);
  this.projectWorkingSet=projectWorkingSet;
}
Program: 22072
Project: 22072
Buggy source:
/** 
 * @see net.sourceforge.pmd.runtime.properties.IProjectProperties#setRuleSetStoredInProject(boolean)
 */
public void setRuleSetStoredInProject(final boolean ruleSetStoredInProject) throws PropertiesException {
  log.debug("String_Node_Str" + this.project.getName() + "String_Node_Str"+ ruleSetStoredInProject);
  this.ruleSetStoredInProject=ruleSetStoredInProject;
  if ((this.ruleSetStoredInProject) && (!isRuleSetFileExist())) {
    throw new PropertiesException("String_Node_Str" + this.project.getName());
  }
}

Fixed version (ground truth):
/** 
 * @see net.sourceforge.pmd.runtime.properties.IProjectProperties#setRuleSetStoredInProject(boolean)
 */
public void setRuleSetStoredInProject(final boolean ruleSetStoredInProject) throws PropertiesException {
  log.debug("String_Node_Str" + this.project.getName() + "String_Node_Str"+ ruleSetStoredInProject);
  this.needRebuild|=this.ruleSetStoredInProject != ruleSetStoredInProject;
  this.ruleSetStoredInProject=ruleSetStoredInProject;
  if ((this.ruleSetStoredInProject) && (!isRuleSetFileExist())) {
    throw new PropertiesException("String_Node_Str" + this.project.getName());
  }
}
Program: 22073
Project: 22073
Buggy source:
/** 
 * Set the rule set from rule specs found in properties file
 * @param rules array of selected rules
 */
private void setRuleSetFromProperties(IProjectProperties projectProperties,RuleSpecTO[] rules) throws PropertiesException {
  final RuleSet ruleSet=new RuleSet();
  final RuleSet pluginRuleSet=PMDRuntimePlugin.getDefault().getPreferencesManager().getRuleSet();
  for (int i=0; i < rules.length; i++) {
    try {
      final Rule rule=pluginRuleSet.getRuleByName(rules[i].getName());
      ruleSet.addRule(rule);
    }
 catch (    RuntimeException e) {
      log.debug("String_Node_Str" + rules[i].getName() + "String_Node_Str");
    }
  }
  projectProperties.setProjectRuleSet(ruleSet);
}

Fixed version (ground truth):
/** 
 * Set the rule set from rule specs found in properties file
 * @param rules array of selected rules
 */
private void setRuleSetFromProperties(IProjectProperties projectProperties,RuleSpecTO[] rules) throws PropertiesException {
  final RuleSet ruleSet=new RuleSet();
  final RuleSet pluginRuleSet=PMDRuntimePlugin.getDefault().getPreferencesManager().getRuleSet();
  int n=rules == null ? 0 : rules.length;
  for (int i=0; i < n; i++) {
    try {
      final Rule rule=pluginRuleSet.getRuleByName(rules[i].getName());
      ruleSet.addRule(rule);
    }
 catch (    RuntimeException e) {
      log.debug("String_Node_Str" + rules[i].getName() + "String_Node_Str");
    }
  }
  projectProperties.setProjectRuleSet(ruleSet);
}
Program: 22074
Project: 22074
Buggy source:
/** 
 * Builds the HitEnum that finds the hits from Lucene.
 */
private List<HitEnum> buildLuceneHitFindingHitEnums() throws IOException {
  Set<String> matchedFields=context.field.fieldOptions().matchedFields();
  if (matchedFields == null) {
    if (!defaultField.canProduceHits()) {
      return Collections.emptyList();
    }
    return Collections.singletonList(defaultField.buildHitEnum());
  }
  List<HitEnum> hitEnums=new ArrayList<HitEnum>(matchedFields.size());
  extraFields=new ArrayList<FieldWrapper>(matchedFields.size());
  for (  String field : matchedFields) {
    FieldWrapper wrapper;
    if (context.fieldName.equals(field)) {
      wrapper=defaultField;
    }
 else {
      wrapper=new FieldWrapper(this,context,weigher,field);
      if (!wrapper.exists()) {
        continue;
      }
    }
    if (wrapper.canProduceHits()) {
      hitEnums.add(wrapper.buildHitEnum());
    }
    extraFields.add(wrapper);
  }
  if (hitEnums.size() == 0) {
    return Collections.emptyList();
  }
  return hitEnums;
}

Fixed version (ground truth):
/** 
 * Builds the HitEnum that finds the hits from Lucene.
 */
private List<HitEnum> buildLuceneHitFindingHitEnums() throws IOException {
  Set<String> matchedFields=context.field.fieldOptions().matchedFields();
  if (matchedFields == null) {
    if (!defaultField.canProduceHits()) {
      return Collections.emptyList();
    }
    return Collections.singletonList(defaultField.buildHitEnum());
  }
  List<HitEnum> hitEnums=new ArrayList<HitEnum>(matchedFields.size());
  extraFields=new ArrayList<FieldWrapper>(matchedFields.size());
  for (  String field : matchedFields) {
    FieldWrapper wrapper;
    if (context.fieldName.equals(field)) {
      wrapper=defaultField;
    }
 else {
      wrapper=new FieldWrapper(this,context,weigher,field);
      if (!wrapper.exists()) {
        continue;
      }
    }
    if (wrapper.canProduceHits()) {
      hitEnums.add(wrapper.buildHitEnum());
    }
    extraFields.add(wrapper);
  }
  if (hitEnums.isEmpty()) {
    return Collections.emptyList();
  }
  return hitEnums;
}
Program: 22075
Project: 22075
Buggy source:
/** 
 * Builds the hit enum including any required wrappers.
 */
private HitEnum buildHitEnum() throws IOException {
  HitEnum e=buildHitFindingHitEnum();
  e=new OverlapMergingHitEnumWrapper(e);
  if (getOption(OPTION_RETURN_DEBUG_GRAPH,false)) {
    e=new GraphvizHitEnum(e);
  }
  return e;
}

Fixed version (ground truth):
/** 
 * Builds the hit enum including any required wrappers.
 */
private HitEnum buildHitEnum() throws IOException {
  HitEnum e=buildHitFindingHitEnum();
  e=new OverlapMergingHitEnumWrapper(e);
  if (getOption(OPTION_RETURN_DEBUG_GRAPH,FALSE)) {
    e=new GraphvizHitEnum(e);
  }
  return e;
}
Program: 22076
Project: 22076
Buggy source:
@SuppressWarnings("String_Node_Str") private List<HitEnum> buildRegexHitEnums() throws IOException {
  boolean luceneRegex=isLuceneRegexFlavor();
  if (luceneRegex) {
    cache.automatonHitEnumFactories=new HashMap<>();
  }
  Boolean caseInsensitiveOption=(Boolean)getOption("String_Node_Str");
  boolean caseInsensitive=caseInsensitiveOption == null ? false : caseInsensitiveOption;
  List<HitEnum> hitEnums=new ArrayList<>();
  List<String> fieldValues=defaultField.getFieldValues();
  if (fieldValues.size() == 0) {
    return hitEnums;
  }
  for (  String regex : getRegexes()) {
    if (luceneRegex) {
      if (caseInsensitive) {
        regex=regex.toLowerCase(getLocale());
      }
      AutomatonHitEnum.Factory factory=cache.automatonHitEnumFactories.get(regex);
      if (factory == null) {
        factory=buildFactoryForRegex(new RegExp(regex));
        cache.automatonHitEnumFactories.put(regex,factory);
      }
      hitEnums.add(buildLuceneRegexHitEnumForRegex(factory,fieldValues,caseInsensitive));
    }
 else {
      int options=0;
      if (caseInsensitive) {
        options|=Pattern.CASE_INSENSITIVE;
      }
      hitEnums.add(buildJavaRegexHitEnumForRegex(Pattern.compile(regex,options),fieldValues));
    }
  }
  return hitEnums;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private List<HitEnum> buildRegexHitEnums() throws IOException {
  boolean luceneRegex=isLuceneRegexFlavor();
  if (luceneRegex) {
    cache.automatonHitEnumFactories=new HashMap<>();
  }
  Boolean caseInsensitiveOption=(Boolean)getOption("String_Node_Str");
  boolean caseInsensitive=caseInsensitiveOption == null ? false : caseInsensitiveOption;
  List<HitEnum> hitEnums=new ArrayList<>();
  List<String> fieldValues=defaultField.getFieldValues();
  if (fieldValues.isEmpty()) {
    return hitEnums;
  }
  for (  String regex : getRegexes()) {
    if (luceneRegex) {
      if (caseInsensitive) {
        regex=regex.toLowerCase(getLocale());
      }
      AutomatonHitEnum.Factory factory=cache.automatonHitEnumFactories.get(regex);
      if (factory == null) {
        factory=buildFactoryForRegex(new RegExp(regex));
        cache.automatonHitEnumFactories.put(regex,factory);
      }
      hitEnums.add(buildLuceneRegexHitEnumForRegex(factory,fieldValues,caseInsensitive));
    }
 else {
      int options=0;
      if (caseInsensitive) {
        options|=Pattern.CASE_INSENSITIVE;
      }
      hitEnums.add(buildJavaRegexHitEnumForRegex(Pattern.compile(regex,options),fieldValues));
    }
  }
  return hitEnums;
}
Program: 22077
Project: 22077
Buggy source:
HighlightField highlight() throws IOException {
  if (shouldSkip()) {
    return null;
  }
  ensureWeigher();
  scoreMatters=context.field.fieldOptions().scoreOrdered();
  if (!scoreMatters) {
    Boolean topScoring=(Boolean)getOption("String_Node_Str");
    scoreMatters=topScoring != null && topScoring;
  }
  defaultField=new FieldWrapper(this,context,weigher);
  int numberOfSnippets=context.field.fieldOptions().numberOfFragments();
  if (numberOfSnippets == 0) {
    numberOfSnippets=1;
  }
  segmenter=new DelayedSegmenter(defaultField);
  List<Snippet> snippets=buildChooser().choose(segmenter,buildHitEnum(),numberOfSnippets);
  if (snippets.size() != 0) {
    cache.lastMatched=true;
    return new HighlightField(context.fieldName,formatSnippets(snippets));
  }
  cache.lastMatched=false;
  int noMatchSize=context.field.fieldOptions().noMatchSize();
  if (noMatchSize <= 0) {
    return null;
  }
  List<String> fieldValues=defaultField.getFieldValues();
  if (fieldValues.isEmpty()) {
    return null;
  }
  Text fragment=new Text(getSegmenterFactory().extractNoMatchFragment(fieldValues.get(0),noMatchSize));
  return new HighlightField(context.fieldName,new Text[]{fragment});
}

Fixed version (ground truth):
HighlightField highlight() throws IOException {
  if (shouldSkip()) {
    return null;
  }
  ensureWeigher();
  scoreMatters=context.field.fieldOptions().scoreOrdered();
  if (!scoreMatters) {
    Boolean topScoring=(Boolean)getOption("String_Node_Str");
    scoreMatters=topScoring != null && topScoring;
  }
  defaultField=new FieldWrapper(this,context,weigher);
  int numberOfSnippets=context.field.fieldOptions().numberOfFragments();
  if (numberOfSnippets == 0) {
    numberOfSnippets=1;
  }
  segmenter=new DelayedSegmenter(defaultField);
  List<Snippet> snippets=buildChooser().choose(segmenter,buildHitEnum(),numberOfSnippets);
  if (!snippets.isEmpty()) {
    cache.lastMatched=true;
    return new HighlightField(context.fieldName,formatSnippets(snippets));
  }
  cache.lastMatched=false;
  int noMatchSize=context.field.fieldOptions().noMatchSize();
  if (noMatchSize <= 0) {
    return null;
  }
  List<String> fieldValues=defaultField.getFieldValues();
  if (fieldValues.isEmpty()) {
    return null;
  }
  Text fragment=new Text(getSegmenterFactory().extractNoMatchFragment(fieldValues.get(0),noMatchSize));
  return new HighlightField(context.fieldName,new Text[]{fragment});
}
Program: 22078
Project: 22078
Buggy source:
private SnippetChooser buildChooser(){
  HitBuilder hitBuilder=Snippet.DEFAULT_HIT_BUILDER;
  if (getOption(OPTION_RETURN_DEBUG_GRAPH,false)) {
    hitBuilder=GraphvizHit.GRAPHVIZ_HIT_BUILDER;
  }
  if (context.field.fieldOptions().scoreOrdered()) {
    return buildScoreBasedSnippetChooser(true,hitBuilder);
  }
  Boolean topScoring=(Boolean)getOption("String_Node_Str");
  if (topScoring != null && topScoring) {
    return buildScoreBasedSnippetChooser(false,hitBuilder);
  }
  return new BasicSourceOrderSnippetChooser(hitBuilder);
}

Fixed version (ground truth):
private SnippetChooser buildChooser(){
  HitBuilder hitBuilder=Snippet.DEFAULT_HIT_BUILDER;
  if (getOption(OPTION_RETURN_DEBUG_GRAPH,FALSE)) {
    hitBuilder=GraphvizHit.GRAPHVIZ_HIT_BUILDER;
  }
  if (context.field.fieldOptions().scoreOrdered()) {
    return buildScoreBasedSnippetChooser(true,hitBuilder);
  }
  Boolean topScoring=(Boolean)getOption("String_Node_Str");
  if (topScoring != null && topScoring) {
    return buildScoreBasedSnippetChooser(false,hitBuilder);
  }
  return new BasicSourceOrderSnippetChooser(hitBuilder);
}
Program: 22080
Project: 22080
Buggy source:
private void ensureWeigher(){
  if (weigher != null) {
    return;
  }
  boolean phraseAsTerms=getOption("String_Node_Str",false);
  boolean removeHighFrequencyTermsFromCommonTerms=getOption("String_Node_Str",true);
  int maxExpandedTerms=getOption("String_Node_Str",1024);
  QueryCacheKey key=new QueryCacheKey(context.query,maxExpandedTerms,phraseAsTerms,removeHighFrequencyTermsFromCommonTerms);
  weigher=cache.queryWeighers.get(key);
  if (weigher != null) {
    return;
  }
  BytesRefHashTermInfos infos=new BytesRefHashTermInfos(BigArrays.NON_RECYCLING_INSTANCE);
  weigher=new BasicQueryWeigher(new ElasticsearchQueryFlattener(maxExpandedTerms,phraseAsTerms,removeHighFrequencyTermsFromCommonTerms),infos,context.hitContext.topLevelReader(),context.query);
  cache.queryWeighers.put(key,weigher);
}

Fixed version (ground truth):
private void ensureWeigher(){
  if (weigher != null) {
    return;
  }
  boolean phraseAsTerms=getOption("String_Node_Str",FALSE);
  boolean removeHighFrequencyTermsFromCommonTerms=getOption("String_Node_Str",TRUE);
  int maxExpandedTerms=getOption("String_Node_Str",1024);
  QueryCacheKey key=new QueryCacheKey(context.query,maxExpandedTerms,phraseAsTerms,removeHighFrequencyTermsFromCommonTerms);
  weigher=cache.queryWeighers.get(key);
  if (weigher != null) {
    return;
  }
  BytesRefHashTermInfos infos=new BytesRefHashTermInfos(BigArrays.NON_RECYCLING_INSTANCE);
  weigher=new BasicQueryWeigher(new ElasticsearchQueryFlattener(maxExpandedTerms,phraseAsTerms,removeHighFrequencyTermsFromCommonTerms),infos,context.hitContext.topLevelReader(),context.query);
  cache.queryWeighers.put(key,weigher);
}
Program: 22081
Project: 22081
Buggy source:
private TermWeigher<BytesRef> getQueryWeigher(boolean mightWeighTermsMultipleTimes){
  return weigher;
}

Fixed version (ground truth):
private TermWeigher<BytesRef> getQueryWeigher(){
  return weigher;
}
Program: 22082
Project: 22082
Buggy source:
public List<String> getFieldValues() throws IOException {
  if (values == null) {
    List<Object> objs=HighlightUtils.loadFieldValues(context.field,context.mapper,context.context,context.hitContext);
    values=new ArrayList<String>(objs.size());
    for (    Object obj : objs) {
      values.add(obj.toString());
    }
  }
  return values;
}

Fixed version (ground truth):
public List<String> getFieldValues() throws IOException {
  if (values == null) {
    List<Object> objs=HighlightUtils.loadFieldValues(context.field,context.mapper,context.context,context.hitContext);
    values=objs.stream().map(Object::toString).collect(toCollection(() -> new ArrayList<>(objs.size())));
  }
  return values;
}
Program: 22083
Project: 22083
Buggy source:
public HitEnum buildHitEnum() throws IOException {
  HitEnum e=buildHitEnumForSource();
  e=weigher.wrap(context.fieldName,e);
  FieldOptions options=context.field.fieldOptions();
  if (!options.scoreOrdered()) {
    Boolean topScoring=(Boolean)executionContext.getOption("String_Node_Str");
    if (topScoring == null || !topScoring) {
      e=new WeightFilteredHitEnumWrapper(e,0f);
      return e;
    }
  }
  @SuppressWarnings("String_Node_Str") Map<String,Object> boostBefore=(Map<String,Object>)executionContext.getOption("String_Node_Str");
  if (boostBefore != null) {
    TreeMap<Integer,Float> ordered=new TreeMap<Integer,Float>();
    for (    Map.Entry<String,Object> entry : boostBefore.entrySet()) {
      if (!(entry.getValue() instanceof Number)) {
        throw new IllegalArgumentException("String_Node_Str");
      }
      ordered.put(Integer.valueOf(entry.getKey()),((Number)entry.getValue()).floatValue());
    }
    PositionBoostingHitEnumWrapper boosting=new PositionBoostingHitEnumWrapper(e);
    e=boosting;
    for (    Map.Entry<Integer,Float> entry : ordered.entrySet()) {
      boosting.add(entry.getKey(),entry.getValue());
    }
  }
  e=new WeightFilteredHitEnumWrapper(e,0f);
  return e;
}

Fixed version (ground truth):
public HitEnum buildHitEnum() throws IOException {
  HitEnum e=buildHitEnumForSource();
  e=weigher.wrap(context.fieldName,e);
  FieldOptions options=context.field.fieldOptions();
  if (!options.scoreOrdered()) {
    Boolean topScoring=(Boolean)executionContext.getOption("String_Node_Str");
    if (topScoring == null || !topScoring) {
      return new WeightFilteredHitEnumWrapper(e,0f);
    }
  }
  @SuppressWarnings("String_Node_Str") Map<String,Object> boostBefore=(Map<String,Object>)executionContext.getOption("String_Node_Str");
  if (boostBefore != null) {
    TreeMap<Integer,Float> ordered=new TreeMap<Integer,Float>();
    for (    Map.Entry<String,Object> entry : boostBefore.entrySet()) {
      if (!(entry.getValue() instanceof Number)) {
        throw new IllegalArgumentException("String_Node_Str");
      }
      ordered.put(Integer.valueOf(entry.getKey()),((Number)entry.getValue()).floatValue());
    }
    PositionBoostingHitEnumWrapper boosting=new PositionBoostingHitEnumWrapper(e);
    e=boosting;
    for (    Map.Entry<Integer,Float> entry : ordered.entrySet()) {
      boosting.add(entry.getKey(),entry.getValue());
    }
  }
  return new WeightFilteredHitEnumWrapper(e,0f);
}
Program: 22084
Project: 22084
Buggy source:
private HitEnum buildPostingsHitEnum() throws IOException {
  return PostingsHitEnum.fromPostings(context.hitContext.reader(),context.hitContext.docId(),context.mapper.fieldType().name(),weigher.acceptableTerms(),getQueryWeigher(false),getCorpusWeigher(false),weigher);
}

Fixed version (ground truth):
private HitEnum buildPostingsHitEnum() throws IOException {
  return PostingsHitEnum.fromPostings(context.hitContext.reader(),context.hitContext.docId(),context.mapper.fieldType().name(),weigher.acceptableTerms(),getQueryWeigher(),getCorpusWeigher(false),weigher);
}
Program: 22085
Project: 22085
Buggy source:
private HitEnum buildTokenStreamHitEnum(Analyzer analyzer,String source) throws IOException {
  TokenStream tokenStream;
  try {
    tokenStream=analyzer.tokenStream(context.fieldName,source);
  }
 catch (  IllegalStateException e) {
    throw new UnsupportedOperationException("String_Node_Str",e);
  }
  this.tokenStream=tokenStream;
  return new TokenStreamHitEnum(tokenStream,getQueryWeigher(true),getCorpusWeigher(true),weigher);
}

Fixed version (ground truth):
private HitEnum buildTokenStreamHitEnum(Analyzer analyzer,String source){
  TokenStream tokenStream;
  try {
    tokenStream=analyzer.tokenStream(context.fieldName,source);
  }
 catch (  IllegalStateException e) {
    throw new UnsupportedOperationException("String_Node_Str",e);
  }
  this.tokenStream=tokenStream;
  return new TokenStreamHitEnum(tokenStream,getQueryWeigher(),getCorpusWeigher(true),weigher);
}
Program: 22086
Project: 22086
Buggy source:
private HitEnum buildTermVectorsHitEnum() throws IOException {
  return PostingsHitEnum.fromTermVectors(context.hitContext.reader(),context.hitContext.docId(),context.mapper.fieldType().name(),weigher.acceptableTerms(),getQueryWeigher(false),getCorpusWeigher(false),weigher);
}

Fixed version (ground truth):
private HitEnum buildTermVectorsHitEnum() throws IOException {
  return PostingsHitEnum.fromTermVectors(context.hitContext.reader(),context.hitContext.docId(),context.mapper.fieldType().name(),weigher.acceptableTerms(),getQueryWeigher(),getCorpusWeigher(false),weigher);
}
Program: 22087
Project: 22087
Buggy source:
@Override public int hashCode(){
  final int prime=31;
  int result=1;
  result=prime * result + maxEdits;
  result=prime * result + prefixLength;
  result=prime * result + ((term == null) ? 0 : term.hashCode());
  result=prime * result + (transpositions ? 1231 : 1237);
  return result;
}

Fixed version (ground truth):
@Override public int hashCode(){
  return Objects.hash(maxEdits,prefixLength,term,transpositions);
}
Program: 22088
Project: 22088
Buggy source:
private static HitEnum fromTerms(Terms terms,CompiledAutomaton acceptable,IndexReader reader,int docId,TermWeigher<BytesRef> queryWeigher,TermWeigher<BytesRef> corpusWeigher,TermSourceFinder<BytesRef> sourceFinder) throws IOException {
  if (terms == null) {
    return EmptyHitEnum.INSTANCE;
  }
  TermsEnum termsEnum=acceptable.getTermsEnum(terms);
  BytesRef term;
  List<HitEnum> enums=new ArrayList<HitEnum>();
  PostingsEnum dp=null;
  while ((term=termsEnum.next()) != null) {
    dp=termsEnum.postings(dp,PostingsEnum.OFFSETS);
    if (dp == null) {
      continue;
    }
    if (docId < 0) {
      if (dp.nextDoc() == DocIdSetIterator.NO_MORE_DOCS) {
        continue;
      }
    }
 else {
      if (dp.advance(docId) != docId) {
        continue;
      }
    }
    HitEnum e=new PostingsHitEnum(dp,queryWeigher.weigh(term),corpusWeigher.weigh(term),sourceFinder.source(term));
    enums.add(e);
    dp=null;
  }
switch (enums.size()) {
case 0:
    return EmptyHitEnum.INSTANCE;
case 1:
  return enums.get(0);
default :
}
return new MergingHitEnum(enums,HitEnum.LessThans.POSITION);
}

Fixed version (ground truth):
private static HitEnum fromTerms(Terms terms,CompiledAutomaton acceptable,int docId,TermWeigher<BytesRef> queryWeigher,TermWeigher<BytesRef> corpusWeigher,TermSourceFinder<BytesRef> sourceFinder) throws IOException {
  if (terms == null) {
    return EmptyHitEnum.INSTANCE;
  }
  TermsEnum termsEnum=acceptable.getTermsEnum(terms);
  BytesRef term;
  List<HitEnum> enums=new ArrayList<HitEnum>();
  PostingsEnum dp=null;
  while ((term=termsEnum.next()) != null) {
    dp=termsEnum.postings(dp,PostingsEnum.OFFSETS);
    if (dp == null) {
      continue;
    }
    if (docId < 0) {
      if (dp.nextDoc() == DocIdSetIterator.NO_MORE_DOCS) {
        continue;
      }
    }
 else {
      if (dp.advance(docId) != docId) {
        continue;
      }
    }
    HitEnum e=new PostingsHitEnum(dp,queryWeigher.weigh(term),corpusWeigher.weigh(term),sourceFinder.source(term));
    enums.add(e);
    dp=null;
  }
switch (enums.size()) {
case 0:
    return EmptyHitEnum.INSTANCE;
case 1:
  return enums.get(0);
default :
}
return new MergingHitEnum(enums,HitEnum.LessThans.POSITION);
}
Program: 22089
Project: 22089
Buggy source:
public static HitEnum fromTermVectors(IndexReader reader,int docId,String fieldName,CompiledAutomaton acceptable,TermWeigher<BytesRef> queryWeigher,TermWeigher<BytesRef> corpusWeigher,TermSourceFinder<BytesRef> sourceFinder) throws IOException {
  Fields vectors=reader.getTermVectors(docId);
  if (vectors == null) {
    return EmptyHitEnum.INSTANCE;
  }
  return fromTerms(vectors.terms(fieldName),acceptable,reader,-1,queryWeigher,corpusWeigher,sourceFinder);
}

Fixed version (ground truth):
public static HitEnum fromTermVectors(IndexReader reader,int docId,String fieldName,CompiledAutomaton acceptable,TermWeigher<BytesRef> queryWeigher,TermWeigher<BytesRef> corpusWeigher,TermSourceFinder<BytesRef> sourceFinder) throws IOException {
  Fields vectors=reader.getTermVectors(docId);
  if (vectors == null) {
    return EmptyHitEnum.INSTANCE;
  }
  return fromTerms(vectors.terms(fieldName),acceptable,-1,queryWeigher,corpusWeigher,sourceFinder);
}
Program: 22090
Project: 22090
Buggy source:
public static HitEnum fromPostings(IndexReader reader,int docId,String fieldName,CompiledAutomaton acceptable,TermWeigher<BytesRef> queryWeigher,TermWeigher<BytesRef> corpusWeigher,TermSourceFinder<BytesRef> sourceFinder) throws IOException {
  List<LeafReaderContext> leaves=reader.getContext().leaves();
  int leaf=ReaderUtil.subIndex(docId,leaves);
  LeafReaderContext subcontext=leaves.get(leaf);
  LeafReader atomicReader=subcontext.reader();
  docId-=subcontext.docBase;
  return fromTerms(atomicReader.terms(fieldName),acceptable,reader,docId,queryWeigher,corpusWeigher,sourceFinder);
}

Fixed version (ground truth):
public static HitEnum fromPostings(IndexReader reader,int docId,String fieldName,CompiledAutomaton acceptable,TermWeigher<BytesRef> queryWeigher,TermWeigher<BytesRef> corpusWeigher,TermSourceFinder<BytesRef> sourceFinder) throws IOException {
  List<LeafReaderContext> leaves=reader.getContext().leaves();
  int leaf=ReaderUtil.subIndex(docId,leaves);
  LeafReaderContext subcontext=leaves.get(leaf);
  LeafReader atomicReader=subcontext.reader();
  docId-=subcontext.docBase;
  return fromTerms(atomicReader.terms(fieldName),acceptable,docId,queryWeigher,corpusWeigher,sourceFinder);
}
Program: 22091
Project: 22091
Buggy source:
@Override public boolean next(){
  try {
    if (!tokenStream.incrementToken()) {
      return false;
    }
    BytesRef term=termRef.getBytesRef();
    position+=positionIncr.getPositionIncrement();
    queryWeight=queryWeigher.weigh(term);
    corpusWeight=corpusWeigher.weigh(term);
    source=sourceFinder.source(term);
    return true;
  }
 catch (  IOException e) {
    throw new WrappedExceptionFromLucene(e);
  }
}

Fixed version (ground truth):
@Override @SuppressFBWarnings(value="String_Node_Str",justification="String_Node_Str") public boolean next(){
  try {
    if (!tokenStream.incrementToken()) {
      return false;
    }
    BytesRef term=termRef.getBytesRef();
    position+=positionIncr.getPositionIncrement();
    queryWeight=queryWeigher.weigh(term);
    corpusWeight=corpusWeigher.weigh(term);
    source=sourceFinder.source(term);
    return true;
  }
 catch (  IOException e) {
    throw new WrappedExceptionFromLucene(e);
  }
}
Program: 22092
Project: 22092
Buggy source:
@Override public String toString(){
  StringBuilder b=new StringBuilder();
  for (int p=0; p < phrase.length; p++) {
    if (p != 0) {
      b.append("String_Node_Str");
    }
    b.append(Arrays.toString(phrase[p]));
  }
  return b.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  StringBuilder b=new StringBuilder();
  for (int p=0; p < phrase.length; p++) {
    if (p != 0) {
      b.append(':');
    }
    b.append(Arrays.toString(phrase[p]));
  }
  return b.toString();
}
Program: 22093
Project: 22093
Buggy source:
@SuppressWarnings("String_Node_Str") public PriorityQueue(int maxSize,boolean prepopulate){
  size=0;
  int heapSize;
  if (0 == maxSize) {
    heapSize=2;
  }
 else {
    if (maxSize > MAX_ARRAY_LENGTH) {
      throw new IllegalArgumentException("String_Node_Str" + MAX_ARRAY_LENGTH + "String_Node_Str"+ maxSize);
    }
 else {
      heapSize=maxSize + 1;
    }
  }
  heap=(T[])new Object[heapSize];
  this.maxSize=maxSize;
  if (prepopulate) {
    T sentinel=getSentinelObject();
    if (sentinel != null) {
      heap[1]=sentinel;
      for (int i=2; i < heap.length; i++) {
        heap[i]=getSentinelObject();
      }
      size=maxSize;
    }
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @SuppressFBWarnings(value={"String_Node_Str","String_Node_Str"},justification="String_Node_Str") public PriorityQueue(int maxSize,boolean prepopulate){
  size=0;
  int heapSize;
  if (0 == maxSize) {
    heapSize=2;
  }
 else {
    if (maxSize > MAX_ARRAY_LENGTH) {
      throw new IllegalArgumentException("String_Node_Str" + MAX_ARRAY_LENGTH + "String_Node_Str"+ maxSize);
    }
 else {
      heapSize=maxSize + 1;
    }
  }
  heap=(T[])new Object[heapSize];
  this.maxSize=maxSize;
  if (prepopulate) {
    T sentinel=getSentinelObject();
    if (sentinel != null) {
      heap[1]=sentinel;
      for (int i=2; i < heap.length; i++) {
        heap[i]=getSentinelObject();
      }
      size=maxSize;
    }
  }
}
Program: 22094
Project: 22094
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + delegate.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + delegate;
}
Program: 22095
Project: 22095
Buggy source:
@Override public String toString(){
  StringBuilder b=new StringBuilder(100).append('[');
  for (int p=0; p < phrase.length; p++) {
    if (p != 0) {
      b.append("String_Node_Str");
    }
    b.append(Arrays.toString(phrase[p]));
  }
  return b.append("String_Node_Str").append(phraseSlop).append('\u21D2').append(phraseWeight).append('(').append(wrapped).append(')').toString();
}

Fixed version (ground truth):
@Override public String toString(){
  StringBuilder b=new StringBuilder(100).append('[');
  for (int p=0; p < phrase.length; p++) {
    if (p != 0) {
      b.append(':');
    }
    b.append(Arrays.toString(phrase[p]));
  }
  return b.append("String_Node_Str").append(phraseSlop).append('\u21D2').append(phraseWeight).append('(').append(wrapped).append(')').toString();
}
Program: 22096
Project: 22096
Buggy source:
@Override public float weigh(List<Hit> hits){
switch (hits.size()) {
case 0:
    return 0;
case 1:
  return base * hits.get(0).weight();
default :
}
Hit[] sorted=new Hit[hits.size()];
for (int i=0; i < hits.size(); i++) {
sorted[i]=hits.get(i);
}
Arrays.sort(sorted,new SourceComparator());
float weight=0;
int lastSource=sorted[0].source();
float sum=sorted[0].weight();
int count=1;
for (int i=1; i < hits.size(); i++) {
Hit current=sorted[i];
if (lastSource != current.source()) {
  weight+=Math.pow(base,count) * sum / count;
  lastSource=current.source();
  sum=current.weight();
  count=1;
  continue;
}
sum+=current.weight();
count++;
}
weight+=Math.pow(base,count) * sum / count;
return weight;
}

Fixed version (ground truth):
@Override @SuppressFBWarnings(value="String_Node_Str",justification="String_Node_Str") public float weigh(List<Hit> hits){
switch (hits.size()) {
case 0:
    return 0;
case 1:
  return base * hits.get(0).weight();
default :
}
Hit[] sorted=hits.toArray(new Hit[hits.size()]);
Arrays.sort(sorted,new SourceComparator());
float weight=0;
int lastSource=sorted[0].source();
float sum=sorted[0].weight();
int count=1;
for (int i=1; i < hits.size(); i++) {
Hit current=sorted[i];
if (lastSource != current.source()) {
  weight+=Math.pow(base,count) * sum / count;
  lastSource=current.source();
  sum=current.weight();
  count=1;
  continue;
}
sum+=current.weight();
count++;
}
weight+=Math.pow(base,count) * sum / count;
return weight;
}
Program: 22097
Project: 22097
Buggy source:
/** 
 * Add a node to the current graph with extra infos
 * @param hitEnum
 * @param params
 * @return the node id
 */
public int addNode(HitEnum hitEnum,Map<String,Object> params){
  int id=getHitEnumId(hitEnum);
  graph.append("String_Node_Str").append(id).append("String_Node_Str").append(hitEnum.getClass().getSimpleName()).append("String_Node_Str").append("String_Node_Str").append(hitEnum.position()).append("String_Node_Str").append("String_Node_Str").append(hitEnum.startOffset()).append("String_Node_Str").append(hitEnum.endOffset()).append("String_Node_Str").append("String_Node_Str").append("String_Node_Str").append(hitEnum.corpusWeight()).append("String_Node_Str").append(hitEnum.queryWeight()).append("String_Node_Str");
  appendKeyValue("String_Node_Str",hitEnum.source());
  if (!params.isEmpty()) {
    for (    Map.Entry<String,Object> en : params.entrySet()) {
      appendKeyValue(en.getKey(),en.getValue());
    }
  }
  graph.append("String_Node_Str");
  return id;
}

Fixed version (ground truth):
/** 
 * Add a node to the current graph with extra infos
 * @param hitEnum
 * @param params
 * @return the node id
 */
public int addNode(HitEnum hitEnum,Map<String,Object> params){
  int id=getHitEnumId(hitEnum);
  graph.append("String_Node_Str").append(id).append("String_Node_Str").append(hitEnum.getClass().getSimpleName()).append("String_Node_Str").append("String_Node_Str").append(hitEnum.position()).append("String_Node_Str").append('[').append(hitEnum.startOffset()).append("String_Node_Str").append(hitEnum.endOffset()).append(']').append("String_Node_Str").append("String_Node_Str").append(hitEnum.corpusWeight()).append("String_Node_Str").append(hitEnum.queryWeight()).append("String_Node_Str");
  appendKeyValue("String_Node_Str",hitEnum.source());
  if (!params.isEmpty()) {
    for (    Map.Entry<String,Object> en : params.entrySet()) {
      appendKeyValue(en.getKey(),en.getValue());
    }
  }
  graph.append("String_Node_Str");
  return id;
}
Program: 22098
Project: 22098
Buggy source:
/** 
 * @return Generate the Graph of the HitEnum state
 */
public String generateGraph(HitEnum hitEnum){
  graph.setLength(0);
  links.clear();
  graph.append("String_Node_Str");
  graph.append("String_Node_Str");
  graph.append("String_Node_Str");
  hitEnum.toGraph(this);
  graph.append("String_Node_Str");
  writeLinks();
  graph.append("String_Node_Str");
  return graph.toString();
}

Fixed version (ground truth):
/** 
 * @return Generate the Graph of the HitEnum state
 */
public String generateGraph(HitEnum hitEnum){
  graph.setLength(0);
  links.clear();
  graph.append("String_Node_Str");
  graph.append("String_Node_Str");
  graph.append("String_Node_Str");
  hitEnum.toGraph(this);
  graph.append("String_Node_Str");
  writeLinks();
  graph.append('}');
  return graph.toString();
}
Program: 22099
Project: 22099
Buggy source:
private void writeLinks(){
  for (  Link link : links) {
    graph.append("String_Node_Str").append(link.from).append("String_Node_Str").append(link.to).append("String_Node_Str");
  }
}

Fixed version (ground truth):
private void writeLinks(){
  for (  Link link : links) {
    graph.append(' ').append(link.from).append("String_Node_Str").append(link.to).append('\n');
  }
}
Program: 22100
Project: 22100
Buggy source:
@Override public String format(Snippet snippet){
  StringBuilder b=new StringBuilder();
  for (  Hit hit : snippet.hits()) {
    if (!(hit instanceof GraphvizHit)) {
      throw new IllegalArgumentException("String_Node_Str" + GraphvizHit.class + "String_Node_Str"+ hit.getClass()+ "String_Node_Str");
    }
    GraphvizHit hitGraph=(GraphvizHit)hit;
    b.append(extracter.extract(hit.startOffset(),hit.endOffset())).append("String_Node_Str").append(hitGraph.getGraph()).append("String_Node_Str");
  }
  return b.toString();
}

Fixed version (ground truth):
@Override public String format(Snippet snippet){
  StringBuilder b=new StringBuilder();
  for (  Hit hit : snippet.hits()) {
    if (!(hit instanceof GraphvizHit)) {
      throw new IllegalArgumentException("String_Node_Str" + GraphvizHit.class + "String_Node_Str"+ hit.getClass()+ "String_Node_Str");
    }
    GraphvizHit hitGraph=(GraphvizHit)hit;
    b.append(extracter.extract(hit.startOffset(),hit.endOffset())).append("String_Node_Str").append(hitGraph.getGraph()).append('\n');
  }
  return b.toString();
}
Program: 22101
Project: 22101
Buggy source:
/** 
 * Build with a provided cache.
 */
public CachingTermWeigher(Cache<T> cache,TermWeigher<T> next){
  this.cache=cache;
  this.next=next;
}

Fixed version (ground truth):
/** 
 * Build with a provided cache.
 * @param cache the cache backend to use
 * @param next the term weigher to cache
 */
public CachingTermWeigher(Cache<T> cache,TermWeigher<T> next){
  this.cache=cache;
  this.next=next;
}
Program: 22102
Project: 22102
Buggy source:
@Override public boolean next(){
  if (position == -1) {
    endOffset=itr.next();
  }
 else {
    startOffset=endOffset;
    endOffset=itr.next();
  }
  position++;
  if (endOffset == BreakIterator.DONE) {
    return false;
  }
 else {
    weight=weigher.weight(position,startOffset,endOffset);
    return true;
  }
}

Fixed version (ground truth):
@Override public boolean next(){
  if (position == -1) {
    endOffset=itr.next();
  }
 else {
    startOffset=endOffset;
    endOffset=itr.next();
  }
  position++;
  if (endOffset == BreakIterator.DONE) {
    return false;
  }
 else {
    queryWeight=queryWeigher.weight(position,startOffset,endOffset);
    corpusWeight=corpusWeigher.weight(position,startOffset,endOffset);
    return true;
  }
}
Program: 22103
Project: 22103
Buggy source:
public BreakIteratorHitEnum(BreakIterator itr,HitWeigher weigher){
  this.itr=itr;
  this.weigher=weigher;
  startOffset=itr.first();
}

Fixed version (ground truth):
public BreakIteratorHitEnum(BreakIterator itr,HitWeigher queryWeigher,HitWeigher corpusWeigher){
  this.itr=itr;
  this.queryWeigher=queryWeigher;
  this.corpusWeigher=corpusWeigher;
  startOffset=itr.first();
}
Program: 22104
Project: 22104
Buggy source:
/** 
 * Record the current position of e.
 */
public void recordCurrent(HitEnum e){
  record(e.position(),e.startOffset(),e.endOffset(),e.weight(),e.source());
}

Fixed version (ground truth):
/** 
 * Record the current position of e.
 */
public void recordCurrent(HitEnum e){
  record(e.position(),e.startOffset(),e.endOffset(),e.queryWeight(),e.corpusWeight(),e.source());
}