nus-yam/ex-repair huggingface dataset:
Program: 170071
Project: 170071
Buggy source:
/** 
 * Create a   {@link StreamState} for a stream
 * @param senderStreamId
 * @param isNew
 */
public StreamState calculateStreamState(Stream stream,UUID senderStreamId,boolean isNew){
  StreamState result=new StreamState();
  result.isNewStream=isNew;
  for (  Snapshot sn : streamService.getSnapshots(stream).values()) {
    if (Objects.equal(senderStreamId,sn.senderStreamId)) {
      result.availableSnapshotNumbers.add(sn.nr);
    }
  }
  result.availableSnapshotNumbers.addAll(streamService.getSnapshots(stream).keySet());
  return result;
}

Fixed version (ground truth):
/** 
 * Create a   {@link StreamState} for a stream
 * @param isNew
 */
public StreamState calculateStreamState(Stream stream,boolean isNew){
  StreamState result=new StreamState();
  result.isNewStream=isNew;
  for (  Snapshot sn : streamService.getSnapshots(stream).values()) {
    result.availableSnapshots.add(new SnapshotEntry(sn));
  }
  return result;
}
Program: 170072
Project: 170072
Buggy source:
List<SendFileSpec> determineSendFiles(TreeMap<Integer,Snapshot> sourceSnapshots,VersionHistory versionHistory,Set<Integer> targetSnapshotNrs){
  List<Snapshot> missingSnapshots=calculateMissingSnapshots(sourceSnapshots.values(),targetSnapshotNrs);
  TreeSet<Integer> availableCloneSources=new TreeSet<>();
  for (  int nr : targetSnapshotNrs) {
    if (sourceSnapshots.containsKey(nr)) {
      availableCloneSources.add(nr);
    }
  }
  ArrayList<SendFileSpec> result=new ArrayList<>();
  for (  Snapshot snapshot : missingSnapshots) {
    SendFileSpec spec=new SendFileSpec();
    spec.target=snapshot;
{
      Integer nextNr=calculateNextSnapshotNr(snapshot,availableCloneSources);
      if (nextNr != null) {
        spec.cloneSources.add(sourceSnapshots.get(nextNr));
      }
    }
{
      Set<Integer> ancestors=calculateAncestorNrs(snapshot,versionHistory,availableCloneSources);
      for (      Integer ancestorNr : ancestors) {
        spec.cloneSources.add(sourceSnapshots.get(ancestorNr));
      }
    }
    result.add(spec);
    availableCloneSources.add(snapshot.nr);
  }
  return result;
}

Fixed version (ground truth):
List<SendFileSpec> determineSendFiles(UUID sourceStreamId,TreeMap<Integer,Snapshot> sourceSnapshots,VersionHistory versionHistory,Set<SnapshotEntry> availableSnapshots){
  List<Snapshot> missingSnapshots=calculateMissingSnapshots(sourceSnapshots.values(),availableSnapshots);
  TreeSet<Integer> availableCloneSources=new TreeSet<>();
  for (  SnapshotEntry entry : availableSnapshots) {
    if (sourceSnapshots.containsKey(entry.snapshotNr) && Objects.equal(entry.senderStreamId,sourceStreamId)) {
      availableCloneSources.add(entry.snapshotNr);
    }
  }
  ArrayList<SendFileSpec> result=new ArrayList<>();
  for (  Snapshot snapshot : missingSnapshots) {
    SendFileSpec spec=new SendFileSpec();
    spec.target=snapshot;
{
      Integer nextNr=calculateNextSnapshotNr(snapshot,availableCloneSources);
      if (nextNr != null) {
        spec.cloneSources.add(sourceSnapshots.get(nextNr));
      }
    }
{
      Set<Integer> ancestors=calculateAncestorNrs(snapshot,versionHistory,availableCloneSources);
      for (      Integer ancestorNr : ancestors) {
        spec.cloneSources.add(sourceSnapshots.get(ancestorNr));
      }
    }
    result.add(spec);
    availableCloneSources.add(snapshot.nr);
  }
  return result;
}
Program: 170073
Project: 170073
Buggy source:
/** 
 * Determines the ancestors of the given snapshot which are available on the target
 */
Set<Integer> calculateAncestorNrs(Snapshot snapshot,VersionHistory versionHistory,TreeSet<Integer> availableCloneSources){
  Set<Integer> result=new HashSet<>();
  TreeMap<Integer,HistoryNode> nodes=versionHistory.calculateNodes();
  log.debug("String_Node_Str" + nodes);
  HistoryNode node=nodes.get(snapshot.nr);
  fillAvailableAncestors(node,result,availableCloneSources);
  return result;
}

Fixed version (ground truth):
/** 
 * Determines the ancestors of the given snapshot which are available on the target
 */
Set<Integer> calculateAncestorNrs(Snapshot snapshot,VersionHistory versionHistory,TreeSet<Integer> availableCloneSources){
  Set<Integer> result=new HashSet<>();
  TreeMap<Integer,HistoryNode> nodes=versionHistory.calculateNodes();
  HistoryNode node=nodes.get(snapshot.nr);
  fillAvailableAncestors(node,result,availableCloneSources);
  return result;
}
Program: 170074
Project: 170074
Buggy source:
List<Snapshot> calculateMissingSnapshots(Collection<Snapshot> sourceSnapshots,Set<Integer> targetSnapshotNrs){
  List<Snapshot> result=new ArrayList<>();
  for (  Snapshot s : sourceSnapshots) {
    if (!targetSnapshotNrs.contains(s.nr)) {
      result.add(s);
    }
  }
  return result;
}

Fixed version (ground truth):
List<Snapshot> calculateMissingSnapshots(Collection<Snapshot> sourceSnapshots,Set<SnapshotEntry> availableSnapshots){
  List<Snapshot> result=new ArrayList<>();
  HashSet<Integer> availableSnapshotNrs=new HashSet<>();
  for (  SnapshotEntry e : availableSnapshots) {
    availableSnapshotNrs.add(e.snapshotNr);
  }
  for (  Snapshot s : sourceSnapshots) {
    if (!availableSnapshotNrs.contains(s.nr)) {
      result.add(s);
    }
  }
  return result;
}
Program: 170075
Project: 170075
Buggy source:
private void parseCmdLine(String[] args){
  CmdLineParser parser=new CmdLineParser(this);
  parser.setUsageWidth(80);
  try {
    parser.parseArgument(args);
    if (arguments.isEmpty()) {
      throw new CmdLineException(parser,"String_Node_Str");
    }
  }
 catch (  CmdLineException e) {
    System.err.println("String_Node_Str" + e.getMessage());
    try {
      ByteStreams.copy(getClass().getResourceAsStream("String_Node_Str"),System.err);
    }
 catch (    IOException e1) {
      throw new RuntimeException("String_Node_Str",e1);
    }
    System.err.println("String_Node_Str");
    parser.printUsage(System.err);
    System.err.println();
    System.exit(1);
  }
  btrfsService.setUseSudo(sudoLocalBtrfs);
  sshService.setSudoRemoteBtrbck(sudoRemoteBtrbck);
  sshService.setSudoRemoteBtrfs(sudoRemoteBtrfs);
  if (verbose) {
    org.apache.log4j.Logger.getRootLogger().setLevel(Level.DEBUG);
    sshService.setVerboseRemote(verbose);
  }
}

