nus-yam/ex-repair huggingface dataset:
Program: 133265
Project: 133265
Buggy source:
private static boolean forwardDataflow(Logger logger,CompFunction f,Block block,ListIterator<Instruction> insts,State cv,HierarchicalMap<String,Oparg> replaceInputs,HierarchicalMap<String,Oparg> replaceAll) throws InvalidWriteException {
  boolean anotherPassNeeded=false;
  while (insts.hasNext()) {
    Instruction inst=insts.next();
    logger.trace("String_Node_Str" + replaceInputs);
    logger.trace("String_Node_Str" + replaceAll);
    logger.trace("String_Node_Str" + cv.availableVals);
    logger.trace("String_Node_Str" + cv.closed);
    logger.trace("String_Node_Str");
    logger.trace("String_Node_Str" + inst);
    inst.renameInputs(replaceInputs);
    inst.renameVars(replaceAll);
    List<Instruction> alt=switchToImmediateVersion(logger,block,cv,inst);
    if (alt != null) {
      logger.trace("String_Node_Str" + inst + "String_Node_Str"+ alt.toString());
      ICUtil.replaceInsts(insts,alt);
      ICUtil.rewindIterator(insts,alt.size());
      continue;
    }
    updateReplacements(inst,cv,replaceInputs,replaceAll);
    List<Variable> in=inst.getBlockingInputs();
    if (in != null) {
      for (      Oparg o : inst.getOutputs()) {
        Variable ov=o.getVar();
        if (!Types.isScalarValue(ov.getType())) {
          cv.setDependencies(ov,in);
        }
      }
    }
  }
  return anotherPassNeeded;
}

Fixed version (ground truth):
private static boolean forwardDataflow(Logger logger,CompFunction f,Block block,ListIterator<Instruction> insts,State cv,HierarchicalMap<String,Oparg> replaceInputs,HierarchicalMap<String,Oparg> replaceAll) throws InvalidWriteException {
  boolean anotherPassNeeded=false;
  while (insts.hasNext()) {
    Instruction inst=insts.next();
    logger.trace("String_Node_Str" + replaceInputs);
    logger.trace("String_Node_Str" + replaceAll);
    logger.trace("String_Node_Str" + cv.availableVals);
    logger.trace("String_Node_Str" + cv.closed);
    logger.trace("String_Node_Str");
    logger.trace("String_Node_Str" + inst);
    inst.renameInputs(replaceInputs);
    inst.renameVars(replaceAll);
    List<Instruction> alt=switchToImmediateVersion(logger,block,cv,inst);
    if (alt != null) {
      logger.trace("String_Node_Str" + inst + "String_Node_Str"+ alt.toString());
      ICUtil.replaceInsts(insts,alt);
      ICUtil.rewindIterator(insts,alt.size());
      continue;
    }
    updateReplacements(logger,inst,cv,replaceInputs,replaceAll);
    List<Variable> in=inst.getBlockingInputs();
    if (in != null) {
      for (      Oparg o : inst.getOutputs()) {
        Variable ov=o.getVar();
        if (!Types.isScalarValue(ov.getType())) {
          cv.setDependencies(ov,in);
        }
      }
    }
  }
  return anotherPassNeeded;
}
Program: 133266
Project: 133266
Buggy source:
private static void mergeWaits(Logger logger,CompFunction fn,Block block){
  boolean converged;
  do {
    converged=true;
    Map<String,List<WaitStatement>> waitMap=buildWaitMap(block);
    String winner=mostSharedVar(waitMap);
    if (winner != null) {
      converged=false;
      List<WaitStatement> waits=waitMap.get(winner);
      assert(waits != null && waits.size() >= 2);
      Set<String> intersection=null;
      for (      WaitStatement wait : waits) {
        Set<String> nameSet=Variable.nameSet(wait.getWaitVars());
        if (intersection == null) {
          intersection=nameSet;
        }
 else {
          intersection.retainAll(nameSet);
        }
      }
      assert(intersection != null && !intersection.isEmpty());
      List<Variable> intersectionVs=ICUtil.getVarsByName(intersection,waits.get(0).getWaitVars());
      WaitStatement newWait=new WaitStatement(fn.getName() + "String_Node_Str",intersectionVs,new ArrayList<Variable>(0),new ArrayList<Variable>(0),false);
      for (      WaitStatement wait : waits) {
        wait.removeWaitVars(intersection);
        if (wait.getWaitVars().isEmpty()) {
          newWait.getBlock().insertInline(wait.getBlock());
        }
 else {
          newWait.getBlock().addContinuation(wait);
        }
      }
      block.addContinuation(newWait);
      block.removeContinuations(waits);
    }
  }
 while (!converged);
}

Fixed version (ground truth):
private static void mergeWaits(Logger logger,CompFunction fn,Block block){
  boolean converged;
  do {
    converged=true;
    Map<String,List<WaitStatement>> waitMap=buildWaitMap(block);
    String winner=mostSharedVar(waitMap);
    if (winner != null) {
      converged=false;
      List<WaitStatement> waits=waitMap.get(winner);
      assert(waits != null && waits.size() >= 2);
      boolean explicit=false;
      Set<String> intersection=null;
      for (      WaitStatement wait : waits) {
        Set<String> nameSet=Variable.nameSet(wait.getWaitVars());
        if (intersection == null) {
          intersection=nameSet;
        }
 else {
          intersection.retainAll(nameSet);
        }
        if (wait.isExplicit()) {
          explicit=true;
        }
      }
      assert(intersection != null && !intersection.isEmpty());
      List<Variable> intersectionVs=ICUtil.getVarsByName(intersection,waits.get(0).getWaitVars());
      WaitStatement newWait=new WaitStatement(fn.getName() + "String_Node_Str",intersectionVs,new ArrayList<Variable>(0),new ArrayList<Variable>(0),explicit);
      for (      WaitStatement wait : waits) {
        wait.removeWaitVars(intersection);
        if (wait.getWaitVars().isEmpty()) {
          newWait.getBlock().insertInline(wait.getBlock());
        }
 else {
          newWait.getBlock().addContinuation(wait);
        }
      }
      block.addContinuation(newWait);
      block.removeContinuations(waits);
    }
  }
 while (!converged);
}
Program: 133267
Project: 133267
Buggy source:
private Token arithOpTok(LocalOpcode op){
switch (op) {
case EQ_INT:
case EQ_FLOAT:
case EQ_BOOL:
    return new Token("String_Node_Str");
case NEQ_INT:
case NEQ_FLOAT:
case NEQ_BOOL:
  return new Token("String_Node_Str");
case PLUS_INT:
case PLUS_FLOAT:
return new Token("String_Node_Str");
case MINUS_INT:
case MINUS_FLOAT:
case NEGATE_INT:
case NEGATE_FLOAT:
return new Token("String_Node_Str");
case MULT_FLOAT:
case MULT_INT:
return new Token("String_Node_Str");
case POW_FLOAT:
return new Token("String_Node_Str");
case LT_INT:
case LT_FLOAT:
return new Token("String_Node_Str");
case LTE_INT:
case LTE_FLOAT:
return new Token("String_Node_Str");
case GT_INT:
case GT_FLOAT:
return new Token("String_Node_Str");
case GTE_INT:
case GTE_FLOAT:
return new Token("String_Node_Str");
case OR:
return new Token("String_Node_Str");
case AND:
return new Token("String_Node_Str");
case NOT:
return new Token("String_Node_Str");
case CEIL:
return new Token("String_Node_Str");
case FLOOR:
return new Token("String_Node_Str");
case ROUND:
return new Token("String_Node_Str");
case EXP:
return new Token("String_Node_Str");
case LOG:
return new Token("String_Node_Str");
case SQRT:
return new Token("String_Node_Str");
case ABS_FLOAT:
case ABS_INT:
return new Token("String_Node_Str");
case RANDOM:
return new Token("String_Node_Str");
case DIV_FLOAT:
return new Token("String_Node_Str");
default :
throw new ParserRuntimeException("String_Node_Str" + op.toString());
}
}

