nus-yam/ex-repair huggingface dataset:
Program: 78269
Project: 78269
Buggy source:
public boolean varEquals(Operand operand){
  if (this instanceof Register && operand instanceof Register)   return this == operand || (this.physicalRegister() != null && this.physicalRegister() == operand.physicalRegister());
  if (operand instanceof Memory)   return varEquals(((Memory)operand).baseReg()) || varEquals(((Memory)operand).indexReg());
  return this == operand;
}

Fixed version (ground truth):
public boolean varEquals(Operand operand){
  if (this instanceof Register && operand instanceof Register)   return this.physicalRegister() != null && this.physicalRegister() == operand.physicalRegister();
  if (operand instanceof Memory)   return varEquals(((Memory)operand).baseReg()) || varEquals(((Memory)operand).indexReg());
  return this == operand;
}
Program: 78270
Project: 78270
Buggy source:
private void assignRegister(){
  Set<PhysicalRegister> neighborReg=new HashSet<>();
  while (!graph.varStack.isEmpty()) {
    neighborReg.clear();
    Var var=graph.varStack.pop();
    var.deleted=false;
    for (    Var neighbor : var.neighbors())     if (!neighbor.deleted && neighbor.isAssigned())     neighborReg.add(neighbor.physicalRegister());
    for (    PhysicalRegister preg : registers) {
      if (!neighborReg.contains(preg)) {
        var.setPhysicalRegister(preg);
        usedRegs.add(preg);
        System.err.println("String_Node_Str" + var.irName() + "String_Node_Str"+ preg.nasmName());
        break;
      }
    }
    if (!var.isAssigned()) {
      stackTop=alignStack(stackTop + options.PTR_SIZE,options.PTR_SIZE);
      var.setStackPos(new Memory(RBP,null,0,-stackTop));
    }
  }
}

Fixed version (ground truth):
private void assignRegister(){
  Set<PhysicalRegister> neighborReg=new HashSet<>();
  while (!graph.varStack.isEmpty()) {
    neighborReg.clear();
    Var var=graph.varStack.pop();
    var.deleted=false;
    for (    Var neighbor : var.neighbors())     if (!neighbor.deleted && neighbor.isAssigned())     neighborReg.add(neighbor.physicalRegister());
    for (    PhysicalRegister preg : registers) {
      if (!neighborReg.contains(preg)) {
        var.setPhysicalRegister(preg);
        usedRegs.add(preg);
        break;
      }
    }
    if (!var.isAssigned()) {
      stackTop=alignStack(stackTop + options.PTR_SIZE,options.PTR_SIZE);
      var.setStackPos(new Memory(RBP,null,0,-stackTop));
    }
  }
}
Program: 78271
Project: 78271
Buggy source:
public void compile(String[] args){
  options.compilerArgSolve(args);
  buildAst();
  typeCheck();
  if (options.dumpAst) {
    DumpAstVisitor astDumper=new DumpAstVisitor(options);
    astDumper.apply(programAst);
  }
  buildIR();
  functionInliner();
  if (options.dumpIR) {
    DumpIRVisitor irDumper=new DumpIRVisitor(options);
    irDumper.apply(programIR);
  }
  allocate();
  codeGenerate();
}

Fixed version (ground truth):
public void compile(String[] args){
  options.compilerArgSolve(args);
  buildAst();
  typeCheck();
  if (options.dumpAst) {
    DumpAstVisitor astDumper=new DumpAstVisitor(options);
    astDumper.apply(programAst);
  }
  buildIR();
  if (options.functionInline)   functionInliner();
  if (options.dumpIR) {
    DumpIRVisitor irDumper=new DumpIRVisitor(options);
    irDumper.apply(programIR);
  }
  livenessAnalysis();
  allocate();
  codeGenerate();
}
Program: 78272
Project: 78272
Buggy source:
private void allocate(){
  NaiveAllocator allocator=new NaiveAllocator(options);
  allocator.apply(programIR);
}

Fixed version (ground truth):
private void allocate(){
  Allocator allocator;
  if (options.graphAllocate)   allocator=new GraphAllocator(options);
 else   allocator=new NaiveAllocator(options);
  allocator.apply(programIR);
}
Program: 78273
Project: 78273
Buggy source:
private LinkedList<BasicBlock> inline(Function function,Function callee,BasicBlock currentBlock,FunctionCallInst inst){
  BasicBlock afterInlineBlock=new BasicBlock(function,currentBlock.getCurrentSymbolTable(),function.name() + "String_Node_Str");
  currentBlock.delete(inst);
  Instruction next=inst.next;
  if (next != null) {
    next.prev=null;
    afterInlineBlock.setFront(next);
    afterInlineBlock.setEnd(currentBlock.back());
  }
  if (inst.prev != null)   inst.prev.next=null;
 else   currentBlock.setFront(null);
  currentBlock.setEnd(inst.prev);
  Map<Object,Object> replaceMap=new HashMap<>();
  for (int index=0; index < callee.paramVars().size(); ++index) {
    replaceMap.put(callee.paramVars().get(index),inst.args().get(index));
  }
  replaceMap.put(callee,function);
  if (inst.dst() != null)   replaceMap.put("String_Node_Str",inst.dst());
  replaceMap.put("String_Node_Str",afterInlineBlock);
  LinkedList<BasicBlock> newBlocks=new LinkedList<>();
  for (  BasicBlock block : callee.basicBlocks()) {
    newBlocks.addLast(block.deepCopy(replaceMap));
  }
  currentBlock.pushBack(new DirectJumpInst(newBlocks.getFirst()));
  newBlocks.addLast(afterInlineBlock);
  return newBlocks;
}

