Program: 146531
Project: 146531
Buggy source:
private void TempFileConverter(SplitOutputHandle splits,DivetOutputHandle divets,String rg,TempSortFileHolder sam) throws InterruptedException, IOException, Exception {
  String line, last="String_Node_Str";
  String[] lastsegs=null;
  ArrayList<String[]> records=new ArrayList<>();
  BufferedReader input=sam.GetTempReader();
  Map<Integer,Integer> readState=new HashMap<>();
  readState.put(0,0);
  readState.put(1,0);
  readState.put(2,0);
  readState.put(3,0);
  while ((line=input.readLine()) != null) {
    line=line.trim();
    String[] segs=line.split("String_Node_Str");
    if (!segs[0].equals(last)) {
      if (!records.isEmpty()) {
        if (records.stream().anyMatch((s) -> isSplit(s))) {
          int scount=0, acount=0;
          for (          String[] r : records) {
            if (this.isAnchor(r)) {
              splits.AddAnchor(r);
              if (debug)               this.debugWriter.write("String_Node_Str" + StrUtils.StrArray.Join(r,"String_Node_Str") + System.lineSeparator());
              acount++;
            }
 else {
              splits.AddSplit(r);
              if (debug)               this.debugWriter.write("String_Node_Str" + StrUtils.StrArray.Join(r,"String_Node_Str") + System.lineSeparator());
              scount++;
            }
          }
          if (acount == 0 && scount > 0) {
            String[] temp=records.get(0);
            if (!anchorlookup.containsKey(rg))             anchorlookup.put(rg,new HashMap<>());
            anchorlookup.get(rg).put(temp[0],this.flipCloneNum(Short.parseShort(temp[1])));
          }
        }
        if (records.size() > 1) {
          Integer[] t=thresholds.get(rg);
          SamToDivet converter=new SamToDivet(last,t[0],t[1],t[2]);
          records.stream().forEach((r) -> {
            processXAZTag(r).stream().forEach((n) -> {
              converter.addLines(n);
            }
);
            converter.addLines(r);
            try {
              if (debug)               this.debugWriter.write("String_Node_Str" + StrUtils.StrArray.Join(r,"String_Node_Str") + System.lineSeparator());
            }
 catch (            IOException ex) {
              ex.printStackTrace();
            }
          }
);
          converter.processLinesToDivets();
          int state=converter.getState();
          if (state != 0) {
            readState.put(state,readState.get(state) + 1);
          }
 else {
            readState.put(state,readState.get(state) + 1);
            divets.PrintDivetOut(converter.getDivets());
          }
        }
        records.clear();
      }
    }
    lastsegs=segs;
    records.add(segs);
    last=segs[0];
  }
  log.log(Level.FINE,"String_Node_Str" + readState.get(0) + "String_Node_Str"+ rg+ "String_Node_Str");
  if (readState.get(1) > 0 || readState.get(2) > 0 || readState.get(3) > 0) {
    if (readState.get(1) > 0)     log.log(Level.WARNING,"String_Node_Str" + readState.get(1) + "String_Node_Str"+ rg);
    if (readState.get(2) > 0)     log.log(Level.WARNING,"String_Node_Str" + readState.get(2) + "String_Node_Str"+ rg);
    if (readState.get(3) > 0)     log.log(Level.WARNING,"String_Node_Str" + readState.get(3) + "String_Node_Str"+ rg+ "String_Node_Str");
  }
  int splitTrims=splits.getTrims();
  int splitDiscards=splits.getDiscards();
  log.log(Level.INFO,"String_Node_Str" + splitDiscards + "String_Node_Str"+ splitTrims+ "String_Node_Str"+ splits.getTotalSplits()+ "String_Node_Str");
  divets.CloseHandle();
  splits.CloseFQHandle();
  input.close();
}

