nus-yam/ex-repair huggingface dataset:
Program: 2263
Project: 2263
Buggy source:
@Override public LContinue leaveEndpointGraphBuilding(ScribNode parent,ScribNode child,EndpointGraphBuilder graph,ScribNode visited) throws ScribbleException {
  LContinue lr=(LContinue)visited;
  RecVar rv=lr.recvar.toName();
  if (graph.builder.isUnguardedInChoice()) {
    graph.builder.addContinueEdge(graph.builder.getEntry(),rv);
  }
 else {
    Iterator<EndpointState> preds=graph.builder.getPredecessors().iterator();
    Iterator<IOAction> prevs=graph.builder.getPreviousActions().iterator();
    EndpointState entry=graph.builder.getEntry();
    Set<List<Object>> removed=new HashSet<>();
    while (preds.hasNext()) {
      EndpointState pred=preds.next();
      IOAction prev=prevs.next();
      List<Object> tmp=Arrays.asList(pred,prev,entry);
      if (!removed.contains(tmp)) {
        removed.add(tmp);
        graph.builder.removeEdge(pred,prev,entry);
      }
      graph.builder.addEdge(pred,prev,graph.builder.getRecursionEntry(rv));
    }
  }
  return (LContinue)super.leaveEndpointGraphBuilding(parent,child,graph,lr);
}

Fixed version (ground truth):
@Override public LContinue leaveEndpointGraphBuilding(ScribNode parent,ScribNode child,EndpointGraphBuilder graph,ScribNode visited) throws ScribbleException {
  LContinue lr=(LContinue)visited;
  RecVar rv=lr.recvar.toName();
  if (graph.builder.isUnguardedInChoice()) {
    graph.builder.addContinueEdge(graph.builder.getEntry(),rv);
  }
 else {
    Iterator<EndpointState> preds=graph.builder.getPredecessors().iterator();
    Iterator<IOAction> prevs=graph.builder.getPreviousActions().iterator();
    EndpointState entry=graph.builder.getEntry();
    Set<List<Object>> removed=new HashSet<>();
    while (preds.hasNext()) {
      EndpointState pred=preds.next();
      IOAction prev=prevs.next();
      List<Object> tmp=Arrays.asList(pred,prev,entry);
      if (!removed.contains(tmp)) {
        removed.add(tmp);
        graph.builder.removeEdgeFromPredecessor(pred,prev);
      }
      graph.builder.addRecursionEdge(pred,prev,graph.builder.getRecursionEntry(rv));
    }
  }
  return (LContinue)super.leaveEndpointGraphBuilding(parent,child,graph,lr);
}
Program: 2264
Project: 2264
Buggy source:
public List<A> getPreviousActions(){
  return this.prev.peek();
}

Fixed version (ground truth):
public List<A> getPreviousActions(){
  return new LinkedList<>(this.prev.peek());
}
Program: 2265
Project: 2265
Buggy source:
public List<S> getPredecessors(){
  return this.pred.peek();
}

Fixed version (ground truth):
public List<S> getPredecessors(){
  return new LinkedList<>(this.pred.peek());
}
Program: 2266
Project: 2266
Buggy source:
private void run(Http_C_1 c,String host) throws Exception {
  Buf<Response> buf=new Buf<>();
  c.send(S,new Request("String_Node_Str","String_Node_Str",host)).receive(S,RESPONSE,buf);
  System.out.println("String_Node_Str" + buf.val);
}

Fixed version (ground truth):
private void run(Http_C_1 c,String host) throws Exception {
  Buf<Response> buf=new Buf<>();
  c.send(S,new Request("String_Node_Str","String_Node_Str",host)).receive(S,Response,buf);
  System.out.println("String_Node_Str" + buf.val);
}
Program: 2268
Project: 2268
Buggy source:
private void outputProjections(Job job) throws CommandLineException {
  JobContext jcontext=job.getContext();
  String[] args=this.args.get(ArgFlag.PROJECT);
  for (int i=0; i < args.length; i+=2) {
    GProtocolName fullname=checkGlobalProtocolArg(jcontext,args[i]);
    Role role=checkRoleArg(jcontext,fullname,args[i + 1]);
    Map<LProtocolName,Module> projections=job.getProjections(fullname,role);
    System.out.println("String_Node_Str" + projections.values().stream().map((p) -> p.toString()).collect(Collectors.joining("String_Node_Str")));
  }
}

Fixed version (ground truth):
private void outputProjections(Job job) throws CommandLineException, ScribbleException {
  JobContext jcontext=job.getContext();
  String[] args=this.args.get(ArgFlag.PROJECT);
  for (int i=0; i < args.length; i+=2) {
    GProtocolName fullname=checkGlobalProtocolArg(jcontext,args[i]);
    Role role=checkRoleArg(jcontext,fullname,args[i + 1]);
    Map<LProtocolName,Module> projections=job.getProjections(fullname,role);
    System.out.println("String_Node_Str" + projections.values().stream().map((p) -> p.toString()).collect(Collectors.joining("String_Node_Str")));
  }
}
Program: 2269
Project: 2269
Buggy source:
public Map<LProtocolName,Module> getProjections(GProtocolName fullname,Role role){
  Module root=this.jcontext.getProjection(fullname,role);
  Map<LProtocolName,Set<Role>> dependencies=((LProtocolDeclDel)root.getLocalProtocolDecls().get(0).del()).getProtocolDeclContext().getDependencyMap().getDependencies().get(role);
  return dependencies.keySet().stream().collect(Collectors.toMap((lpn) -> lpn,(lpn) -> this.jcontext.getModule(lpn.getPrefix())));
}

Fixed version (ground truth):
public Map<LProtocolName,Module> getProjections(GProtocolName fullname,Role role) throws ScribbleException {
  Module root=this.jcontext.getProjection(fullname,role);
  Map<LProtocolName,Set<Role>> dependencies=((LProtocolDeclDel)root.getLocalProtocolDecls().get(0).del()).getProtocolDeclContext().getDependencyMap().getDependencies().get(role);
  return dependencies.keySet().stream().collect(Collectors.toMap((lpn) -> lpn,(lpn) -> this.jcontext.getModule(lpn.getPrefix())));
}
Program: 2270
Project: 2270
Buggy source:
public EndpointGraph getEndpointGraph(GProtocolName fullname,Role role) throws ScribbleException {
  LProtocolName fulllpn=Projector.projectFullProtocolName(fullname,role);
  EndpointGraph graph=this.graphs.get(fulllpn);
  if (graph == null) {
    Module proj=getProjection(fullname,role);
    if (proj == null) {
      throw new ScribbleException("String_Node_Str" + fullname + "String_Node_Str"+ role);
    }
    EndpointGraphBuilder builder=new EndpointGraphBuilder(this.job);
    proj.accept(builder);
    graph=builder.builder.finalise();
    addEndpointGraph(fulllpn,graph);
  }
  return graph;
}

Fixed version (ground truth):
public EndpointGraph getEndpointGraph(GProtocolName fullname,Role role) throws ScribbleException {
  LProtocolName fulllpn=Projector.projectFullProtocolName(fullname,role);
  EndpointGraph graph=this.graphs.get(fulllpn);
  if (graph == null) {
    Module proj=getProjection(fullname,role);
    EndpointGraphBuilder builder=new EndpointGraphBuilder(this.job);
    proj.accept(builder);
    graph=builder.builder.finalise();
    addEndpointGraph(fulllpn,graph);
  }
  return graph;
}
Program: 2271
Project: 2271
Buggy source:
public Module getProjection(GProtocolName fullname,Role role){
  return this.projected.get(Projector.projectFullProtocolName(fullname,role));
}