Fixed version (ground truth):
private LinkedList<BasicBlock> inline(Function function,Function callee,BasicBlock currentBlock,FunctionCallInst inst){
  BasicBlock afterInlineBlock=new BasicBlock(function,currentBlock.getCurrentSymbolTable(),function.name() + "String_Node_Str",currentBlock.valTag());
  currentBlock.delete(inst);
  Instruction next=inst.next;
  if (next != null) {
    next.prev=null;
    afterInlineBlock.setFront(next);
    afterInlineBlock.setEnd(currentBlock.back());
  }
  if (inst.prev != null)   inst.prev.next=null;
 else   currentBlock.setFront(null);
  currentBlock.setEnd(inst.prev);
  Map<Object,Object> replaceMap=new HashMap<>();
  LinkedList<BasicBlock> newBlocks=new LinkedList<>();
  replaceMap.put(callee,function);
  if (inst.dst() != null)   replaceMap.put("String_Node_Str",inst.dst());
  replaceMap.put("String_Node_Str",afterInlineBlock);
  BasicBlock argSet=new BasicBlock(function,currentBlock.getCurrentSymbolTable(),function.name() + "String_Node_Str",currentBlock.valTag());
  for (int index=0; index < callee.paramVars().size(); ++index) {
    argSet.pushBack(new MoveInst((MutableOperand)callee.paramVars().get(index).dstCopy(replaceMap),inst.args().get(index)));
  }
  currentBlock.pushBack(new DirectJumpInst(argSet));
  for (  BasicBlock block : callee.basicBlocks()) {
    newBlocks.addLast(block.deepCopy(replaceMap));
  }
  newBlocks.addLast(afterInlineBlock);
  argSet.pushBack(new DirectJumpInst(newBlocks.getFirst()));
  newBlocks.addFirst(argSet);
  return newBlocks;
}
Program: 78274
Project: 78274
Buggy source:
public void apply(ProgramIR programIR){
  this.programIR=programIR;
  boolean change=true;
  while (change) {
    change=false;
    for (    Function function : programIR.functionMap().values()) {
      if (function.notUserFunc())       continue;
      LinkedList<BasicBlock> newBlocks=new LinkedList<>();
      for (      BasicBlock block : function.basicBlocks()) {
        newBlocks.add(block);
        for (Instruction inst=block.front(); inst != null; inst=inst.next) {
          if (inst instanceof FunctionCallInst) {
            FunctionCallInst functionCallInst=(FunctionCallInst)inst;
            Function callee=functionCallInst.function();
            if (callee.notUserFunc() || callee.isMain() || callee == function)             continue;
            if (callee.instNum <= options.INLINE_CALLEE_BOUND && function.instNum <= options.INLINE_CALLER_BOUND) {
              newBlocks.addAll(inline(function,callee,newBlocks.getLast(),functionCallInst));
              change=true;
              function.instNum+=callee.instNum;
            }
          }
        }
      }
      if (change)       function.setBasicBlocks(newBlocks);
    }
  }
  programIR.functionMap().values().forEach(func -> {
    func.cleanUp();
    func.recalcCalleSet();
  }
);
}

Fixed version (ground truth):
public void apply(ProgramIR programIR){
  this.programIR=programIR;
  updateRecursiveCalleeSet();
  boolean change=true;
  while (change) {
    change=false;
    for (    Function function : programIR.functionMap().values()) {
      if (function.notUserFunc())       continue;
      LinkedList<BasicBlock> newBlocks=new LinkedList<>();
      for (      BasicBlock block : function.basicBlocks()) {
        newBlocks.add(block);
        for (Instruction inst=block.front(); inst != null; inst=inst.next) {
          if (inst instanceof FunctionCallInst) {
            FunctionCallInst functionCallInst=(FunctionCallInst)inst;
            Function callee=functionCallInst.function();
            if (callee.notUserFunc() || callee.isMain() || callee == function || callee.recursiveCalleeSet().contains(callee))             continue;
            if (callee.instNum <= options.INLINE_CALLEE_BOUND && function.instNum <= options.INLINE_CALLER_BOUND) {
              newBlocks.addAll(inline(function,callee,newBlocks.getLast(),functionCallInst));
              change=true;
              function.instNum+=callee.instNum;
            }
          }
        }
      }
      if (change)       function.setBasicBlocks(newBlocks);
    }
  }
  programIR.functionMap().values().forEach(func -> {
    func.cleanUp();
    func.reCalcCalleeSet();
  }
);
}
Program: 78276
Project: 78276
Buggy source:
private Operand visitLogic(BinaryExprNode node){
  Var dst=Var.tmpBuilder("String_Node_Str");
  boolean outMost=successStack.empty() && failStack.empty();
  Function function=currentBasicBlock.parentFunction();
  ExprOps op=node.op();
  BasicBlock success;
  BasicBlock fail;
switch (op) {
case AND:
    if (outMost) {
      currentBasicBlock.pushBack(new MoveInst(dst,ZERO_LITERAL),valTag);
      successStack.add(new BasicBlock(function,currentSymbolTable,"String_Node_Str"));
      failStack.add(new BasicBlock(function,currentSymbolTable,"String_Node_Str"));
    }
  success=new BasicBlock(function,currentSymbolTable,"String_Node_Str");
fail=failStack.peek();
successStack.add(success);
Operand andLeft=visit(node.left());
if (andLeft != null) currentBasicBlock.pushBack(new CondJumpInst(andLeft,success,fail));
successStack.pop();
setCurrentEnv(success);
Operand andRight=visit(node.right());
if (andRight != null) currentBasicBlock.pushBack(new CondJumpInst(andRight,successStack.peek(),failStack.peek()));
if (outMost) {
setCurrentEnv(successStack.pop());
currentBasicBlock.pushBack(new MoveInst(dst,ONE_LITERAL),valTag);
currentBasicBlock.pushBack(new DirectJumpInst(failStack.peek()));
setCurrentEnv(failStack.pop());
return dst;
}
break;
case OR:
if (outMost) {
currentBasicBlock.pushBack(new MoveInst(dst,ONE_LITERAL),valTag);
successStack.add(new BasicBlock(function,currentSymbolTable,"String_Node_Str"));
failStack.add(new BasicBlock(function,currentSymbolTable,"String_Node_Str"));
}
success=successStack.peek();
fail=new BasicBlock(function,currentSymbolTable,"String_Node_Str");
failStack.add(fail);
Operand orLeft=visit(node.left());
if (orLeft != null) currentBasicBlock.pushBack(new CondJumpInst(orLeft,success,fail));
failStack.pop();
setCurrentEnv(fail);
Operand orRight=visit(node.right());
if (orRight != null) currentBasicBlock.pushBack(new CondJumpInst(orRight,successStack.peek(),failStack.peek()));
if (outMost) {
setCurrentEnv(failStack.pop());
currentBasicBlock.pushBack(new MoveInst(dst,ZERO_LITERAL),valTag);
currentBasicBlock.pushBack(new DirectJumpInst(successStack.peek()));
setCurrentEnv(successStack.pop());
return dst;
}
break;
}
return null;
}

Fixed version (ground truth):
private Operand visitLogic(BinaryExprNode node){
  ExprOps op=node.op();
switch (op) {
case AND:
    return processLogic(node,successStack,failStack);
case OR:
  return processLogic(node,failStack,successStack);
default :
throw new RuntimeException("String_Node_Str" + node.op());
}
}
Program: 78278
Project: 78278
Buggy source:
@Override public String visit(IntLiteral intLiteral){
  return String.valueOf(intLiteral.getVal());
}

Fixed version (ground truth):
@Override public String visit(IntLiteralSSA intLiteralSSA){
  return String.valueOf(intLiteralSSA.getVal());
}
Program: 78279
Project: 78279
Buggy source:
private void getCurrentBasicBlock(Function function){
  currentBasicBlock=function.getStartBasicBlock();
}