Fixed version (ground truth):
private void parseCmdLine(String[] args){
  CmdLineParser parser=new CmdLineParser(this);
  parser.setUsageWidth(80);
  try {
    parser.parseArgument(args);
    if (arguments.isEmpty()) {
      throw new CmdLineException(parser,"String_Node_Str");
    }
  }
 catch (  CmdLineException e) {
    System.err.println("String_Node_Str" + e.getMessage());
    try {
      ByteStreams.copy(getClass().getResourceAsStream("String_Node_Str"),System.err);
    }
 catch (    IOException e1) {
      throw new RuntimeException("String_Node_Str",e1);
    }
    System.err.println("String_Node_Str");
    parser.printUsage(System.err);
    System.err.println();
    System.exit(1);
  }
  btrfsService.setUseSudo(sudoLocalBtrfs);
  btrfsService.setUseStrace(useStrace);
  sshService.setSudoRemoteBtrbck(sudoRemoteBtrbck);
  sshService.setSudoRemoteBtrfs(sudoRemoteBtrfs);
  if (verbose) {
    org.apache.log4j.Logger.getRootLogger().setLevel(Level.DEBUG);
    sshService.setVerboseRemote(verbose);
  }
}
Program: 170077
Project: 170077
Buggy source:
@Override public void add(Obs obs){
  Object subKeyValue=obs.get(subKey);
  if (subKeyValue != null) {
    String skv=subKeyValue.toString();
    Map<String,GenericData.Record> inner=(Map<String,GenericData.Record>)wrapper.get("String_Node_Str");
    Schema vschema=intermediate.getField("String_Node_Str").schema().getValueType();
    GenericData.Record innerValue=new GenericData.Record(vschema);
    for (    Map.Entry<String,String> e : values.entrySet()) {
      if (!subKey.equals(e.getKey())) {
        innerValue.put(e.getValue(),obs.get(e.getKey()));
      }
    }
    GenericData.Record sum=(GenericData.Record)SumTbl.add(inner.get(skv),innerValue,vschema);
    inner.put(skv,sum);
  }
}

Fixed version (ground truth):
@Override public void add(Obs obs){
  Object subKeyValue=obs.get(subKey);
  if (subKeyValue != null) {
    String skv=subKeyValue.toString();
    Map<CharSequence,GenericData.Record> inner=(Map<CharSequence,GenericData.Record>)wrapper.get("String_Node_Str");
    Schema vschema=intermediate.getField("String_Node_Str").schema().getValueType();
    GenericData.Record innerValue=new GenericData.Record(vschema);
    for (    Map.Entry<String,String> e : values.entrySet()) {
      if (!subKey.equals(e.getKey())) {
        innerValue.put(e.getValue(),obs.get(e.getKey()));
      }
    }
    GenericData.Record sum=(GenericData.Record)SumTbl.add(inner.get(skv),innerValue,vschema);
    inner.put(skv,sum);
  }
}
Program: 170078
Project: 170078
Buggy source:
@Override public GenericData.Record merge(GenericData.Record current,GenericData.Record next){
  if (current == null) {
    return next;
  }
  Map<String,GenericData.Record> curValue=(Map<String,GenericData.Record>)current.get("String_Node_Str");
  Map<String,GenericData.Record> nextValue=(Map<String,GenericData.Record>)next.get("String_Node_Str");
  Schema vschema=intermediate.getField("String_Node_Str").schema().getValueType();
  for (  String key : Sets.union(curValue.keySet(),nextValue.keySet())) {
    GenericData.Record sum=(GenericData.Record)SumTbl.add(curValue.get(key),nextValue.get(key),vschema);
    current.put(key,sum);
  }
  return current;
}

Fixed version (ground truth):
@Override public GenericData.Record merge(GenericData.Record current,GenericData.Record next){
  if (current == null) {
    return next;
  }
  Map<CharSequence,GenericData.Record> curValue=(Map<CharSequence,GenericData.Record>)current.get("String_Node_Str");
  Map<CharSequence,GenericData.Record> nextValue=(Map<CharSequence,GenericData.Record>)next.get("String_Node_Str");
  Schema vschema=intermediate.getField("String_Node_Str").schema().getValueType();
  for (  CharSequence key : Sets.union(curValue.keySet(),nextValue.keySet())) {
    GenericData.Record sum=(GenericData.Record)SumTbl.add(curValue.get(key),nextValue.get(key),vschema);
    current.put(key.toString(),sum);
  }
  return current;
}
Program: 170079
Project: 170079
Buggy source:
@Override public void process(Pair<Pair<GenericData.Record,Integer>,Iterable<Pair<Integer,GenericData.Record>>> input,Emitter<Pair<Pair<GenericData.Record,Integer>,Pair<Integer,GenericData.Record>>> emitter){
  GenericData.Record key=input.first().first();
  int outIdx=(Integer)key.get("String_Node_Str");
  AggConfig ac=null;
  int aggIdx=-1;
  GenericData.Record merged=null;
  for (  Pair<Integer,GenericData.Record> p : input.second()) {
    if (aggIdx < 0 || aggIdx != p.first()) {
      if (aggIdx >= 0) {
        emitter.emit(Pair.of(Pair.of(key,aggIdx),Pair.of(aggIdx,merged)));
      }
      aggIdx=p.first();
      ac=configs.get(outIdx).aggregates.get(aggIdx);
      merged=null;
    }
    merged=ac.merge(merged,p.second());
  }
  if (aggIdx >= 0) {
    emitter.emit(Pair.of(Pair.of(key,aggIdx),Pair.of(aggIdx,merged)));
  }
}

Fixed version (ground truth):
@Override public void process(Pair<Pair<GenericData.Record,Integer>,Iterable<Pair<Integer,GenericData.Record>>> input,Emitter<Pair<Pair<GenericData.Record,Integer>,Pair<Integer,GenericData.Record>>> emitter){
  GenericData.Record key=input.first().first();
  int outIdx=(Integer)key.get("String_Node_Str");
  AggConfig ac=null;
  int aggIdx=-1;
  GenericData.Record merged=null;
  for (  Pair<Integer,GenericData.Record> p : input.second()) {
    if (aggIdx < 0 || aggIdx != p.first()) {
      if (aggIdx >= 0) {
        increment("String_Node_Str","String_Node_Str");
        GenericData.Record outValue=new GenericData.Record(provider.get(1));
        outValue.put("String_Node_Str",merged);
        emitter.emit(Pair.of(Pair.of(key,aggIdx),Pair.of(aggIdx,outValue)));
      }
      aggIdx=p.first();
      ac=configs.get(outIdx).aggregates.get(aggIdx);
      merged=null;
    }
    merged=ac.merge(merged,(GenericData.Record)p.second().get("String_Node_Str"));
  }
  if (aggIdx >= 0) {
    increment("String_Node_Str","String_Node_Str");
    GenericData.Record outValue=new GenericData.Record(provider.get(1));
    outValue.put("String_Node_Str",merged);
    emitter.emit(Pair.of(Pair.of(key,aggIdx),Pair.of(aggIdx,outValue)));
  }
}
Program: 170080
Project: 170080
Buggy source:
public ExCombiner(List<OutputConfig> configs){
  this.configs=configs;
}