Fixed version (ground truth):
private void TempFileConverter(SplitOutputHandle splits,DivetOutputHandle divets,String rg,TempSortFileHolder sam) throws InterruptedException, IOException, Exception {
  String line, last="String_Node_Str";
  String[] lastsegs=null;
  ArrayList<String[]> records=new ArrayList<>();
  BufferedReader input=sam.GetTempReader();
  Map<Integer,Integer> readState=new HashMap<>();
  readState.put(0,0);
  readState.put(1,0);
  readState.put(2,0);
  readState.put(3,0);
  while ((line=input.readLine()) != null) {
    line=line.trim();
    String[] segs=line.split("String_Node_Str");
    if (!segs[0].equals(last)) {
      if (!records.isEmpty()) {
        if (records.stream().anyMatch((s) -> isSplit(s))) {
          int scount=0, acount=0;
          for (          String[] r : records) {
            if (this.isAnchor(r)) {
              splits.AddAnchor(r);
              if (debug)               this.debugWriter.write("String_Node_Str" + StrUtils.StrArray.Join(r,"String_Node_Str") + System.lineSeparator());
              acount++;
            }
 else {
              splits.AddSplit(r);
              if (debug)               this.debugWriter.write("String_Node_Str" + StrUtils.StrArray.Join(r,"String_Node_Str") + System.lineSeparator());
              scount++;
            }
          }
          if (acount == 0 && scount > 0) {
            String[] temp=records.get(0);
            if (!anchorlookup.containsKey(rg))             anchorlookup.put(rg,new HashMap<>());
            anchorlookup.get(rg).put(temp[0],this.flipCloneNum(Short.parseShort(temp[1])));
          }
        }
        if (records.size() > 1) {
          Integer[] t=thresholds.get(rg);
          SamToDivet converter=new SamToDivet(last,t[0],t[1],t[2]);
          records.stream().forEach((r) -> {
            processXAZTag(r).stream().forEach((n) -> {
              converter.addLines(n);
            }
);
            converter.addLines(r);
            try {
              if (debug)               this.debugWriter.write("String_Node_Str" + StrUtils.StrArray.Join(r,"String_Node_Str") + System.lineSeparator());
            }
 catch (            IOException ex) {
              ex.printStackTrace();
            }
          }
);
          converter.processLinesToDivets();
          int state=converter.getState();
          if (state != 0) {
            readState.put(state,readState.get(state) + 1);
          }
 else {
            readState.put(state,readState.get(state) + 1);
            divets.PrintDivetOut(converter.getDivets());
          }
        }
        records.clear();
      }
    }
    lastsegs=segs;
    records.add(segs);
    last=segs[0];
  }
  log.log(Level.FINE,"String_Node_Str" + readState.get(0) + "String_Node_Str"+ rg+ "String_Node_Str");
  if (readState.get(1) > 0 || readState.get(2) > 0 || readState.get(3) > 0) {
    if (readState.get(1) > 0)     log.log(Level.WARNING,"String_Node_Str" + readState.get(1) + "String_Node_Str"+ rg);
    if (readState.get(2) > 0)     log.log(Level.WARNING,"String_Node_Str" + readState.get(2) + "String_Node_Str"+ rg);
    if (readState.get(3) > 0)     log.log(Level.WARNING,"String_Node_Str" + readState.get(3) + "String_Node_Str"+ rg+ "String_Node_Str");
  }
  int splitTrims=splits.getTrims();
  int splitDiscards=splits.getDiscards();
  int splitErrors=splits.getErrors();
  log.log(Level.INFO,"String_Node_Str" + splitDiscards + "String_Node_Str"+ splitTrims+ "String_Node_Str"+ splits.getTotalSplits()+ "String_Node_Str");
  if (splitErrors > 0) {
    log.log(Level.INFO,"String_Node_Str" + splitErrors + "String_Node_Str");
  }
  divets.CloseHandle();
  splits.CloseFQHandle();
  input.close();
}