Fixed version (ground truth):
private void getCurrentBasicBlock(Function function){
  currentBasicBlock=new BasicBlock(function,currentSymbolTable);
  function.pushBack(currentBasicBlock);
}
Program: 78280
Project: 78280
Buggy source:
private Operand visitLogic(BinaryExprNode node){
  Function function=currentBasicBlock.getParentFunction();
  ExprOps op=node.getOp();
  Operand left=visit(node.getLeft());
  BasicBlock next=new BasicBlock(function,"String_Node_Str");
switch (op) {
case AND:
    if (left instanceof IntLiteral) {
      if (((IntLiteral)left).getVal() == 0)       return left;
      return visit(node.getRight());
    }
  BasicBlock valTrue=new BasicBlock(function,"String_Node_Str");
currentBasicBlock.pushBack(new CondJumpInst(left,valTrue,next));
setCurrentBasicBlock(valTrue);
break;
case OR:
if (left instanceof IntLiteral) {
if (((IntLiteral)left).getVal() == 1) return left;
return visit(node.getRight());
}
BasicBlock valFalse=new BasicBlock(function,"String_Node_Str");
currentBasicBlock.pushBack(new CondJumpInst(left,valFalse,next));
setCurrentBasicBlock(valFalse);
break;
}
Operand right=visit(node.getRight());
currentBasicBlock.pushBack(new MoveInst((VirtualRegister)left,right));
currentBasicBlock.pushBack(new DirectJumpInst(next));
setCurrentBasicBlock(next);
return left;
}

Fixed version (ground truth):
private Operand visitLogic(BinaryExprNode node){
  Function function=currentBasicBlock.getParentFunction();
  ExprOps op=node.getOp();
  Operand left=visit(node.getLeft());
  BasicBlock next=new BasicBlock(function,currentSymbolTable,"String_Node_Str");
switch (op) {
case AND:
    if (left instanceof IntLiteral) {
      if (((IntLiteral)left).getVal() == 0)       return left;
      return visit(node.getRight());
    }
  BasicBlock valTrue=new BasicBlock(function,null,"String_Node_Str");
currentBasicBlock.pushBack(new CondJumpInst(left,valTrue,next));
setCurrentBasicBlock(valTrue);
break;
case OR:
if (left instanceof IntLiteral) {
if (((IntLiteral)left).getVal() == 1) return left;
return visit(node.getRight());
}
BasicBlock valFalse=new BasicBlock(function,null,"String_Node_Str");
currentBasicBlock.pushBack(new CondJumpInst(left,valFalse,next));
setCurrentBasicBlock(valFalse);
break;
}
Operand right=visit(node.getRight());
currentBasicBlock.pushBack(new MoveInst((VirtualRegister)left,right));
currentBasicBlock.pushBack(new DirectJumpInst(next));
setCurrentBasicBlock(next);
return left;
}
Program: 78281
Project: 78281
Buggy source:
private void addKnownReg(Register reg,Operand val){
  if (val instanceof IntLiteral)   reg.setVal((IntLiteral)val);
 else   reg.setVal(null);
}

Fixed version (ground truth):
private void addKnownReg(VirtualRegister reg,Operand val){
  if (reg.getSymbolTable() == currentSymbolTable && val instanceof IntLiteral)   reg.setVal((IntLiteral)val);
 else   reg.setVal(null);
}
Program: 78282
Project: 78282
Buggy source:
public BasicBlock(Function parentFunction,String name){
  this.parentFunction=parentFunction;
  this.name=NameBuilder.builder(name);
}

Fixed version (ground truth):
public BasicBlock(Function parentFunction,SymbolTable currentSymbolTable,String name){
  this.parentFunction=parentFunction;
  this.currentSymbolTable=currentSymbolTable;
  this.name=NameBuilder.builder(name);
}
Program: 78283
Project: 78283
Buggy source:
public Function(InstanceSymbol instanceSymbol,FunctionTypeSymbol functionTypeSymbol){
  this.functionTypeSymbol=functionTypeSymbol;
  this.instanceSymbol=instanceSymbol;
  this.startBasicBlock=new BasicBlock(this,instanceSymbol.getName());
}

Fixed version (ground truth):
public Function(InstanceSymbol instanceSymbol,FunctionTypeSymbol functionTypeSymbol){
  this.functionTypeSymbol=functionTypeSymbol;
  this.instanceSymbol=instanceSymbol;
}
Program: 78284
Project: 78284
Buggy source:
public VirtualRegister(InstanceSymbol symbol,SymbolTable table){
  this.name=symbol.getName();
  this.table=table;
}

Fixed version (ground truth):
public VirtualRegister(InstanceSymbol symbol,SymbolTable symbolTable){
  this.name=symbol.getName();
  this.symbolTable=symbolTable;
}
Program: 78285
Project: 78285
Buggy source:
@Override public SSA visit(ConstructorCallNode node){
  return null;
}

Fixed version (ground truth):
@Override public RegOrImm visit(ConstructorCallNode node){
  return null;
}
Program: 78286
Project: 78286
Buggy source:
public BasicBlock(String name){
  this.name=NameBuilder.builder(name);
}

Fixed version (ground truth):
public BasicBlock(Function parentFunction,String name){
  this.parentFunction=parentFunction;
  this.name=NameBuilder.builder(name);
}
Program: 78287
Project: 78287
Buggy source:
public BinaryExpInst(RegisterSSA target,RegisterSSA left,RegisterSSA right){
  super();
  super.setTarget(target);
  super.setLeft(left);
  super.setRight(right);
}

Fixed version (ground truth):
public BinaryExpInst(Register target,Register left,Register right){
  super();
  super.setTarget(target);
  super.setLeft(left);
  super.setRight(right);
}
Program: 78288
Project: 78288
Buggy source:
public RegisterSSA getTarget(){
  return target;
}

Fixed version (ground truth):
public Register getTarget(){
  return target;
}
Program: 78289
Project: 78289
Buggy source:
public SSA getRight(){
  return right;
}

Fixed version (ground truth):
public RegOrImm getRight(){
  return right;
}
Program: 78290
Project: 78290
Buggy source:
public void setLeft(SSA left){
  this.left=left;
}

Fixed version (ground truth):
public void setLeft(RegOrImm left){
  this.left=left;
}
Program: 78291
Project: 78291
Buggy source:
public void setTarget(RegisterSSA target){
  this.target=target;
}

Fixed version (ground truth):
public void setTarget(Register target){
  this.target=target;
}
Program: 78292
Project: 78292
Buggy source:
public void setRight(SSA right){
  this.right=right;
}

Fixed version (ground truth):
public void setRight(RegOrImm right){
  this.right=right;
}
Program: 78293
Project: 78293
Buggy source:
public SSA getLeft(){
  return left;
}