Fixed version (ground truth):
public Module getProjection(GProtocolName fullname,Role role) throws ScribbleException {
  Module proj=this.projected.get(Projector.projectFullProtocolName(fullname,role));
  if (proj == null) {
    throw new ScribbleException("String_Node_Str" + fullname + "String_Node_Str"+ role);
  }
  return proj;
}
Program: 2272
Project: 2272
Buggy source:
protected EndpointGraph getEndpointGraph(LProtocolName fullname){
  EndpointGraph graph=this.graphs.get(fullname);
  if (graph == null) {
    throw new RuntimeException("String_Node_Str" + fullname);
  }
  return graph;
}

Fixed version (ground truth):
public EndpointGraph getEndpointGraph(GProtocolName fullname,Role role) throws ScribbleException {
  LProtocolName fulllpn=Projector.projectFullProtocolName(fullname,role);
  EndpointGraph graph=this.graphs.get(fulllpn);
  if (graph == null) {
    Module proj=getProjection(fullname,role);
    if (proj == null) {
      throw new ScribbleException("String_Node_Str" + fullname + "String_Node_Str"+ role);
    }
    EndpointGraphBuilder builder=new EndpointGraphBuilder(this.job);
    proj.accept(builder);
    graph=builder.builder.finalise();
    addEndpointGraph(fulllpn,graph);
  }
  return graph;
}
Program: 2273
Project: 2273
Buggy source:
protected EndpointGraph getUnfairEndpointGraph(LProtocolName fullname){
  EndpointGraph unfair=this.unfair.get(fullname);
  if (unfair == null) {
    unfair=getEndpointGraph(fullname).init.unfairTransform().toGraph();
    addUnfairEndpointGraph(fullname,unfair);
  }
  return unfair;
}

Fixed version (ground truth):
public EndpointGraph getUnfairEndpointGraph(GProtocolName fullname,Role role) throws ScribbleException {
  return getUnfairEndpointGraphAux(fullname,role);
}
Program: 2274
Project: 2274
Buggy source:
protected EndpointGraph getMinimisedEndpointGraph(LProtocolName fullname){
  EndpointGraph minimised=this.minimised.get(fullname);
  if (minimised == null) {
    try {
      String aut=runAut(getEndpointGraph(fullname).init.toAut(),fullname + "String_Node_Str");
      minimised=new AutParser().parse(aut);
      addMinimisedEndpointGraph(fullname,minimised);
    }
 catch (    ScribbleException e) {
      throw new RuntimeException(e);
    }
  }
  return minimised;
}

Fixed version (ground truth):
public EndpointGraph getMinimisedEndpointGraph(GProtocolName fullname,Role role){
  return getMinimisedEndpointGraphAux(fullname,role);
}
Program: 2275
Project: 2275
Buggy source:
public Map<Role,Map<Role,Send>> getBuffers(){
  return this.buffs;
}

Fixed version (ground truth):
public Map<Role,Map<Role,Send>> getBuffers(){
  return new WFBuffers(this).buffs;
}
Program: 2278
Project: 2278
Buggy source:
@Override protected void addMethods(){
  String branchName=this.apigen.getSocketClassName(curr);
  String enumClassName=branchName + "String_Node_Str" + BranchSocketGenerator.getBranchEnumClassName(this.apigen,this.curr);
  FieldBuilder fb1=this.cb.newField(CASE_OP_FIELD);
  fb1.addModifiers(JavaBuilder.PUBLIC,JavaBuilder.FINAL);
  fb1.setType(enumClassName);
  FieldBuilder fb2=this.cb.newField(CASE_MESSAGE_FIELD);
  fb2.addModifiers(JavaBuilder.PRIVATE,JavaBuilder.FINAL);
  fb2.setType(StateChannelApiGenerator.SCRIBMESSAGE_CLASS);
  for (  IOAction a : this.curr.getTakeable()) {
    EndpointState succ=this.curr.take(a);
    addReceiveMethod(this.cb,a,succ);
    addCaseReceiveMethod(this.cb,a,succ);
    if (!a.payload.isEmpty() || a.mid.isMessageSigName()) {
      addCaseReceiveDiscardMethod(this.cb,a,succ);
    }
  }
  Role self=this.apigen.getSelf();
  MethodBuilder mb=this.cb.newMethod("String_Node_Str");
  mb.addAnnotations("String_Node_Str");
  mb.addModifiers(JavaBuilder.PUBLIC);
  mb.setReturn(IOStateInterfaceGenerator.getIOStateInterfaceName(self,this.curr) + "String_Node_Str" + BranchInterfaceGenerator.getBranchInterfaceEnumName(self,this.curr));
  mb.addBodyLine(JavaBuilder.RETURN + "String_Node_Str" + JavaBuilder.THIS+ "String_Node_Str"+ CASE_OP_FIELD+ "String_Node_Str");
  this.apigen.addTypeDecl(this.cb);
}

Fixed version (ground truth):
@Override protected void addMethods() throws ScribbleException {
  String branchName=this.apigen.getSocketClassName(curr);
  String enumClassName=branchName + "String_Node_Str" + BranchSocketGenerator.getBranchEnumClassName(this.apigen,this.curr);
  FieldBuilder fb1=this.cb.newField(CASE_OP_FIELD);
  fb1.addModifiers(JavaBuilder.PUBLIC,JavaBuilder.FINAL);
  fb1.setType(enumClassName);
  FieldBuilder fb2=this.cb.newField(CASE_MESSAGE_FIELD);
  fb2.addModifiers(JavaBuilder.PRIVATE,JavaBuilder.FINAL);
  fb2.setType(StateChannelApiGenerator.SCRIBMESSAGE_CLASS);
  for (  IOAction a : this.curr.getTakeable()) {
    EndpointState succ=this.curr.take(a);
    addReceiveMethod(this.cb,a,succ);
    addCaseReceiveMethod(this.cb,a,succ);
    if (!a.payload.isEmpty() || a.mid.isMessageSigName()) {
      addCaseReceiveDiscardMethod(this.cb,a,succ);
    }
  }
  Role self=this.apigen.getSelf();
  MethodBuilder mb=this.cb.newMethod("String_Node_Str");
  mb.addAnnotations("String_Node_Str");
  mb.addModifiers(JavaBuilder.PUBLIC);
  mb.setReturn(IOStateInterfaceGenerator.getIOStateInterfaceName(self,this.curr) + "String_Node_Str" + BranchInterfaceGenerator.getBranchInterfaceEnumName(self,this.curr));
  mb.addBodyLine(JavaBuilder.RETURN + "String_Node_Str" + JavaBuilder.THIS+ "String_Node_Str"+ CASE_OP_FIELD+ "String_Node_Str");
  this.apigen.addTypeDecl(this.cb);
}
Program: 2279
Project: 2279
Buggy source:
public static void setCaseReceiveHeaderWithoutReturnType(StateChannelApiGenerator apigen,IOAction a,MethodBuilder mb){
  Module main=apigen.getMainModule();
  String opClass=SessionApiGenerator.getOpClassName(a.mid);
  mb.setName("String_Node_Str");
  mb.addModifiers(JavaBuilder.PUBLIC);
  mb.addParameters(opClass + "String_Node_Str" + StateChannelApiGenerator.RECEIVE_OP_PARAM);
  mb.addExceptions(StateChannelApiGenerator.SCRIBBLERUNTIMEEXCEPTION_CLASS,"String_Node_Str","String_Node_Str");
  if (a.mid.isOp()) {
    ReceiveSocketGenerator.addReceiveOpParams(mb,main,a,true);
  }
 else {
    MessageSigNameDecl msd=main.getMessageSigDecl(((MessageSigName)a.mid).getSimpleName());
    ReceiveSocketGenerator.addReceiveMessageSigNameParams(mb,msd,true);
  }
}