Fixed version (ground truth):
public ExCombiner(SchemaProvider provider,List<OutputConfig> configs){
  this.provider=provider;
  this.configs=configs;
}
Program: 170083
Project: 170083
Buggy source:
private void setupComputeReader(YamlReader reader) throws Exception {
  reader.getConfig().setPropertyElementType(ComputeConfig.class,"String_Node_Str",OutputConfig.class);
  reader.getConfig().setPropertyElementType(OutputConfig.class,"String_Node_Str",AggConfig.class);
  reader.getConfig().setPropertyElementType(MetricConfig.class,"String_Node_Str",PivotCalculator.Key.class);
}

Fixed version (ground truth):
private void setupComputeReader(YamlReader reader) throws Exception {
  reader.getConfig().setPropertyElementType(ComputeConfig.class,"String_Node_Str",MetricConfig.class);
  reader.getConfig().setPropertyElementType(ComputeConfig.class,"String_Node_Str",OutputConfig.class);
  reader.getConfig().setPropertyElementType(OutputConfig.class,"String_Node_Str",AggConfig.class);
  reader.getConfig().setPropertyElementType(MetricConfig.class,"String_Node_Str",PivotCalculator.Key.class);
}
Program: 170084
Project: 170084
Buggy source:
@Override public void process(Pair<Integer,GenericData.Record> input,Emitter<GenericData.Record> emitter){
  if (outputIndex == input.first()) {
    emitter.emit(input.second());
  }
}

Fixed version (ground truth):
@Override public void process(Pair<Integer,GenericData.Record> input,Emitter<GenericData.Record> emitter){
  if (outputIndex == input.first()) {
    emitter.emit((GenericData.Record)input.second().get("String_Node_Str"));
  }
}
Program: 170085
Project: 170085
Buggy source:
@Override public void process(Pair<Pair<GenericData.Record,Integer>,Pair<Integer,GenericData.Record>> input,Emitter<Pair<Integer,GenericData.Record>> emitter){
  if (lastKey == null || !lastKey.equals(input.first().first())) {
    if (lastKey != null) {
      emitter.emit(Pair.of(outputIndex,lastValue));
    }
    lastKey=input.first().first();
    outputIndex=(Integer)lastKey.get("String_Node_Str");
    lastValue=new GenericData.Record(schemas.get(outputIndex));
    GenericRecord innerKey=(GenericRecord)lastKey.get("String_Node_Str");
    for (    Schema.Field sf : innerKey.getSchema().getFields()) {
      lastValue.put(sf.name(),innerKey.get(sf.name()));
    }
  }
  GenericData.Record value=input.second().second();
  for (  Schema.Field sf : value.getSchema().getFields()) {
    lastValue.put(sf.name(),value.get(sf.name()));
  }
}

Fixed version (ground truth):
@Override public void process(Pair<Pair<GenericData.Record,Integer>,Pair<Integer,GenericData.Record>> input,Emitter<Pair<Integer,GenericData.Record>> emitter){
  if (lastKey == null || !lastKey.equals(input.first().first())) {
    if (lastKey != null) {
      GenericData.Record wrapper=new GenericData.Record(wrapperSchema);
      wrapper.put("String_Node_Str",lastValue);
      increment("String_Node_Str","String_Node_Str" + outputIndex);
      emitter.emit(Pair.of(outputIndex,wrapper));
    }
    lastKey=input.first().first();
    outputIndex=(Integer)lastKey.get("String_Node_Str");
    lastValue=new GenericData.Record(schemas.get(outputIndex));
    GenericRecord innerKey=(GenericRecord)lastKey.get("String_Node_Str");
    for (    Schema.Field sf : innerKey.getSchema().getFields()) {
      lastValue.put(sf.name(),innerKey.get(sf.name()));
    }
  }
  GenericData.Record value=(GenericData.Record)input.second().second().get("String_Node_Str");
  for (  Schema.Field sf : value.getSchema().getFields()) {
    lastValue.put(sf.name(),value.get(sf.name()));
  }
}
Program: 170086
Project: 170086
Buggy source:
public MergeRowsFn(List<Schema> schemas){
  this.json=Lists.newArrayList(Lists.transform(schemas,new Function<Schema,String>(){
    @Nullable @Override public String apply(    Schema schema){
      return schema.toString();
    }
  }
));
}

Fixed version (ground truth):
public MergeRowsFn(Schema unionSchema){
  this.wrapperJson=unionSchema.toString();
}
Program: 170087
Project: 170087
Buggy source:
@Override public void cleanup(Emitter<Pair<Integer,GenericData.Record>> emitter){
  if (lastKey != null) {
    emitter.emit(Pair.of(outputIndex,lastValue));
  }
}

Fixed version (ground truth):
@Override public void cleanup(Emitter<Pair<Integer,GenericData.Record>> emitter){
  if (lastKey != null && lastValue != null) {
    System.out.println("String_Node_Str" + lastKey);
    System.out.println("String_Node_Str" + lastValue);
    GenericData.Record wrapper=new GenericData.Record(wrapperSchema);
    wrapper.put("String_Node_Str",lastValue);
    increment("String_Node_Str","String_Node_Str" + outputIndex);
    emitter.emit(Pair.of((Integer)lastKey.get("String_Node_Str"),wrapper));
  }
}
Program: 170088
Project: 170088
Buggy source:
@Override public void initialize(){
  final Schema.Parser sp=new Schema.Parser();
  this.schemas=Lists.newArrayList(Lists.transform(json,new Function<String,Schema>(){
    @Nullable @Override public Schema apply(    @Nullable String s){
      return sp.parse(s);
    }
  }
));
  lastKey=null;
  lastValue=null;
}

Fixed version (ground truth):
@Override public void initialize(){
  final Schema.Parser sp=new Schema.Parser();
  this.wrapperSchema=sp.parse(wrapperJson);
  this.schemas=wrapperSchema.getField("String_Node_Str").schema().getTypes();
  for (  Schema s : this.schemas) {
    System.out.println(s.toString(true));
  }
  lastKey=null;
  lastValue=null;
}
Program: 170089
Project: 170089
Buggy source:
public OutputGen(OutputConfig config,ExhibitDescriptor descriptor){
  this.config=config;
  this.keySchema=keySchema(descriptor);
  this.valueSchemas=valueSchemas(descriptor);
}