Fixed version (ground truth):
public RegOrImm getLeft(){
  return left;
}
Program: 78294
Project: 78294
Buggy source:
public MoveInst(RegisterSSA target,SSA value){
  super();
  super.setTarget(target);
  super.setLeft(value);
}

Fixed version (ground truth):
public MoveInst(Register target,RegOrImm value){
  super();
  super.setTarget(target);
  super.setLeft(value);
}
Program: 78295
Project: 78295
Buggy source:
@Override public void visit(ContinueNode node){
  if (!inLoop) {
    throw new RuntimeException("String_Node_Str" + node.getStartLocation().getLocation());
  }
  returnType=null;
}

Fixed version (ground truth):
@Override public void visit(ContinueNode node){
  if (inLoop == 0) {
    throw new RuntimeException("String_Node_Str" + node.getStartLocation().getLocation());
  }
  returnType=null;
}
Program: 78296
Project: 78296
Buggy source:
public static void build() throws Exception {
  CharStream input=CharStreams.fromFileName("String_Node_Str" + typeCheck[2]);
  MxLexer lexer=new MxLexer(input);
  CommonTokenStream tokens=new CommonTokenStream(lexer);
  MxParser parser=new MxParser(tokens);
  ParseTree tree=parser.program();
  buildAst=new BuildAst();
  program=buildAst.visitProgram((MxParser.ProgramContext)tree);
}

Fixed version (ground truth):
public static void build() throws Exception {
  CharStream input=CharStreams.fromFileName("String_Node_Str" + astBuild[4]);
  MxLexer lexer=new MxLexer(input);
  CommonTokenStream tokens=new CommonTokenStream(lexer);
  MxParser parser=new MxParser(tokens);
  ParseTree tree=parser.program();
  buildAst=new BuildAst();
  program=buildAst.visitProgram((MxParser.ProgramContext)tree);
}
Program: 78297
Project: 78297
Buggy source:
@Test public void testDumpAst(){
  AstVisitor constructSymbolTableAstVisitor=new ForwardRefPreprocessAstVisitor();
  program.accept(constructSymbolTableAstVisitor);
  AstVisitor typeNotPresentException=new TypeCheckAstVisitor();
  program.accept(typeNotPresentException);
}

Fixed version (ground truth):
@Test public void testDumpAst(){
  try {
    AstVisitor constructSymbolTableAstVisitor=new ForwardRefPreprocessAstVisitor();
    program.accept(constructSymbolTableAstVisitor);
    AstVisitor typeNotPresentException=new TypeCheckAstVisitor();
    program.accept(typeNotPresentException);
  }
 catch (  CompileError e) {
    CompileWarining.printWarings();
    System.err.println(e.getMessage());
    System.exit(1);
  }
}
Program: 78298
Project: 78298
Buggy source:
private static String getAfter(Location location){
  Integer end=location.getInterval().b;
  if (tokens.get(end + 1).getText().contains("String_Node_Str"))   return "String_Node_Str";
  Integer lineEnd=end + 1;
  while (lineEnd < tokens.size() && !tokens.get(lineEnd).getText().contains("String_Node_Str")) {
    ++lineEnd;
  }
  return BLACK + tokens.getText(new Interval(end + 1,lineEnd));
}

Fixed version (ground truth):
private static String getAfter(Location location){
  Integer end=location.getInterval().b;
  if (end == tokens.size() || tokens.get(end + 1).getText().contains("String_Node_Str"))   return "String_Node_Str";
  Integer lineEnd=end + 1;
  while (lineEnd < tokens.size() && !tokens.get(lineEnd).getText().contains("String_Node_Str")) {
    ++lineEnd;
  }
  return BLACK + tokens.getText(new Interval(end + 1,lineEnd));
}
Program: 78299
Project: 78299
Buggy source:
private static String getBefore(Location location){
  Integer start=location.getInterval().a;
  if (tokens.get(start - 1).getText().contains("String_Node_Str"))   return "String_Node_Str";
  Integer lineStart=start - 1;
  while (lineStart >= 0 && !tokens.get(lineStart).getText().contains("String_Node_Str")) {
    --lineStart;
  }
  return BLACK + tokens.getText(new Interval(lineStart + 1,start - 1));
}

Fixed version (ground truth):
private static String getBefore(Location location){
  Integer start=location.getInterval().a;
  if (start == 0 || tokens.get(start - 1).getText().contains("String_Node_Str"))   return "String_Node_Str";
  Integer lineStart=start - 1;
  while (lineStart >= 0 && !tokens.get(lineStart).getText().contains("String_Node_Str")) {
    --lineStart;
  }
  return BLACK + tokens.getText(new Interval(lineStart + 1,start - 1));
}
Program: 78300
Project: 78300
Buggy source:
public LoopNode(ExprNode varDecl,ExprNode condition,ExprNode step,BlockNode body,Location varDeclPos,Location conditionPos,Location stepPos){
  this.varDecl=varDecl;
  this.condition=condition;
  this.step=step;
  this.body=body;
  this.varDeclPos=varDeclPos;
  this.conditionPos=conditionPos;
  this.stepPos=stepPos;
}

Fixed version (ground truth):
public LoopNode(Node varDecl,ExprNode condition,ExprNode step,BlockNode body,Location varDeclPos,Location conditionPos,Location stepPos){
  this.varDecl=varDecl;
  this.condition=condition;
  this.step=step;
  this.body=body;
  this.varDeclPos=varDeclPos;
  this.conditionPos=conditionPos;
  this.stepPos=stepPos;
}
Program: 78301
Project: 78301
Buggy source:
public ExprNode getVarDecl(){
  return varDecl;
}

Fixed version (ground truth):
public Node getVarDecl(){
  return varDecl;
}
Program: 78302
Project: 78302
Buggy source:
@Override public Node visitForField(MxParser.ForFieldContext ctx){
  ExprNode vardecl=null;
  ExprNode condition=null;
  ExprNode step=null;
  BlockNode body=(BlockNode)visit(ctx.body());
  Location vardeclPos=null;
  Location conditionPos=null;
  Location stepPos=null;
  if (ctx.vardecl != null) {
    vardecl=(ExprNode)visit(ctx.vardecl);
    vardeclPos=new Location(ctx.vardecl);
  }
  if (ctx.cond != null) {
    condition=(ExprNode)visit(ctx.cond);
    conditionPos=new Location(ctx.cond);
  }
  if (ctx.step != null) {
    step=(ExprNode)visit(ctx.step);
    stepPos=new Location(ctx.step);
  }
  return new LoopNode(vardecl,condition,step,body,vardeclPos,conditionPos,stepPos);
}