Fixed version (ground truth):
public static void setCaseReceiveHeaderWithoutReturnType(StateChannelApiGenerator apigen,IOAction a,MethodBuilder mb) throws ScribbleException {
  Module main=apigen.getMainModule();
  String opClass=SessionApiGenerator.getOpClassName(a.mid);
  mb.setName("String_Node_Str");
  mb.addModifiers(JavaBuilder.PUBLIC);
  mb.addParameters(opClass + "String_Node_Str" + StateChannelApiGenerator.RECEIVE_OP_PARAM);
  mb.addExceptions(StateChannelApiGenerator.SCRIBBLERUNTIMEEXCEPTION_CLASS,"String_Node_Str","String_Node_Str");
  if (a.mid.isOp()) {
    ReceiveSocketGenerator.addReceiveOpParams(mb,main,a,true);
  }
 else {
    MessageSigNameDecl msd=main.getMessageSigDecl(((MessageSigName)a.mid).getSimpleName());
    ReceiveSocketGenerator.addReceiveMessageSigNameParams(mb,msd,true);
  }
}
Program: 2280
Project: 2280
Buggy source:
private void addCaseReceiveMethod(ClassBuilder cb,IOAction a,EndpointState succ){
  MethodBuilder mb=makeCaseReceiveHeader(cb,a,succ);
  String ln=JavaBuilder.RETURN + "String_Node_Str" + "String_Node_Str"+ getSessionApiRoleConstant(a.obj)+ "String_Node_Str";
  boolean first=true;
  for (  String param : mb.getParameters()) {
    if (first) {
      first=false;
    }
 else {
      ln+="String_Node_Str";
    }
    if (param.contains("String_Node_Str")) {
      param=param.substring(param.lastIndexOf('>') + 1,param.length());
    }
    ln+=param.substring(param.indexOf("String_Node_Str") + 1,param.length());
  }
  mb.addBodyLine(ln + "String_Node_Str");
}

Fixed version (ground truth):
private void addCaseReceiveMethod(ClassBuilder cb,IOAction a,EndpointState succ) throws ScribbleException {
  MethodBuilder mb=makeCaseReceiveHeader(cb,a,succ);
  String ln=JavaBuilder.RETURN + "String_Node_Str" + "String_Node_Str"+ getSessionApiRoleConstant(a.obj)+ "String_Node_Str";
  boolean first=true;
  for (  String param : mb.getParameters()) {
    if (first) {
      first=false;
    }
 else {
      ln+="String_Node_Str";
    }
    if (param.contains("String_Node_Str")) {
      param=param.substring(param.lastIndexOf('>') + 1,param.length());
    }
    ln+=param.substring(param.indexOf("String_Node_Str") + 1,param.length());
  }
  mb.addBodyLine(ln + "String_Node_Str");
}
Program: 2281
Project: 2281
Buggy source:
private MethodBuilder makeReceiveHeader(ClassBuilder cb,IOAction a,EndpointState succ){
  MethodBuilder mb=cb.newMethod();
  ReceiveSocketGenerator.setReceiveHeaderWithoutReturnType(this.apigen,a,mb);
  setNextSocketReturnType(this.apigen,mb,succ);
  return mb;
}

Fixed version (ground truth):
private MethodBuilder makeReceiveHeader(ClassBuilder cb,IOAction a,EndpointState succ) throws ScribbleException {
  MethodBuilder mb=cb.newMethod();
  ReceiveSocketGenerator.setReceiveHeaderWithoutReturnType(this.apigen,a,mb);
  setNextSocketReturnType(this.apigen,mb,succ);
  return mb;
}
Program: 2282
Project: 2282
Buggy source:
private void addReceiveMethod(ClassBuilder cb,IOAction a,EndpointState succ){
  Module main=this.apigen.getMainModule();
  MethodBuilder mb=makeReceiveHeader(cb,a,succ);
  if (a.mid.isOp()) {
    mb.addBodyLine(JavaBuilder.SUPER + "String_Node_Str");
    addBranchCheck(getSessionApiOpConstant(a.mid),mb,CASE_MESSAGE_FIELD);
    ReceiveSocketGenerator.addPayloadBuffSetters(main,a,mb);
  }
 else {
    MessageSigNameDecl msd=main.getMessageSigDecl(((MessageSigName)a.mid).getSimpleName());
    mb.addBodyLine(JavaBuilder.SUPER + "String_Node_Str");
    addBranchCheck(getSessionApiOpConstant(a.mid),mb,CASE_MESSAGE_FIELD);
    mb.addBodyLine(CASE_ARG_PREFIX + "String_Node_Str" + BUFF_VAL_FIELD+ "String_Node_Str"+ msd.extName+ "String_Node_Str"+ CASE_MESSAGE_FIELD+ "String_Node_Str");
  }
  addReturnNextSocket(mb,succ);
}

Fixed version (ground truth):
private void addReceiveMethod(ClassBuilder cb,IOAction a,EndpointState succ) throws ScribbleException {
  Module main=this.apigen.getMainModule();
  MethodBuilder mb=makeReceiveHeader(cb,a,succ);
  if (a.mid.isOp()) {
    mb.addBodyLine(JavaBuilder.SUPER + "String_Node_Str");
    addBranchCheck(getSessionApiOpConstant(a.mid),mb,CASE_MESSAGE_FIELD);
    ReceiveSocketGenerator.addPayloadBuffSetters(main,a,mb);
  }
 else {
    MessageSigNameDecl msd=main.getMessageSigDecl(((MessageSigName)a.mid).getSimpleName());
    mb.addBodyLine(JavaBuilder.SUPER + "String_Node_Str");
    addBranchCheck(getSessionApiOpConstant(a.mid),mb,CASE_MESSAGE_FIELD);
    mb.addBodyLine(CASE_ARG_PREFIX + "String_Node_Str" + BUFF_VAL_FIELD+ "String_Node_Str"+ msd.extName+ "String_Node_Str"+ CASE_MESSAGE_FIELD+ "String_Node_Str");
  }
  addReturnNextSocket(mb,succ);
}
Program: 2283
Project: 2283
Buggy source:
private MethodBuilder makeCaseReceiveHeader(ClassBuilder cb,IOAction a,EndpointState succ){
  MethodBuilder mb=cb.newMethod();
  setCaseReceiveHeaderWithoutReturnType(this.apigen,a,mb);
  setNextSocketReturnType(this.apigen,mb,succ);
  return mb;
}

