nus-yam/ex-repair huggingface dataset:
Program: 146517
Project: 146517
Buggy source:
/** 
 * Disable by removing the sensor data from the SensorManager. Apps will think the sensor does not exist.
 */
private void removeSensors(final LoadPackageParam lpparam){
  XposedHelpers.findAndHookMethod("String_Node_Str",lpparam.classLoader,"String_Node_Str",new XC_MethodHook(){
    @Override protected void afterHookedMethod(    MethodHookParam param) throws Throwable {
      if (!lpparam.packageName.equals(Constants.PACKAGE_NAME)) {
        @SuppressWarnings("String_Node_Str") List<Sensor> fullSensorList=new ArrayList<>((Collection<? extends Sensor>)param.getResult());
        Iterator<Sensor> iterator=fullSensorList.iterator();
        while (iterator.hasNext()) {
          Sensor sensor=iterator.next();
          if (!shouldAppHalt(lpparam.packageName,sensor) && getSensorStatus(sensor) == Constants.SENSOR_STATUS_REMOVE_SENSOR) {
            iterator.remove();
          }
        }
        param.setResult(fullSensorList);
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Disable by removing the sensor data from the SensorManager. Apps will think the sensor does not exist.
 */
private void removeSensors(final LoadPackageParam lpparam){
  XposedHelpers.findAndHookMethod("String_Node_Str",lpparam.classLoader,"String_Node_Str",new XC_MethodHook(){
    @Override protected void afterHookedMethod(    MethodHookParam param) throws Throwable {
      if (!lpparam.packageName.equals(Constants.PACKAGE_NAME)) {
        @SuppressWarnings("String_Node_Str") List<Sensor> fullSensorList=new ArrayList<>((Collection<? extends Sensor>)param.getResult());
        Iterator<Sensor> iterator=fullSensorList.iterator();
        while (iterator.hasNext()) {
          Sensor sensor=iterator.next();
          if (!shouldAppHalt(lpparam.processName,sensor) && getSensorStatus(sensor) == Constants.SENSOR_STATUS_REMOVE_SENSOR) {
            iterator.remove();
          }
        }
        param.setResult(fullSensorList);
      }
    }
  }
);
}
Program: 146518
Project: 146518
Buggy source:
protected void showInfoDialog(){
  new AlertDialog.Builder(getContext()).setTitle("String_Node_Str").setMessage("String_Node_Str" + sensor.getName() + "String_Node_Str"+ "String_Node_Str"+ SensorUtil.getHumanStringType(sensor)+ "String_Node_Str"+ "String_Node_Str"+ sensor.getVendor()+ "String_Node_Str"+ "String_Node_Str"+ sensor.getMaximumRange()+ "String_Node_Str").show();
}

Fixed version (ground truth):
protected void showInfoDialog(){
  new AlertDialog.Builder(getContext()).setTitle("String_Node_Str").setMessage("String_Node_Str" + sensor.getName() + "String_Node_Str"+ "String_Node_Str"+ SensorUtil.getHumanStringType(sensor)+ "String_Node_Str"+ "String_Node_Str"+ sensor.getVendor()+ "String_Node_Str"+ "String_Node_Str"+ sensor.getMaximumRange()+ "String_Node_Str"+ SensorUtil.getDescription(sensor)+ "String_Node_Str").show();
}
Program: 146519
Project: 146519
Buggy source:
@Override public void onCreate(){
  super.onCreate();
  SharedPreferences prefs=getSharedPreferences(Constants.PREFS_FILE_NAME,MODE_WORLD_READABLE);
  if (prefs.getBoolean("String_Node_Str",false)) {
    SensorManager sensorManager=(SensorManager)getSystemService(SENSOR_SERVICE);
    Sensor proximitySensor=sensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY);
    String sensorKey=SensorUtil.generateUniqueSensorKey(proximitySensor);
    String mockValuesKey=SensorUtil.generateUniqueSensorMockValuesKey(proximitySensor);
    prefs.edit().putInt(sensorKey,Constants.SENSOR_STATUS_MOCK_VALUES).putString(mockValuesKey,"String_Node_Str").remove("String_Node_Str").apply();
  }
}

Fixed version (ground truth):
@Override public void onCreate(){
  super.onCreate();
  SharedPreferences prefs=getSharedPreferences(Constants.PREFS_FILE_NAME,MODE_WORLD_READABLE);
  if (prefs.getBoolean("String_Node_Str",false)) {
    SensorManager sensorManager=(SensorManager)getSystemService(SENSOR_SERVICE);
    Sensor proximitySensor=sensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY);
    String sensorKey=SensorUtil.generateUniqueSensorKey(proximitySensor);
    String mockValuesKey=SensorUtil.generateUniqueSensorMockValuesKey(proximitySensor);
    prefs.edit().putInt(sensorKey,Constants.SENSOR_STATUS_MOCK_VALUES).putString(mockValuesKey,proximitySensor.getMaximumRange() + "String_Node_Str").remove("String_Node_Str").apply();
  }
}
Program: 146520
Project: 146520
Buggy source:
public void ConcatenateFiles(List<Path> files){
  this.openTemp('W');
  for (  Path p : files) {
    try (BufferedReader in=Files.newBufferedReader(p,Charset.defaultCharset())){
      String line;
      while ((line=in.readLine()) != null) {
        this.output.write(line);
      }
      p.toFile().delete();
    }
 catch (    IOException ex) {
      log.log(Level.SEVERE,"String_Node_Str" + files.toString(),ex);
    }
  }
  this.closeTemp('W');
}

Fixed version (ground truth):
public void ConcatenateFiles(List<Path> files){
  this.openTemp('W');
  for (  Path p : files) {
    try (BufferedReader in=Files.newBufferedReader(p,Charset.defaultCharset())){
      String line;
      while ((line=in.readLine()) != null) {
        this.output.write(line);
        this.output.write(System.lineSeparator());
      }
      p.toFile().delete();
    }
 catch (    IOException ex) {
      log.log(Level.SEVERE,"String_Node_Str" + files.toString(),ex);
    }
  }
  this.closeTemp('W');
}
Program: 146521
Project: 146521
Buggy source:
private long readNameHashBin(long hash){
  return hash >> 61;
}

Fixed version (ground truth):
private long readNameHashBin(long hash){
  return hash >> 60;
}
Program: 146522
Project: 146522
Buggy source:
/** 
 * Writes the list of lines out to the output stream, append new lines after each line.
 * @param list
 * @param os
 * @throws IOException
 */
private void writeOut(List<String[]> list,OutputStream os) throws IOException {
  BufferedWriter writer=null;
  try {
    writer=new BufferedWriter(new OutputStreamWriter(os));
    for (    String[] s : list) {
      writer.write(StrArray.Join(s,delimiter));
      writer.write("String_Node_Str");
    }
    writer.flush();
  }
 catch (  IOException io) {
    log.log(Level.SEVERE,"String_Node_Str" + os.toString(),io);
  }
 finally {
    if (writer != null) {
      try {
        writer.close();
      }
 catch (      Exception e) {
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Writes the list of lines out to the output stream, append new lines after each line.
 * @param list
 * @param os
 * @throws IOException
 */
private void writeOut(List<String[]> list,OutputStream os) throws IOException {
  BufferedWriter writer=null;
  try {
    writer=new BufferedWriter(new OutputStreamWriter(os));
    for (    String[] s : list) {
      writer.write(StrArray.Join(s,delimiter));
      writer.write(System.lineSeparator());
    }
    writer.flush();
  }
 catch (  IOException io) {
    log.log(Level.SEVERE,"String_Node_Str" + os.toString(),io);
  }
 finally {
    if (writer != null) {
      try {
        writer.close();
      }
 catch (      Exception e) {
      }
    }
  }
}
Program: 146524
Project: 146524
Buggy source:
private void createTemp(Path path){
  try {
    this.tempFile=Files.createTempFile(path.toString(),"String_Node_Str");
    this.tempFile.toFile().deleteOnExit();
  }
 catch (  IOException ex) {
    Logger.getLogger(TempDataClass.class.getName()).log(Level.SEVERE,null,ex);
  }
}

Fixed version (ground truth):
private void createTemp(Path path){
  try {
    this.tempFile=Files.createTempFile(path.toString(),"String_Node_Str");
    this.tempFile.toFile().deleteOnExit();
    log.log(Level.FINE,"String_Node_Str" + this.tempFile.toString());
  }
 catch (  IOException ex) {
    Logger.getLogger(TempDataClass.class.getName()).log(Level.SEVERE,null,ex);
  }
}
Program: 146525
Project: 146525
Buggy source:
/** 
 * Reads the input io stream and splits it into sorted chunks which are written to temporary files. 
 * @param in
 * @param identifier
 * @throws IOException
 */
public void splitChunks(InputStream in,String identifier){
  outputs.clear();
  BufferedReader br=null;
  List<String[]> lines=new ArrayList<>(maxChunkSize);
  log.log(Level.INFO,"String_Node_Str" + identifier);
  try {
    br=new BufferedReader(new InputStreamReader(in));
    String line=null;
    int currChunkSize=0;
    while ((line=br.readLine()) != null) {
      lines.add(line.split("String_Node_Str"));
      currChunkSize+=line.length() + 1;
      if (currChunkSize >= maxChunkSize) {
        currChunkSize=0;
        Collections.sort(lines,sorter);
        File file=new File(tempDirectory + "String_Node_Str" + System.currentTimeMillis());
        outputs.add(file);
        writeOut(lines,new FileOutputStream(file));
        lines.clear();
      }
    }
    Collections.sort(lines,sorter);
    File file=new File(tempDirectory + "String_Node_Str" + System.currentTimeMillis());
    outputs.add(file);
    writeOut(lines,new FileOutputStream(file));
    lines.clear();
  }
 catch (  IOException io) {
    log.log(Level.SEVERE,"String_Node_Str" + in.toString(),io);
  }
 finally {
    if (br != null)     try {
      br.close();
    }
 catch (    Exception e) {
    }
  }
}

Fixed version (ground truth):
/** 
 * Reads the input io stream and splits it into sorted chunks which are written to temporary files. 
 * @param in
 * @param identifier
 * @throws IOException
 */
public void splitChunks(InputStream in,String identifier){
  outputs.clear();
  BufferedReader br=null;
  List<String[]> lines=new ArrayList<>(maxChunkSize);
  log.log(Level.INFO,"String_Node_Str" + identifier);
  try {
    br=new BufferedReader(new InputStreamReader(in));
    String line=null;
    int currChunkSize=0;
    while ((line=br.readLine()) != null) {
      this.hasData=true;
      lines.add(line.split("String_Node_Str"));
      currChunkSize+=line.length() + 1;
      if (currChunkSize >= maxChunkSize) {
        currChunkSize=0;
        Collections.sort(lines,sorter);
        String tmpfile=tempDirectory + "String_Node_Str" + System.currentTimeMillis();
        File file=new File(tmpfile);
        log.log(Level.FINE,"String_Node_Str" + tmpfile + "String_Node_Str"+ identifier);
        outputs.add(file);
        writeOut(lines,new FileOutputStream(file));
        lines.clear();
      }
    }
    Collections.sort(lines,sorter);
    File file=new File(tempDirectory + "String_Node_Str" + System.currentTimeMillis());
    outputs.add(file);
    writeOut(lines,new FileOutputStream(file));
    log.log(Level.FINE,"String_Node_Str" + this.hasData);
    lines.clear();
  }
 catch (  IOException io) {
    log.log(Level.SEVERE,"String_Node_Str" + in.toString(),io);
  }
 finally {
    if (br != null)     try {
      br.close();
    }
 catch (    Exception e) {
    }
  }
}
Program: 146526
Project: 146526
Buggy source:
public OutputEvents(String outfile,boolean debug){
  this.outfile=Paths.get(outfile);
  this.supportfile=Paths.get(outfile + "String_Node_Str");
  this.debug=debug;
  if (!this.outfile.toFile().exists())   try {
    this.outfile.toFile().createNewFile();
  }
 catch (  IOException ex) {
    Logger.getLogger(OutputEvents.class.getName()).log(Level.SEVERE,null,ex);
  }
 else {
    this.outfile.toFile().delete();
    try {
      this.outfile.toFile().createNewFile();
    }
 catch (    IOException ex) {
      Logger.getLogger(OutputEvents.class.getName()).log(Level.SEVERE,null,ex);
    }
  }
}

Fixed version (ground truth):
public OutputEvents(String outfile,boolean debug){
  this.outfile=Paths.get(outfile);
  this.supportfile=Paths.get(outfile + "String_Node_Str");
  this.debug=debug;
  if (!this.outfile.toFile().exists())   try {
    this.outfile.toFile().createNewFile();
  }
 catch (  IOException ex) {
    log.log(Level.SEVERE,"String_Node_Str" + outfile,ex);
    System.exit(-1);
  }
 else {
    this.outfile.toFile().delete();
    try {
      this.outfile.toFile().createNewFile();
    }
 catch (    IOException ex) {
      log.log(Level.SEVERE,"String_Node_Str" + outfile,ex);
      System.exit(-1);
    }
  }
}
Program: 146527
Project: 146527
Buggy source:
public void WriteOut(){
  if (this.sets == null) {
    return;
  }
  try (BufferedWriter output=Files.newBufferedWriter(outfile,Charset.forName("String_Node_Str"),StandardOpenOption.APPEND)){
    Collections.sort(sets);
    for (    finalSets event : this.sets) {
      String outLine=join(event.Chr(),String.valueOf(event.Start()),String.valueOf(event.InnerStart()),String.valueOf(event.InnerEnd()),String.valueOf(event.End()),String.valueOf(event.svType),String.valueOf(event.DiscSupport()),String.valueOf(event.SplitSupport()),String.valueOf(event.UnbalancedSplitSupport()),String.valueOf(event.SumFullSupport()));
      output.write(outLine);
    }
  }
 catch (  IOException ex) {
    Logger.getLogger(OutputEvents.class.getName()).log(Level.SEVERE,null,ex);
  }
  if (debug) {
    try (BufferedWriter support=Files.newBufferedWriter(supportfile,Charset.defaultCharset())){
      for (      finalSets event : this.sets) {
        support.write(event.getSupportReadStr());
        support.newLine();
      }
    }
 catch (    IOException ex) {
      Logger.getLogger(OutputEvents.class.getName()).log(Level.SEVERE,null,ex);
    }
  }
}

Fixed version (ground truth):
public void WriteOut(){
  if (this.sets == null) {
    return;
  }
  try (BufferedWriter output=Files.newBufferedWriter(outfile,Charset.forName("String_Node_Str"),StandardOpenOption.APPEND)){
    Collections.sort(sets);
    for (    finalSets event : this.sets) {
      String outLine=join(event.Chr(),String.valueOf(event.Start()),String.valueOf(event.InnerStart()),String.valueOf(event.InnerEnd()),String.valueOf(event.End()),String.valueOf(event.svType),String.valueOf(event.DiscSupport()),String.valueOf(event.SplitSupport()),String.valueOf(event.UnbalancedSplitSupport()),String.valueOf(event.SumFullSupport()));
      output.write(outLine);
    }
  }
 catch (  IOException ex) {
    log.log(Level.SEVERE,"String_Node_Str" + this.outfile.toString(),ex);
  }
  if (debug) {
    try (BufferedWriter support=Files.newBufferedWriter(supportfile,Charset.defaultCharset())){
      for (      finalSets event : this.sets) {
        support.write(event.getSupportReadStr());
        support.newLine();
      }
    }
 catch (    IOException ex) {
      log.log(Level.SEVERE,"String_Node_Str" + this.supportfile.toString(),ex);
    }
  }
}
Program: 146528
Project: 146528
Buggy source:
private boolean isSplit(String[] segs){
  int fflags=Integer.parseInt(segs[3]);
  Cigar c=TextCigarCodec.getSingleton().decode(segs[7]);
  return (((fflags & 0x4) == 0x4 && (fflags & 0x8) != 0x8 && (fflags & 0x100) != 0x100) || (isOverSoftClipThreshold(c,segs[11].length()) && (fflags & 0x100) != 0x100));
}

Fixed version (ground truth):
private boolean isSplit(String[] segs){
  int fflags=Integer.parseInt(segs[3]);
  Cigar c=TextCigarCodec.getSingleton().decode(segs[7]);
  boolean segmentUnmapped=(fflags & 0x4) == 0x4 && (fflags & 0x8) != 0x8 && (fflags & 0x100) != 0x100;
  boolean softclipThresh=isOverSoftClipThreshold(c,segs[11].length()) && (fflags & 0x100) != 0x100;
  return segmentUnmapped || softclipThresh;
}
Program: 146533
Project: 146533
Buggy source:
public synchronized void combineRecordMatcher(SamRecordMatcher s){
  s.SamTemp.keySet().forEach((k) -> {
    if (!this.SamTemp.containsKey(k)) {
      this.SamTemp.put(k,new ConcurrentHashMap<>());
    }
    s.SamTemp.get(k).keySet().forEach((c) -> {
      if (!this.SamTemp.get(k).containsKey(c))       this.SamTemp.get(k).put(c,s.SamTemp.get(k).get(c));
 else {
        log.log(Level.FINE,"String_Node_Str" + k + "String_Node_Str"+ c);
        this.SamTemp.get(k).get(c).combineTempFiles(s.SamTemp.get(k).get(c));
      }
    }
);
  }
);
}

Fixed version (ground truth):
/** 
 * Method that merges several child SamRecordMatcher objects with a parent object.
 * @param s SamRecordMatcher class
 */
public synchronized void combineRecordMatcher(SamRecordMatcher s){
  s.SamTemp.keySet().forEach((k) -> {
    if (!this.SamTemp.containsKey(k)) {
      this.SamTemp.put(k,new ConcurrentHashMap<>());
    }
    s.SamTemp.get(k).keySet().forEach((c) -> {
      if (!this.SamTemp.get(k).containsKey(c))       this.SamTemp.get(k).put(c,s.SamTemp.get(k).get(c));
 else {
        log.log(Level.FINE,"String_Node_Str" + k + "String_Node_Str"+ c);
        this.SamTemp.get(k).get(c).combineTempFiles(s.SamTemp.get(k).get(c));
      }
    }
);
  }
);
}
Program: 146534
Project: 146534
Buggy source:
public SamRecordMatcher(int threshold,boolean checkRGs,String tmpoutname,Map<String,Integer[]> thresholds,boolean debug){
  this.threshold=threshold;
  this.checkRGs=checkRGs;
  this.thresholds=thresholds;
  this.debug=debug;
  if (debug) {
    debugOut=Paths.get("String_Node_Str");
    try {
      this.debugWriter=Files.newBufferedWriter(this.debugOut,Charset.defaultCharset());
    }
 catch (    IOException ex) {
      log.log(Level.SEVERE,"String_Node_Str",ex);
    }
  }
  this.tempOutBase=tmpoutname;
}

Fixed version (ground truth):
/** 
 * Creates a factory that processes sam entries for discordant and split reads.
 * @param threshold The number of alignments to save in memory before spilling to disk
 * @param checkRGs true if the user wants the samheader read groups treated separately
 * @param tmpoutname The base temporary file output name
 * @param thresholds Obtained from the BamMetadataGeneration class -- [0] = lower insert size threshold [1] = upper insert size threshold
 * @param debug true if debug "samsupport.tab" file should be generated 
 */
public SamRecordMatcher(int threshold,boolean checkRGs,String tmpoutname,Map<String,Integer[]> thresholds,boolean debug){
  this.threshold=threshold;
  this.checkRGs=checkRGs;
  this.thresholds=thresholds;
  this.debug=debug;
  if (debug) {
    debugOut=Paths.get("String_Node_Str");
    try {
      this.debugWriter=Files.newBufferedWriter(this.debugOut,Charset.defaultCharset());
    }
 catch (    IOException ex) {
      log.log(Level.SEVERE,"String_Node_Str",ex);
    }
  }
  this.tempOutBase=tmpoutname;
}
Program: 146535
Project: 146535
Buggy source:
public String fq1File(){
  return this.fq1path.toString();
}

Fixed version (ground truth):
/** 
 * @return returns the absolute path of the temp FQ file
 */
public String fq1File(){
  return this.fq1path.toString();
}
Program: 146536
Project: 146536
Buggy source:
public boolean fileIsOpen(){
  return fileopen;
}

Fixed version (ground truth):
/** 
 * Checks if the temporary files are open for writing.
 * @return true if the handles are open. 
 */
public boolean fileIsOpen(){
  return fileopen;
}
Program: 146537
Project: 146537
Buggy source:
public int getTotalSplits(){
  return this.totalSplits.intValue();
}

Fixed version (ground truth):
/** 
 * @return returns the total number of processed (trimmed and normal) split reads.
 */
public int getTotalSplits(){
  return this.totalSplits.intValue();
}
Program: 146538
Project: 146538
Buggy source:
public void CloseAnchorHandle(){
  if (fileopen) {
    anchorOut.close();
  }
  fileopen=false;
}

Fixed version (ground truth):
/** 
 * Closes the temp Anchor handle file for writing.
 */
public void CloseAnchorHandle(){
  if (fileopen) {
    anchorOut.close();
  }
  fileopen=false;
}
Program: 146539
Project: 146539
Buggy source:
public void OpenFQHandle(){
  try {
    fq1=Files.newBufferedWriter(fq1path,Charset.defaultCharset());
  }
 catch (  IOException ex) {
    log.log(Level.SEVERE,"String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Opens the temp FQ handle file for writing. 
 */
public void OpenFQHandle(){
  try {
    fq1=Files.newBufferedWriter(fq1path,Charset.defaultCharset());
  }
 catch (  IOException ex) {
    log.log(Level.SEVERE,"String_Node_Str",ex);
  }
}
Program: 146540
Project: 146540
Buggy source:
public int getTrims(){
  return this.trimCounter.intValue();
}

Fixed version (ground truth):
/** 
 * @return returns the count of split reads that were too long and were trimmed.
 */
public int getTrims(){
  return this.trimCounter.intValue();
}
Program: 146541
Project: 146541
Buggy source:
public void OpenAnchorHandle(){
  anchorOut=anchor.makeBAMWriter(header,false,anchorpath.toFile());
  fileopen=true;
}

Fixed version (ground truth):
/** 
 * Opens the temp Anchor handle file for writing.
 */
public void OpenAnchorHandle(){
  anchorOut=anchor.makeBAMWriter(header,false,anchorpath.toFile());
  fileopen=true;
}
Program: 146542
Project: 146542
Buggy source:
public int getDiscards(){
  return this.discardCounter.intValue();
}

Fixed version (ground truth):
/** 
 * @return returns the count of split reads that were too short for processing
 */
public int getDiscards(){
  return this.discardCounter.intValue();
}
Program: 146543
Project: 146543
Buggy source:
public synchronized void AddAnchor(SAMRecord s){
  if (!fileopen)   this.OpenAnchorHandle();
  anchorOut.addAlignment(s);
}

Fixed version (ground truth):
/** 
 * This adds an anchor to the temp anchor file
 * @param s A SAMRecord object
 */
public synchronized void AddAnchor(SAMRecord s){
  if (!fileopen)   this.OpenAnchorHandle();
  anchorOut.addAlignment(s);
}
Program: 146544
Project: 146544
Buggy source:
public SplitOutputHandle(String file,String file2,SAMFileHeader sam,int readlen){
  fq1path=Paths.get(file);
  anchorpath=Paths.get(file2);
  header=sam;
  if (readlen % 2 != 0)   readlen-=1;
  this.splitreadlen=readlen / 2;
}

Fixed version (ground truth):
/** 
 * This class generates the temporary output file handle for split read generation
 * @param file The temporary fq file for alignment
 * @param file2 The output handle for the anchoring reads
 * @param sam A Samheader class object
 * @param readlen The read length chosen for read trimming
 */
public SplitOutputHandle(String file,String file2,SAMFileHeader sam,int readlen){
  fq1path=Paths.get(file);
  anchorpath=Paths.get(file2);
  header=sam;
  if (readlen % 2 != 0)   readlen-=1;
  this.splitreadlen=readlen / 2;
}
Program: 146545
Project: 146545
Buggy source:
public void CloseFQHandle(){
  try {
    fq1.close();
  }
 catch (  IOException ex) {
    log.log(Level.SEVERE,"String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Closes the temp FQ handle.
 */
public void CloseFQHandle(){
  try {
    fq1.close();
  }
 catch (  IOException ex) {
    log.log(Level.SEVERE,"String_Node_Str");
  }
}
Program: 146546
Project: 146546
Buggy source:
public synchronized void AddSplit(String[] segs){
  if (!fileopen)   this.OpenFQHandle();
  String nl=System.lineSeparator();
  String rn1="String_Node_Str" + segs[2] + "String_Node_Str";
  String rn2="String_Node_Str" + segs[2] + "String_Node_Str";
  int len=segs[11].length();
  if (len % 2 != 0)   len-=1;
  int splitter=len / 2;
  String tS1, tS2, tQ1, tQ2;
  if (splitter < this.splitreadlen) {
    this.discardCounter.incrementAndGet();
    return;
  }
 else   if (splitter > this.splitreadlen) {
    int diff=splitter - this.splitreadlen;
    this.trimCounter.incrementAndGet();
    tS1=segs[11].substring(diff,splitter);
    tS2=segs[11].substring(splitter,(splitter * 2) - diff);
    tQ1=segs[12].substring(diff,splitter);
    tQ2=segs[12].substring(splitter,(splitter * 2) - diff);
  }
 else {
    tS1=segs[11].substring(0,splitter);
    tS2=segs[11].substring(splitter,splitter * 2);
    tQ1=segs[12].substring(0,splitter);
    tQ2=segs[12].substring(splitter,splitter * 2);
  }
  this.totalSplits.incrementAndGet();
  try {
    fq1.write(rn1 + nl + tS1+ nl+ "String_Node_Str"+ nl+ tQ1+ nl);
    fq1.write(rn2 + nl + tS2+ nl+ "String_Node_Str"+ nl+ tQ2+ nl);
    fq1.flush();
  }
 catch (  IOException ex) {
    log.log(Level.SEVERE,"String_Node_Str",ex);
  }
}

Fixed version (ground truth):
/** 
 * This adds an alignment to the split read temporary file output
 * @param segs String representation of a temporary SAMRecord object (first two columns have the bin and RG ids)
 */
public synchronized void AddSplit(String[] segs){
  if (!fileopen)   this.OpenFQHandle();
  String nl=System.lineSeparator();
  String rn1="String_Node_Str" + segs[2] + "String_Node_Str";
  String rn2="String_Node_Str" + segs[2] + "String_Node_Str";
  int len=segs[11].length();
  if (len % 2 != 0)   len-=1;
  int splitter=len / 2;
  String tS1, tS2, tQ1, tQ2;
  if (segs[11].length() != segs[12].length()) {
    this.errorCounter.getAndIncrement();
    return;
  }
 else   if (splitter < this.splitreadlen) {
    this.discardCounter.incrementAndGet();
    return;
  }
 else   if (splitter > this.splitreadlen) {
    int diff=splitter - this.splitreadlen;
    this.trimCounter.incrementAndGet();
    tS1=segs[11].substring(diff,splitter);
    tS2=segs[11].substring(splitter,(splitter * 2) - diff);
    tQ1=segs[12].substring(diff,splitter);
    tQ2=segs[12].substring(splitter,(splitter * 2) - diff);
  }
 else {
    tS1=segs[11].substring(0,splitter);
    tS2=segs[11].substring(splitter,splitter * 2);
    tQ1=segs[12].substring(0,splitter);
    tQ2=segs[12].substring(splitter,splitter * 2);
  }
  this.totalSplits.incrementAndGet();
  try {
    fq1.write(rn1 + nl + tS1+ nl+ "String_Node_Str"+ nl+ tQ1+ nl);
    fq1.write(rn2 + nl + tS2+ nl+ "String_Node_Str"+ nl+ tQ2+ nl);
    fq1.flush();
  }
 catch (  IOException ex) {
    log.log(Level.SEVERE,"String_Node_Str",ex);
  }
}
Program: 146547
Project: 146547
Buggy source:
public String getAnchorFileStr(){
  return this.anchorpath.toAbsolutePath().toString();
}

Fixed version (ground truth):
/** 
 * @return returns the absolute path of the temp Anchor file
 */
public String getAnchorFileStr(){
  return this.anchorpath.toAbsolutePath().toString();
}
Program: 146550
Project: 146550
Buggy source:
private boolean isSplit(String[] segs){
  int fflags=Integer.parseInt(segs[3]);
  Cigar c=TextCigarCodec.getSingleton().decode(segs[7]);
  return (((fflags & 0x4) == 0x4 && (fflags & 0x8) != 0x8) || isOverSoftClipThreshold(c,segs[11].length()));
}

Fixed version (ground truth):
private boolean isSplit(String[] segs){
  int fflags=Integer.parseInt(segs[3]);
  Cigar c=TextCigarCodec.getSingleton().decode(segs[7]);
  return (((fflags & 0x4) == 0x4 && (fflags & 0x8) != 0x8 && (fflags & 0x256) != 0x256) || (isOverSoftClipThreshold(c,segs[11].length()) && (fflags & 0x256) != 0x256));
}
Program: 146551
Project: 146551
Buggy source:
public SamRecordMatcher(int threshold,boolean checkRGs,String tmpoutname,Map<String,Integer[]> thresholds,boolean debug){
  this.threshold=threshold;
  this.checkRGs=checkRGs;
  this.thresholds=thresholds;
  this.debug=debug;
  if (debug) {
    debugOut=Paths.get("String_Node_Str");
    try {
      this.debugWriter=Files.newBufferedWriter(this.debugOut,Charset.defaultCharset());
    }
 catch (    IOException ex) {
      Logger.getLogger(SamRecordMatcher.class.getName()).log(Level.SEVERE,null,ex);
    }
  }
  this.tempOutBase=tmpoutname;
}

Fixed version (ground truth):
public SamRecordMatcher(int threshold,boolean checkRGs,String tmpoutname,Map<String,Integer[]> thresholds,boolean debug){
  this.threshold=threshold;
  this.checkRGs=checkRGs;
  this.thresholds=thresholds;
  this.debug=debug;
  if (debug) {
    debugOut=Paths.get("String_Node_Str");
    try {
      this.debugWriter=Files.newBufferedWriter(this.debugOut,Charset.defaultCharset());
    }
 catch (    IOException ex) {
      log.log(Level.SEVERE,"String_Node_Str",ex);
    }
  }
  this.tempOutBase=tmpoutname;
}
Program: 146553
Project: 146553
Buggy source:
private List<BedSimple> getSamIntervals(SAMFileHeader h){
  List<BedSimple> coords=new ArrayList<>();
  coords=h.getSequenceDictionary().getSequences().stream().map((s) -> {
    String chr=s.getSequenceName();
    int len=s.getSequenceLength();
    return new BedSimple(chr,0,len);
  }
).collect(Collectors.toList());
  return coords;
}

Fixed version (ground truth):
private List<BedSimple> getSamIntervals(SAMFileHeader h){
  List<BedSimple> coords=new ArrayList<>();
  coords=h.getSequenceDictionary().getSequences().stream().map((s) -> {
    String chr=s.getSequenceName();
    int len=s.getSequenceLength();
    log.log(Level.FINE,"String_Node_Str" + chr + "String_Node_Str"+ 0+ "String_Node_Str"+ len);
    return new BedSimple(chr,0,len);
  }
).collect(Collectors.toList());
  return coords;
}
Program: 146554
Project: 146554
Buggy source:
/** 
 * Object constructor
 * @param hasRG This is a boolean flag telling the MetadataGenerator to search the BAM file for read groups and to treat them separately. A value of "false" will ignore all readgroups in the file.
 */
public BamMetadataGeneration(boolean hasRG){
  expectRG=hasRG;
}

Fixed version (ground truth):
/** 
 * Object constructor
 * @param hasRG This is a boolean flag telling the MetadataGenerator to search the BAM file for read groups and to treat them separately. A value of "false" will ignore all readgroups in the file.
 */
public BamMetadataGeneration(boolean hasRG){
  expectRG=hasRG;
  log.log(Level.FINE,"String_Node_Str" + hasRG);
}
Program: 146557
Project: 146557
Buggy source:
private boolean isSplit(String[] segs){
  int fflags=Integer.parseInt(segs[3]);
  Cigar c=TextCigarCodec.getSingleton().decode(segs[7]);
  return (((fflags & 0x4) == 0x4 && (fflags & 0x8) != 0x8 && (fflags & 0x256) != 0x256) || (isOverSoftClipThreshold(c,segs[11].length()) && (fflags & 0x256) != 0x256));
}

Fixed version (ground truth):
private boolean isSplit(String[] segs){
  int fflags=Integer.parseInt(segs[3]);
  Cigar c=TextCigarCodec.getSingleton().decode(segs[7]);
  return (((fflags & 0x4) == 0x4 && (fflags & 0x8) != 0x8 && (fflags & 0x100) != 0x100) || (isOverSoftClipThreshold(c,segs[11].length()) && (fflags & 0x100) != 0x100));
}
Program: 146559
Project: 146559
Buggy source:
public void OpenFQHandle(){
  try {
    fq1=Files.newBufferedWriter(fq1path,Charset.defaultCharset(),StandardOpenOption.APPEND);
  }
 catch (  IOException ex) {
    ex.printStackTrace();
  }
}

Fixed version (ground truth):
public void OpenFQHandle(){
  try {
    fq1=Files.newBufferedWriter(fq1path,Charset.defaultCharset());
  }
 catch (  IOException ex) {
    ex.printStackTrace();
  }
}
Program: 146560
Project: 146560
Buggy source:
@Override public void applyAndPropagateAnalyzer(XPathAnalyzer analyzer) throws AnalysisInvalidException {
  if (analyzer.shortCircuit()) {
    return;
  }
  analyzer.doAnalysis(TreeReference.this);
  if (this.hasPredicates()) {
    TreeReference contextForPredicates=this;
    if (this.contextType == CONTEXT_ORIGINAL) {
      if (analyzer.getOriginalContextRef() == null) {
        throw AnalysisInvalidException.INSTANCE;
      }
      contextForPredicates=this.contextualize(analyzer.getOriginalContextRef());
    }
 else     if (!this.isAbsolute()) {
      if (analyzer.getContextRef() == null) {
        throw AnalysisInvalidException.INSTANCE;
      }
      contextForPredicates=this.contextualize(analyzer.getContextRef());
    }
    for (int i=0; i < data.size(); i++) {
      TreeReferenceLevel subLevel=data.get(i);
      if (subLevel.getPredicates() != null) {
        TreeReference subContext=contextForPredicates.removePredicates().getSubReference(i);
        XPathAnalyzer subAnalyzer=analyzer.spawnSubAnalyzer(subContext);
        for (        XPathExpression expr : subLevel.getPredicates()) {
          expr.applyAndPropagateAnalyzer(subAnalyzer);
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void applyAndPropagateAnalyzer(XPathAnalyzer analyzer) throws AnalysisInvalidException {
  if (analyzer.shortCircuit()) {
    return;
  }
  analyzer.doAnalysis(TreeReference.this);
  if (analyzer.shouldIncludePredicates() && this.hasPredicates()) {
    TreeReference contextForPredicates=this;
    if (this.contextType == CONTEXT_ORIGINAL) {
      if (analyzer.getOriginalContextRef() == null) {
        throw AnalysisInvalidException.INSTANCE;
      }
      contextForPredicates=this.contextualize(analyzer.getOriginalContextRef());
    }
 else     if (!this.isAbsolute()) {
      if (analyzer.getContextRef() == null) {
        throw AnalysisInvalidException.INSTANCE;
      }
      contextForPredicates=this.contextualize(analyzer.getContextRef());
    }
    for (int i=0; i < data.size(); i++) {
      TreeReferenceLevel subLevel=data.get(i);
      if (subLevel.getPredicates() != null) {
        TreeReference subContext=contextForPredicates.removePredicates().getSubReference(i);
        XPathAnalyzer subAnalyzer=analyzer.spawnSubAnalyzer(subContext);
        for (        XPathExpression expr : subLevel.getPredicates()) {
          expr.applyAndPropagateAnalyzer(subAnalyzer);
        }
      }
    }
  }
}
Program: 146561
Project: 146561
Buggy source:
@Override public void doNormalTreeRefAnalysis(TreeReference treeRef) throws AnalysisInvalidException {
  if (treeRef.getContextType() == TreeReference.CONTEXT_INSTANCE) {
    addResultToList(treeRef.getInstanceName());
  }
}

Fixed version (ground truth):
@Override public void doNormalTreeRefAnalysis(TreeReference treeRef) throws AnalysisInvalidException {
  if (treeRef.getContextType() == TreeReference.CONTEXT_INSTANCE) {
    addToResult(treeRef.getInstanceName());
  }
}
Program: 146562
Project: 146562
Buggy source:
@Override public void doNormalTreeRefAnalysis(TreeReference treeRef) throws AnalysisInvalidException {
  addResultToList(treeRef.removePredicates());
}

Fixed version (ground truth):
@Override public void doNormalTreeRefAnalysis(TreeReference treeRef) throws AnalysisInvalidException {
  addToResult(treeRef.removePredicates());
}
Program: 146563
Project: 146563
Buggy source:
@Nullable public List<T> accumulateAsList(XPathAnalyzable rootExpression){
  try {
    rootExpression.applyAndPropagateAnalyzer(this);
    return aggregateResults(new ArrayList<T>());
  }
 catch (  AnalysisInvalidException e) {
    return null;
  }
}

Fixed version (ground truth):
@Nullable public List<T> accumulateAsList(XPathAnalyzable rootExpression){
  try {
    accumulated=new ArrayList<>();
    rootExpression.applyAndPropagateAnalyzer(this);
    List<T> resultList=new ArrayList<>();
    aggregateResults(resultList);
    return resultList;
  }
 catch (  AnalysisInvalidException e) {
    return null;
  }
}
Program: 146564
Project: 146564
Buggy source:
@Nullable public Set<T> accumulate(XPathAnalyzable rootExpression){
  try {
    rootExpression.applyAndPropagateAnalyzer(this);
    Set<T> set=new HashSet<>();
    set.addAll(aggregateResults(new ArrayList<T>()));
    return set;
  }
 catch (  AnalysisInvalidException e) {
    return null;
  }
}

Fixed version (ground truth):
@Nullable public Set<T> accumulate(XPathAnalyzable rootExpression){
  try {
    accumulated=new HashSet<>();
    rootExpression.applyAndPropagateAnalyzer(this);
    Set<T> resultSet=new HashSet<>();
    aggregateResults(resultSet);
    return resultSet;
  }
 catch (  AnalysisInvalidException e) {
    return null;
  }
}
Program: 146565
Project: 146565
Buggy source:
private List<T> aggregateResults(List<T> aggregated){
  aggregated.addAll(this.accumulatedList);
  for (  XPathAnalyzer subAnalyzer : this.subAnalyzers) {
    ((XPathAccumulatingAnalyzer)subAnalyzer).aggregateResults(aggregated);
  }
  return aggregated;
}

Fixed version (ground truth):
private void aggregateResults(Collection<T> resultCollection){
  resultCollection.addAll(this.accumulated);
  for (  XPathAnalyzer subAnalyzer : this.subAnalyzers) {
    ((XPathAccumulatingAnalyzer)subAnalyzer).aggregateResults(resultCollection);
  }
}
Program: 146566
Project: 146566
Buggy source:
@Override public int hashCode(){
  return expr.hashCode();
}

Fixed version (ground truth):
@Override public int hashCode(){
  int hash=expr.hashCode();
  if (contextRef != null) {
    hash^=contextRef.hashCode();
  }
  if (originalContextRef != null) {
    hash^=originalContextRef.hashCode();
  }
  return hash;
}
Program: 146567
Project: 146567
Buggy source:
public ExpressionCacheKey(InFormCacheableExpr expr){
  this.expr=expr;
}

Fixed version (ground truth):
public ExpressionCacheKey(InFormCacheableExpr expr,EvaluationContext ec){
  this.expr=expr;
  for (  int contextType : getRelevantContextTypes(expr)) {
    if (contextType == TreeReference.CONTEXT_INHERITED) {
      contextRef=ec.getContextRef();
    }
 else     if (contextType == TreeReference.CONTEXT_ORIGINAL) {
      originalContextRef=ec.getOriginalContext();
    }
  }
}
Program: 146568
Project: 146568
Buggy source:
@Override public boolean equals(Object o){
  if (o instanceof ExpressionCacheKey) {
    ExpressionCacheKey other=(ExpressionCacheKey)o;
    return expr.equals(other.expr);
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean equals(Object o){
  if (o instanceof ExpressionCacheKey) {
    ExpressionCacheKey other=(ExpressionCacheKey)o;
    return this.expr.equals(other.expr) && contextsEqual(this,other) && originalContextsEqual(this,other);
  }
  return false;
}
Program: 146569
Project: 146569
Buggy source:
void cache(Object value,EvaluationContext ec){
  if (ec.expressionCachingEnabled() && isCacheable(ec)) {
    ec.expressionCacher().cache(cacheKey(),value);
  }
}

Fixed version (ground truth):
void cache(Object value,EvaluationContext ec){
  if (ec.expressionCachingEnabled() && isCacheable(ec)) {
    ec.expressionCacher().cache(cacheKey(ec),value);
  }
}
Program: 146570
Project: 146570
Buggy source:
private ExpressionCacheKey cacheKey(){
  return new ExpressionCacheKey(this);
}

Fixed version (ground truth):
private ExpressionCacheKey cacheKey(EvaluationContext ec){
  return new ExpressionCacheKey(this,ec);
}
Program: 146571
Project: 146571
Buggy source:
private void queueUpCachedValue(EvaluationContext ec){
  justRetrieved=ec.expressionCacher().getCachedValue(cacheKey());
}

Fixed version (ground truth):
private void queueUpCachedValue(EvaluationContext ec){
  justRetrieved=ec.expressionCacher().getCachedValue(cacheKey(ec));
}
Program: 146572
Project: 146572
Buggy source:
private ArrayList<String> depthFirstSearch(String startNode,String currentNode,ArrayList<String> visited){
  if (visited.contains(currentNode)) {
    if (startNode.equals(currentNode)) {
      return visited;
    }
    return null;
  }
  visited.add(currentNode);
  for (  String child : childrenMap.get(currentNode)) {
    ArrayList<String> shortestPath=depthFirstSearch(startNode,child,visited);
    if (shortestPath != null) {
      return shortestPath;
    }
  }
  visited.remove(currentNode);
  return null;
}

Fixed version (ground truth):
private ArrayList<String> depthFirstSearch(String startNode,String currentNode,ArrayList<String> visited){
  if (visited.contains(currentNode)) {
    if (startNode.equals(currentNode)) {
      return visited;
    }
    return null;
  }
  visited.add(currentNode);
  ArrayList<String> children=childrenMap.get(currentNode);
  if (children != null) {
    for (    String child : children) {
      ArrayList<String> shortestPath=depthFirstSearch(startNode,child,visited);
      if (shortestPath != null) {
        return shortestPath;
      }
    }
  }
  visited.remove(currentNode);
  return null;
}
Program: 146573
Project: 146573
Buggy source:
private void processAppUpdate(){
  mSession.clearAllState();
  this.mUpdatePending=false;
  String updateTarget=mUpdateTarget;
  this.mUpdateTarget=null;
  try {
    mEngine.attemptAppUpdate(updateTarget);
  }
 catch (  UnresolvedResourceException e) {
    printStream.println("String_Node_Str");
    e.printStackTrace();
  }
catch (  UnfullfilledRequirementsException e) {
    printStream.println("String_Node_Str");
    e.printStackTrace();
  }
catch (  Exception e) {
    printStream.println("String_Node_Str");
    e.printStackTrace();
  }
}

Fixed version (ground truth):
private void processAppUpdate(){
}
Program: 146574
Project: 146574
Buggy source:
private void processAppUpdate(){
  mSession.clearAllState();
  this.mUpdatePending=false;
  String updateTarget=mUpdateTarget;
  this.mUpdateTarget=null;
  try {
    mEngine.attemptAppUpdate(updateTarget);
  }
 catch (  UnresolvedResourceException e) {
    printStream.println("String_Node_Str");
    e.printStackTrace();
  }
catch (  UnfullfilledRequirementsException e) {
    printStream.println("String_Node_Str");
    e.printStackTrace();
  }
catch (  Exception e) {
    printStream.println("String_Node_Str");
    e.printStackTrace();
  }
}

Fixed version (ground truth):
private void processAppUpdate(){
}
Program: 146575
Project: 146575
Buggy source:
/** 
 * Copy Constructor
 */
private EvaluationContext(EvaluationContext base,DataInstance instance,TreeReference contextNode,Hashtable<String,DataInstance> formInstances,boolean inheritCaching){
  this.functionHandlers=base.functionHandlers;
  this.formInstances=formInstances;
  this.variables=new Hashtable<>();
  this.shallowVariablesCopy(base.variables);
  this.contextNode=contextNode;
  this.instance=instance;
  this.isConstraint=base.isConstraint;
  this.candidateValue=base.candidateValue;
  this.outputTextForm=base.outputTextForm;
  this.original=base.original;
  this.currentContextPosition=base.currentContextPosition;
  if (base.mAccumulateExprs) {
    this.mAccumulateExprs=true;
    this.mDebugCore=base.mDebugCore;
  }
  if (inheritCaching) {
    this.expressionCacher=base.expressionCacher;
  }
  setQueryContext(base.queryContext);
}

Fixed version (ground truth):
/** 
 * Copy Constructor
 */
private EvaluationContext(EvaluationContext base,DataInstance instance,TreeReference contextNode,Hashtable<String,DataInstance> formInstances){
  this.functionHandlers=base.functionHandlers;
  this.formInstances=formInstances;
  this.variables=new Hashtable<>();
  this.shallowVariablesCopy(base.variables);
  this.contextNode=contextNode;
  this.instance=instance;
  this.isConstraint=base.isConstraint;
  this.candidateValue=base.candidateValue;
  this.outputTextForm=base.outputTextForm;
  this.original=base.original;
  this.currentContextPosition=base.currentContextPosition;
  if (base.mAccumulateExprs) {
    this.mAccumulateExprs=true;
    this.mDebugCore=base.mDebugCore;
  }
  this.expressionCacher=base.expressionCacher;
  setQueryContext(base.queryContext);
}
Program: 146576
Project: 146576
Buggy source:
public ExpressionCacheKey(InFormCacheableExpr expr,EvaluationContext ec){
  this.originalExpression=expr;
  generateContextualizedRefs(ec);
}

Fixed version (ground truth):
public ExpressionCacheKey(InFormCacheableExpr expr,EvaluationContext ec){
  this.originalExpression=expr;
  contextualizedRefs=new TreeReferenceAccumulatingAnalyzer(ec).accumulate(originalExpression);
}
Program: 146578
Project: 146578
Buggy source:
@Override protected TreeElement cache(QueryContext context){
  if (recordId == TreeReference.INDEX_TEMPLATE) {
    return empty;
  }
synchronized (parent.treeCache) {
    TreeElement element=parent.treeCache.retrieve(recordId);
    if (element != null) {
      return element;
    }
    TreeElement partialMatch=detectAndProcessLimitedScopeResponse(recordId,context);
    if (partialMatch != null) {
      return partialMatch;
    }
    StorageIndexedTreeElementModel model=parent.getElement(recordId,context);
    TreeElement cacheBuilder=buildElementFromModel(model);
    parent.treeCache.register(recordId,cacheBuilder);
    return cacheBuilder;
  }
}

Fixed version (ground truth):
@Override protected TreeElement cache(QueryContext context){
  if (recordId == TreeReference.INDEX_TEMPLATE) {
    return empty;
  }
synchronized (parent.treeCache) {
    TreeElement partialMatch=detectAndProcessLimitedScopeResponse(recordId,context);
    if (partialMatch != null) {
      return partialMatch;
    }
    TreeElement element=parent.treeCache.retrieve(recordId);
    if (element != null) {
      return element;
    }
    StorageIndexedTreeElementModel model=parent.getElement(recordId,context);
    TreeElement cacheBuilder=buildElementFromModel(model);
    parent.treeCache.register(recordId,cacheBuilder);
    return cacheBuilder;
  }
}
Program: 146580
Project: 146580
Buggy source:
/** 
 * Identifies whether in the current context it is potentially the case that a "partial" response is acceptable, and builds the response if so. Returns null if that strategy is not applicable or if a partial response could not be generated
 */
private TreeElement detectAndProcessLimitedScopeResponse(int recordId,QueryContext context){
  if (context == null) {
    return null;
  }
  ScopeLimitedReferenceRequestCache cache=context.getQueryCacheOrNull(ScopeLimitedReferenceRequestCache.class);
  if (cache == null) {
    return null;
  }
  TreeElement partialMatch=cache.getCachedElementIfExists(this.getInstanceName(),recordId);
  if (partialMatch != null) {
    return partialMatch;
  }
  if (!cache.isInstancePotentiallyScopeLimited(this.getInstanceName())) {
    return null;
  }
  String[] scopeSufficientColumnList=analyseScopeSufficientColumnList(cache);
  String[] objectMetadata=getElementMetadata(recordId,scopeSufficientColumnList,context);
  partialMatch=this.buildPartialElementFromMetadata(scopeSufficientColumnList,objectMetadata);
  cache.cacheElement(this.getInstanceName(),recordId,partialMatch);
  return partialMatch;
}

Fixed version (ground truth):
/** 
 * Identifies whether in the current context it is potentially the case that a "partial" response is acceptable, and builds the response if so. Returns null if that strategy is not applicable or if a partial response could not be generated
 */
private TreeElement detectAndProcessLimitedScopeResponse(int recordId,QueryContext context){
  if (context == null) {
    return null;
  }
  ScopeLimitedReferenceRequestCache cache=context.getQueryCacheOrNull(ScopeLimitedReferenceRequestCache.class);
  if (cache == null) {
    return null;
  }
  TreeElement partialMatch=cache.getCachedElementIfExists(this.getInstanceName(),recordId);
  if (partialMatch != null) {
    return partialMatch;
  }
  if (!cache.isInstancePotentiallyScopeLimited(this.getInstanceName())) {
    return null;
  }
  String[] scopeSufficientColumnList=analyseScopeSufficientColumnList(cache);
  if (scopeSufficientColumnList == null) {
    return null;
  }
  String[] objectMetadata=getElementMetadata(recordId,scopeSufficientColumnList,context);
  partialMatch=this.buildPartialElementFromMetadata(scopeSufficientColumnList,objectMetadata);
  cache.cacheElement(this.getInstanceName(),recordId,partialMatch);
  return partialMatch;
}
Program: 146581
Project: 146581
Buggy source:
public TreeElement getCachedElementIfExists(String instanceName,int recordId){
  if (!treeElementCache.containsKey(instanceName) || !treeElementCache.get(instanceName).containsKey(recordId)) {
    return null;
  }
  return treeElementCache.get(instanceName).get(recordId).get();
}

Fixed version (ground truth):
public TreeElement getCachedElementIfExists(String instanceName,int recordId){
  if (!treeElementCache.containsKey(instanceName) || !treeElementCache.get(instanceName).containsKey(recordId)) {
    return null;
  }
  return treeElementCache.get(instanceName).get(recordId);
}
Program: 146582
Project: 146582
Buggy source:
public void cacheElement(String instanceName,int recordId,TreeElement element){
  treeElementCache.get(instanceName).put(recordId,new WeakReference<TreeElement>(element));
}

Fixed version (ground truth):
public void cacheElement(String instanceName,int recordId,TreeElement element){
  treeElementCache.get(instanceName).put(recordId,element);
}
Program: 146583
Project: 146583
Buggy source:
/** 
 * Provide a cue from within an instance that it has determined a payload that it can use to process requests from limited scope. This signal is a guarantee that the instance will be able to dereference the tree references it is responsible for in the limited scope using a partial load rather than a full model load.
 */
public void setInternalScopeLimit(String instanceName,String[] columnNameCacheLoads){
  this.instanceScopeLimitCache.put(instanceName,columnNameCacheLoads);
  treeElementCache.put(instanceName,new HashMap<Integer,WeakReference<TreeElement>>());
}

Fixed version (ground truth):
/** 
 * Provide a cue from within an instance that it has determined a payload that it can use to process requests from limited scope. This signal is a guarantee that the instance will be able to dereference the tree references it is responsible for in the limited scope using a partial load rather than a full model load.
 */
public void setInternalScopeLimit(String instanceName,String[] columnNameCacheLoads){
  this.instanceScopeLimitCache.put(instanceName,columnNameCacheLoads);
  treeElementCache.put(instanceName,new HashMap());
}