Fixed version (ground truth):
@Override public Node visitForField(MxParser.ForFieldContext ctx){
  Node vardecl=null;
  ExprNode condition=null;
  ExprNode step=null;
  BlockNode body=(BlockNode)visit(ctx.body());
  Location vardeclPos=null;
  Location conditionPos=null;
  Location stepPos=null;
  if (ctx.type() != null) {
    vardeclPos=new Location(ctx.type());
    if (ctx.variableField() == null) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + new Location(ctx.type()).getLocation());
    }
    VariableDeclNode node=(VariableDeclNode)visit(ctx.variableField());
    TypeNode typeNode=(TypeNode)visit(ctx.type());
    node.setType(typeNode.getTypeSymbol(),vardeclPos);
    vardecl=node;
  }
 else {
    if (ctx.variableField() != null) {
      vardecl=visit(ctx.variableField());
    }
  }
  if (ctx.cond != null) {
    condition=(ExprNode)visit(ctx.cond);
    conditionPos=new Location(ctx.cond);
  }
  if (ctx.step != null) {
    step=(ExprNode)visit(ctx.step);
    stepPos=new Location(ctx.step);
  }
  return new LoopNode(vardecl,condition,step,body,vardeclPos,conditionPos,stepPos);
}
Program: 78303
Project: 78303
Buggy source:
private void initInnerFunction(){
  putInner("String_Node_Str","String_Node_Str","String_Node_Str");
  putInner("String_Node_Str","String_Node_Str");
  putInner("String_Node_Str","String_Node_Str");
  putInner("String_Node_Str","String_Node_Str");
  putInner("String_Node_Str","String_Node_Str","String_Node_Str");
  SymbolTable stringSymbolTable=SymbolTable.getNamedSymbolTable(NonArrayTypeSymbol.builder("String_Node_Str"));
  stringSymbolTable.put(InstanceSymbol.builder("String_Node_Str"),getFunctionType("String_Node_Str"));
  stringSymbolTable.put(InstanceSymbol.builder("String_Node_Str"),getFunctionType("String_Node_Str","String_Node_Str","String_Node_Str"));
  stringSymbolTable.put(InstanceSymbol.builder("String_Node_Str"),getFunctionType("String_Node_Str"));
  stringSymbolTable.put(InstanceSymbol.builder("String_Node_Str"),getFunctionType("String_Node_Str","String_Node_Str"));
}

Fixed version (ground truth):
private void initInnerFunction(){
  putInner("String_Node_Str","String_Node_Str","String_Node_Str");
  putInner("String_Node_Str","String_Node_Str","String_Node_Str");
  putInner("String_Node_Str","String_Node_Str");
  putInner("String_Node_Str","String_Node_Str");
  putInner("String_Node_Str","String_Node_Str","String_Node_Str");
  SymbolTable stringSymbolTable=SymbolTable.getNamedSymbolTable(NonArrayTypeSymbol.builder("String_Node_Str"));
  stringSymbolTable.put(InstanceSymbol.builder("String_Node_Str"),getFunctionType("String_Node_Str"));
  stringSymbolTable.put(InstanceSymbol.builder("String_Node_Str"),getFunctionType("String_Node_Str","String_Node_Str","String_Node_Str"));
  stringSymbolTable.put(InstanceSymbol.builder("String_Node_Str"),getFunctionType("String_Node_Str"));
  stringSymbolTable.put(InstanceSymbol.builder("String_Node_Str"),getFunctionType("String_Node_Str","String_Node_Str"));
}
Program: 78304
Project: 78304
Buggy source:
@Override public void visit(ContinueNode node){
  returnType=null;
}

Fixed version (ground truth):
@Override public void visit(ContinueNode node){
  if (!inLoop) {
    throw new RuntimeException("String_Node_Str" + node.getStartLocation().getLocation());
  }
  returnType=null;
}
Program: 78305
Project: 78305
Buggy source:
@Override public Node visitFunctionCall_(MxParser.FunctionCall_Context ctx){
  List<ExprNode> args=new ArrayList<>();
  if (ctx.arguments().exprList() != null) {
    for (    MxParser.ExprContext expr : ctx.arguments().exprList().expr()) {
      args.add((ExprNode)visit(expr));
    }
  }
  if (ctx.expr() instanceof MxParser.Identifier_Context) {
    Symbol symbol=Symbol.searchSymbol(((MxParser.Identifier_Context)ctx.expr()).Identifier().getText());
    if (symbol instanceof NonArrayTypeSymbol) {
      return new ConstructorCallNode((NonArrayTypeSymbol)symbol,args,new Location(ctx.arguments()));
    }
  }
  ExprNode caller=(ExprNode)visit(ctx.expr());
  return new FunctionCallNode(caller,args,new Location(ctx.arguments()));
}

Fixed version (ground truth):
@Override public Node visitFunctionCall_(MxParser.FunctionCall_Context ctx){
  List<ExprNode> args=new ArrayList<>();
  if (ctx.arguments().exprList() != null) {
    for (    MxParser.ExprContext expr : ctx.arguments().exprList().expr()) {
      args.add((ExprNode)visit(expr));
    }
  }
  if (ctx.expr() instanceof MxParser.Identifier_Context) {
    TypeSymbol symbol=TypeSymbol.searchSymbol(((MxParser.Identifier_Context)ctx.expr()).Identifier().getText());
    if (symbol instanceof NonArrayTypeSymbol) {
      return new ConstructorCallNode((NonArrayTypeSymbol)symbol,args,new Location(ctx.arguments()));
    }
  }
  ExprNode caller=(ExprNode)visit(ctx.expr());
  return new FunctionCallNode(caller,args,new Location(ctx.arguments()));
}
Program: 78306
Project: 78306
Buggy source:
@Override public Node visitClassField(MxParser.ClassFieldContext ctx){
  String declClass=ctx.Identifier().getText();
  List<Node> body=new ArrayList<>();
  Location declClassPos=new Location(ctx.Identifier());
  Location bodyPos=new Location(ctx.LBRACE());
  for (  MxParser.ClassBodyContext declarator : ctx.classBody()) {
    Node statement=visit(declarator);
    if (statement instanceof VariableDeclNode || statement instanceof FunctionDeclNode) {
      body.add(visit(declarator));
    }
 else {
      throw new RuntimeException("String_Node_Str" + declClassPos.getLocation());
    }
  }
  BlockNode block=new BlockNode(body,bodyPos);
  ClassDeclNode classDeclNode;
  try {
    classDeclNode=new ClassDeclNode(declClass,block,declClassPos);
  }
 catch (  RuntimeException e) {
    throw new RuntimeException("String_Node_Str" + e.getMessage() + declClassPos.getLocation());
  }
  return classDeclNode;
}