Fixed version (ground truth):
private MethodBuilder makeCaseReceiveHeader(ClassBuilder cb,IOAction a,EndpointState succ) throws ScribbleException {
  MethodBuilder mb=cb.newMethod();
  setCaseReceiveHeaderWithoutReturnType(this.apigen,a,mb);
  setNextSocketReturnType(this.apigen,mb,succ);
  return mb;
}
Program: 2284
Project: 2284
Buggy source:
@Override public InterfaceBuilder generateType(){
  GProtocolName gpn=this.apigen.getGProtocolName();
  InterfaceBuilder ib=new InterfaceBuilder();
  ib.setPackage(SessionApiGenerator.getStateChannelPackageName(gpn,this.apigen.getSelf()));
  ib.addImports(SessionApiGenerator.getOpsPackageName(gpn) + "String_Node_Str");
  ib.setName(getHandlerInterfaceName(this.parent.getName()));
  ib.addModifiers(InterfaceBuilder.PUBLIC);
  for (  IOAction a : this.curr.getTakeable()) {
    EndpointState succ=this.curr.take(a);
    String nextClass=this.apigen.getSocketClassName(succ);
    AbstractMethodBuilder mb3=ib.newAbstractMethod();
    mb3.addAnnotations("String_Node_Str");
    setHandleMethodHeaderWithoutParamTypes(this.apigen,mb3);
    if (succ.isTerminal()) {
      mb3.addParameters(ScribSocketGenerator.GENERATED_ENDSOCKET_NAME + "String_Node_Str");
    }
 else {
      mb3.addParameters(nextClass + "String_Node_Str");
    }
    addHandleMethodOpAndPayloadParams(this.apigen,a,mb3);
    if (this.curr.take(a).isTerminal()) {
      ib.addImports(SessionApiGenerator.getEndpointApiRootPackageName(gpn) + "String_Node_Str");
      ib.addImports(SessionApiGenerator.getRolesPackageName(this.apigen.getGProtocolName()) + "String_Node_Str");
    }
  }
  return ib;
}

Fixed version (ground truth):
@Override public InterfaceBuilder generateType() throws ScribbleException {
  GProtocolName gpn=this.apigen.getGProtocolName();
  InterfaceBuilder ib=new InterfaceBuilder();
  ib.setPackage(SessionApiGenerator.getStateChannelPackageName(gpn,this.apigen.getSelf()));
  ib.addImports(SessionApiGenerator.getOpsPackageName(gpn) + "String_Node_Str");
  ib.setName(getHandlerInterfaceName(this.parent.getName()));
  ib.addModifiers(InterfaceBuilder.PUBLIC);
  for (  IOAction a : this.curr.getTakeable()) {
    EndpointState succ=this.curr.take(a);
    String nextClass=this.apigen.getSocketClassName(succ);
    AbstractMethodBuilder mb3=ib.newAbstractMethod();
    mb3.addAnnotations("String_Node_Str");
    setHandleMethodHeaderWithoutParamTypes(this.apigen,mb3);
    if (succ.isTerminal()) {
      mb3.addParameters(ScribSocketGenerator.GENERATED_ENDSOCKET_NAME + "String_Node_Str");
    }
 else {
      mb3.addParameters(nextClass + "String_Node_Str");
    }
    addHandleMethodOpAndPayloadParams(this.apigen,a,mb3);
    if (this.curr.take(a).isTerminal()) {
      ib.addImports(SessionApiGenerator.getEndpointApiRootPackageName(gpn) + "String_Node_Str");
      ib.addImports(SessionApiGenerator.getRolesPackageName(this.apigen.getGProtocolName()) + "String_Node_Str");
    }
  }
  return ib;
}
Program: 2285
Project: 2285
Buggy source:
public static void addHandleMethodOpAndPayloadParams(StateChannelApiGenerator apigen,IOAction a,MethodBuilder mb){
  Module main=apigen.getMainModule();
  String opClass=SessionApiGenerator.getOpClassName(a.mid);
  mb.addParameters(opClass + "String_Node_Str" + StateChannelApiGenerator.RECEIVE_OP_PARAM);
  if (a.mid.isOp()) {
    ReceiveSocketGenerator.addReceiveOpParams(mb,apigen.getMainModule(),a,false);
  }
 else {
    MessageSigNameDecl msd=main.getMessageSigDecl(((MessageSigName)a.mid).getSimpleName());
    ReceiveSocketGenerator.addReceiveMessageSigNameParams(mb,msd,false);
  }
}

Fixed version (ground truth):
public static void addHandleMethodOpAndPayloadParams(StateChannelApiGenerator apigen,IOAction a,MethodBuilder mb) throws ScribbleException {
  Module main=apigen.getMainModule();
  String opClass=SessionApiGenerator.getOpClassName(a.mid);
  mb.addParameters(opClass + "String_Node_Str" + StateChannelApiGenerator.RECEIVE_OP_PARAM);
  if (a.mid.isOp()) {
    ReceiveSocketGenerator.addReceiveOpParams(mb,apigen.getMainModule(),a,false);
  }
 else {
    MessageSigNameDecl msd=main.getMessageSigDecl(((MessageSigName)a.mid).getSimpleName());
    ReceiveSocketGenerator.addReceiveMessageSigNameParams(mb,msd,false);
  }
}
Program: 2288
Project: 2288
Buggy source:
public static void setSendHeaderWithoutReturnType(StateChannelApiGenerator apigen,IOAction a,MethodBuilder mb){
  final String ROLE_PARAM="String_Node_Str";
  Module main=apigen.getMainModule();
  mb.setName("String_Node_Str");
  mb.addModifiers(JavaBuilder.PUBLIC);
  mb.addExceptions(StateChannelApiGenerator.SCRIBBLERUNTIMEEXCEPTION_CLASS,"String_Node_Str");
  mb.addParameters(SessionApiGenerator.getRoleClassName(a.obj) + "String_Node_Str" + ROLE_PARAM);
  if (a.mid.isOp()) {
    addSendOpParams(apigen,mb,main,a);
  }
 else {
    MessageSigNameDecl msd=main.getMessageSigDecl(((MessageSigName)a.mid).getSimpleName());
    addSendMessageSigNameParams(mb,msd);
  }
}

Fixed version (ground truth):
public static void setSendHeaderWithoutReturnType(StateChannelApiGenerator apigen,IOAction a,MethodBuilder mb) throws ScribbleException {
  final String ROLE_PARAM="String_Node_Str";
  Module main=apigen.getMainModule();
  mb.setName("String_Node_Str");
  mb.addModifiers(JavaBuilder.PUBLIC);
  mb.addExceptions(StateChannelApiGenerator.SCRIBBLERUNTIMEEXCEPTION_CLASS,"String_Node_Str");
  mb.addParameters(SessionApiGenerator.getRoleClassName(a.obj) + "String_Node_Str" + ROLE_PARAM);
  if (a.mid.isOp()) {
    addSendOpParams(apigen,mb,main,a);
  }
 else {
    MessageSigNameDecl msd=main.getMessageSigDecl(((MessageSigName)a.mid).getSimpleName());
    addSendMessageSigNameParams(mb,msd);
  }
}
Program: 2289
Project: 2289
Buggy source:
protected static void addSendOpParams(StateChannelApiGenerator apigen,MethodBuilder mb,Module main,IOAction a){
  List<String> args=getSendPayloadArgs(a);
  mb.addParameters(SessionApiGenerator.getOpClassName(a.mid) + "String_Node_Str");
  if (!a.payload.isEmpty()) {
    Iterator<String> as=args.iterator();
    for (    PayloadType<?> pt : a.payload.elems) {
      DataTypeDecl dtd=main.getDataTypeDecl((DataType)pt);
      mb.addParameters(dtd.extName + "String_Node_Str" + as.next());
    }
  }
}

