Program: 6371
Project: 6371
Buggy source:
public String toLS(){
  StringBuffer ls=new StringBuffer();
  ls.append("String_Node_Str");
  ls.append("String_Node_Str" + jc.getClassName() + "String_Node_Str"+ methodbcel.getName()+ "String_Node_Str");
  ls.append("String_Node_Str");
  for (Iterator iter=bbs.keySet().iterator(); iter.hasNext(); ) {
    Integer keyInt=(Integer)iter.next();
    WCETBasicBlock wcbb=(WCETBasicBlock)bbs.get(keyInt);
    ls.append("String_Node_Str" + wcbb.id);
    if (iter.hasNext())     ls.append("String_Node_Str");
  }
  ls.append("String_Node_Str");
  ls.append("String_Node_Str");
  ls.append("String_Node_Str");
  WCETBasicBlock wcbb=null;
  for (Iterator iter=bbs.keySet().iterator(); iter.hasNext(); ) {
    Integer keyInt=(Integer)iter.next();
    wcbb=(WCETBasicBlock)bbs.get(keyInt);
    HashMap tinbbs=wcbb.getInbbs();
    if (tinbbs.size() > 0 || wcbb.id == 0) {
      ls.append("String_Node_Str" + wcbb.id + "String_Node_Str");
      if (wcbb.id == 0) {
        ls.append("String_Node_Str");
        if (tinbbs.size() > 0) {
          ls.append("String_Node_Str");
        }
      }
      for (Iterator titer=tinbbs.keySet().iterator(); titer.hasNext(); ) {
        Integer tkeyInt=(Integer)titer.next();
        WCETBasicBlock w=(WCETBasicBlock)tinbbs.get(tkeyInt);
        ls.append("String_Node_Str" + w.id + "String_Node_Str"+ wcbb.id);
        if (titer.hasNext())         ls.append("String_Node_Str");
      }
      ls.append("String_Node_Str");
      if (wcbb.sucbb != null)       ls.append("String_Node_Str" + wcbb.id + "String_Node_Str"+ wcbb.sucbb.id);
      if (wcbb.sucbb != null && wcbb.tarbb != null)       ls.append("String_Node_Str");
      if (wcbb.tarbb != null)       ls.append("String_Node_Str" + wcbb.id + "String_Node_Str"+ wcbb.tarbb.id);
      if (wcbb.sucbb == null && wcbb.tarbb == null)       ls.append("String_Node_Str");
      ls.append("String_Node_Str");
    }
  }
  ls.append("String_Node_Str");
  for (Iterator iter=bbs.keySet().iterator(); iter.hasNext(); ) {
    Integer keyInt=(Integer)iter.next();
    wcbb=(WCETBasicBlock)bbs.get(keyInt);
    if (wcbb.loopcontroller) {
      if (wcbb.id == 0) {
        ls.append("String_Node_Str" + wcbb.id + "String_Node_Str"+ wcbb.id+ "String_Node_Str"+ wcbb.sucbb.id+ "String_Node_Str"+ wcbb.loop+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ wcbb.id+ "String_Node_Str"+ wcbb.id+ "String_Node_Str");
      }
 else {
        ls.append("String_Node_Str" + wcbb.id + "String_Node_Str"+ wcbb.id+ "String_Node_Str"+ wcbb.sucbb.id+ "String_Node_Str"+ wcbb.loop+ "String_Node_Str"+ (wcbb.loopid - 1)+ "String_Node_Str"+ wcbb.loopid+ "String_Node_Str"+ wcbb.id+ "String_Node_Str");
      }
    }
  }
  ls.append("String_Node_Str");
  for (Iterator iter=bbs.keySet().iterator(); iter.hasNext(); ) {
    Integer keyInt=(Integer)iter.next();
    wcbb=(WCETBasicBlock)bbs.get(keyInt);
    ls.append("String_Node_Str" + wcbb.id + "String_Node_Str");
    HashMap tinbbs=wcbb.getInbbs();
    if (tinbbs.size() > 0 || wcbb.id == 0) {
      if (wcbb.id == 0) {
        ls.append(wcbb.blockcycmiss + "String_Node_Str");
        if (tinbbs.size() > 0)         ls.append("String_Node_Str");
      }
      for (Iterator titer=tinbbs.keySet().iterator(); titer.hasNext(); ) {
        Integer tkeyInt=(Integer)titer.next();
        WCETBasicBlock w=(WCETBasicBlock)tinbbs.get(tkeyInt);
        ls.append(wcbb.blockcycmiss + "String_Node_Str" + w.id+ "String_Node_Str"+ wcbb.id);
        if (titer.hasNext())         ls.append("String_Node_Str");
      }
    }
    ls.append("String_Node_Str" + wcbb.id + "String_Node_Str");
  }
  try {
    lpf=new File(WCETAnalyser.outFile).getParentFile().getAbsolutePath() + "String_Node_Str" + jc.getClassName()+ "String_Node_Str"+ methodbcel.getName()+ "String_Node_Str";
    lpf=lpf.replace('<','_');
    lpf=lpf.replace('>','_');
    PrintWriter lsout=new PrintWriter(new FileOutputStream(lpf));
    lsout.write(ls.toString());
    lsout.close();
  }
 catch (  FileNotFoundException e1) {
    e1.printStackTrace();
  }
  try {
    wcetvars=new HashMap();
    LpSolve problem=LpSolve.readLp(lpf,LpSolve.NORMAL,jc.getClassName() + "String_Node_Str" + methodbcel.getName());
    problem.setOutputfile(lpf + "String_Node_Str");
    problem.solve();
    problem.setOutputfile(lpf + "String_Node_Str");
    problem.printObjective();
    problem.printSolution(1);
    wcetlp=(int)problem.getObjective();
    try {
      BufferedReader in=new BufferedReader(new FileReader(lpf + "String_Node_Str"));
      String str;
      while ((str=in.readLine()) != null) {
        ls.append(str + "String_Node_Str");
        StringTokenizer st=new StringTokenizer(str);
        if (st.countTokens() == 2) {
          wcetvars.put(st.nextToken(),st.nextToken());
        }
      }
      in.close();
    }
 catch (    IOException e) {
    }
  }
 catch (  LpSolveException e) {
    System.out.println("String_Node_Str" + jc.getClassName() + "String_Node_Str"+ methodbcel.getName());
  }
  return ls.toString();
}