Fixed version (ground truth):
@Override public Node visitClassField(MxParser.ClassFieldContext ctx){
  String declClass=ctx.Identifier().getText();
  List<Node> body=new ArrayList<>();
  Location declClassPos=new Location(ctx.Identifier());
  Location bodyPos=new Location(ctx.LBRACE());
  for (  MxParser.ClassBodyContext declarator : ctx.classBody()) {
    Node statement=visit(declarator);
    if (statement instanceof VariableDeclNode) {
      body.add(visit(declarator));
    }
 else     if (statement instanceof FunctionDeclNode) {
      body.add(visit(declarator));
      if (((FunctionDeclNode)statement).getInstanceSymbol() == InstanceSymbol.constructorSymbol && !((FunctionDeclNode)statement).getFunctionTypeSymbol().getReturnType().getName().equals(declClass)) {
        throw new RuntimeException("String_Node_Str" + new Location(declarator).getLocation());
      }
    }
 else {
      throw new RuntimeException("String_Node_Str" + declClassPos.getLocation());
    }
  }
  BlockNode block=new BlockNode(body,bodyPos);
  ClassDeclNode classDeclNode;
  try {
    classDeclNode=new ClassDeclNode(declClass,block,declClassPos);
  }
 catch (  RuntimeException e) {
    throw new RuntimeException("String_Node_Str" + e.getMessage() + declClassPos.getLocation());
  }
  return classDeclNode;
}
Program: 78307
Project: 78307
Buggy source:
private FunctionDeclNode getFunctionField(TerminalNode identifier,MxParser.ParamExprFieldContext paramExprFieldContext,MxParser.FunctionBodyContext functionBodyContext){
  Location identifierLocation=new Location(identifier);
  Location paramLocation=new Location(paramExprFieldContext);
  Location functionBodyLocation=new Location(functionBodyContext);
  List<VariableDeclNode> params=new ArrayList<>();
  for (  MxParser.ParamExprContext param : paramExprFieldContext.paramExpr()) {
    params.add((VariableDeclNode)visit(param));
  }
  BlockNode body=(BlockNode)visit(functionBodyContext);
  String name=identifier.getText();
  Symbol search=Symbol.searchSymbol(name);
  if (search instanceof TypeSymbol) {
    return new FunctionDeclNode((TypeSymbol)search,InstanceSymbol.constructorSymbol,params,body,null,identifierLocation,paramLocation,functionBodyLocation);
  }
  InstanceSymbol instanceSymbol;
  try {
    instanceSymbol=InstanceSymbol.builder(name);
  }
 catch (  RuntimeException e) {
    throw new RuntimeException("String_Node_Str" + e.getMessage() + new Location(identifier).getLocation());
  }
  return new FunctionDeclNode(null,instanceSymbol,params,body,null,new Location(identifier),new Location(paramExprFieldContext),new Location(functionBodyContext));
}

Fixed version (ground truth):
private FunctionDeclNode getFunctionField(TerminalNode identifier,MxParser.ParamExprFieldContext paramExprFieldContext,MxParser.FunctionBodyContext functionBodyContext){
  Location identifierLocation=new Location(identifier);
  Location paramLocation=new Location(paramExprFieldContext);
  Location functionBodyLocation=new Location(functionBodyContext);
  List<VariableDeclNode> params=new ArrayList<>();
  for (  MxParser.ParamExprContext param : paramExprFieldContext.paramExpr()) {
    params.add((VariableDeclNode)visit(param));
  }
  BlockNode body=(BlockNode)visit(functionBodyContext);
  String name=identifier.getText();
  TypeSymbol search=TypeSymbol.searchSymbol(name);
  if (search instanceof NonArrayTypeSymbol) {
    return new FunctionDeclNode(search,InstanceSymbol.constructorSymbol,params,body,null,identifierLocation,paramLocation,functionBodyLocation);
  }
  InstanceSymbol instanceSymbol;
  try {
    instanceSymbol=InstanceSymbol.builder(name);
  }
 catch (  RuntimeException e) {
    throw new RuntimeException("String_Node_Str" + e.getMessage() + new Location(identifier).getLocation());
  }
  return new FunctionDeclNode(null,instanceSymbol,params,body,null,new Location(identifier),new Location(paramExprFieldContext),new Location(functionBodyContext));
}
Program: 78308
Project: 78308
Buggy source:
@Override public Node visitProgram(MxParser.ProgramContext ctx){
  List<Node> declarators=new ArrayList<>();
  Location programPos=new Location(1,1);
  buildClassSymbol(ctx);
  for (  ParseTree child : ctx.declarator()) {
    Node childNode=visit(child);
    if (childNode instanceof DeclaratorNode)     declarators.add(childNode);
 else     throw new RuntimeException("String_Node_Str" + programPos.getLocation());
  }
  BlockNode block=new BlockNode(declarators,programPos);
  return new ProgramNode(block,new Location(ctx));
}

Fixed version (ground truth):
@Override public Node visitProgram(MxParser.ProgramContext ctx){
  List<Node> declarators=new ArrayList<>();
  Location programPos=new Location(1,1);
  buildClassSymbol(ctx);
  for (  ParseTree child : ctx.declarator()) {
    Node childNode=visit(child);
    if (childNode instanceof DeclaratorNode) {
      declarators.add(childNode);
      if (childNode instanceof VariableDeclNode) {
        TypeSymbol search=TypeSymbol.searchSymbol(((VariableDeclNode)childNode).getVarSymbol().getName());
        if (search != null) {
          throw new RuntimeException("String_Node_Str" + ((VariableDeclNode)childNode).getVarSymbol().getName() + "String_Node_Str"+ "String_Node_Str"+ childNode.getStartLocation().getLocation());
        }
      }
    }
 else     throw new RuntimeException("String_Node_Str" + programPos.getLocation());
  }
  BlockNode block=new BlockNode(declarators,programPos);
  return new ProgramNode(block,new Location(ctx));
}
Program: 78309
Project: 78309
Buggy source:
public static ArrayTypeSymbol builder(String name,Integer dim){
  NonArrayTypeSymbol nonArrayTypeSymbol=NonArrayTypeSymbol.builder(name);
  Symbol search=symbolMap.get(combineName(name,dim));
  if (search == null) {
    search=new ArrayTypeSymbol(nonArrayTypeSymbol,dim);
    symbolMap.put(combineName(name,dim),search);
  }
  return (ArrayTypeSymbol)search;
}