Fixed version (ground truth):
protected static void addSendOpParams(StateChannelApiGenerator apigen,MethodBuilder mb,Module main,IOAction a) throws ScribbleException {
  List<String> args=getSendPayloadArgs(a);
  mb.addParameters(SessionApiGenerator.getOpClassName(a.mid) + "String_Node_Str");
  if (!a.payload.isEmpty()) {
    Iterator<String> as=args.iterator();
    for (    PayloadType<?> pt : a.payload.elems) {
      DataTypeDecl dtd=main.getDataTypeDecl((DataType)pt);
      if (!dtd.schema.equals(ScribSocketGenerator.JAVA_SCHEMA)) {
        throw new ScribbleException("String_Node_Str" + dtd.schema);
      }
      mb.addParameters(dtd.extName + "String_Node_Str" + as.next());
    }
  }
}
Program: 2290
Project: 2290
Buggy source:
protected static void addSendMessageSigNameParams(MethodBuilder mb,MessageSigNameDecl msd){
  final String MESSAGE_PARAM="String_Node_Str";
  mb.addParameters(msd.extName + "String_Node_Str" + MESSAGE_PARAM);
}

Fixed version (ground truth):
protected static void addSendMessageSigNameParams(MethodBuilder mb,MessageSigNameDecl msd) throws ScribbleException {
  final String MESSAGE_PARAM="String_Node_Str";
  if (!msd.schema.equals(ScribSocketGenerator.JAVA_SCHEMA)) {
    throw new ScribbleException("String_Node_Str" + msd.schema);
  }
  mb.addParameters(msd.extName + "String_Node_Str" + MESSAGE_PARAM);
}
Program: 2291
Project: 2291
Buggy source:
@Override protected void addMethods(){
  IOAction a=curr.getTakeable().iterator().next();
  EndpointState succ=curr.take(a);
  ClassBuilder futureClass=new InputFutureGenerator(this.apigen,this.cb,a).generateType();
  this.apigen.addTypeDecl(futureClass);
  makeReceiveMethod(a,succ);
  makeAsyncMethod(a,succ,futureClass.getName());
  makeIsDoneMethod(a);
  makeAsyncDiscardMethod(a,succ,futureClass.getName());
}

Fixed version (ground truth):
@Override protected void addMethods() throws ScribbleException {
  IOAction a=curr.getTakeable().iterator().next();
  EndpointState succ=curr.take(a);
  ClassBuilder futureClass=new InputFutureGenerator(this.apigen,this.cb,a).generateType();
  this.apigen.addTypeDecl(futureClass);
  makeReceiveMethod(a,succ);
  makeAsyncMethod(a,succ,futureClass.getName());
  makeIsDoneMethod(a);
  makeAsyncDiscardMethod(a,succ,futureClass.getName());
}
Program: 2292
Project: 2292
Buggy source:
public static void setReceiveHeaderWithoutReturnType(StateChannelApiGenerator apigen,IOAction a,MethodBuilder mb){
  final String ROLE_PARAM="String_Node_Str";
  Module main=apigen.getMainModule();
  String opClass=SessionApiGenerator.getOpClassName(a.mid);
  mb.setName("String_Node_Str");
  mb.addModifiers(JavaBuilder.PUBLIC);
  mb.addExceptions(StateChannelApiGenerator.SCRIBBLERUNTIMEEXCEPTION_CLASS,"String_Node_Str","String_Node_Str");
  mb.addParameters(SessionApiGenerator.getRoleClassName(a.obj) + "String_Node_Str" + ROLE_PARAM,opClass + "String_Node_Str" + StateChannelApiGenerator.RECEIVE_OP_PARAM);
  if (a.mid.isOp()) {
    addReceiveOpParams(mb,main,a,true);
  }
 else {
    MessageSigNameDecl msd=main.getMessageSigDecl(((MessageSigName)a.mid).getSimpleName());
    addReceiveMessageSigNameParams(mb,msd,true);
  }
}

Fixed version (ground truth):
public static void setReceiveHeaderWithoutReturnType(StateChannelApiGenerator apigen,IOAction a,MethodBuilder mb) throws ScribbleException {
  final String ROLE_PARAM="String_Node_Str";
  Module main=apigen.getMainModule();
  String opClass=SessionApiGenerator.getOpClassName(a.mid);
  mb.setName("String_Node_Str");
  mb.addModifiers(JavaBuilder.PUBLIC);
  mb.addExceptions(StateChannelApiGenerator.SCRIBBLERUNTIMEEXCEPTION_CLASS,"String_Node_Str","String_Node_Str");
  mb.addParameters(SessionApiGenerator.getRoleClassName(a.obj) + "String_Node_Str" + ROLE_PARAM,opClass + "String_Node_Str" + StateChannelApiGenerator.RECEIVE_OP_PARAM);
  if (a.mid.isOp()) {
    addReceiveOpParams(mb,main,a,true);
  }
 else {
    MessageSigNameDecl msd=main.getMessageSigDecl(((MessageSigName)a.mid).getSimpleName());
    addReceiveMessageSigNameParams(mb,msd,true);
  }
}
Program: 2293
Project: 2293
Buggy source:
protected static void addReceiveMessageSigNameParams(MethodBuilder mb,MessageSigNameDecl msd,boolean superr){
  mb.addParameters(BUF_CLASS + "String_Node_Str" + ((superr) ? "String_Node_Str" + JavaBuilder.SUPER + "String_Node_Str" : "String_Node_Str")+ msd.extName+ "String_Node_Str"+ RECEIVE_ARG_PREFIX);
}

Fixed version (ground truth):
protected static void addReceiveMessageSigNameParams(MethodBuilder mb,MessageSigNameDecl msd,boolean superr) throws ScribbleException {
  if (!msd.schema.equals(ScribSocketGenerator.JAVA_SCHEMA)) {
    throw new ScribbleException("String_Node_Str" + msd.schema);
  }
  mb.addParameters(BUF_CLASS + "String_Node_Str" + ((superr) ? "String_Node_Str" + JavaBuilder.SUPER + "String_Node_Str" : "String_Node_Str")+ msd.extName+ "String_Node_Str"+ RECEIVE_ARG_PREFIX);
}
Program: 2294
Project: 2294
Buggy source:
private MethodBuilder makeReceiveHeader(IOAction a,EndpointState succ){
  MethodBuilder mb=this.cb.newMethod();
  setReceiveHeaderWithoutReturnType(this.apigen,a,mb);
  setNextSocketReturnType(this.apigen,mb,succ);
  return mb;
}

