Program: 2247
Project: 2247
Buggy source:
private void addHandleMethod(final String ROLE_PARAM,final String MESSAGE_VAR,final String OP,Module main,Role peer){
  boolean first;
  MethodBuilder mb4=this.cb.newMethod("String_Node_Str");
  mb4.addParameters(SessionApiGenerator.getRoleClassName(peer) + "String_Node_Str" + ROLE_PARAM);
  String tmp=HandleIfaceGen.getHandleInterfaceName(this.apigen.getSelf(),this.curr) + "String_Node_Str";
  tmp+=this.curr.getActions().stream().sorted(IOStateIfaceGen.IOACTION_COMPARATOR).map((a) -> SuccessorIfaceGen.getSuccessorInterfaceName(a)).collect(Collectors.joining("String_Node_Str")) + "String_Node_Str";
  mb4.addParameters(tmp + "String_Node_Str");
  mb4.setReturn(JavaBuilder.VOID);
  mb4.addModifiers(JavaBuilder.PUBLIC);
  mb4.addExceptions(StateChannelApiGenerator.SCRIBBLERUNTIMEEXCEPTION_CLASS,"String_Node_Str","String_Node_Str");
  mb4.addAnnotations("String_Node_Str");
  mb4.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 {
      mb4.addBodyLine("String_Node_Str");
    }
    mb4.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()) {
      mb4.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";
    mb4.addBodyLine(1,ln);
    mb4.addBodyLine("String_Node_Str");
  }
  mb4.addBodyLine("String_Node_Str");
  mb4.addBodyLine(1,"String_Node_Str" + JavaBuilder.NEW + "String_Node_Str"+ OP+ "String_Node_Str");
  mb4.addBodyLine("String_Node_Str");
}

Fixed version (ground truth):
private void addHandleMethod(final String ROLE_PARAM,final String MESSAGE_VAR,final String OP,Module main,Role peer){
  boolean first;
  MethodBuilder mb4=this.cb.newMethod("String_Node_Str");
  mb4.addParameters(SessionApiGenerator.getRoleClassName(peer) + "String_Node_Str" + ROLE_PARAM);
  String tmp=HandleIfaceGen.getHandleInterfaceName(this.apigen.getSelf(),this.curr) + "String_Node_Str";
  tmp+=this.curr.getActions().stream().sorted(IOStateIfaceGen.IOACTION_COMPARATOR).map((a) -> SuccessorIfaceGen.getSuccessorInterfaceName(a)).collect(Collectors.joining("String_Node_Str")) + "String_Node_Str";
  mb4.addParameters(tmp + "String_Node_Str");
  mb4.setReturn(JavaBuilder.VOID);
  mb4.addModifiers(JavaBuilder.PUBLIC);
  mb4.addExceptions(StateChannelApiGenerator.SCRIBBLERUNTIMEEXCEPTION_CLASS,"String_Node_Str","String_Node_Str");
  mb4.addAnnotations("String_Node_Str");
  mb4.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 {
      mb4.addBodyLine("String_Node_Str");
    }
    mb4.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()) {
      mb4.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";
    mb4.addBodyLine(1,ln);
    mb4.addBodyLine("String_Node_Str");
  }
  mb4.addBodyLine("String_Node_Str");
  mb4.addBodyLine(1,"String_Node_Str" + JavaBuilder.NEW + "String_Node_Str"+ OP+ "String_Node_Str");
  mb4.addBodyLine("String_Node_Str");
}