Fixed version (ground truth):
public OutputGen(int id,OutputConfig config,ExhibitDescriptor descriptor){
  this.id=id;
  this.config=config;
  this.keySchema=keySchema(descriptor);
  this.valueSchemas=valueSchemas(descriptor);
}
Program: 170090
Project: 170090
Buggy source:
private List<Schema> valueSchemas(ExhibitDescriptor descriptor){
  List<Schema> schemas=Lists.newArrayList();
  for (  AggConfig ac : config.aggregates) {
    ObsDescriptor fd=ac.getFrameDescriptor(descriptor);
    List<Schema.Field> fields=Lists.newArrayList();
    for (    Map.Entry<String,String> e : ac.values.entrySet()) {
      ObsDescriptor.Field f=fd.get(fd.indexOf(e.getKey()));
      fields.add(new Schema.Field(e.getValue(),AvroExhibit.getSchema(f.type),"String_Node_Str",null));
    }
    schemas.add(Schema.createRecord(fields));
  }
  return schemas;
}

Fixed version (ground truth):
private List<Schema> valueSchemas(ExhibitDescriptor descriptor){
  List<Schema> schemas=Lists.newArrayList();
  int idx=0;
  for (  AggConfig ac : config.aggregates) {
    ObsDescriptor fd=ac.getFrameDescriptor(descriptor);
    List<Schema.Field> fields=Lists.newArrayList();
    for (    Map.Entry<String,String> e : ac.values.entrySet()) {
      ObsDescriptor.Field f=fd.get(fd.indexOf(e.getKey()));
      fields.add(new Schema.Field(e.getValue(),AvroExhibit.getSchema(f.type),"String_Node_Str",null));
    }
    Schema wrapper=Schema.createRecord("String_Node_Str" + id + "String_Node_Str"+ idx,"String_Node_Str","String_Node_Str",false);
    wrapper.setFields(fields);
    schemas.add(wrapper);
    idx++;
  }
  return schemas;
}
Program: 170091
Project: 170091
Buggy source:
@Override public void process(Exhibit exhibit,Emitter<Pair<GenericData.Record,Pair<Integer,GenericData.Record>>> emitter){
  GenericData.Record keyRec=new GenericData.Record(key);
  for (  String attr : config.attrs) {
    keyRec.put(attr,exhibit.attributes().get(attr));
  }
  if (!initialized) {
    for (    Calculator c : calcs) {
      c.initialize(exhibit.descriptor());
    }
    initialized=true;
  }
  for (int i=0; i < calcs.size(); i++) {
    AggConfig ac=config.aggregates.get(i);
    GenericData.Record valRec=new GenericData.Record(valueSchemas.get(i));
    for (    Obs obs : calcs.get(i).apply(exhibit)) {
      for (int j=0; j < ac.keys.size(); j++) {
        keyRec.put(config.keys.get(j),obs.get(ac.keys.get(j)));
      }
      for (      Map.Entry<String,String> e : ac.values.entrySet()) {
        valRec.put(e.getValue(),obs.get(e.getKey()));
      }
    }
    emitter.emit(Pair.of(keyRec,Pair.of(i,valRec)));
  }
}

Fixed version (ground truth):
@Override public void process(Exhibit exhibit,Emitter<Pair<GenericData.Record,Pair<Integer,GenericData.Record>>> emitter){
  GenericData.Record keyRec=new GenericData.Record(key);
  for (  String attr : config.attrs) {
    keyRec.put(attr,exhibit.attributes().get(attr));
  }
  if (!initialized) {
    for (    Calculator c : calcs) {
      c.initialize(exhibit.descriptor());
    }
    initialized=true;
  }
  for (int i=0; i < calcs.size(); i++) {
    AggConfig ac=config.aggregates.get(i);
    GenericData.Record valRec=new GenericData.Record(valueSchemas.get(i));
    for (    Obs obs : calcs.get(i).apply(exhibit)) {
      for (int j=0; j < ac.keys.size(); j++) {
        keyRec.put(config.keys.get(j),obs.get(ac.keys.get(j)));
      }
      for (      Map.Entry<String,String> e : ac.values.entrySet()) {
        valRec.put(e.getValue(),obs.get(e.getKey()));
      }
      increment("String_Node_Str","String_Node_Str" + outputId + "String_Node_Str"+ i);
      emitter.emit(Pair.of(keyRec,Pair.of(i,valRec)));
    }
  }
}
Program: 170092
Project: 170092
Buggy source:
private Schema keySchema(ExhibitDescriptor descriptor){
  List<Schema.Field> keyFields=Lists.newArrayList();
  ObsDescriptor od=descriptor.attributes();
  for (  String attr : config.attrs) {
    ObsDescriptor.Field f=od.get(od.indexOf(attr));
    keyFields.add(AvroExhibit.getSchemaField(f));
  }
  List<Schema> frameKeySchemas=Lists.newArrayList();
  for (int i=0; i < config.keys.size(); i++) {
    frameKeySchemas.add(null);
  }
  for (  AggConfig ac : config.aggregates) {
    ObsDescriptor fd=ac.getFrameDescriptor(descriptor);
    for (int i=0; i < ac.keys.size(); i++) {
      ObsDescriptor.Field f=fd.get(fd.indexOf(ac.keys.get(i)));
      Schema s=AvroExhibit.getSchema(f.type);
      if (frameKeySchemas.get(i) == null) {
        frameKeySchemas.set(i,s);
      }
 else       if (!frameKeySchemas.get(i).equals(s)) {
        throw new IllegalStateException("String_Node_Str");
      }
    }
  }
  for (int i=0; i < config.keys.size(); i++) {
    keyFields.add(new Schema.Field(config.keys.get(i),frameKeySchemas.get(i),"String_Node_Str",null));
  }
  return Schema.createRecord(keyFields);
}

