Program: 17065
Project: 17065
Buggy source:
public static String toFatCatCore(AFPChain afpChain,Atom[] ca1,Atom[] ca2,boolean printLegend,boolean longHeader,boolean showHTML){
  if (!afpChain.isSequentialAlignment()) {
    return "String_Node_Str";
  }
  String name1=afpChain.getName1();
  String name2=afpChain.getName2();
  int ca1Length=afpChain.getCa1Length();
  int ca2Length=afpChain.getCa2Length();
  int blockNum=afpChain.getBlockNum();
  int totalLenIni=afpChain.getTotalLenIni();
  double totalRmsdIni=afpChain.getTotalRmsdIni();
  int optLength=afpChain.getOptLength();
  double totalRmsdOpt=afpChain.getTotalRmsdOpt();
  double chainRmsd=afpChain.getChainRmsd();
  double alignScore=afpChain.getAlignScore();
  int alnLength=afpChain.getAlnLength();
  int gapLen=afpChain.getGapLen();
  List<AFP> afpSet=afpChain.getAfpSet();
  double similarity=afpChain.getSimilarity();
  double identity=afpChain.getIdentity();
  if (similarity < 0 || identity < 0) {
    afpChain.calcSimilarity();
    similarity=afpChain.getSimilarity();
    identity=afpChain.getIdentity();
  }
  String algorithmName=afpChain.getAlgorithmName();
  double probability=afpChain.getProbability();
  int afpNum=afpSet.size();
  int[] blockGap=afpChain.getBlockGap();
  double[] blockScore=afpChain.getBlockScore();
  double[] blockRmsd=afpChain.getBlockRmsd();
  int[] blockSize=afpChain.getBlockSize();
  int alnbeg1=afpChain.getAlnbeg1();
  int alnbeg2=afpChain.getAlnbeg2();
  char[] alnseq1=afpChain.getAlnseq1();
  char[] alnseq2=afpChain.getAlnseq2();
  char[] alnsymb=afpChain.getAlnsymb();
  StringBuffer txt=new StringBuffer();
  if (longHeader) {
    txt.append(String.format("String_Node_Str",name1,ca1Length,name2,ca2Length));
  }
 else {
    txt.append(String.format("String_Node_Str",name1,ca1Length,name2,ca2Length));
  }
  txt.append(newline);
  if (afpChain.isShortAlign()) {
    txt.append("String_Node_Str");
    return txt.toString();
  }
  if (longHeader) {
    txt.append(String.format("String_Node_Str",blockNum - 1,totalLenIni,totalRmsdIni,optLength,totalRmsdOpt,chainRmsd,alignScore,alnLength,gapLen,(100.0 * (double)gapLen / (double)alnLength)));
    txt.append(newline);
  }
 else {
    if (!longHeader)     printScore(txt,algorithmName,probability,longHeader);
    printScoresInLines(afpChain,blockNum,optLength,totalRmsdOpt,alignScore,alnLength,gapLen,identity,similarity,txt);
  }
  if (longHeader) {
    printScore(txt,algorithmName,probability,longHeader);
    txt.append(String.format("String_Node_Str",afpNum,identity * 100,similarity * 100));
    txt.append(newline);
  }
  int i;
  double gap;
  if (longHeader) {
    int fragLen=8;
    for (i=0; i < blockNum; i++) {
      gap=(double)blockGap[i] / ((double)blockGap[i] + fragLen * blockSize[i]);
      txt.append(String.format("String_Node_Str",i,blockSize[i],blockScore[i],blockRmsd[i],blockGap[i],gap));
      txt.append(newline);
    }
  }
  int linelen=70;
  String a;
  String b;
  String c;
  int t=0;
  int ap=alnbeg1;
  int bp=alnbeg2;
  int k, len;
  while ((alnLength - t) > 0) {
    if (alnLength - t > linelen)     len=linelen;
 else     len=alnLength - t;
    String lseq1=new String(alnseq1).substring(t,t + len);
    String lseq2=new String(alnseq2).substring(t,t + len);
    String lsymb=new String(alnsymb).substring(t,t + len);
    if (showHTML) {
      a="String_Node_Str";
      b="String_Node_Str";
      c="String_Node_Str";
      for (int pos=0; pos < lseq1.length(); pos++) {
        char c1=lseq1.charAt(pos);
        char c2=lseq2.charAt(pos);
        char cl=lsymb.charAt(pos);
        if (cl != ' ') {
          a+="String_Node_Str" + c1 + "String_Node_Str";
          b+="String_Node_Str" + c2 + "String_Node_Str";
          c+="String_Node_Str" + cl + "String_Node_Str";
        }
 else         if (c1 != '-' && c2 != '-') {
          a+="String_Node_Str" + c1 + "String_Node_Str";
          b+="String_Node_Str" + c2 + "String_Node_Str";
          c+="String_Node_Str" + cl + "String_Node_Str";
        }
 else {
          a+="String_Node_Str" + c1 + "String_Node_Str";
          b+="String_Node_Str" + c2 + "String_Node_Str";
          c+="String_Node_Str" + cl + "String_Node_Str";
        }
        if (c1 != '-')         ap++;
        if (c2 != '-')         bp++;
      }
    }
 else {
      a=lseq1;
      b=lseq2;
      c=lsymb;
    }
    txt.append(newline);
    if (longHeader)     txt.append(String.format("String_Node_Str","String_Node_Str"));
 else     txt.append(String.format("String_Node_Str","String_Node_Str"));
    if (longHeader) {
      for (k=10; k <= len; k+=10)       txt.append("String_Node_Str");
      if (k <= len + 5)       txt.append("String_Node_Str");
    }
 else {
      for (k=10; k <= len; k+=10)       txt.append("String_Node_Str");
      if (k <= len + 5)       txt.append("String_Node_Str");
    }
    if (ap >= ca1.length)     break;
    if (bp >= ca2.length)     break;
    String pdb1=ca1[ap].getGroup().getResidueNumber().toString();
    String pdb2=ca2[bp].getGroup().getResidueNumber().toString();
    txt.append(newline);
    txt.append(String.format("String_Node_Str" + newline + "String_Node_Str"+ newline+ "String_Node_Str",pdb1,a,"String_Node_Str",c,pdb2,b));
    txt.append(newline);
    if (!showHTML) {
      for (k=0; k < len; k++) {
        if (a.charAt(k) != '-')         ap++;
        if (b.charAt(k) != '-')         bp++;
      }
    }
    t+=len;
  }
  txt.append(newline);
  if (printLegend) {
    if (algorithmName.equalsIgnoreCase(CeMain.algorithmName) || algorithmName.equalsIgnoreCase(SmithWaterman3Daligner.algorithmName)) {
      txt.append("String_Node_Str");
    }
 else {
      txt.append("String_Node_Str");
    }
    txt.append(newline);
  }
  return txt.toString();
}