Fixed version (ground truth):
private MethodBuilder makeReceiveHeader(IOAction a,EndpointState succ) throws ScribbleException {
  MethodBuilder mb=this.cb.newMethod();
  setReceiveHeaderWithoutReturnType(this.apigen,a,mb);
  setNextSocketReturnType(this.apigen,mb,succ);
  return mb;
}
Program: 2295
Project: 2295
Buggy source:
private void makeReceiveMethod(IOAction a,EndpointState succ){
  Module main=this.apigen.getMainModule();
  MethodBuilder mb=makeReceiveHeader(a,succ);
  if (a.mid.isOp()) {
    String ln=a.payload.isEmpty() ? "String_Node_Str" : StateChannelApiGenerator.SCRIBMESSAGE_CLASS + "String_Node_Str" + RECEIVE_MESSAGE_PARAM+ "String_Node_Str";
    ln+=JavaBuilder.SUPER + "String_Node_Str" + getSessionApiRoleConstant(a.obj)+ "String_Node_Str";
    mb.addBodyLine(ln);
    addPayloadBuffSetters(main,a,mb);
  }
 else {
    MessageSigNameDecl msd=main.getMessageSigDecl(((MessageSigName)a.mid).getSimpleName());
    mb.addBodyLine(StateChannelApiGenerator.SCRIBMESSAGE_CLASS + "String_Node_Str" + RECEIVE_MESSAGE_PARAM+ "String_Node_Str"+ JavaBuilder.SUPER+ "String_Node_Str"+ getSessionApiRoleConstant(a.obj)+ "String_Node_Str");
    mb.addBodyLine(RECEIVE_ARG_PREFIX + "String_Node_Str" + BUFF_VAL_FIELD+ "String_Node_Str"+ msd.extName+ "String_Node_Str"+ RECEIVE_MESSAGE_PARAM+ "String_Node_Str");
  }
  addReturnNextSocket(mb,succ);
}

Fixed version (ground truth):
private void makeReceiveMethod(IOAction a,EndpointState succ) throws ScribbleException {
  Module main=this.apigen.getMainModule();
  MethodBuilder mb=makeReceiveHeader(a,succ);
  if (a.mid.isOp()) {
    String ln=a.payload.isEmpty() ? "String_Node_Str" : StateChannelApiGenerator.SCRIBMESSAGE_CLASS + "String_Node_Str" + RECEIVE_MESSAGE_PARAM+ "String_Node_Str";
    ln+=JavaBuilder.SUPER + "String_Node_Str" + getSessionApiRoleConstant(a.obj)+ "String_Node_Str";
    mb.addBodyLine(ln);
    addPayloadBuffSetters(main,a,mb);
  }
 else {
    MessageSigNameDecl msd=main.getMessageSigDecl(((MessageSigName)a.mid).getSimpleName());
    mb.addBodyLine(StateChannelApiGenerator.SCRIBMESSAGE_CLASS + "String_Node_Str" + RECEIVE_MESSAGE_PARAM+ "String_Node_Str"+ JavaBuilder.SUPER+ "String_Node_Str"+ getSessionApiRoleConstant(a.obj)+ "String_Node_Str");
    mb.addBodyLine(RECEIVE_ARG_PREFIX + "String_Node_Str" + BUFF_VAL_FIELD+ "String_Node_Str"+ msd.extName+ "String_Node_Str"+ RECEIVE_MESSAGE_PARAM+ "String_Node_Str");
  }
  addReturnNextSocket(mb,succ);
}
Program: 2296
Project: 2296
Buggy source:
protected static void addReceiveOpParams(MethodBuilder mb,Module main,IOAction a,boolean superr){
  if (!a.payload.isEmpty()) {
    String buffSuper=BUF_CLASS + "String_Node_Str" + ((superr) ? "String_Node_Str" + JavaBuilder.SUPER + "String_Node_Str" : "String_Node_Str");
    int i=1;
    for (    PayloadType<?> pt : a.payload.elems) {
      DataTypeDecl dtd=main.getDataTypeDecl((DataType)pt);
      mb.addParameters(buffSuper + dtd.extName + "String_Node_Str"+ RECEIVE_ARG_PREFIX+ i++);
    }
  }
}

Fixed version (ground truth):
protected static void addReceiveOpParams(MethodBuilder mb,Module main,IOAction a,boolean superr) throws ScribbleException {
  if (!a.payload.isEmpty()) {
    String buffSuper=BUF_CLASS + "String_Node_Str" + ((superr) ? "String_Node_Str" + JavaBuilder.SUPER + "String_Node_Str" : "String_Node_Str");
    int i=1;
    for (    PayloadType<?> pt : a.payload.elems) {
      DataTypeDecl dtd=main.getDataTypeDecl((DataType)pt);
      if (!dtd.schema.equals(ScribSocketGenerator.JAVA_SCHEMA)) {
        throw new ScribbleException("String_Node_Str" + dtd.schema);
      }
      mb.addParameters(buffSuper + dtd.extName + "String_Node_Str"+ RECEIVE_ARG_PREFIX+ i++);
    }
  }
}
Program: 2297
Project: 2297
Buggy source:
protected abstract void addMethods();

Fixed version (ground truth):
protected abstract void addMethods() throws ScribbleException ;
Program: 2298
Project: 2298
Buggy source:
@Override public ClassBuilder generateType(){
  constructClass();
  return this.cb;
}

Fixed version (ground truth):
@Override public ClassBuilder generateType() throws ScribbleException {
  constructClass();
  return this.cb;
}
Program: 2299
Project: 2299
Buggy source:
protected void constructClass(){
  constructClassExceptMethods();
  addMethods();
}

Fixed version (ground truth):
protected void constructClass() throws ScribbleException {
  constructClassExceptMethods();
  addMethods();
}
Program: 2300
Project: 2300
Buggy source:
private void outputGraph(Job job) throws ScribbleException {
  JobContext jcontext=job.getContext();
  String[] args=this.args.get(ArgFlag.FSM);
  for (int i=0; i < args.length; i+=2) {
    GProtocolName fullname=checkGlobalProtocolArg(jcontext,args[i]);
    Role role=checkRoleArg(jcontext,fullname,args[i + 1]);
    EndpointGraph fsm=getEndointGraph(job,fullname,role);
    System.out.println("String_Node_Str" + fsm);
  }
}

Fixed version (ground truth):
private void outputGraph(Job job) throws ScribbleException, CommandLineException {
  JobContext jcontext=job.getContext();
  String[] args=this.args.get(ArgFlag.FSM);
  for (int i=0; i < args.length; i+=2) {
    GProtocolName fullname=checkGlobalProtocolArg(jcontext,args[i]);
    Role role=checkRoleArg(jcontext,fullname,args[i + 1]);
    EndpointGraph fsm=getEndointGraph(job,fullname,role);
    System.out.println("String_Node_Str" + fsm);
  }
}
Program: 2301
Project: 2301
Buggy source:
private void drawGraph(Job job) throws ScribbleException {
  JobContext jcontext=job.getContext();
  String[] args=this.args.get(ArgFlag.FSM_DOT);
  for (int i=0; i < args.length; i+=3) {
    GProtocolName fullname=checkGlobalProtocolArg(jcontext,args[i]);
    Role role=checkRoleArg(jcontext,fullname,args[i + 1]);
    String png=args[i + 2];
    EndpointGraph fsm=getEndointGraph(job,fullname,role);
    runDot(fsm.init.toDot(),png);
  }
}

Fixed version (ground truth):
private void drawGraph(Job job) throws ScribbleException, CommandLineException {
  JobContext jcontext=job.getContext();
  String[] args=this.args.get(ArgFlag.FSM_DOT);
  for (int i=0; i < args.length; i+=3) {
    GProtocolName fullname=checkGlobalProtocolArg(jcontext,args[i]);
    Role role=checkRoleArg(jcontext,fullname,args[i + 1]);
    String png=args[i + 2];
    EndpointGraph fsm=getEndointGraph(job,fullname,role);
    runDot(fsm.init.toDot(),png);
  }
}
Program: 2302
Project: 2302
Buggy source:
public static void main(String[] args) throws ScribbleException {
  new CommandLine(args).run();
}