Fixed version (ground truth):
private Schema keySchema(ExhibitDescriptor descriptor){
  List<Schema.Field> keyFields=Lists.newArrayList();
  ObsDescriptor od=descriptor.attributes();
  for (  String attr : config.attrs) {
    ObsDescriptor.Field f=od.get(od.indexOf(attr));
    keyFields.add(AvroExhibit.getSchemaField(f));
  }
  List<Schema> frameKeySchemas=Lists.newArrayList();
  for (int i=0; i < config.keys.size(); i++) {
    frameKeySchemas.add(null);
  }
  for (  AggConfig ac : config.aggregates) {
    ObsDescriptor fd=ac.getFrameDescriptor(descriptor);
    for (int i=0; i < ac.keys.size(); i++) {
      ObsDescriptor.Field f=fd.get(fd.indexOf(ac.keys.get(i)));
      Schema s=AvroExhibit.getSchema(f.type);
      if (frameKeySchemas.get(i) == null) {
        frameKeySchemas.set(i,s);
      }
 else       if (!frameKeySchemas.get(i).equals(s)) {
        throw new IllegalStateException("String_Node_Str");
      }
    }
  }
  for (int i=0; i < config.keys.size(); i++) {
    keyFields.add(new Schema.Field(config.keys.get(i),frameKeySchemas.get(i),"String_Node_Str",null));
  }
  Schema wrapper=Schema.createRecord("String_Node_Str" + id,"String_Node_Str","String_Node_Str",false);
  wrapper.setFields(keyFields);
  return wrapper;
}
Program: 170093
Project: 170093
Buggy source:
public MapOutFn(OutputConfig config,Schema keySchema,List<Schema> valueSchemas){
  this.config=config;
  this.keyJson=keySchema.toString();
  this.valueJson=Lists.newArrayList(Lists.transform(valueSchemas,new Function<Schema,String>(){
    @Override public String apply(    Schema schema){
      return schema.toString();
    }
  }
));
}

Fixed version (ground truth):
public MapOutFn(int outputId,OutputConfig config,Schema keySchema,List<Schema> valueSchemas){
  this.outputId=outputId;
  this.config=config;
  this.keyJson=keySchema.toString();
  this.valueJson=Lists.newArrayList(Lists.transform(valueSchemas,new Function<Schema,String>(){
    @Override public String apply(    Schema schema){
      return schema.toString();
    }
  }
));
}
Program: 170095
Project: 170095
Buggy source:
@Override public void process(Exhibit exhibit,Emitter<Pair<GenericData.Record,Pair<Integer,GenericData.Record>>> emitter){
  GenericData.Record keyRec=new GenericData.Record(key);
  for (  String attr : config.attrs) {
    keyRec.put(attr,exhibit.attributes().get(attr));
  }
  if (!initialized) {
    for (int i=0; i < config.aggregates.size(); i++) {
      AggConfig ac=config.aggregates.get(i);
      Calculator c=ac.getCalculator();
      c.initialize(exhibit.descriptor());
      calcs.add(c);
      TblCache tc=new TblCache(ac,i,emitter,providers.get(i));
      tblCaches.add(tc);
    }
    initialized=true;
  }
  for (int i=0; i < calcs.size(); i++) {
    AggConfig ac=config.aggregates.get(i);
    for (    Obs obs : calcs.get(i).apply(exhibit)) {
      List<String> keys=getKeys(ac,config);
      for (int j=0; j < keys.size(); j++) {
        keyRec.put(config.keys.get(j),obs.get(keys.get(j)));
      }
      tblCaches.get(i).update(keyRec,obs);
      increment("String_Node_Str","String_Node_Str" + outputId + "String_Node_Str"+ i);
    }
  }
}

Fixed version (ground truth):
@Override public void process(Exhibit exhibit,Emitter<Pair<GenericData.Record,Pair<Integer,GenericData.Record>>> emitter){
  if (!initialized) {
    for (int i=0; i < config.aggregates.size(); i++) {
      AggConfig ac=config.aggregates.get(i);
      Calculator c=ac.getCalculator();
      c.initialize(exhibit.descriptor());
      calcs.add(c);
      TblCache tc=new TblCache(ac,i,emitter,providers.get(i));
      tblCaches.add(tc);
    }
    initialized=true;
  }
  for (int i=0; i < calcs.size(); i++) {
    AggConfig ac=config.aggregates.get(i);
    for (    Obs obs : calcs.get(i).apply(exhibit)) {
      List<String> keys=getKeys(ac,config);
      GenericData.Record keyRec=new GenericData.Record(key);
      for (      String attr : config.attrs) {
        keyRec.put(attr,exhibit.attributes().get(attr));
      }
      for (int j=0; j < keys.size(); j++) {
        keyRec.put(config.keys.get(j),obs.get(keys.get(j)));
      }
      tblCaches.get(i).update(keyRec,obs);
      increment("String_Node_Str","String_Node_Str" + outputId + "String_Node_Str"+ i);
    }
  }
}
Program: 170096
Project: 170096
Buggy source:
@Override public void cleanup(Emitter<Pair<GenericData.Record,Pair<Integer,GenericData.Record>>> emitter){
  for (  TblCache tc : tblCaches) {
    tc.flush();
  }
}

Fixed version (ground truth):
@Override public void cleanup(Emitter<Pair<GenericData.Record,Pair<Integer,GenericData.Record>>> emitter){
  for (  TblCache tc : tblCaches) {
    tc.flush();
  }
  tblCaches.clear();
}
Program: 170097
Project: 170097
Buggy source:
private static List<String> getKeys(AggConfig ac,OutputConfig config){
  if (ac.keys == null || ac.keys.isEmpty()) {
    return config.keys;
  }
  return ac.keys;
}

Fixed version (ground truth):
private static List<String> getKeys(AggConfig ac,OutputConfig config){
  if (ac.keys == null || ac.keys.isEmpty()) {
    return config.keys;
  }
 else   if (config.keys.size() != ac.keys.size()) {
    throw new IllegalArgumentException("String_Node_Str" + ac.frame);
  }
  return ac.keys;
}
Program: 170098
Project: 170098
Buggy source:
@Nullable @Override public Schema apply(@Nullable String s){
  return sp.parse(s);
}

Fixed version (ground truth):
@Nullable @Override public String apply(Schema schema){
  return schema.toString();
}
Program: 170099
Project: 170099
Buggy source:
private List<Schema> getSchemas(){
  if (schemas == null) {
    final Schema.Parser sp=new Schema.Parser();
    this.schemas=Lists.newArrayList(Lists.transform(json,new Function<String,Schema>(){
      @Nullable @Override public Schema apply(      @Nullable String s){
        return sp.parse(s);
      }
    }
));
  }
  return schemas;
}

Fixed version (ground truth):
private List<Schema> getSchemas(){
  if (schemas == null) {
    final Schema.Parser sp=new Schema.Parser();
    Map<String,Schema> defined=Maps.newHashMap();
    this.schemas=Lists.newArrayList();
    for (    String s : json) {
      if (defined.containsKey(s)) {
        schemas.add(defined.get(s));
      }
 else {
        Schema schema=sp.parse(s);
        defined.put(s,schema);
        schemas.add(schema);
      }
    }
  }
  return schemas;
}
Program: 170100
Project: 170100
Buggy source:
public Tbl createTbl(){
  return new SumTbl(values);
}

Fixed version (ground truth):
public Tbl createTbl(){
  return type.create(values,options);
}
Program: 170101
Project: 170101
Buggy source:
/** 
 * Takes a serialized histogram created by the serialize() method and merges it with the current histogram object.
 */