Fixed version (ground truth):
public static String toFatCatCore(AFPChain afpChain,Atom[] ca1,Atom[] ca2,boolean printLegend,boolean longHeader,boolean showHTML){
  if (!afpChain.isSequentialAlignment()) {
    return "String_Node_Str";
  }
  String name1=afpChain.getName1();
  String name2=afpChain.getName2();
  int ca1Length=afpChain.getCa1Length();
  int ca2Length=afpChain.getCa2Length();
  int blockNum=afpChain.getBlockNum();
  int totalLenIni=afpChain.getTotalLenIni();
  double totalRmsdIni=afpChain.getTotalRmsdIni();
  int optLength=afpChain.getOptLength();
  double totalRmsdOpt=afpChain.getTotalRmsdOpt();
  double chainRmsd=afpChain.getChainRmsd();
  double alignScore=afpChain.getAlignScore();
  int alnLength=afpChain.getAlnLength();
  int gapLen=afpChain.getGapLen();
  List<AFP> afpSet=afpChain.getAfpSet();
  double similarity=afpChain.getSimilarity();
  double identity=afpChain.getIdentity();
  if (similarity < 0 || identity < 0) {
    afpChain.calcSimilarity();
    similarity=afpChain.getSimilarity();
    identity=afpChain.getIdentity();
  }
  String algorithmName=afpChain.getAlgorithmName();
  double probability=afpChain.getProbability();
  int afpNum=afpSet.size();
  int[] blockGap=afpChain.getBlockGap();
  double[] blockScore=afpChain.getBlockScore();
  double[] blockRmsd=afpChain.getBlockRmsd();
  int[] blockSize=afpChain.getBlockSize();
  int alnbeg1=afpChain.getAlnbeg1();
  int alnbeg2=afpChain.getAlnbeg2();
  char[] alnseq1=afpChain.getAlnseq1();
  char[] alnseq2=afpChain.getAlnseq2();
  char[] alnsymb=afpChain.getAlnsymb();
  StringBuffer txt=new StringBuffer();
  if (longHeader) {
    txt.append(String.format("String_Node_Str",name1,ca1Length,name2,ca2Length));
  }
 else {
    txt.append(String.format("String_Node_Str",name1,ca1Length,name2,ca2Length));
  }
  txt.append(newline);
  if (afpChain.isShortAlign()) {
    txt.append("String_Node_Str");
    return txt.toString();
  }
  if (longHeader) {
    txt.append(String.format("String_Node_Str",blockNum - 1,totalLenIni,totalRmsdIni,optLength,totalRmsdOpt,chainRmsd,alignScore,alnLength,gapLen,(100.0 * (double)gapLen / (double)alnLength)));
    txt.append(newline);
  }
 else {
    if (!longHeader)     printScore(txt,algorithmName,probability,longHeader);
    printScoresInLines(afpChain,blockNum,optLength,totalRmsdOpt,alignScore,alnLength,gapLen,identity,similarity,txt);
  }
  if (longHeader) {
    printScore(txt,algorithmName,probability,longHeader);
    txt.append(String.format("String_Node_Str",afpNum,identity * 100,similarity * 100));
    txt.append(newline);
  }
  int i;
  double gap;
  if (longHeader) {
    int fragLen=8;
    for (i=0; i < blockNum; i++) {
      gap=(double)blockGap[i] / ((double)blockGap[i] + fragLen * blockSize[i]);
      txt.append(String.format("String_Node_Str",i,blockSize[i],blockScore[i],blockRmsd[i],blockGap[i],gap));
      txt.append(newline);
    }
  }
  int linelen=70;
  String a;
  String b;
  String c;
  int t=0;
  int ap=alnbeg1;
  int bp=alnbeg2;
  int k, len;
  System.out.println(alnseq1.length + "String_Node_Str" + alnseq1.toString());
  while ((alnLength - t) > 0) {
    if (alnLength - t > linelen)     len=linelen;
 else     len=alnLength - t;
    if (ap >= ca1.length)     break;
    if (bp >= ca2.length)     break;
    String pdb1=ca1[ap].getGroup().getResidueNumber().toString();
    String pdb2=ca2[bp].getGroup().getResidueNumber().toString();
    String lseq1=new String(alnseq1).substring(t,t + len);
    String lseq2=new String(alnseq2).substring(t,t + len);
    String lsymb=new String(alnsymb).substring(t,t + len);
    if (showHTML) {
      a="String_Node_Str";
      b="String_Node_Str";
      c="String_Node_Str";
      for (int pos=0; pos < lseq1.length(); pos++) {
        char c1=lseq1.charAt(pos);
        char c2=lseq2.charAt(pos);
        char cl=lsymb.charAt(pos);
        int block=-1;
        if (cl != ' ') {
          try {
            block=Integer.parseInt(cl + "String_Node_Str");
          }
 catch (          Exception e) {
          }
        }
        if (cl != ' ') {
          if (block > -1) {
            a+="String_Node_Str" + block + "String_Node_Str"+ c1+ "String_Node_Str";
            b+="String_Node_Str" + block + "String_Node_Str"+ c2+ "String_Node_Str";
            c+="String_Node_Str" + cl + "String_Node_Str";
          }
 else {
            a+="String_Node_Str" + c1 + "String_Node_Str";
            b+="String_Node_Str" + c2 + "String_Node_Str";
            c+="String_Node_Str" + cl + "String_Node_Str";
          }
        }
 else         if (c1 != '-' && c2 != '-') {
          a+="String_Node_Str" + c1 + "String_Node_Str";
          b+="String_Node_Str" + c2 + "String_Node_Str";
          c+="String_Node_Str" + cl + "String_Node_Str";
        }
 else {
          a+="String_Node_Str" + c1 + "String_Node_Str";
          b+="String_Node_Str" + c2 + "String_Node_Str";
          c+="String_Node_Str" + cl + "String_Node_Str";
        }
        if (c1 != '-')         ap++;
        if (c2 != '-')         bp++;
      }
    }
 else {
      a=lseq1;
      b=lseq2;
      c=lsymb;
    }
    txt.append(newline);
    if (longHeader)     txt.append(String.format("String_Node_Str","String_Node_Str"));
 else     txt.append(String.format("String_Node_Str","String_Node_Str"));
    if (longHeader) {
      for (k=10; k <= len; k+=10)       txt.append("String_Node_Str");
      if (k <= len + 5)       txt.append("String_Node_Str");
    }
 else {
      for (k=10; k <= len; k+=10)       txt.append("String_Node_Str");
      if (k <= len + 5)       txt.append("String_Node_Str");
    }
    txt.append(newline);
    txt.append(String.format("String_Node_Str" + newline + "String_Node_Str"+ newline+ "String_Node_Str",pdb1,a,"String_Node_Str",c,pdb2,b));
    txt.append(newline);
    if (!showHTML) {
      for (k=0; k < len; k++) {
        if (a.charAt(k) != '-')         ap++;
        if (b.charAt(k) != '-')         bp++;
      }
    }
    t+=len;
  }
  txt.append(newline);
  if (printLegend) {
    if (algorithmName.equalsIgnoreCase(CeMain.algorithmName) || algorithmName.equalsIgnoreCase(SmithWaterman3Daligner.algorithmName)) {
      txt.append("String_Node_Str");
    }
 else {
      txt.append("String_Node_Str");
    }
    txt.append(newline);
  }
  return txt.toString();
}