Fixed version (ground truth):
public static ArrayTypeSymbol builder(String name,Integer dim){
  NonArrayTypeSymbol nonArrayTypeSymbol=NonArrayTypeSymbol.builder(name);
  TypeSymbol search=typeSymbolMap.get(combineName(name,dim));
  if (search == null) {
    search=new ArrayTypeSymbol(nonArrayTypeSymbol,dim);
    typeSymbolMap.put(combineName(name,dim),search);
  }
  return (ArrayTypeSymbol)search;
}
Program: 78310
Project: 78310
Buggy source:
public static InstanceSymbol builder(String name){
  String intern=name.intern();
  Symbol search=symbolMap.get(intern);
  if (search == null) {
    search=new InstanceSymbol(intern);
    symbolMap.put(intern,search);
  }
  return (InstanceSymbol)search;
}

Fixed version (ground truth):
public static InstanceSymbol builder(String name){
  String intern=name.intern();
  InstanceSymbol search=instanceSymbolMap.get(intern);
  if (search == null) {
    search=new InstanceSymbol(intern);
    instanceSymbolMap.put(intern,search);
  }
  return search;
}
Program: 78311
Project: 78311
Buggy source:
public static NonArrayTypeSymbol getConstructorType(){
  return (NonArrayTypeSymbol)symbolMap.get("String_Node_Str");
}

Fixed version (ground truth):
public static NonArrayTypeSymbol getConstructorType(){
  return (NonArrayTypeSymbol)typeSymbolMap.get("String_Node_Str");
}
Program: 78312
Project: 78312
Buggy source:
public static NonArrayTypeSymbol builder(String typename){
  if (typename == null) {
    throw new RuntimeException("String_Node_Str");
  }
  String intern=typename.intern();
  Symbol search=symbolMap.get(intern);
  if (search == null) {
    search=new NonArrayTypeSymbol(typename);
    symbolMap.put(typename.intern(),search);
  }
  return (NonArrayTypeSymbol)search;
}

Fixed version (ground truth):
public static NonArrayTypeSymbol builder(String typename){
  if (typename == null) {
    throw new RuntimeException("String_Node_Str");
  }
  String intern=typename.intern();
  TypeSymbol search=typeSymbolMap.get(intern);
  if (search == null) {
    search=new NonArrayTypeSymbol(typename);
    typeSymbolMap.put(typename.intern(),search);
  }
  return (NonArrayTypeSymbol)search;
}
Program: 78313
Project: 78313
Buggy source:
private boolean uploadFile(String remotePath,List<File> fileList) throws IOException {
  boolean uploaded=true;
  FileInputStream fis=null;
  if (connectServer(this.ip,this.port,this.user,this.pwd)) {
    try {
      ftpClient.changeWorkingDirectory(remotePath);
      ftpClient.setBufferSize(1024);
      ftpClient.setControlEncoding("String_Node_Str");
      ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
      ftpClient.enterLocalPassiveMode();
      for (      File fileItem : fileList) {
        fis=new FileInputStream(fileItem);
        ftpClient.storeFile(fileItem.getName(),fis);
      }
    }
 catch (    IOException e) {
      logger.error("String_Node_Str",e);
      uploaded=false;
      e.printStackTrace();
    }
 finally {
      fis.close();
      ftpClient.disconnect();
    }
  }
  return uploaded;
}

Fixed version (ground truth):
public boolean uploadFile(String remotePath,List<File> fileList) throws IOException {
  boolean uploaded=true;
  FileInputStream fis=null;
  boolean isConnect=connectServer(this.ip,this.port,this.user,this.pwd);
  if (isConnect) {
    try {
      ftpClient.changeWorkingDirectory(remotePath);
      ftpClient.setBufferSize(1024);
      ftpClient.setControlEncoding("String_Node_Str");
      ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
      ftpClient.enterLocalPassiveMode();
      for (      File fileItem : fileList) {
        fis=new FileInputStream(fileItem);
        ftpClient.storeFile(fileItem.getName(),fis);
      }
      logger.info("String_Node_Str");
    }
 catch (    IOException e) {
      logger.error("String_Node_Str",e);
      uploaded=false;
      e.printStackTrace();
    }
 finally {
      fis.close();
      ftpClient.disconnect();
    }
  }
  return uploaded;
}
Program: 78314
Project: 78314
Buggy source:
private static void initPool(){
  JedisPoolConfig config=new JedisPoolConfig();
  config.setMaxTotal(maxTotal);
  config.setMaxIdle(maxIdle);
  config.setMinIdle(minIdle);
  config.setBlockWhenExhausted(true);
  config.setTestOnBorrow(testOnborrow);
  config.setTestOnReturn(testOnReturn);
  pool=new JedisPool(config,host,ip,1000 * 2);
}

Fixed version (ground truth):
private static void initPool(){
  JedisPoolConfig config=new JedisPoolConfig();
  config.setMaxTotal(maxTotal);
  config.setMaxIdle(maxIdle);
  config.setMinIdle(minIdle);
  config.setBlockWhenExhausted(true);
  config.setTestOnBorrow(testOnborrow);
  config.setTestOnReturn(testOnReturn);
  pool=new JedisPool(config,host,port,1000 * 2);
}
Program: 78315
Project: 78315
Buggy source:
@Scheduled(cron="String_Node_Str") public void closeOrderTaskV4(){
  log.info("String_Node_Str");
  RLock lock=redissonManager.getRedisson().getLock(Const.REDIS_LOCK.CLOSE_ORDER_TASK_LOCK);
  boolean getLock=false;
  try {
    if (getLock=lock.tryLock(2,5,TimeUnit.SECONDS)) {
      int hour=Integer.parseInt(PropertiesUtil.getProperty("String_Node_Str","String_Node_Str"));
      iOrderService.closeOrder(hour);
    }
 else {
      log.info("String_Node_Str",Const.REDIS_LOCK.CLOSE_ORDER_TASK_LOCK,Thread.currentThread().getName());
    }
  }
 catch (  InterruptedException e) {
    log.error("String_Node_Str",e);
  }
 finally {
    if (!getLock) {
      return;
    }
    lock.unlock();
    log.info("String_Node_Str",Const.REDIS_LOCK.CLOSE_ORDER_TASK_LOCK,Thread.currentThread().getName());
  }
}

Fixed version (ground truth):
@Scheduled(cron="String_Node_Str") public void closeOrderTaskV4(){
  log.info("String_Node_Str");
  RLock lock=redissonManager.getRedisson().getLock(Const.REDIS_LOCK.CLOSE_ORDER_TASK_LOCK);
  boolean getLock=false;
  try {
    if (getLock=lock.tryLock(0,5,TimeUnit.SECONDS)) {
      int hour=Integer.parseInt(PropertiesUtil.getProperty("String_Node_Str","String_Node_Str"));
      iOrderService.closeOrder(hour);
    }
 else {
      log.info("String_Node_Str",Const.REDIS_LOCK.CLOSE_ORDER_TASK_LOCK,Thread.currentThread().getName());
    }
  }
 catch (  InterruptedException e) {
    log.error("String_Node_Str",e);
  }
 finally {
    if (!getLock) {
      return;
    }
    lock.unlock();
    log.info("String_Node_Str",Const.REDIS_LOCK.CLOSE_ORDER_TASK_LOCK,Thread.currentThread().getName());
  }
}
Program: 78316
Project: 78316
Buggy source:
/** 
 * 取消订单
 * @param userId
 * @param orderNo
 * @return
 */