public void merge(int otherBins,List<Double> other){
  if (other == null) {
    return;
  }
  if (nbins == 0 || nusedbins == 0) {
    nbins=otherBins;
    nusedbins=(other.size() - 1) / 2;
    bins=new ArrayList<Coord>(nusedbins);
    for (int i=1; i < other.size(); i+=2) {
      Coord bin=new Coord();
      bin.x=other.get(i);
      bin.y=other.get(i + 1);
      bins.add(bin);
    }
  }
 else {
    ArrayList<Coord> tmp_bins=new ArrayList<Coord>(nusedbins + (other.size() - 1) / 2);
    for (int i=0; i < nusedbins; i++) {
      Coord bin=new Coord();
      bin.x=bins.get(i).x;
      bin.y=bins.get(i).y;
      tmp_bins.add(bin);
    }
    for (int j=1; j < other.size(); j+=2) {
      Coord bin=new Coord();
      bin.x=other.get(j);
      bin.y=other.get(j + 1);
      tmp_bins.add(bin);
    }
    Collections.sort(tmp_bins);
    bins=tmp_bins;
    nusedbins+=(other.size() - 1) / 2;
    trim();
  }
}

Fixed version (ground truth):
/** 
 * Takes a serialized histogram created by the serialize() method and merges it with the current histogram object.
 */
public void merge(int otherBins,List<Double> other){
  if (other == null) {
    return;
  }
  if (nbins == 0 || nusedbins == 0) {
    nbins=otherBins;
    nusedbins=(other.size() - 1) / 2;
    bins=new ArrayList<Coord>(nusedbins);
    for (int i=0; i < other.size(); i+=2) {
      Coord bin=new Coord();
      bin.x=other.get(i);
      bin.y=other.get(i + 1);
      bins.add(bin);
    }
  }
 else {
    ArrayList<Coord> tmp_bins=new ArrayList<Coord>(nusedbins + (other.size() - 1) / 2);
    for (int i=0; i < nusedbins; i++) {
      Coord bin=new Coord();
      bin.x=bins.get(i).x;
      bin.y=bins.get(i).y;
      tmp_bins.add(bin);
    }
    for (int j=0; j < other.size(); j+=2) {
      Coord bin=new Coord();
      bin.x=other.get(j);
      bin.y=other.get(j + 1);
      tmp_bins.add(bin);
    }
    Collections.sort(tmp_bins);
    bins=tmp_bins;
    nusedbins+=(other.size() - 1) / 2;
    trim();
  }
}
Program: 170102
Project: 170102
Buggy source:
@Override public void add(Obs obs){
  Double d=obs.get(obsKey,Double.class);
  if (d != null) {
    hist.add(d);
  }
}