Fixed version (ground truth):
public static void main(String[] args) throws CommandLineException, ScribbleException {
  try {
    new CommandLine(args).run();
  }
 catch (  CommandLineException e) {
    System.err.println(e.getMessage());
    System.exit(1);
  }
}
Program: 2304
Project: 2304
Buggy source:
private EndpointGraph getEndointGraph(Job job,GProtocolName fullname,Role role) throws ScribbleException {
  JobContext jcontext=job.getContext();
  GProtocolDecl gpd=(GProtocolDecl)jcontext.getMainModule().getProtocolDecl(fullname.getSimpleName());
  if (gpd == null || !gpd.header.roledecls.getRoles().contains(role)) {
    throw new RuntimeException("String_Node_Str" + Arrays.toString(this.args.get(ArgFlag.FSM)));
  }
  EndpointGraph fsm=this.args.containsKey(ArgFlag.MIN_EFSM) ? jcontext.getMinimisedEndpointGraph(fullname,role) : jcontext.getEndpointGraph(fullname,role);
  if (fsm == null) {
    throw new ScribbleException("String_Node_Str" + fullname);
  }
  return fsm;
}

Fixed version (ground truth):
private EndpointGraph getEndointGraph(Job job,GProtocolName fullname,Role role) throws ScribbleException, CommandLineException {
  JobContext jcontext=job.getContext();
  GProtocolDecl gpd=(GProtocolDecl)jcontext.getMainModule().getProtocolDecl(fullname.getSimpleName());
  if (gpd == null || !gpd.header.roledecls.getRoles().contains(role)) {
    throw new CommandLineException("String_Node_Str" + Arrays.toString(this.args.get(ArgFlag.FSM)));
  }
  EndpointGraph fsm=this.args.containsKey(ArgFlag.MIN_EFSM) ? jcontext.getMinimisedEndpointGraph(fullname,role) : jcontext.getEndpointGraph(fullname,role);
  if (fsm == null) {
    throw new ScribbleException("String_Node_Str" + fullname);
  }
  return fsm;
}
Program: 2305
Project: 2305
Buggy source:
private static Role checkRoleArg(JobContext jcontext,GProtocolName fullname,String rolename){
  ProtocolDecl<?> pd=jcontext.getMainModule().getProtocolDecl(fullname.getSimpleName());
  Role role=new Role(rolename);
  if (!pd.header.roledecls.getRoles().contains(role)) {
    throw new RuntimeException("String_Node_Str" + fullname + "String_Node_Str"+ role);
  }
  return role;
}

Fixed version (ground truth):
private static Role checkRoleArg(JobContext jcontext,GProtocolName fullname,String rolename) throws CommandLineException {
  ProtocolDecl<?> pd=jcontext.getMainModule().getProtocolDecl(fullname.getSimpleName());
  Role role=new Role(rolename);
  if (!pd.header.roledecls.getRoles().contains(role)) {
    throw new CommandLineException("String_Node_Str" + fullname + "String_Node_Str"+ role);
  }
  return role;
}
Program: 2306
Project: 2306
Buggy source:
private void outputSessionApi(Job job) throws ScribbleException {
  JobContext jcontext=job.getContext();
  String[] args=this.args.get(ArgFlag.SESS_API);
  for (  String fullname : args) {
    GProtocolName gpn=checkGlobalProtocolArg(jcontext,fullname);
    Map<String,String> classes=job.generateSessionApi(gpn);
    outputClasses(classes);
  }
}

Fixed version (ground truth):
private void outputSessionApi(Job job) throws ScribbleException, CommandLineException {
  JobContext jcontext=job.getContext();
  String[] args=this.args.get(ArgFlag.SESS_API);
  for (  String fullname : args) {
    GProtocolName gpn=checkGlobalProtocolArg(jcontext,fullname);
    Map<String,String> classes=job.generateSessionApi(gpn);
    outputClasses(classes);
  }
}
Program: 2307
Project: 2307
Buggy source:
private void outputGlobalModel(Job job) throws ScribbleException {
  JobContext jcontext=job.getContext();
  String[] args=this.args.get(ArgFlag.GLOBAL_MODEL);
  for (int i=0; i < args.length; i+=1) {
    GProtocolName fullname=checkGlobalProtocolArg(jcontext,args[i]);
    WFState model=getGlobalModel(job,fullname);
    System.out.println("String_Node_Str" + model.toDot());
  }
}

Fixed version (ground truth):
private void outputGlobalModel(Job job) throws ScribbleException, CommandLineException {
  JobContext jcontext=job.getContext();
  String[] args=this.args.get(ArgFlag.GLOBAL_MODEL);
  for (int i=0; i < args.length; i+=1) {
    GProtocolName fullname=checkGlobalProtocolArg(jcontext,args[i]);
    WFState model=getGlobalModel(job,fullname);
    System.out.println("String_Node_Str" + model.toDot());
  }
}
Program: 2308
Project: 2308
Buggy source:
private void outputStateChannelApi(Job job) throws ScribbleException {
  JobContext jcontext=job.getContext();
  String[] args=this.args.get(ArgFlag.SCHAN_API);
  for (int i=0; i < args.length; i+=2) {
    GProtocolName fullname=checkGlobalProtocolArg(jcontext,args[i]);
    Role role=checkRoleArg(jcontext,fullname,args[i + 1]);
    Map<String,String> classes=job.generateStateChannelApi(fullname,role,this.args.containsKey(ArgFlag.SCHAN_API_SUBTYPES));
    outputClasses(classes);
  }
}