public ServerResponse cancleOrder(Integer userId,Long orderNo){
  Order order=orderMapper.selectByUserIdAndOrderNo(userId,orderNo);
  if (order == null) {
    return ServerResponse.createByErrorMessage("String_Node_Str");
  }
  if (order.getStatus() != Const.OrderStatusEnum.NO_PAY.getCode()) {
    return ServerResponse.createByErrorMessage("String_Node_Str");
  }
  Order updateOrder=new Order();
  updateOrder.setId(order.getId());
  updateOrder.setStatus(Const.OrderStatusEnum.CANCEL.getCode());
  int rowCount=orderMapper.updateByPrimaryKeySelective(updateOrder);
  if (rowCount > 0) {
    return ServerResponse.createBySuccess();
  }
  return ServerResponse.createByError();
}

Fixed version (ground truth):
/** 
 * 取消订单 fixme bug:取消订单后需要恢复商品库存
 * @param userId
 * @param orderNo
 * @return
 */
public ServerResponse cancleOrder(Integer userId,Long orderNo){
  Order order=orderMapper.selectByUserIdAndOrderNo(userId,orderNo);
  if (order == null) {
    return ServerResponse.createByErrorMessage("String_Node_Str");
  }
  if (order.getStatus() != Const.OrderStatusEnum.NO_PAY.getCode()) {
    return ServerResponse.createByErrorMessage("String_Node_Str");
  }
  Order updateOrder=new Order();
  updateOrder.setId(order.getId());
  updateOrder.setStatus(Const.OrderStatusEnum.CANCEL.getCode());
  List<OrderItem> orderItemList=orderItemMapper.selectByUserIdOrderNo(userId,orderNo);
  this.restoreProductStock(orderItemList);
  int rowCount=orderMapper.updateByPrimaryKeySelective(updateOrder);
  if (rowCount > 0) {
    return ServerResponse.createBySuccess();
  }
  return ServerResponse.createByError();
}
Program: 78317
Project: 78317
Buggy source:
/** 
 * 生成订单号 fixme 此处以后要扩展,采用分布式订单号生成策咯
 * @return
 */
private long generateOrderNo(){
  long currentTime=System.currentTimeMillis();
  return currentTime + new Random().nextInt(100);
}

Fixed version (ground truth):
/** 
 * 生成订单号 fixme 此处以后要扩展,采用分布式订单号生成策咯 可以使用Redis 生成自增主键
 * @return
 */
private long generateOrderNo(){
  long currentTime=System.currentTimeMillis();
  return currentTime + new Random().nextInt(100);
}
Program: 78318
Project: 78318
Buggy source:
/** 
 * 管理员登录
 * @param username
 * @param password
 * @param session
 * @return
 */
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST) @ResponseBody public ServerResponse<User> login(String username,String password,HttpSession session){
  ServerResponse<User> response=iUserService.login(username,password);
  if (response.isSuccess()) {
    User user=response.getData();
    if (user.getRole().equals(Const.ROLE.MANAGER_USER)) {
      session.setAttribute(Const.CURRENT_USER,user);
    }
 else {
      return ServerResponse.createByErorrMessage("String_Node_Str");
    }
  }
  return ServerResponse.createByErorrMessage("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * 管理员登录
 * @param username
 * @param password
 * @param session
 * @return
 */
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST) @ResponseBody public ServerResponse<User> login(String username,String password,HttpSession session){
  ServerResponse<User> response=iUserService.login(username,password);
  if (response.isSuccess()) {
    User user=response.getData();
    if (user.getRole().equals(Const.ROLE.MANAGER_USER)) {
      session.setAttribute(Const.CURRENT_USER,user);
    }
 else {
      return ServerResponse.createByErrorMessage("String_Node_Str");
    }
  }
  return ServerResponse.createByErrorMessage("String_Node_Str");
}
Program: 78319
Project: 78319
Buggy source:
/** 
 * 已登录用户的重置密码
 * @param passwordOld
 * @param passwordNew
 * @param session
 * @return
 */
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST) @ResponseBody public ServerResponse<String> resetPassword(String passwordOld,String passwordNew,HttpSession session){
  User user=(User)session.getAttribute(Const.CURRENT_USER);
  if (user == null) {
    return ServerResponse.createByErorrMessage("String_Node_Str");
  }
  return iUserService.resetPassword(passwordOld,passwordNew,user);
}

Fixed version (ground truth):
/** 
 * 已登录用户的重置密码
 * @param passwordOld
 * @param passwordNew
 * @param session
 * @return
 */
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST) @ResponseBody public ServerResponse<String> resetPassword(String passwordOld,String passwordNew,HttpSession session){
  User user=(User)session.getAttribute(Const.CURRENT_USER);
  if (user == null) {
    return ServerResponse.createByErrorMessage("String_Node_Str");
  }
  return iUserService.resetPassword(passwordOld,passwordNew,user);
}
Program: 78320
Project: 78320
Buggy source:
/** 
 * 更新用户信息-----注意横向越权问题
 * @param session
 * @param user
 * @return
 */
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST) @ResponseBody public ServerResponse updateInformation(HttpSession session,User user){
  User currentUser=(User)session.getAttribute(Const.CURRENT_USER);
  if (currentUser == null) {
    return ServerResponse.createByErorrMessage("String_Node_Str");
  }
  user.setId(currentUser.getId());
  user.setUsername(currentUser.getUsername());
  ServerResponse response=iUserService.updateUserInfo(user);
  if (response.isSuccess()) {
    session.setAttribute(Const.CURRENT_USER,response.getData());
    return ServerResponse.createBySuccessMessage("String_Node_Str");
  }
  return response;
}

Fixed version (ground truth):
/** 
 * 更新用户信息-----注意横向越权问题
 * @param session
 * @param user
 * @return
 */
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST) @ResponseBody public ServerResponse updateInformation(HttpSession session,User user){
  User currentUser=(User)session.getAttribute(Const.CURRENT_USER);
  if (currentUser == null) {
    return ServerResponse.createByErrorMessage("String_Node_Str");
  }
  user.setId(currentUser.getId());
  user.setUsername(currentUser.getUsername());
  ServerResponse response=iUserService.updateUserInfo(user);
  if (response.isSuccess()) {
    session.setAttribute(Const.CURRENT_USER,response.getData());
    return ServerResponse.createBySuccessMessage("String_Node_Str");
  }
  return response;
}