Fixed version (ground truth):
private Token arithOpTok(LocalOpcode op){
switch (op) {
case EQ_INT:
case EQ_FLOAT:
case EQ_BOOL:
    return new Token("String_Node_Str");
case NEQ_INT:
case NEQ_FLOAT:
case NEQ_BOOL:
  return new Token("String_Node_Str");
case PLUS_INT:
case PLUS_FLOAT:
return new Token("String_Node_Str");
case MINUS_INT:
case MINUS_FLOAT:
case NEGATE_INT:
case NEGATE_FLOAT:
return new Token("String_Node_Str");
case MULT_FLOAT:
case MULT_INT:
return new Token("String_Node_Str");
case POW_FLOAT:
return new Token("String_Node_Str");
case LT_INT:
case LT_FLOAT:
return new Token("String_Node_Str");
case LTE_INT:
case LTE_FLOAT:
return new Token("String_Node_Str");
case GT_INT:
case GT_FLOAT:
return new Token("String_Node_Str");
case GTE_INT:
case GTE_FLOAT:
return new Token("String_Node_Str");
case OR:
return new Token("String_Node_Str");
case AND:
return new Token("String_Node_Str");
case NOT:
return new Token("String_Node_Str");
case EXP:
return new Token("String_Node_Str");
case LOG:
return new Token("String_Node_Str");
case SQRT:
return new Token("String_Node_Str");
case ABS_FLOAT:
case ABS_INT:
return new Token("String_Node_Str");
case RANDOM:
return new Token("String_Node_Str");
case DIV_FLOAT:
return new Token("String_Node_Str");
default :
throw new ParserRuntimeException("String_Node_Str" + op.toString());
}
}
Program: 133269
Project: 133269
Buggy source:
@Override public void startRangeLoop(String loopName,Variable loopVar,Oparg start,Oparg end,Oparg increment,boolean isSync,List<Variable> usedVariables,List<Variable> containersToRegister,int desiredUnroll,int splitDegree){
  assert(start.getType() == OpargType.INTVAL || (start.getType() == OpargType.VAR && start.getVariable().getType().equals(Types.VALUE_INTEGER)));
  assert(end.getType() == OpargType.INTVAL || (end.getType() == OpargType.VAR && end.getVariable().getType().equals(Types.VALUE_INTEGER)));
  assert(increment.getType() == OpargType.INTVAL || (increment.getType() == OpargType.VAR && increment.getVariable().getType().equals(Types.VALUE_INTEGER)));
  assert(loopVar.getType().equals(Types.VALUE_INTEGER));
  Expression startE=opargToExpr(start);
  Expression endE=opargToExpr(end);
  Expression incrE=opargToExpr(increment);
  if (splitDegree > 0) {
    startRangeSplit(loopName,usedVariables,containersToRegister,splitDegree,startE,endE,incrE);
    startRangeLoopInner(loopName,loopVar,isSync,usedVariables,containersToRegister,TCLTMP_RANGE_LO_V,TCLTMP_RANGE_HI_V,TCLTMP_RANGE_INC_V);
  }
 else {
    startRangeLoopInner(loopName,loopVar,isSync,usedVariables,containersToRegister,startE,endE,incrE);
  }
}

Fixed version (ground truth):
@Override public void startRangeLoop(String loopName,Variable loopVar,Oparg start,Oparg end,Oparg increment,boolean isSync,List<Variable> usedVariables,List<Variable> containersToRegister,int desiredUnroll,int splitDegree){
  assert(start.getType() == OpargType.INTVAL || (start.getType() == OpargType.VAR && start.getVar().getType().equals(Types.VALUE_INTEGER)));
  assert(end.getType() == OpargType.INTVAL || (end.getType() == OpargType.VAR && end.getVar().getType().equals(Types.VALUE_INTEGER)));
  assert(increment.getType() == OpargType.INTVAL || (increment.getType() == OpargType.VAR && increment.getVar().getType().equals(Types.VALUE_INTEGER)));
  assert(loopVar.getType().equals(Types.VALUE_INTEGER));
  Expression startE=opargToExpr(start);
  Expression endE=opargToExpr(end);
  Expression incrE=opargToExpr(increment);
  if (splitDegree > 0) {
    startRangeSplit(loopName,usedVariables,containersToRegister,splitDegree,startE,endE,incrE);
    startRangeLoopInner(loopName,loopVar,isSync,usedVariables,containersToRegister,TCLTMP_RANGE_LO_V,TCLTMP_RANGE_HI_V,TCLTMP_RANGE_INC_V);
  }
 else {
    startRangeLoopInner(loopName,loopVar,isSync,usedVariables,containersToRegister,startE,endE,incrE);
  }
}
Program: 133270
Project: 133270
Buggy source:
private Expression opargToExpr(Oparg in){
switch (in.getType()) {
case INTVAL:
    return new LiteralInt(in.getIntLit());
case BOOLVAL:
  return new LiteralInt(in.getBoolLit() ? 1 : 0);
case STRINGVAL:
return new TclString(in.getStringLit(),true);
case VAR:
return new Value(prefixVar(in.getVariable().getName()));
case FLOATVAL:
return new LiteralFloat(in.getFloatLit());
default :
throw new ParserRuntimeException("String_Node_Str" + in.getType().toString());
}
}