Fixed version (ground truth):
private void outputStateChannelApi(Job job) throws ScribbleException, CommandLineException {
  JobContext jcontext=job.getContext();
  String[] args=this.args.get(ArgFlag.SCHAN_API);
  for (int i=0; i < args.length; i+=2) {
    GProtocolName fullname=checkGlobalProtocolArg(jcontext,args[i]);
    Role role=checkRoleArg(jcontext,fullname,args[i + 1]);
    Map<String,String> classes=job.generateStateChannelApi(fullname,role,this.args.containsKey(ArgFlag.SCHAN_API_SUBTYPES));
    outputClasses(classes);
  }
}
Program: 2309
Project: 2309
Buggy source:
public CommandLine(String... args){
  this.args=new CommandLineArgParser(args).getArgs();
  if (!this.args.containsKey(ArgFlag.MAIN)) {
    throw new RuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
public CommandLine(String... args) throws CommandLineException {
  this.args=new CommandLineArgParser(args).getArgs();
  if (!this.args.containsKey(ArgFlag.MAIN)) {
    throw new CommandLineException("String_Node_Str");
  }
}
Program: 2310
Project: 2310
Buggy source:
private static void runDot(String dot,String png) throws ScribbleException {
  String tmpName=png + "String_Node_Str";
  File tmp=new File(tmpName);
  if (tmp.exists()) {
    throw new RuntimeException("String_Node_Str" + tmpName);
  }
  try {
    ScribUtil.writeToFile(tmpName,dot);
    String[] res=ScribUtil.runProcess("String_Node_Str","String_Node_Str","String_Node_Str" + png,tmpName);
    System.out.print(!res[1].isEmpty() ? res[1] : res[0]);
  }
  finally {
    tmp.delete();
  }
}

Fixed version (ground truth):
private static void runDot(String dot,String png) throws ScribbleException, CommandLineException {
  String tmpName=png + "String_Node_Str";
  File tmp=new File(tmpName);
  if (tmp.exists()) {
    throw new CommandLineException("String_Node_Str" + tmpName);
  }
  try {
    ScribUtil.writeToFile(tmpName,dot);
    String[] res=ScribUtil.runProcess("String_Node_Str","String_Node_Str","String_Node_Str" + png,tmpName);
    System.out.print(!res[1].isEmpty() ? res[1] : res[0]);
  }
  finally {
    tmp.delete();
  }
}
Program: 2311
Project: 2311
Buggy source:
private void outputProjections(Job job){
  JobContext jcontext=job.getContext();
  String[] args=this.args.get(ArgFlag.PROJECT);
  for (int i=0; i < args.length; i+=2) {
    GProtocolName fullname=checkGlobalProtocolArg(jcontext,args[i]);
    Role role=checkRoleArg(jcontext,fullname,args[i + 1]);
    Map<LProtocolName,Module> projections=job.getProjections(fullname,role);
    System.out.println("String_Node_Str" + projections.values().stream().map((p) -> p.toString()).collect(Collectors.joining("String_Node_Str")));
  }
}

Fixed version (ground truth):
private void outputProjections(Job job) throws CommandLineException {
  JobContext jcontext=job.getContext();
  String[] args=this.args.get(ArgFlag.PROJECT);
  for (int i=0; i < args.length; i+=2) {
    GProtocolName fullname=checkGlobalProtocolArg(jcontext,args[i]);
    Role role=checkRoleArg(jcontext,fullname,args[i + 1]);
    Map<LProtocolName,Module> projections=job.getProjections(fullname,role);
    System.out.println("String_Node_Str" + projections.values().stream().map((p) -> p.toString()).collect(Collectors.joining("String_Node_Str")));
  }
}
Program: 2312
Project: 2312
Buggy source:
private void drawGlobalModel(Job job) throws ScribbleException {
  JobContext jcontext=job.getContext();
  String[] args=this.args.get(ArgFlag.GLOBAL_MODEL_DOT);
  for (int i=0; i < args.length; i+=2) {
    GProtocolName fullname=checkGlobalProtocolArg(jcontext,args[i]);
    String png=args[i + 1];
    WFState model=getGlobalModel(job,fullname);
    runDot(model.toDot(),png);
  }
}

Fixed version (ground truth):
private void drawGlobalModel(Job job) throws ScribbleException, CommandLineException {
  JobContext jcontext=job.getContext();
  String[] args=this.args.get(ArgFlag.GLOBAL_MODEL_DOT);
  for (int i=0; i < args.length; i+=2) {
    GProtocolName fullname=checkGlobalProtocolArg(jcontext,args[i]);
    String png=args[i + 1];
    WFState model=getGlobalModel(job,fullname);
    runDot(model.toDot(),png);
  }
}
Program: 2313
Project: 2313
Buggy source:
private static GProtocolName checkGlobalProtocolArg(JobContext jcontext,String simpname){
  GProtocolName simpgpn=new GProtocolName(simpname);
  ProtocolDecl<?> pd=jcontext.getMainModule().getProtocolDecl(simpgpn);
  if (pd == null || !pd.isGlobal()) {
    throw new RuntimeException("String_Node_Str" + simpname);
  }
  return new GProtocolName(jcontext.main,simpgpn);
}

Fixed version (ground truth):
private static GProtocolName checkGlobalProtocolArg(JobContext jcontext,String simpname) throws CommandLineException {
  GProtocolName simpgpn=new GProtocolName(simpname);
  ProtocolDecl<?> pd=jcontext.getMainModule().getProtocolDecl(simpgpn);
  if (pd == null || !pd.isGlobal()) {
    throw new CommandLineException("String_Node_Str" + simpname);
  }
  return new GProtocolName(jcontext.main,simpgpn);
}
Program: 2314
Project: 2314
Buggy source:
private void outputEndpointApi(Job job) throws ScribbleException {
  JobContext jcontext=job.getContext();
  String[] args=this.args.get(ArgFlag.EP_API);
  for (int i=0; i < args.length; i+=2) {
    GProtocolName fullname=checkGlobalProtocolArg(jcontext,args[i]);
    Map<String,String> sessClasses=job.generateSessionApi(fullname);
    outputClasses(sessClasses);
    Role role=checkRoleArg(jcontext,fullname,args[i + 1]);
    Map<String,String> scClasses=job.generateStateChannelApi(fullname,role,this.args.containsKey(ArgFlag.SCHAN_API_SUBTYPES));
    outputClasses(scClasses);
  }
}

Fixed version (ground truth):
private void outputEndpointApi(Job job) throws ScribbleException, CommandLineException {
  JobContext jcontext=job.getContext();
  String[] args=this.args.get(ArgFlag.EP_API);
  for (int i=0; i < args.length; i+=2) {
    GProtocolName fullname=checkGlobalProtocolArg(jcontext,args[i]);
    Map<String,String> sessClasses=job.generateSessionApi(fullname);
    outputClasses(sessClasses);
    Role role=checkRoleArg(jcontext,fullname,args[i + 1]);
    Map<String,String> scClasses=job.generateStateChannelApi(fullname,role,this.args.containsKey(ArgFlag.SCHAN_API_SUBTYPES));
    outputClasses(scClasses);
  }
}
Program: 2316
Project: 2316
Buggy source:
private MainContext newMainContext(){
  boolean debug=this.args.containsKey(ArgFlag.VERBOSE);
  boolean useOldWF=this.args.containsKey(ArgFlag.OLD_WF);
  boolean noLiveness=this.args.containsKey(ArgFlag.NO_LIVENESS);
  Path mainpath=CommandLine.parseMainPath(this.args.get(ArgFlag.MAIN)[0]);
  List<Path> impaths=this.args.containsKey(ArgFlag.PATH) ? CommandLine.parseImportPaths(this.args.get(ArgFlag.PATH)[0]) : Collections.emptyList();
  ResourceLocator locator=new DirectoryResourceLocator(impaths);
  return new MainContext(debug,locator,mainpath,useOldWF,noLiveness);
}

Fixed version (ground truth):
private MainContext newMainContext(){
  boolean debug=this.args.containsKey(ArgFlag.VERBOSE);
  boolean useOldWF=this.args.containsKey(ArgFlag.OLD_WF);
  boolean noLiveness=this.args.containsKey(ArgFlag.NO_LIVENESS);
  boolean minEfsm=this.args.containsKey(ArgFlag.MIN_EFSM);
  Path mainpath=CommandLine.parseMainPath(this.args.get(ArgFlag.MAIN)[0]);
  List<Path> impaths=this.args.containsKey(ArgFlag.PATH) ? CommandLine.parseImportPaths(this.args.get(ArgFlag.PATH)[0]) : Collections.emptyList();
  ResourceLocator locator=new DirectoryResourceLocator(impaths);
  return new MainContext(debug,locator,mainpath,useOldWF,noLiveness,minEfsm);
}
Program: 2317
Project: 2317
Buggy source:
private Job newJob(MainContext mc){
  return new Job(mc.debug,mc.getParsedModules(),mc.main,mc.useOldWF,mc.noLiveness);
}

Fixed version (ground truth):
private Job newJob(MainContext mc){
  return new Job(mc.debug,mc.getParsedModules(),mc.main,mc.useOldWF,mc.noLiveness,mc.minEfsm);
}