Fixed version (ground truth):
@Override public void add(Obs obs){
  Object o=obs.get(obsKey);
  if (o != null) {
    hist.add(((Number)o).doubleValue());
  }
}
Program: 170103
Project: 170103
Buggy source:
public PercentileTbl(Map<String,String> values,Map<String,Object> options){
  if (values.size() != 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (options.get("String_Node_Str") == null || !(options.get("String_Node_Str") instanceof List)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Map.Entry<String,String> e=Iterables.getOnlyElement(values.entrySet());
  this.obsKey=e.getKey();
  this.outKey=e.getValue();
  this.percentiles=(List<Integer>)options.get("String_Node_Str");
  this.binCount=options.containsKey("String_Node_Str") ? (Integer)options.get("String_Node_Str") : 10000;
}

Fixed version (ground truth):
public PercentileTbl(Map<String,String> values,Map<String,Object> options){
  if (values.size() != 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (options.get(PERCENTILES_OPTION) == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Map.Entry<String,String> e=Iterables.getOnlyElement(values.entrySet());
  this.obsKey=e.getKey();
  this.outKey=e.getValue();
  this.percentiles=Lists.transform((List)options.get(PERCENTILES_OPTION),new Function<Object,Integer>(){
    @Override public Integer apply(    Object o){
      return Integer.valueOf(o.toString());
    }
  }
);
  this.binCount=options.containsKey("String_Node_Str") ? Integer.valueOf(options.get("String_Node_Str").toString()) : 10000;
}
Program: 170104
Project: 170104
Buggy source:
@Override public SchemaProvider getSchemas(ObsDescriptor od,int outputId,int aggIdx){
  List<Schema.Field> interFields=Lists.newArrayList();
  List<Schema.Field> outerFields=Lists.newArrayList();
  for (  int p : percentiles) {
    String name=outKey + "String_Node_Str" + p;
    outerFields.add(new Schema.Field(name,DOUBLE,"String_Node_Str",null));
  }
  this.output=Schema.createRecord("String_Node_Str" + outputId + "String_Node_Str"+ aggIdx,"String_Node_Str","String_Node_Str",false);
  this.output.setFields(outerFields);
  return new SchemaProvider(ImmutableList.of(intermediate,output));
}

Fixed version (ground truth):
@Override public SchemaProvider getSchemas(ObsDescriptor od,int outputId,int aggIdx){
  List<Schema.Field> interFields=Lists.newArrayList();
  interFields.add(new Schema.Field("String_Node_Str",Schema.create(Schema.Type.INT),"String_Node_Str",null));
  interFields.add(new Schema.Field("String_Node_Str",Schema.createArray(DOUBLE),"String_Node_Str",null));
  this.intermediate=Schema.createRecord("String_Node_Str" + outputId + "String_Node_Str"+ aggIdx,"String_Node_Str","String_Node_Str",false);
  this.intermediate.setFields(interFields);
  List<Schema.Field> outerFields=Lists.newArrayList();
  for (  int p : percentiles) {
    String name=outKey + "String_Node_Str" + p;
    outerFields.add(new Schema.Field(name,DOUBLE,"String_Node_Str",null));
  }
  this.output=Schema.createRecord("String_Node_Str" + outputId + "String_Node_Str"+ aggIdx,"String_Node_Str","String_Node_Str",false);
  this.output.setFields(outerFields);
  return new SchemaProvider(ImmutableList.of(intermediate,output));
}
Program: 170105
Project: 170105
Buggy source:
@Override public void add(Obs obs){
  GenericData.Record cur=new GenericData.Record(schema);
  for (  Map.Entry<String,String> e : values.entrySet()) {
    cur.put(e.getValue(),obs.get(e.getKey()));
  }
  value=(GenericData.Record)add(cur,value,schema);
}

Fixed version (ground truth):
@Override public void add(Obs obs){
  GenericData.Record next=new GenericData.Record(schema);
  for (  Map.Entry<String,String> e : values.entrySet()) {
    next.put(e.getValue(),obs.get(e.getKey()));
  }
  value=(GenericData.Record)add(value,next,schema);
}
Program: 170106
Project: 170106
Buggy source:
@Override public void initialize(SchemaProvider provider){
  this.schema=provider.get(0);
}

Fixed version (ground truth):
@Override public void initialize(SchemaProvider provider){
  this.schema=provider.get(0);
  this.value=new GenericData.Record(schema);
}
Program: 170107
Project: 170107
Buggy source:
public void flush(){
  cache.cleanUp();
}

Fixed version (ground truth):
public void flush(){
  for (  Map.Entry<GenericData.Record,Tbl> e : cache.entrySet()) {
    Tbl tbl=e.getValue();
    emitter.emit(Pair.of(e.getKey(),Pair.of(aggIdx,tbl.getValue())));
  }
  cache.clear();
}
Program: 170108
Project: 170108
Buggy source:
public void update(GenericData.Record key,Obs obs){
  cache.asMap().get(key).add(obs);
}

Fixed version (ground truth):
public void update(GenericData.Record key,Obs obs){
  Tbl tbl=cache.get(key);
  if (tbl == null) {
    if (cache.size() > config.cacheSize) {
      flush();
    }
    tbl=config.createTbl();
    tbl.initialize(provider);
    cache.put(key,tbl);
  }
 else {
    int x=1;
  }
  tbl.add(obs);
}
Program: 170109
Project: 170109
Buggy source:
public TblCache(final AggConfig config,final int aggIdx,final Emitter<Pair<GenericData.Record,Pair<Integer,GenericData.Record>>> emitter,final SchemaProvider provider){
  this.cache=CacheBuilder.<GenericData.Record,Tbl>from(config.cache).removalListener(new RemovalListener<GenericData.Record,Tbl>(){
    @Override public void onRemoval(    RemovalNotification<GenericData.Record,Tbl> note){
      emitter.emit(Pair.of(note.getKey(),Pair.of(aggIdx,note.getValue().getValue())));
    }
  }
).build(new CacheLoader<GenericData.Record,Tbl>(){
    @Override public Tbl load(    GenericData.Record record) throws Exception {
      Tbl tbl=config.createTbl();
      tbl.initialize(provider);
      return tbl;
    }
  }
);
}

Fixed version (ground truth):
public TblCache(final AggConfig config,final int aggIdx,final Emitter<Pair<GenericData.Record,Pair<Integer,GenericData.Record>>> emitter,final SchemaProvider provider){
  this.cache=Maps.newHashMap();
  this.config=config;
  this.aggIdx=aggIdx;
  this.emitter=emitter;
  this.provider=provider;
}
Program: 170110
Project: 170110
Buggy source:
@Override public boolean moveNext(){
  currentIndex++;
  boolean hasNext=currentIndex < frame.size();
  if (hasNext) {
    Obs obs=frame.get(currentIndex);
    for (int i=0; i < current.length; i++) {
      current[i]=obs.get(i);
    }
  }
  return hasNext;
}

Fixed version (ground truth):
@Override public boolean moveNext(){
  currentIndex++;
  boolean hasNext=currentIndex < frame.size();
  if (hasNext) {
    Obs obs=frame.get(currentIndex);
    this.current=new Object[current.length];
    for (int i=0; i < current.length; i++) {
      current[i]=obs.get(i);
    }
  }
  return hasNext;
}
Program: 170111
Project: 170111
Buggy source:
public static void updateViewWithTime(View view,Calendar time){
  int currentMinute;
  if (DateFormat.is24HourFormat(view.getContext())) {
    currentMinute=time.get(Calendar.HOUR_OF_DAY);
  }
 else {
    currentMinute=time.get(Calendar.HOUR);
  }
  int columnOneComponent=currentMinute / 10;
  int columnTwoComponent=currentMinute % 10;
  updateView(column1,columnOneComponent,view);
  updateView(column2,columnTwoComponent,view);
}

Fixed version (ground truth):
public static void updateViewWithTime(View view,Calendar time){
  int currentMinute;
  if (DateFormat.is24HourFormat(view.getContext())) {
    currentMinute=time.get(Calendar.HOUR_OF_DAY);
  }
 else {
    currentMinute=time.get(Calendar.HOUR);
    if (currentMinute == 0) {
      currentMinute=12;
    }
  }
  int columnOneComponent=currentMinute / 10;
  int columnTwoComponent=currentMinute % 10;
  updateView(column1,columnOneComponent,view);
  updateView(column2,columnTwoComponent,view);
}
Program: 170112
Project: 170112
Buggy source:
private void updateCompleteTime(){
  View view=this.findViewById(android.R.id.content).getRootView();
  Calendar calendar=Calendar.getInstance();
  Minutes.updateViewWithTime(view,calendar);
  Hours.updateViewWithTime(view,calendar);
  Seconds.updateViewWithTime(view,calendar);
}

Fixed version (ground truth):
private void updateCompleteTime(){
  View view=this.findViewById(android.R.id.content).getRootView();
  Calendar calendar=Calendar.getInstance();
  Minutes.updateViewWithTime(view,calendar);
  Hours.updateViewWithTime(view,calendar);
  if (!isDimmed()) {
    Seconds.updateViewWithTime(view,calendar);
  }
}
Program: 170113
Project: 170113
Buggy source:
@Override public void run(){
  mHandler.postDelayed(mStatusChecker,TICK_INTERVAL);
  updateSeconds();
}

Fixed version (ground truth):
public void run(){
  if (!Thread.currentThread().isInterrupted()) {
    try {
      updateSecondsUI();
      mHandler.postDelayed(secondsAnimation,TICK_INTERVAL);
    }
 catch (    Exception e) {
      Log.e("String_Node_Str","String_Node_Str" + e.toString());
    }
  }
}
Program: 170114
Project: 170114
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  if (Constants.DOT_COLOR_RECIEVED_ACTION.equals(intent.getAction())) {
    startRepeatingTask();
    updateCompleteTime();
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  if (Constants.DOT_COLOR_RECIEVED_ACTION.equals(intent.getAction())) {
    updateCompleteTime();
    startRepeatingTask();
  }
}
Program: 170115
Project: 170115
Buggy source:
private void startRepeatingTask(){
  mHandler.removeCallbacks(mStatusChecker);
  mStatusChecker.run();
}

Fixed version (ground truth):
private void startRepeatingTask(){
  mHandler.post(secondsAnimation);
}
Program: 170116
Project: 170116
Buggy source:
private void initReceivers(){
  filter=new IntentFilter(Intent.ACTION_TIME_TICK);
  timeUpdateReceiver=new BroadcastReceiver(){
    @Override public void onReceive(    Context context,    Intent intent){
      if (Intent.ACTION_TIME_TICK.equals(intent.getAction())) {
        startRepeatingTask();
        updateCompleteTime();
      }
    }
  }
;
  dotColorChangedIntentfilter=new IntentFilter(Constants.DOT_COLOR_RECIEVED_ACTION);
  dotColorChangedReceiver=new BroadcastReceiver(){
    @Override public void onReceive(    Context context,    Intent intent){
      if (Constants.DOT_COLOR_RECIEVED_ACTION.equals(intent.getAction())) {
        startRepeatingTask();
        updateCompleteTime();
      }
    }
  }
;
}

Fixed version (ground truth):
private void initReceivers(){
  filter=new IntentFilter(Intent.ACTION_TIME_TICK);
  timeUpdateReceiver=new BroadcastReceiver(){
    @Override public void onReceive(    Context context,    Intent intent){
      if (Intent.ACTION_TIME_TICK.equals(intent.getAction())) {
        updateCompleteTime();
        if (!isDimmed()) {
          restartRepeatingTask();
        }
      }
    }
  }
;
  dotColorChangedIntentfilter=new IntentFilter(Constants.DOT_COLOR_RECIEVED_ACTION);
  dotColorChangedReceiver=new BroadcastReceiver(){
    @Override public void onReceive(    Context context,    Intent intent){
      if (Constants.DOT_COLOR_RECIEVED_ACTION.equals(intent.getAction())) {
        updateCompleteTime();
        startRepeatingTask();
      }
    }
  }
;
}
Program: 170117
Project: 170117
Buggy source:
private void stopRepeatingTask(){
  mHandler.removeCallbacks(mStatusChecker);
}

Fixed version (ground truth):
private void stopRepeatingTask(){
  mHandler.removeCallbacksAndMessages(null);
}
Program: 170118
Project: 170118
Buggy source:
/** 
 * Connects to the device and retrieves the configuration file from the  device.
 * @return A BufferedReader containing the output from the GET_ALL_CONFIG command 
 */
private BufferedReader getConfigFile() throws JSchException, IOException {
  InputStream in=null;
  JSch jsch=new JSch();
  Session session=jsch.getSession(host.getUser(),host.getAddress().getHostAddress(),SSH_PORT);
  session.setPassword(host.getPass());
  session.setConfig("String_Node_Str","String_Node_Str");
  session.connect();
  Channel channel=session.openChannel("String_Node_Str");
  ((ChannelExec)channel).setCommand(GET_ALL_CONFIG);
  in=channel.getInputStream();
  channel.connect();
  return new BufferedReader(new InputStreamReader(in));
}

Fixed version (ground truth):
/** 
 * Connects to the device and retrieves the configuration file from the  device.
 * @return A BufferedReader containing the output from the GET_ALL_CONFIG command 
 */
private BufferedReader getConfigFile() throws JSchException, IOException {
  InputStream in=null;
  JSch jsch=new JSch();
  Session session=jsch.getSession(host.getUser(),host.getAddress().getHostAddress(),SSH_PORT);
  session.setPassword(host.getPass());
  session.setConfig("String_Node_Str","String_Node_Str");
  session.connect();
  if (host.usesEnable()) {
    Channel channel=session.openChannel("String_Node_Str");
    ((ChannelExec)channel).setCommand(ENABLE_SUPERUSER);
    in=channel.getInputStream();
    OutputStream outputStream=channel.getOutputStream();
    channel.connect();
    outputStream.write((host.getEnablePass() + "String_Node_Str").getBytes());
    outputStream.flush();
    outputStream.write(DISABLE_OUTPUT_BUFFERING.getBytes());
    outputStream.flush();
    outputStream.write(GET_ALL_CONFIG.getBytes());
    outputStream.flush();
  }
 else {
    Channel channel=session.openChannel("String_Node_Str");
    ((ChannelExec)channel).setCommand(DISABLE_OUTPUT_BUFFERING);
    in=channel.getInputStream();
    OutputStream outputStream=channel.getOutputStream();
    channel.connect();
    outputStream.write(GET_ALL_CONFIG.getBytes());
    outputStream.flush();
  }
  return new BufferedReader(new InputStreamReader(in));
}
Program: 170119
Project: 170119
Buggy source:
/** 
 * Allows the user to save the current configuration from the file
 * @param evt The ActionEvent object with relevant data
 */
private void menuSaveConfigActionPerformed(java.awt.event.ActionEvent evt){
  JOptionPane.showMessageDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.WARNING_MESSAGE);
  int returnCode=fc.showSaveDialog(this);
  if (returnCode == JFileChooser.APPROVE_OPTION) {
    File file=fc.getSelectedFile();
    String filename=file.getName();
    String path=file.getPath();
    if (!filename.matches("String_Node_Str")) {
      filename=filename + "String_Node_Str";
      file=new File(path + filename);
    }
    ConfigurationManager.saveConfiguration(file,hosts);
    JOptionPane.showMessageDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.INFORMATION_MESSAGE);
  }
}

Fixed version (ground truth):
/** 
 * Allows the user to save the current configuration from the file
 * @param evt The ActionEvent object with relevant data
 */
private void menuSaveConfigActionPerformed(java.awt.event.ActionEvent evt){
  JOptionPane.showMessageDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.WARNING_MESSAGE);
  int returnCode=fc.showSaveDialog(this);
  if (returnCode == JFileChooser.APPROVE_OPTION) {
    File file=fc.getSelectedFile();
    String path=file.getPath();
    if (!path.matches("String_Node_Str")) {
      path=path + "String_Node_Str";
      file=new File(path);
    }
    ConfigurationManager.saveConfiguration(file,hosts);
    JOptionPane.showMessageDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.INFORMATION_MESSAGE);
  }
}
Program: 170120
Project: 170120
Buggy source:
/** 
 * Checks the credentials and allows login if the credentials are correct.
 * @param evt The ActionEvent object with relevant data
 */