Fixed version (ground truth):
private Expression opargToExpr(Oparg in){
switch (in.getType()) {
case INTVAL:
    return new LiteralInt(in.getIntLit());
case BOOLVAL:
  return new LiteralInt(in.getBoolLit() ? 1 : 0);
case STRINGVAL:
return new TclString(in.getStringLit(),true);
case VAR:
return new Value(prefixVar(in.getVar().getName()));
case FLOATVAL:
return new LiteralFloat(in.getFloatLit());
default :
throw new ParserRuntimeException("String_Node_Str" + in.getType().toString());
}
}
Program: 133271
Project: 133271
Buggy source:
private RangeLoop(String loopName,Block block,Variable loopVar,Oparg start,Oparg end,Oparg increment,boolean isSync,List<Variable> usedVariables,List<Variable> containersToRegister,int desiredUnroll,int splitDegree){
  super(block,usedVariables,containersToRegister);
  assert(start.getType() == OpargType.INTVAL || (start.getType() == OpargType.VAR && start.getVariable().getType().equals(Types.VALUE_INTEGER)));
  assert(end.getType() == OpargType.INTVAL || (end.getType() == OpargType.VAR && end.getVariable().getType().equals(Types.VALUE_INTEGER)));
  assert(increment.getType() == OpargType.INTVAL || (increment.getType() == OpargType.VAR && increment.getVariable().getType().equals(Types.VALUE_INTEGER)));
  assert(loopVar.getType().equals(Types.VALUE_INTEGER));
  this.loopName=loopName;
  this.loopVar=loopVar;
  this.start=start;
  this.end=end;
  this.increment=increment;
  this.isSync=isSync;
  this.desiredUnroll=desiredUnroll;
  this.splitDegree=splitDegree;
}

Fixed version (ground truth):
private RangeLoop(String loopName,Block block,Variable loopVar,Oparg start,Oparg end,Oparg increment,boolean isSync,List<Variable> usedVariables,List<Variable> containersToRegister,int desiredUnroll,int splitDegree){
  super(block,usedVariables,containersToRegister);
  assert(start.getType() == OpargType.INTVAL || (start.getType() == OpargType.VAR && start.getVar().getType().equals(Types.VALUE_INTEGER)));
  assert(end.getType() == OpargType.INTVAL || (end.getType() == OpargType.VAR && end.getVar().getType().equals(Types.VALUE_INTEGER)));
  assert(increment.getType() == OpargType.INTVAL || (increment.getType() == OpargType.VAR && increment.getVar().getType().equals(Types.VALUE_INTEGER)));
  assert(loopVar.getType().equals(Types.VALUE_INTEGER));
  this.loopName=loopName;
  this.loopVar=loopVar;
  this.start=start;
  this.end=end;
  this.increment=increment;
  this.isSync=isSync;
  this.desiredUnroll=desiredUnroll;
  this.splitDegree=splitDegree;
}
Program: 133272
Project: 133272
Buggy source:
@Override public boolean constantReplace(Map<String,Oparg> knownConstants){
  boolean anyChanged=false;
  Oparg oldVals[]=new Oparg[]{start,end,increment};
  Oparg newVals[]=new Oparg[3];
  for (int i=0; i < oldVals.length; i++) {
    Oparg old=oldVals[i];
    if (old.type == OpargType.VAR) {
      Oparg replacement=knownConstants.get(old.getVariable().getName());
      if (replacement != null) {
        assert(replacement.getType() == OpargType.INTVAL);
        anyChanged=true;
        newVals[i]=replacement;
      }
 else {
        newVals[i]=old;
      }
    }
 else {
      newVals[i]=old;
    }
  }
  start=newVals[0];
  end=newVals[1];
  increment=newVals[2];
  assert(start != null);
  assert(end != null);
  assert(increment != null);
  return anyChanged;
}

Fixed version (ground truth):
@Override public boolean constantReplace(Map<String,Oparg> knownConstants){
  boolean anyChanged=false;
  Oparg oldVals[]=new Oparg[]{start,end,increment};
  Oparg newVals[]=new Oparg[3];
  for (int i=0; i < oldVals.length; i++) {
    Oparg old=oldVals[i];
    if (old.type == OpargType.VAR) {
      Oparg replacement=knownConstants.get(old.getVar().getName());
      if (replacement != null) {
        assert(replacement.getType() == OpargType.INTVAL);
        anyChanged=true;
        newVals[i]=replacement;
      }
 else {
        newVals[i]=old;
      }
    }
 else {
      newVals[i]=old;
    }
  }
  start=newVals[0];
  end=newVals[1];
  increment=newVals[2];
  assert(start != null);
  assert(end != null);
  assert(increment != null);
  return anyChanged;
}
Program: 133273
Project: 133273
Buggy source:
private Oparg renameRangeArg(Oparg val,Map<String,Oparg> renames){
  if (val.type == OpargType.VAR) {
    String vName=val.getVariable().getName();
    if (renames.containsKey(vName)) {
      Oparg o=renames.get(vName);
      assert(o != null);
      return o;
    }
  }
  return val;
}

Fixed version (ground truth):
private Oparg renameRangeArg(Oparg val,Map<String,Oparg> renames){
  if (val.type == OpargType.VAR) {
    String vName=val.getVar().getName();
    if (renames.containsKey(vName)) {
      Oparg o=renames.get(vName);
      assert(o != null);
      return o;
    }
  }
  return val;
}
Program: 133274
Project: 133274
Buggy source:
@Override public void replaceInputs(Map<String,Oparg> renames){
  replaceVarsInBlocks(renames,true);
  ICUtil.replaceVarsInList2(renames,waitVars,true);
}

Fixed version (ground truth):
@Override public void replaceInputs(Map<String,Oparg> renames){
  replaceVarsInBlocks(renames,true);
  ICUtil.replaceVarsInList(renames,waitVars,true);
}
Program: 133276
Project: 133276
Buggy source:
private void replaceShared(Map<String,Oparg> renames,boolean inputsOnly){
  replaceVarsInBlocks(renames,inputsOnly);
  if (renames.containsKey(condVar.getName())) {
    condVar=renames.get(condVar.getName()).getVariable();
  }
}

Fixed version (ground truth):
private void replaceShared(Map<String,Oparg> renames,boolean inputsOnly){
  replaceVarsInBlocks(renames,inputsOnly);
  if (renames.containsKey(condVar.getName())) {
    condVar=renames.get(condVar.getName()).getVar();
  }
}
Program: 133277
Project: 133277
Buggy source:
@Override public void replaceVars(Map<String,Oparg> renames){
  replaceVarsInBlocks(renames,false);
  ICUtil.replaceVarsInList2(renames,waitVars,true);
  ICUtil.replaceVarsInList2(renames,usedVariables,true);
  ICUtil.replaceVarsInList2(renames,containersToRegister,true);
}

Fixed version (ground truth):
@Override public void replaceVars(Map<String,Oparg> renames){
  replaceVarsInBlocks(renames,false);
  ICUtil.replaceVarsInList(renames,waitVars,true);
  ICUtil.replaceVarsInList(renames,usedVariables,true);
  ICUtil.replaceVarsInList(renames,containersToRegister,true);
}
Program: 133278
Project: 133278
Buggy source:
protected void checkNotRemoved(Oparg o,Set<String> removeVars){
  if (o.type == OpargType.VAR) {
    checkNotRemoved(o.getVariable(),removeVars);
  }
}