Fixed version (ground truth):
public String toLS(){
  StringBuffer ls=new StringBuffer();
  ls.append("String_Node_Str");
  ls.append("String_Node_Str" + jc.getClassName() + "String_Node_Str"+ methodbcel.getName()+ "String_Node_Str");
  ls.append("String_Node_Str");
  for (Iterator iter=bbs.keySet().iterator(); iter.hasNext(); ) {
    Integer keyInt=(Integer)iter.next();
    WCETBasicBlock wcbb=(WCETBasicBlock)bbs.get(keyInt);
    ls.append("String_Node_Str" + wcbb.id);
    if (iter.hasNext())     ls.append("String_Node_Str");
  }
  ls.append("String_Node_Str");
  ls.append("String_Node_Str");
  ls.append("String_Node_Str");
  WCETBasicBlock wcbb=null;
  for (Iterator iter=bbs.keySet().iterator(); iter.hasNext(); ) {
    Integer keyInt=(Integer)iter.next();
    wcbb=(WCETBasicBlock)bbs.get(keyInt);
    HashMap tinbbs=wcbb.getInbbs();
    if (tinbbs.size() > 0 || wcbb.id == 0) {
      ls.append("String_Node_Str" + wcbb.id + "String_Node_Str");
      if (wcbb.id == 0) {
        ls.append("String_Node_Str");
        if (tinbbs.size() > 0) {
          ls.append("String_Node_Str");
        }
      }
      for (Iterator titer=tinbbs.keySet().iterator(); titer.hasNext(); ) {
        Integer tkeyInt=(Integer)titer.next();
        WCETBasicBlock w=(WCETBasicBlock)tinbbs.get(tkeyInt);
        ls.append("String_Node_Str" + w.id + "String_Node_Str"+ wcbb.id);
        if (titer.hasNext())         ls.append("String_Node_Str");
      }
      ls.append("String_Node_Str");
      if (wcbb.sucbb != null)       ls.append("String_Node_Str" + wcbb.id + "String_Node_Str"+ wcbb.sucbb.id);
      if (wcbb.sucbb != null && wcbb.tarbb != null)       ls.append("String_Node_Str");
      if (wcbb.tarbb != null)       ls.append("String_Node_Str" + wcbb.id + "String_Node_Str"+ wcbb.tarbb.id);
      if (wcbb.sucbb == null && wcbb.tarbb == null)       ls.append("String_Node_Str");
      ls.append("String_Node_Str");
    }
  }
  ls.append("String_Node_Str");
  for (Iterator iter=bbs.keySet().iterator(); iter.hasNext(); ) {
    Integer keyInt=(Integer)iter.next();
    wcbb=(WCETBasicBlock)bbs.get(keyInt);
    if (wcbb.loopcontroller) {
      if (wcbb.id == 0) {
        ls.append("String_Node_Str" + wcbb.id + "String_Node_Str"+ wcbb.id+ "String_Node_Str"+ wcbb.sucbb.id+ "String_Node_Str"+ wcbb.loop+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ wcbb.id+ "String_Node_Str");
      }
 else {
        ls.append("String_Node_Str" + wcbb.id + "String_Node_Str"+ wcbb.id+ "String_Node_Str"+ wcbb.sucbb.id+ "String_Node_Str"+ wcbb.loop+ "String_Node_Str"+ (wcbb.loopid - 1)+ "String_Node_Str"+ wcbb.loopid+ "String_Node_Str");
      }
    }
  }
  ls.append("String_Node_Str");
  for (Iterator iter=bbs.keySet().iterator(); iter.hasNext(); ) {
    Integer keyInt=(Integer)iter.next();
    wcbb=(WCETBasicBlock)bbs.get(keyInt);
    ls.append("String_Node_Str" + wcbb.id + "String_Node_Str");
    HashMap tinbbs=wcbb.getInbbs();
    if (tinbbs.size() > 0 || wcbb.id == 0) {
      if (wcbb.id == 0) {
        ls.append(wcbb.blockcycmiss + "String_Node_Str");
        if (tinbbs.size() > 0)         ls.append("String_Node_Str");
      }
      for (Iterator titer=tinbbs.keySet().iterator(); titer.hasNext(); ) {
        Integer tkeyInt=(Integer)titer.next();
        WCETBasicBlock w=(WCETBasicBlock)tinbbs.get(tkeyInt);
        ls.append(wcbb.blockcycmiss + "String_Node_Str" + w.id+ "String_Node_Str"+ wcbb.id);
        if (titer.hasNext())         ls.append("String_Node_Str");
      }
    }
    ls.append("String_Node_Str");
  }
  try {
    lpf=new File(WCETAnalyser.outFile).getParentFile().getAbsolutePath() + "String_Node_Str" + jc.getClassName()+ "String_Node_Str"+ methodbcel.getName()+ "String_Node_Str";
    lpf=lpf.replace('<','_');
    lpf=lpf.replace('>','_');
    PrintWriter lsout=new PrintWriter(new FileOutputStream(lpf));
    lsout.write(ls.toString());
    lsout.close();
  }
 catch (  FileNotFoundException e1) {
    e1.printStackTrace();
  }
  try {
    wcetvars=new HashMap();
    LpSolve problem=LpSolve.readLp(lpf,LpSolve.NORMAL,jc.getClassName() + "String_Node_Str" + methodbcel.getName());
    problem.setOutputfile(lpf + "String_Node_Str");
    problem.solve();
    problem.setOutputfile(lpf + "String_Node_Str");
    problem.printObjective();
    problem.printSolution(1);
    wcetlp=(int)problem.getObjective();
    try {
      BufferedReader in=new BufferedReader(new FileReader(lpf + "String_Node_Str"));
      String str;
      while ((str=in.readLine()) != null) {
        ls.append(str + "String_Node_Str");
        StringTokenizer st=new StringTokenizer(str);
        if (st.countTokens() == 2) {
          wcetvars.put(st.nextToken(),st.nextToken());
        }
      }
      in.close();
    }
 catch (    IOException e) {
    }
  }
 catch (  LpSolveException e) {
    System.out.println("String_Node_Str" + jc.getClassName() + "String_Node_Str"+ methodbcel.getName());
  }
  return ls.toString();
}