private void btnLoginActionPerformed(java.awt.event.ActionEvent evt){
  String username=fieldUsername.getText().trim();
  String password=new String(fieldPassword.getPassword());
  if (MainGUI.settingsManager.checkAuth(username,password)) {
    parent.setVisible(true);
    this.dispose();
  }
 else {
    JOptionPane.showMessageDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.ERROR_MESSAGE);
  }
}

Fixed version (ground truth):
/** 
 * Checks the credentials and allows login if the credentials are correct.
 * @param evt The ActionEvent object with relevant data
 */
private void btnLoginActionPerformed(java.awt.event.ActionEvent evt){
  String username=fieldUsername.getText().trim();
  String password=new String(fieldPassword.getPassword());
  if (MainGUI.settingsManager.checkAuth(username,password)) {
    parent.setVisible(true);
    parent.setEnabled(true);
    this.dispose();
  }
 else {
    JOptionPane.showMessageDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.ERROR_MESSAGE);
  }
}
Program: 170121
Project: 170121
Buggy source:
/** 
 * Creates new form MainGUI
 */
public MainGUI(){
  initComponents();
  fc.setFileFilter(filter);
  if (settingsManager.requiresAuth()) {
    AuthDialog auth=new AuthDialog(this);
    this.setVisible(false);
    auth.setVisible(true);
    auth.setAlwaysOnTop(true);
  }
}

Fixed version (ground truth):
/** 
 * Creates new form MainGUI
 */
public MainGUI(){
  initComponents();
  fc.setFileFilter(filter);
  if (settingsManager.requiresAuth()) {
    AuthDialog auth=new AuthDialog(this);
    this.setEnabled(false);
    auth.setVisible(true);
    auth.setAlwaysOnTop(true);
  }
}