Fixed version (ground truth):
protected void checkNotRemoved(Oparg o,Set<String> removeVars){
  if (o.type == OpargType.VAR) {
    checkNotRemoved(o.getVar(),removeVars);
  }
}
Program: 133279
Project: 133279
Buggy source:
/** 
 * Make all of variable names in composite functions completely unique within the function 
 * @param in
 */
public static void makeVarNamesUnique(Program in){
  for (  CompFunction f : in.getComposites()) {
    makeVarNamesUnique(f);
  }
}

Fixed version (ground truth):
/** 
 * Make all of variable names in composite functions completely unique within the function 
 * @param in
 */
public static void makeVarNamesUnique(Program in){
  for (  CompFunction f : in.getComposites()) {
    makeVarNamesUnique(f,in.getGlobalConsts().keySet());
  }
}
Program: 133283
Project: 133283
Buggy source:
@Override public IRateSource createRateSource(String sourceLogin){
  if (sourceLogin != null && !sourceLogin.trim().isEmpty()) {
    StringTokenizer st=new StringTokenizer(sourceLogin,"String_Node_Str");
    String exchangeType=st.nextToken();
    if ("String_Node_Str".equalsIgnoreCase(exchangeType)) {
      return new SmartcashTickerRateSource();
    }
 else     if ("String_Node_Str".equalsIgnoreCase(exchangeType)) {
      BigDecimal rate=BigDecimal.ZERO;
      if (st.hasMoreTokens()) {
        try {
          rate=new BigDecimal(st.nextToken());
        }
 catch (        Throwable e) {
        }
      }
      String preferedFiatCurrency=ICurrencies.USD;
      if (st.hasMoreTokens()) {
        preferedFiatCurrency=st.nextToken().toUpperCase();
      }
      return new FixPriceRateSource(rate,preferedFiatCurrency);
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public IRateSource createRateSource(String sourceLogin){
  if (sourceLogin != null && !sourceLogin.trim().isEmpty()) {
    StringTokenizer st=new StringTokenizer(sourceLogin,"String_Node_Str");
    String exchangeType=st.nextToken();
    if ("String_Node_Str".equalsIgnoreCase(exchangeType)) {
      BigDecimal rate=BigDecimal.ZERO;
      if (st.hasMoreTokens()) {
        try {
          rate=new BigDecimal(st.nextToken());
        }
 catch (        Throwable e) {
        }
      }
      String preferedFiatCurrency=ICurrencies.USD;
      if (st.hasMoreTokens()) {
        preferedFiatCurrency=st.nextToken().toUpperCase();
      }
      return new FixPriceRateSource(rate,preferedFiatCurrency);
    }
  }
  return null;
}
Program: 133284
Project: 133284
Buggy source:
@Override public IWallet createWallet(String walletLogin){
  if (walletLogin != null && !walletLogin.trim().isEmpty()) {
    StringTokenizer st=new StringTokenizer(walletLogin,"String_Node_Str");
    String walletType=st.nextToken();
    if ("String_Node_Str".equalsIgnoreCase(walletType)) {
      String protocol=st.nextToken();
      String username=st.nextToken();
      String password=st.nextToken();
      String hostname=st.nextToken();
      String port=st.nextToken();
      String accountName="String_Node_Str";
      if (st.hasMoreTokens()) {
        accountName=st.nextToken();
      }
      if (protocol != null && username != null && password != null && hostname != null && port != null && accountName != null) {
        String rpcURL=protocol + "String_Node_Str" + username+ "String_Node_Str"+ password+ "String_Node_Str"+ hostname+ "String_Node_Str"+ port;
        return new SmartcashdRPCWallet(rpcURL,accountName);
      }
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public IWallet createWallet(String walletLogin){
  if (walletLogin != null && !walletLogin.trim().isEmpty()) {
    StringTokenizer st=new StringTokenizer(walletLogin,"String_Node_Str");
    String walletType=st.nextToken();
    if ("String_Node_Str".equalsIgnoreCase(walletType)) {
      String protocol=st.nextToken();
      String username=st.nextToken();
      String password=st.nextToken();
      String hostname=st.nextToken();
      String port=st.nextToken();
      String accountName="String_Node_Str";
      if (st.hasMoreTokens()) {
        accountName=st.nextToken();
      }
      if (protocol != null && username != null && password != null && hostname != null && port != null && accountName != null) {
        String rpcURL=protocol + "String_Node_Str" + username+ "String_Node_Str"+ password+ "String_Node_Str"+ hostname+ "String_Node_Str"+ port;
        return new SmartcashRPCWallet(rpcURL,accountName);
      }
    }
  }
  return null;
}
Program: 133285
Project: 133285
Buggy source:
private void loadFiatCurrencies(){
  IBitcoinAverage api=RestProxyFactory.createProxy(IBitcoinAverage.class,"String_Node_Str");
  HashMap<String,String> currenciesAndURLs=api.getFiatCurrenciesAndURLs();
  if (fiatCurrenciesAndURLs != null) {
    fiatCurrenciesAndURLs=currenciesAndURLs;
  }
}

Fixed version (ground truth):
private void loadFiatCurrencies(){
  IBitcoinAverage api=RestProxyFactory.createProxy(IBitcoinAverage.class,"String_Node_Str");
  HashMap<String,String> currenciesAndURLs=api.getFiatCurrenciesAndURLs();
  if (currenciesAndURLs != null) {
    for (    Map.Entry<String,String> entry : currenciesAndURLs.entrySet()) {
      entry.setValue(entry.getValue().replace("String_Node_Str","String_Node_Str"));
    }
    fiatCurrenciesAndURLs=currenciesAndURLs;
  }
}
Program: 133286
Project: 133286
Buggy source:
@Override public void remove(){
  super.removeElementFromNamedIndexes();
  if (!globals.getEdgeWrapper().elementExists(id)) {
    return;
  }
  Set<String> indexedKeys=globals.getIndexedKeysListWrapper().getIndexedKeys(Edge.class);
  Map<String,Object> props=globals.getEdgeWrapper().readProperties(this,indexedKeys.toArray(ArrayUtils.EMPTY_STRING_ARRAY));
  for (  String key : props.keySet()) {
    globals.getEdgeKeyIndexWrapper().removePropertyFromIndex(this,key,props.get(key));
  }
  globals.getVertexWrapper().deleteEdgeEndpoints(this);
  globals.getEdgeWrapper().deleteEdge(this);
  globals.getCaches().remove(id,Edge.class);
  globals.checkedFlush();
}

Fixed version (ground truth):
@Override public void remove(){
  super.removeElementFromNamedIndexes();
  if (!globals.getEdgeWrapper().elementExists(id)) {
    return;
  }
  Map<String,Object> props=globals.getEdgeWrapper().readAllProperties(this);
  for (  String key : props.keySet()) {
    globals.getEdgeKeyIndexWrapper().removePropertyFromIndex(this,key,props.get(key));
  }
  globals.getVertexWrapper().deleteEdgeEndpoints(this);
  globals.getEdgeWrapper().deleteEdge(this);
  globals.getCaches().remove(id,Edge.class);
  globals.checkedFlush();
}
Program: 133287
Project: 133287
Buggy source:
@Override public Edge getEdge(Object id){
  if (id == null) {
    throw ExceptionFactory.edgeIdCanNotBeNull();
  }
  String myID=id.toString();
  Edge edge=globals.getCaches().retrieve(myID,Edge.class);
  if (edge != null) {
    return edge;
  }
  edge=new AccumuloEdge(globals,myID);
  if (!globals.getConfig().getSkipExistenceChecks()) {
    String[] preload=globals.getConfig().getPreloadedProperties();
    if (preload == null) {
      preload=new String[]{};
    }
    Map<String,Object> props=globals.getEdgeWrapper().readProperties(edge,preload);
    if (props == null) {
      return null;
    }
    for (    String key : props.keySet()) {
      ((AccumuloElement)edge).setPropertyInMemory(key,props.get(key));
    }
  }
  globals.getCaches().cache(edge,Edge.class);
  return edge;
}

Fixed version (ground truth):
@Override public Edge getEdge(Object id){
  if (id == null) {
    throw ExceptionFactory.edgeIdCanNotBeNull();
  }
  String idStr=id.toString();
  Edge edge=globals.getCaches().retrieve(idStr,Edge.class);
  if (edge != null) {
    return edge;
  }
  edge=new AccumuloEdge(globals,idStr);
  if (!globals.getConfig().getSkipExistenceChecks()) {
    String[] preload=globals.getConfig().getPreloadedProperties();
    if (preload == null) {
      preload=new String[]{};
    }
    Map<String,Object> props=globals.getEdgeWrapper().readProperties(edge,preload);
    if (props == null) {
      return null;
    }
    for (    String key : props.keySet()) {
      ((AccumuloElement)edge).setPropertyInMemory(key,props.get(key));
    }
  }
  globals.getCaches().cache(edge,Edge.class);
  return edge;
}
Program: 133288
Project: 133288
Buggy source:
/** 
 * @deprecated Move this somewhere appropriate
 * @return
 */
@Deprecated public BatchWriter getWriter(String tablename){
  try {
    return globals.getMtbw().getBatchWriter(tablename);
  }
 catch (  Exception e) {
    throw new AccumuloGraphException(e);
  }
}

Fixed version (ground truth):
/** 
 * @deprecated Move this somewhere appropriate
 * @return
 */
@Deprecated private BatchWriter getWriter(String tablename){
  try {
    return globals.getMtbw().getBatchWriter(tablename);
  }
 catch (  Exception e) {
    throw new AccumuloGraphException(e);
  }
}
Program: 133289
Project: 133289
Buggy source:
/** 
 * @deprecated Move this somewhere appropriate
 * @param tablename
 * @return
 */
@Deprecated protected Scanner getScanner(String tablename){
  try {
    return globals.getConfig().getConnector().createScanner(tablename,globals.getConfig().getAuthorizations());
  }
 catch (  Exception e) {
    throw new AccumuloGraphException(e);
  }
}

Fixed version (ground truth):
/** 
 * @deprecated Move this somewhere appropriate
 * @param tablename
 * @return
 */
@Deprecated private Scanner getScanner(String tablename){
  try {
    return globals.getConfig().getConnector().createScanner(tablename,globals.getConfig().getAuthorizations());
  }
 catch (  Exception e) {
    throw new AccumuloGraphException(e);
  }
}
Program: 133290
Project: 133290
Buggy source:
@Override public Vertex addVertex(Object id){
  if (id == null) {
    id=AccumuloGraphUtils.generateId();
  }
  String myID=id.toString();
  Vertex vert=null;
  if (!globals.getConfig().getSkipExistenceChecks()) {
    vert=getVertex(myID);
    if (vert != null) {
      throw ExceptionFactory.vertexWithIdAlreadyExists(myID);
    }
  }
  vert=new AccumuloVertex(globals,myID);
  globals.getVertexWrapper().writeVertex(vert);
  globals.checkedFlush();
  globals.getCaches().cache(vert,Vertex.class);
  return vert;
}

Fixed version (ground truth):
@Override public Vertex addVertex(Object id){
  if (id == null) {
    id=AccumuloGraphUtils.generateId();
  }
  String idStr=id.toString();
  Vertex vert=null;
  if (!globals.getConfig().getSkipExistenceChecks()) {
    vert=getVertex(idStr);
    if (vert != null) {
      throw ExceptionFactory.vertexWithIdAlreadyExists(idStr);
    }
  }
  vert=new AccumuloVertex(globals,idStr);
  globals.getVertexWrapper().writeVertex(vert);
  globals.checkedFlush();
  globals.getCaches().cache(vert,Vertex.class);
  return vert;
}
Program: 133291
Project: 133291
Buggy source:
@Override public void remove(){
  globals.getCaches().remove(getId(),Vertex.class);
  super.removeElementFromNamedIndexes();
  if (!globals.getVertexWrapper().elementExists(id)) {
    throw ExceptionFactory.vertexWithIdDoesNotExist(getId());
  }
  Set<String> indexedKeys=globals.getIndexedKeysListWrapper().getIndexedKeys(Vertex.class);
  Map<String,Object> props=globals.getVertexWrapper().readProperties(this,indexedKeys.toArray(ArrayUtils.EMPTY_STRING_ARRAY));
  for (  String key : props.keySet()) {
    globals.getVertexKeyIndexWrapper().removePropertyFromIndex(this,key,props.get(key));
  }
  for (  Edge edge : getEdges(Direction.BOTH)) {
    edge.remove();
  }
  globals.checkedFlush();
  globals.getVertexWrapper().deleteVertex(this);
  globals.checkedFlush();
}

Fixed version (ground truth):
@Override public void remove(){
  globals.getCaches().remove(getId(),Vertex.class);
  super.removeElementFromNamedIndexes();
  if (!globals.getVertexWrapper().elementExists(id)) {
    throw ExceptionFactory.vertexWithIdDoesNotExist(getId());
  }
  Map<String,Object> props=globals.getVertexWrapper().readAllProperties(this);
  for (  String key : props.keySet()) {
    globals.getVertexKeyIndexWrapper().removePropertyFromIndex(this,key,props.get(key));
  }
  for (  Edge edge : getEdges(Direction.BOTH)) {
    edge.remove();
  }
  globals.checkedFlush();
  globals.getVertexWrapper().deleteVertex(this);
  globals.checkedFlush();
}
Program: 133292
Project: 133292
Buggy source:
/** 
 * Test whether the given Accumulo key represents a metadata key (e.g. existence, edge endpoint, etc), rather than a property.
 * @param key
 * @return
 */
private static boolean isMetaKey(Key key){
  String cf=key.getColumnFamily().toString();
  String cq=key.getColumnQualifier().toString();
  return (Constants.LABEL.equals(cf) && Constants.EXISTS.equals(cq)) || Constants.IN_EDGE.equals(cf) || Constants.OUT_EDGE.equals(cf);
}

Fixed version (ground truth):
/** 
 * Test whether the given Accumulo key represents a metadata key (e.g. existence, edge endpoint, etc), rather than a property.
 * @param key
 * @return
 */
private static boolean isMetaKey(Key key){
  String cf=key.getColumnFamily().toString();
  return Constants.LABEL.equals(cf) || Constants.IN_EDGE.equals(cf) || Constants.OUT_EDGE.equals(cf);
}
Program: 133293
Project: 133293
Buggy source:
/** 
 * Read the given properties for the given element id. This may return an empty map for elements with no properties. If the element does not exist, return null.
 * @param id
 * @param propertyKeys
 * @return
 */
public Map<String,Object> readProperties(Element element,String... propertyKeys){
  Scanner s=getScanner();
  s.setRange(new Range(element.getId().toString()));
  s.fetchColumnFamily(new Text(Constants.LABEL));
  for (  String key : propertyKeys) {
    s.fetchColumnFamily(new Text(key));
  }
  Map<String,Object> props=new PropertyParser().parse(s);
  s.close();
  return props;
}

Fixed version (ground truth):
/** 
 * Read the given properties for the given element. If propertyKeys is null, read all properties. If the element has no properties, return an empty Map. If the element does not exist, return null.
 * @param id
 * @param propertyKeys
 * @return
 */
public Map<String,Object> readProperties(Element element,String[] propertyKeys){
  Scanner s=getScanner();
  s.setRange(Range.exact((String)element.getId()));
  if (propertyKeys != null) {
    s.fetchColumnFamily(new Text(Constants.LABEL));
    for (    String key : propertyKeys) {
      s.fetchColumnFamily(new Text(key));
    }
  }
  Map<String,Object> props=new PropertyParser().parse(s);
  s.close();
  return props;
}
Program: 133294
Project: 133294
Buggy source:
public Iterable<Edge> getEdges(Vertex vertex,Direction direction,String... labels){
  Scanner scan=getScanner();
  scan.setRange(new Range(vertex.getId().toString()));
  if (direction.equals(Direction.IN)) {
    scan.fetchColumnFamily(new Text(Constants.IN_EDGE));
  }
 else   if (direction.equals(Direction.OUT)) {
    scan.fetchColumnFamily(new Text(Constants.OUT_EDGE));
  }
 else {
    scan.fetchColumnFamily(new Text(Constants.IN_EDGE));
    scan.fetchColumnFamily(new Text(Constants.OUT_EDGE));
  }
  if (labels.length > 0) {
    applyEdgeLabelValueFilter(scan,labels);
  }
  return new ScannerIterable<Edge>(scan){
    @Override public Edge next(    PeekingIterator<Entry<Key,Value>> iterator){
      Entry<Key,Value> kv=iterator.next();
      String[] parts=kv.getKey().getColumnQualifier().toString().split(Constants.ID_DELIM);
      String label=(new String(kv.getValue().get())).split("String_Node_Str")[1];
      AccumuloEdge edge;
      if (kv.getKey().getColumnFamily().toString().equalsIgnoreCase(Constants.IN_EDGE)) {
        edge=new AccumuloEdge(globals,parts[1],new AccumuloVertex(globals,kv.getKey().getRow().toString()),new AccumuloVertex(globals,parts[0]),label);
      }
 else {
        edge=new AccumuloEdge(globals,parts[1],new AccumuloVertex(globals,parts[0]),new AccumuloVertex(globals,kv.getKey().getRow().toString()),label);
      }
      globals.getCaches().cache(edge,Edge.class);
      return edge;
    }
  }
;
}

Fixed version (ground truth):
public Iterable<Edge> getEdges(Vertex vertex,Direction direction,String... labels){
  Scanner scan=getScanner();
  scan.setRange(new Range(vertex.getId().toString()));
  if (direction.equals(Direction.IN)) {
    scan.fetchColumnFamily(new Text(Constants.IN_EDGE));
  }
 else   if (direction.equals(Direction.OUT)) {
    scan.fetchColumnFamily(new Text(Constants.OUT_EDGE));
  }
 else {
    scan.fetchColumnFamily(new Text(Constants.IN_EDGE));
    scan.fetchColumnFamily(new Text(Constants.OUT_EDGE));
  }
  if (labels.length > 0) {
    applyEdgeLabelValueFilter(scan,labels);
  }
  return new ScannerIterable<Edge>(scan){
    @Override public Edge next(    PeekingIterator<Entry<Key,Value>> iterator){
      Entry<Key,Value> kv=iterator.next();
      String[] parts=kv.getKey().getColumnQualifier().toString().split(Constants.ID_DELIM);
      String label=(new String(kv.getValue().get())).split(Constants.ID_DELIM)[1];
      AccumuloEdge edge;
      if (kv.getKey().getColumnFamily().toString().equalsIgnoreCase(Constants.IN_EDGE)) {
        edge=new AccumuloEdge(globals,parts[1],new AccumuloVertex(globals,kv.getKey().getRow().toString()),new AccumuloVertex(globals,parts[0]),label);
      }
 else {
        edge=new AccumuloEdge(globals,parts[1],new AccumuloVertex(globals,parts[0]),new AccumuloVertex(globals,kv.getKey().getRow().toString()),label);
      }
      globals.getCaches().cache(edge,Edge.class);
      return edge;
    }
  }
;
}
Program: 133295
Project: 133295
Buggy source:
@Override public void remove(){
  super.removeElementFromNamedIndexes();
  Map<String,Object> props=globals.getEdgeWrapper().readProperties(this);
  for (  String key : props.keySet()) {
    globals.getEdgeKeyIndexWrapper().removePropertyFromIndex(this,key,props.get(key));
  }
  globals.getVertexWrapper().deleteEdgeEndpoints(this);
  globals.getEdgeWrapper().deleteEdge(this);
  globals.getCaches().remove(id,Edge.class);
  globals.checkedFlush();
}

Fixed version (ground truth):
@Override public void remove(){
  super.removeElementFromNamedIndexes();
  if (!globals.getEdgeWrapper().elementExists(id)) {
    return;
  }
  Set<String> indexedKeys=globals.getIndexedKeysListWrapper().getIndexedKeys(Edge.class);
  Map<String,Object> props=globals.getEdgeWrapper().readProperties(this,indexedKeys.toArray(ArrayUtils.EMPTY_STRING_ARRAY));
  for (  String key : props.keySet()) {
    globals.getEdgeKeyIndexWrapper().removePropertyFromIndex(this,key,props.get(key));
  }
  globals.getVertexWrapper().deleteEdgeEndpoints(this);
  globals.getEdgeWrapper().deleteEdge(this);
  globals.getCaches().remove(id,Edge.class);
  globals.checkedFlush();
}
Program: 133296
Project: 133296
Buggy source:
@Override public void removeVertex(Vertex vertex){
  globals.getCaches().remove(vertex.getId(),Vertex.class);
  if (!globals.getConfig().getIndexableGraphDisabled()) {
    removeElementFromNamedIndexes(vertex);
  }
  Scanner scan=getElementScanner(Vertex.class);
  scan.setRange(new Range(vertex.getId().toString()));
  BatchDeleter edgedeleter=null;
  BatchDeleter vertexdeleter=null;
  BatchWriter indexdeleter=getVertexIndexWriter();
  try {
    edgedeleter=globals.getConfig().getConnector().createBatchDeleter(globals.getConfig().getEdgeTableName(),globals.getConfig().getAuthorizations(),globals.getConfig().getQueryThreads(),globals.getConfig().getBatchWriterConfig());
    vertexdeleter=globals.getConfig().getConnector().createBatchDeleter(globals.getConfig().getVertexTableName(),globals.getConfig().getAuthorizations(),globals.getConfig().getQueryThreads(),globals.getConfig().getBatchWriterConfig());
  }
 catch (  Exception e) {
    throw new AccumuloGraphException(e);
  }
  Iterator<Entry<Key,Value>> iter=scan.iterator();
  List<Range> ranges=new ArrayList<Range>();
  if (!iter.hasNext()) {
    throw ExceptionFactory.vertexWithIdDoesNotExist(vertex.getId());
  }
  try {
    while (iter.hasNext()) {
      Entry<Key,Value> e=iter.next();
      Key k=e.getKey();
      if (k.getColumnFamily().toString().equals(Constants.OUT_EDGE) || k.getColumnFamily().toString().equals(Constants.IN_EDGE)) {
        ranges.add(new Range(k.getColumnQualifier().toString().split(Constants.ID_DELIM)[1]));
        Mutation vm=new Mutation(k.getColumnQualifier().toString().split(Constants.ID_DELIM)[0]);
        vm.putDelete(invert(k.getColumnFamily()),new Text(vertex.getId().toString() + Constants.ID_DELIM + k.getColumnQualifier().toString().split(Constants.ID_DELIM)[1]));
        vertexBW.addMutation(vm);
      }
 else {
        Mutation m=new Mutation(e.getValue().get());
        m.putDelete(k.getColumnFamily(),k.getRow());
        indexdeleter.addMutation(m);
      }
    }
    globals.checkedFlush();
    scan.close();
    if (!ranges.isEmpty()) {
      edgedeleter.setRanges(ranges);
      edgedeleter.delete();
      ranges.clear();
    }
    ranges.add(new Range(vertex.getId().toString()));
    vertexdeleter.setRanges(ranges);
    vertexdeleter.delete();
  }
 catch (  Exception e) {
    throw new AccumuloGraphException(e);
  }
 finally {
    if (edgedeleter != null)     edgedeleter.close();
    if (vertexdeleter != null)     vertexdeleter.close();
  }
}

Fixed version (ground truth):
@Override public void removeVertex(Vertex vertex){
  vertex.remove();
}
Program: 133297
Project: 133297
Buggy source:
/** 
 * @deprecated Move to appropriate location.
 * @param element
 */
private void removeElementFromNamedIndexes(Element element){
  for (  Index<? extends Element> index : getIndices()) {
    ((AccumuloIndex<? extends Element>)index).getWrapper().removeElementFromIndex(element);
  }
}

Fixed version (ground truth):
/** 
 * @deprecated Move to appropriate location.
 * @param element
 */
@Deprecated private void removeElementFromNamedIndexes(Element element){
  for (  Index<? extends Element> index : getIndices()) {
    ((AccumuloIndex<? extends Element>)index).getWrapper().removeElementFromIndex(element);
  }
}
Program: 133298
Project: 133298
Buggy source:
/** 
 * @deprecated This will go away along with {@link #vertexBW}.
 * @throws Exception
 */
private void setupWriters() throws Exception {
  vertexBW=globals.getMtbw().getBatchWriter(globals.getConfig().getVertexTableName());
}

Fixed version (ground truth):
/** 
 * @deprecated This will go away along with {@link #vertexBW}.
 * @throws Exception
 */
@Deprecated private void setupWriters() throws Exception {
  vertexBW=globals.getMtbw().getBatchWriter(globals.getConfig().getVertexTableName());
}
Program: 133299
Project: 133299
Buggy source:
@Override public void remove(){
  globals.getCaches().remove(getId(),Vertex.class);
  super.removeElementFromNamedIndexes();
  for (  Edge edge : getEdges(Direction.BOTH)) {
    edge.remove();
  }
  globals.checkedFlush();
  globals.getVertexWrapper().deleteVertex(this);
  globals.checkedFlush();
}

Fixed version (ground truth):
@Override public void remove(){
  globals.getCaches().remove(getId(),Vertex.class);
  super.removeElementFromNamedIndexes();
  if (!globals.getVertexWrapper().elementExists(id)) {
    throw ExceptionFactory.vertexWithIdDoesNotExist(getId());
  }
  Set<String> indexedKeys=globals.getIndexedKeysListWrapper().getIndexedKeys(Vertex.class);
  Map<String,Object> props=globals.getVertexWrapper().readProperties(this,indexedKeys.toArray(ArrayUtils.EMPTY_STRING_ARRAY));
  for (  String key : props.keySet()) {
    globals.getVertexKeyIndexWrapper().removePropertyFromIndex(this,key,props.get(key));
  }
  for (  Edge edge : getEdges(Direction.BOTH)) {
    edge.remove();
  }
  globals.checkedFlush();
  globals.getVertexWrapper().deleteVertex(this);
  globals.checkedFlush();
}
Program: 133300
Project: 133300
Buggy source:
@Override public Map<String,Object> parse(Iterable<Entry<Key,Value>> entries){
  Map<String,Object> props=null;
  for (  Entry<Key,Value> entry : entries) {
    if (props == null) {
      props=new HashMap<String,Object>();
    }
    Key key=entry.getKey();
    if (!isExistenceKey(key)) {
      String attr=key.getColumnFamily().toString();
      Object value=AccumuloByteSerializer.deserialize(entry.getValue().get());
      props.put(attr,value);
    }
  }
  return props;
}

Fixed version (ground truth):
@Override public Map<String,Object> parse(Iterable<Entry<Key,Value>> entries){
  Map<String,Object> props=null;
  for (  Entry<Key,Value> entry : entries) {
    if (props == null) {
      props=new HashMap<String,Object>();
    }
    Key key=entry.getKey();
    if (!isMetaKey(key)) {
      String attr=key.getColumnFamily().toString();
      Object value=AccumuloByteSerializer.deserialize(entry.getValue().get());
      props.put(attr,value);
    }
  }
  return props;
}
Program: 133301
Project: 133301
Buggy source:
@Override public void remove(){
  super.removeElementFromNamedIndexes();
  if (!globals.getEdgeWrapper().elementExists(id)) {
    return;
  }
  Map<String,Object> props=globals.getEdgeWrapper().readAllProperties(this);
  for (  String key : props.keySet()) {
    globals.getEdgeKeyIndexWrapper().removePropertyFromIndex(this,key,props.get(key));
  }
  globals.getVertexWrapper().deleteEdgeEndpoints(this);
  globals.getEdgeWrapper().deleteEdge(this);
  globals.getCaches().remove(id,Edge.class);
  globals.checkedFlush();
}

Fixed version (ground truth):
@Override public void remove(){
  super.removeElementFromNamedIndexes();
  if (!globals.getEdgeWrapper().elementExists(id)) {
    return;
  }
  Map<String,Object> props=globals.getEdgeWrapper().readAllProperties(this);
  for (  Entry<String,Object> ents : props.entrySet()) {
    globals.getEdgeKeyIndexWrapper().removePropertyFromIndex(this,ents.getKey(),ents.getValue());
  }
  globals.getVertexWrapper().deleteEdgeEndpoints(this);
  globals.getEdgeWrapper().deleteEdge(this);
  globals.getCaches().remove(id,Edge.class);
  globals.checkedFlush();
}
Program: 133302
Project: 133302
Buggy source:
@Override public Vertex getVertex(Object id){
  if (id == null) {
    throw ExceptionFactory.vertexIdCanNotBeNull();
  }
  String myID=id.toString();
  Vertex vertex=globals.getCaches().retrieve(myID,Vertex.class);
  if (vertex != null) {
    return vertex;
  }
  vertex=new AccumuloVertex(globals,myID);
  if (!globals.getConfig().getSkipExistenceChecks()) {
    String[] preload=globals.getConfig().getPreloadedProperties();
    if (preload == null) {
      preload=new String[]{};
    }
    Map<String,Object> props=globals.getVertexWrapper().readProperties(vertex,preload);
    if (props == null) {
      return null;
    }
    for (    String key : props.keySet()) {
      ((AccumuloElement)vertex).setPropertyInMemory(key,props.get(key));
    }
  }
  globals.getCaches().cache(vertex,Vertex.class);
  return vertex;
}

Fixed version (ground truth):
@Override public Vertex getVertex(Object id){
  if (id == null) {
    throw ExceptionFactory.vertexIdCanNotBeNull();
  }
  String myID=id.toString();
  Vertex vertex=globals.getCaches().retrieve(myID,Vertex.class);
  if (vertex != null) {
    return vertex;
  }
  vertex=new AccumuloVertex(globals,myID);
  if (!globals.getConfig().getSkipExistenceChecks()) {
    String[] preload=globals.getConfig().getPreloadedProperties();
    if (preload == null) {
      preload=new String[]{};
    }
    Map<String,Object> props=globals.getVertexWrapper().readProperties(vertex,preload);
    if (props == null) {
      return null;
    }
    for (    Entry<String,Object> ents : props.entrySet()) {
      ((AccumuloElement)vertex).setPropertyInMemory(ents.getKey(),ents.getValue());
    }
  }
  globals.getCaches().cache(vertex,Vertex.class);
  return vertex;
}
Program: 133303
Project: 133303
Buggy source:
@Override public Edge getEdge(Object id){
  if (id == null) {
    throw ExceptionFactory.edgeIdCanNotBeNull();
  }
  String idStr=id.toString();
  Edge edge=globals.getCaches().retrieve(idStr,Edge.class);
  if (edge != null) {
    return edge;
  }
  edge=new AccumuloEdge(globals,idStr);
  if (!globals.getConfig().getSkipExistenceChecks()) {
    String[] preload=globals.getConfig().getPreloadedProperties();
    if (preload == null) {
      preload=new String[]{};
    }
    Map<String,Object> props=globals.getEdgeWrapper().readProperties(edge,preload);
    if (props == null) {
      return null;
    }
    for (    String key : props.keySet()) {
      ((AccumuloElement)edge).setPropertyInMemory(key,props.get(key));
    }
  }
  globals.getCaches().cache(edge,Edge.class);
  return edge;
}

Fixed version (ground truth):
@Override public Edge getEdge(Object id){
  if (id == null) {
    throw ExceptionFactory.edgeIdCanNotBeNull();
  }
  String idStr=id.toString();
  Edge edge=globals.getCaches().retrieve(idStr,Edge.class);
  if (edge != null) {
    return edge;
  }
  edge=new AccumuloEdge(globals,idStr);
  if (!globals.getConfig().getSkipExistenceChecks()) {
    String[] preload=globals.getConfig().getPreloadedProperties();
    if (preload == null) {
      preload=new String[]{};
    }
    Map<String,Object> props=globals.getEdgeWrapper().readProperties(edge,preload);
    if (props == null) {
      return null;
    }
    for (    Entry<String,Object> ents : props.entrySet()) {
      ((AccumuloElement)edge).setPropertyInMemory(ents.getKey(),ents.getValue());
    }
  }
  globals.getCaches().cache(edge,Edge.class);
  return edge;
}
Program: 133304
Project: 133304
Buggy source:
@Override public void remove(){
  globals.getCaches().remove(getId(),Vertex.class);
  super.removeElementFromNamedIndexes();
  if (!globals.getVertexWrapper().elementExists(id)) {
    throw ExceptionFactory.vertexWithIdDoesNotExist(getId());
  }
  Map<String,Object> props=globals.getVertexWrapper().readAllProperties(this);
  for (  String key : props.keySet()) {
    globals.getVertexKeyIndexWrapper().removePropertyFromIndex(this,key,props.get(key));
  }
  for (  Edge edge : getEdges(Direction.BOTH)) {
    edge.remove();
  }
  globals.checkedFlush();
  globals.getVertexWrapper().deleteVertex(this);
  globals.checkedFlush();
}

Fixed version (ground truth):
@Override public void remove(){
  globals.getCaches().remove(getId(),Vertex.class);
  super.removeElementFromNamedIndexes();
  if (!globals.getVertexWrapper().elementExists(id)) {
    throw ExceptionFactory.vertexWithIdDoesNotExist(getId());
  }
  Map<String,Object> props=globals.getVertexWrapper().readAllProperties(this);
  for (  Entry<String,Object> ent : props.entrySet()) {
    globals.getVertexKeyIndexWrapper().removePropertyFromIndex(this,ent.getKey(),ent.getValue());
  }
  CloseableIterable<Edge> iter=(CloseableIterable<Edge>)getEdges(Direction.BOTH);
  for (  Edge edge : iter) {
    edge.remove();
  }
  iter.close();
  globals.checkedFlush();
  globals.getVertexWrapper().deleteVertex(this);
  globals.checkedFlush();
}