Program: 2248
Project: 2248
Buggy source:
private void addCallbackCases(MethodBuilder mb2,final String ROLE_PARAM,final String MESSAGE_VAR,final String OP,Module main,Role peer){
  boolean first;
  mb2.addBodyLine(StateChannelApiGenerator.SCRIBMESSAGE_CLASS + "String_Node_Str" + MESSAGE_VAR+ "String_Node_Str"+ JavaBuilder.SUPER+ "String_Node_Str"+ getSessionApiRoleConstant(peer)+ "String_Node_Str");
  first=true;
  for (  EAction a : this.curr.getActions()) {
    EState succ=this.curr.getSuccessor(a);
    if (first) {
      first=false;
    }
 else {
      mb2.addBodyLine("String_Node_Str");
    }
    mb2.addBodyLine("String_Node_Str" + MESSAGE_VAR + "String_Node_Str"+ StateChannelApiGenerator.SCRIBMESSAGE_OP_FIELD+ "String_Node_Str"+ getSessionApiOpConstant(a.mid)+ "String_Node_Str");
    if (succ.isTerminal()) {
      mb2.addBodyLine(1,SCRIBSOCKET_SE_FIELD + "String_Node_Str");
    }
    String ln="String_Node_Str";
{
      ln+=JavaBuilder.NEW + "String_Node_Str" + (succ.isTerminal() ? ScribSockGen.GENERATED_ENDSOCKET_NAME : this.apigen.getSocketClassName(succ))+ "String_Node_Str"+ SCRIBSOCKET_SE_FIELD+ "String_Node_Str";
    }
    ln+=getSessionApiOpConstant(a.mid);
    if (a.mid.isOp()) {
      if (!a.payload.isEmpty()) {
        String buffSuper=JavaBuilder.NEW + "String_Node_Str" + BUF_CLASS+ "String_Node_Str";
        int i=0;
        for (        PayloadType<?> pt : a.payload.elems) {
          DataTypeDecl dtd=main.getDataTypeDecl((DataType)pt);
          ln+="String_Node_Str" + buffSuper + "String_Node_Str"+ dtd.extName+ "String_Node_Str"+ RECEIVE_MESSAGE_PARAM+ "String_Node_Str"+ SCRIBMESSAGE_PAYLOAD_FIELD+ "String_Node_Str"+ i+++ "String_Node_Str";
        }
      }
    }
 else {
      MessageSigNameDecl msd=main.getMessageSigDecl(((MessageSigName)a.mid).getSimpleName());
      ln+="String_Node_Str" + JavaBuilder.NEW + "String_Node_Str"+ BUF_CLASS+ "String_Node_Str"+ msd.extName+ "String_Node_Str"+ RECEIVE_MESSAGE_PARAM+ "String_Node_Str"+ SCRIBMESSAGE_PAYLOAD_FIELD+ "String_Node_Str";
    }
    ln+="String_Node_Str";
    mb2.addBodyLine(1,ln);
    mb2.addBodyLine("String_Node_Str");
  }
  mb2.addBodyLine("String_Node_Str");
  mb2.addBodyLine(1,"String_Node_Str" + JavaBuilder.NEW + "String_Node_Str"+ OP+ "String_Node_Str");
  mb2.addBodyLine("String_Node_Str");
}

Fixed version (ground truth):
private void addCallbackCases(MethodBuilder mb2,final String ROLE_PARAM,final String MESSAGE_VAR,final String OP,Module main,Role peer){
  boolean first;
  mb2.addBodyLine(StateChannelApiGenerator.SCRIBMESSAGE_CLASS + "String_Node_Str" + MESSAGE_VAR+ "String_Node_Str"+ JavaBuilder.SUPER+ "String_Node_Str"+ getSessionApiRoleConstant(peer)+ "String_Node_Str");
  first=true;
  for (  EAction a : this.curr.getActions()) {
    EState succ=this.curr.getSuccessor(a);
    if (first) {
      first=false;
    }
 else {
      mb2.addBodyLine("String_Node_Str");
    }
    mb2.addBodyLine("String_Node_Str" + MESSAGE_VAR + "String_Node_Str"+ StateChannelApiGenerator.SCRIBMESSAGE_OP_FIELD+ "String_Node_Str"+ getSessionApiOpConstant(a.mid)+ "String_Node_Str");
    if (succ.isTerminal()) {
      mb2.addBodyLine(1,SCRIBSOCKET_SE_FIELD + "String_Node_Str");
    }
    String ln="String_Node_Str";
{
      ln+=JavaBuilder.NEW + "String_Node_Str" + (succ.isTerminal() ? ScribSockGen.GENERATED_ENDSOCKET_NAME : this.apigen.getSocketClassName(succ))+ "String_Node_Str"+ SCRIBSOCKET_SE_FIELD+ "String_Node_Str";
    }
    ln+=getSessionApiOpConstant(a.mid);
    if (a.mid.isOp()) {
      if (!a.payload.isEmpty()) {
        String buffSuper=JavaBuilder.NEW + "String_Node_Str" + BUF_CLASS+ "String_Node_Str";
        int i=0;
        for (        PayloadType<?> pt : a.payload.elems) {
          DataTypeDecl dtd=main.getDataTypeDecl((DataType)pt);
          ln+="String_Node_Str" + buffSuper + "String_Node_Str"+ dtd.extName+ "String_Node_Str"+ RECEIVE_MESSAGE_PARAM+ "String_Node_Str"+ SCRIBMESSAGE_PAYLOAD_FIELD+ "String_Node_Str"+ i+++ "String_Node_Str";
        }
      }
    }
 else {
      MessageSigNameDecl msd=main.getMessageSigDecl(((MessageSigName)a.mid).getSimpleName());
      ln+="String_Node_Str" + JavaBuilder.NEW + "String_Node_Str"+ BUF_CLASS+ "String_Node_Str"+ msd.extName+ "String_Node_Str"+ RECEIVE_MESSAGE_PARAM+ "String_Node_Str";
    }
    ln+="String_Node_Str";
    mb2.addBodyLine(1,ln);
    mb2.addBodyLine("String_Node_Str");
  }
  mb2.addBodyLine("String_Node_Str");
  mb2.addBodyLine(1,"String_Node_Str" + JavaBuilder.NEW + "String_Node_Str"+ OP+ "String_Node_Str");
  mb2.addBodyLine("String_Node_Str");
}