nus-yam/ex-repair huggingface dataset:
Program: 171499
Project: 171499
Buggy source:
public static void main(String[] args){
  String filename="String_Node_Str";
  MazeData data=new MazeData(filename);
  int blockSide=8;
  int sceneWidth=data.N() * blockSide;
  int sceneHeight=data.M() * blockSide;
  EventQueue.invokeLater(() -> {
    AlgoFrame frame=new AlgoFrame("String_Node_Str",sceneWidth,sceneHeight);
    AlgoVisualizer vis=new AlgoVisualizer(frame,data);
    new Thread(() -> {
      vis.run();
    }
).start();
  }
);
}

Fixed version (ground truth):
public static void main(String[] args){
  String filename="String_Node_Str";
  MazeData data=new MazeData(filename);
  int blockSide=8;
  int sceneHeight=data.N() * blockSide;
  int sceneWidth=data.M() * blockSide;
  EventQueue.invokeLater(() -> {
    AlgoFrame frame=new AlgoFrame("String_Node_Str",sceneWidth,sceneHeight);
    AlgoVisualizer vis=new AlgoVisualizer(frame,data);
    new Thread(() -> {
      vis.run();
    }
).start();
  }
);
}
Program: 171500
Project: 171500
Buggy source:
public static void main(String[] args){
  String filename="String_Node_Str";
  MazeData data=new MazeData(filename);
  int blockSide=8;
  int sceneWidth=data.N() * blockSide;
  int sceneHeight=data.M() * blockSide;
  EventQueue.invokeLater(() -> {
    AlgoFrame frame=new AlgoFrame("String_Node_Str",sceneWidth,sceneHeight);
    AlgoVisualizer vis=new AlgoVisualizer(frame,data);
    new Thread(() -> {
      vis.run();
    }
).start();
  }
);
}

Fixed version (ground truth):
public static void main(String[] args){
  String filename="String_Node_Str";
  MazeData data=new MazeData(filename);
  int blockSide=8;
  int sceneHeight=data.N() * blockSide;
  int sceneWidth=data.M() * blockSide;
  EventQueue.invokeLater(() -> {
    AlgoFrame frame=new AlgoFrame("String_Node_Str",sceneWidth,sceneHeight);
    AlgoVisualizer vis=new AlgoVisualizer(frame,data);
    new Thread(() -> {
      vis.run();
    }
).start();
  }
);
}
Program: 171501
Project: 171501
Buggy source:
public static void main(String[] args){
  String filename="String_Node_Str";
  MazeData data=new MazeData(filename);
  int blockSide=8;
  int sceneWidth=data.N() * blockSide;
  int sceneHeight=data.M() * blockSide;
  EventQueue.invokeLater(() -> {
    AlgoFrame frame=new AlgoFrame("String_Node_Str",sceneWidth,sceneHeight);
    AlgoVisualizer vis=new AlgoVisualizer(frame,data);
    new Thread(() -> {
      vis.run();
    }
).start();
  }
);
}

Fixed version (ground truth):
public static void main(String[] args){
  String filename="String_Node_Str";
  MazeData data=new MazeData(filename);
  int blockSide=8;
  int sceneHeight=data.N() * blockSide;
  int sceneWidth=data.M() * blockSide;
  EventQueue.invokeLater(() -> {
    AlgoFrame frame=new AlgoFrame("String_Node_Str",sceneWidth,sceneHeight);
    AlgoVisualizer vis=new AlgoVisualizer(frame,data);
    new Thread(() -> {
      vis.run();
    }
).start();
  }
);
}
Program: 171502
Project: 171502
Buggy source:
public static void main(String[] args){
  String filename="String_Node_Str";
  MazeData data=new MazeData(filename);
  int blockSide=8;
  int sceneWidth=data.N() * blockSide;
  int sceneHeight=data.M() * blockSide;
  EventQueue.invokeLater(() -> {
    AlgoFrame frame=new AlgoFrame("String_Node_Str",sceneWidth,sceneHeight);
    AlgoVisualizer vis=new AlgoVisualizer(frame,data);
    new Thread(() -> {
      vis.run();
    }
).start();
  }
);
}

Fixed version (ground truth):
public static void main(String[] args){
  String filename="String_Node_Str";
  MazeData data=new MazeData(filename);
  int blockSide=8;
  int sceneHeight=data.N() * blockSide;
  int sceneWidth=data.M() * blockSide;
  EventQueue.invokeLater(() -> {
    AlgoFrame frame=new AlgoFrame("String_Node_Str",sceneWidth,sceneHeight);
    AlgoVisualizer vis=new AlgoVisualizer(frame,data);
    new Thread(() -> {
      vis.run();
    }
).start();
  }
);
}
Program: 171503
Project: 171503
Buggy source:
public static void main(String[] args){
  String filename="String_Node_Str";
  MazeData data=new MazeData(filename);
  int blockSide=8;
  int sceneWidth=data.N() * blockSide;
  int sceneHeight=data.M() * blockSide;
  EventQueue.invokeLater(() -> {
    AlgoFrame frame=new AlgoFrame("String_Node_Str",sceneWidth,sceneHeight);
    AlgoVisualizer vis=new AlgoVisualizer(frame,data);
    new Thread(() -> {
      vis.run();
    }
).start();
  }
);
}

Fixed version (ground truth):
public static void main(String[] args){
  String filename="String_Node_Str";
  MazeData data=new MazeData(filename);
  int blockSide=8;
  int sceneHeight=data.N() * blockSide;
  int sceneWidth=data.M() * blockSide;
  EventQueue.invokeLater(() -> {
    AlgoFrame frame=new AlgoFrame("String_Node_Str",sceneWidth,sceneHeight);
    AlgoVisualizer vis=new AlgoVisualizer(frame,data);
    new Thread(() -> {
      vis.run();
    }
).start();
  }
);
}
Program: 171504
Project: 171504
Buggy source:
public void run(){
  this.setData(-1,-1,-1);
  AlgoVisHelper.pause(DELAY);
  mergeSort(0,data.N() - 1);
  this.setData(0,data.N(),data.N());
  AlgoVisHelper.pause(DELAY);
}

Fixed version (ground truth):
public void run(){
  this.setData(-1,-1,-1);
  AlgoVisHelper.pause(DELAY);
  mergeSort(0,data.N() - 1);
  this.setData(0,data.N() - 1,data.N());
  AlgoVisHelper.pause(DELAY);
}
Program: 171505
Project: 171505
Buggy source:
protected String generateConstraintValidator(Vars vars,ConstraintValidator validator){
  Class<?> type=validator.getClass();
  ConstraintMetaData metadata=vars.cmdManager.getConstraintMetaData(type);
  StringBuilder buffer=new StringBuilder();
  buffer.append("String_Node_Str").append(VALIDATOR_NAMESPACE).append('.').append(metadata.isScriptRemote() ? REMOTE_MAPPING : type.getSimpleName()).append("String_Node_Str").append(this.generateConstraintValidatorParams(vars,validator,metadata)).append("String_Node_Str");
  return buffer.toString();
}

Fixed version (ground truth):
protected String generateConstraintValidator(Vars vars,ConstraintValidator validator){
  Class<?> type=validator.getClass();
  ConstraintMetaData metadata=vars.cmdManager.getConstraintMetaData(type);
  StringBuilder buffer=new StringBuilder();
  String scirptName=metadata.getScriptID();
  if (metadata.isScriptRemote()) {
    scirptName=REMOTE_MAPPING;
  }
 else   if (!StringUtils.hasText(scirptName)) {
    scirptName=type.getSimpleName();
  }
  buffer.append("String_Node_Str").append(VALIDATOR_NAMESPACE).append('.').append(scirptName).append("String_Node_Str").append(this.generateConstraintValidatorParams(vars,validator,metadata)).append("String_Node_Str");
  return buffer.toString();
}
Program: 171506
Project: 171506
Buggy source:
@Override public boolean isValid(Object value){
  if (value == null) {
    return true;
  }
  WebContext context=WebContextThreadStack.get();
  HttpServletRequest request=context.getHttpServletRequest();
  String diffValue=request.getParameter(name);
  if (diffValue == null) {
    return false;
  }
  return ignoreCase ? diffValue.equalsIgnoreCase(value.toString()) : diffValue.equals(value);
}

Fixed version (ground truth):
@Override public boolean isValid(Object value){
  if (value == null) {
    return true;
  }
  BeanReader beanReader=new BeanReader(ThreadContext.getModel());
  Object diffValue=beanReader.getProperty(this.name);
  if (diffValue == null) {
    return false;
  }
  String diffString=diffValue.toString();
  return ignoreCase ? diffString.equalsIgnoreCase(value.toString()) : diffString.equals(value);
}
Program: 171507
Project: 171507
Buggy source:
protected void validateConstraintsForCurrentGroup(ValidationContext.Accessor context,ValueContext valueContext,List<ConstraintViolation> failingConstraintViolations){
  for (  ConstraintDescriptor descriptor : context.getConstraintDescriptors()) {
    if (isValidationRequired(valueContext,descriptor)) {
      if (valueContext.getCurrentBean() != null) {
        Object valueToValidate=getBeanProperty(valueContext.getCurrentBean(),descriptor.getName());
        valueContext.setCurrentValidatedValue(valueToValidate);
      }
      ConstraintViolation constraintViolation=validateConstraint(context,valueContext,descriptor);
      if (constraintViolation != null) {
        failingConstraintViolations.add(constraintViolation);
      }
    }
    if (shouldFailFast(context,failingConstraintViolations)) {
      return;
    }
  }
}

Fixed version (ground truth):
protected void validateConstraintsForCurrentGroup(ValidationContext.Accessor context,ValueContext valueContext,List<ConstraintViolation> failingConstraintViolations){
  BeanReader beanReader=new BeanReader(valueContext.getCurrentBean());
  for (  ConstraintDescriptor descriptor : context.getConstraintDescriptors()) {
    if (isValidationRequired(valueContext,descriptor)) {
      if (valueContext.getCurrentBean() != null) {
        Object valueToValidate=beanReader.getProperty(descriptor.getName());
        valueContext.setCurrentValidatedValue(valueToValidate);
      }
      ConstraintViolation constraintViolation=validateConstraint(context,valueContext,descriptor);
      if (constraintViolation != null) {
        failingConstraintViolations.add(constraintViolation);
      }
    }
    if (shouldFailFast(context,failingConstraintViolations)) {
      return;
    }
  }
}
Program: 171508
Project: 171508
Buggy source:
protected String generateConstraintDescriptor(Vars vars,ValidationContext.Accessor context){
  StringBuilder buffer=new StringBuilder();
  for (  ConstraintDescriptor descriptor : context.getConstraintDescriptors()) {
    String name=descriptor.getName();
    String message=vars.messageInterpolator.interpolateBundleMessage(descriptor.getMessageTemplate(),context.getResourceBundleLocator());
    if (message != null) {
      message=message.replaceAll("String_Node_Str","String_Node_Str");
    }
    ConstraintValidator validator=descriptor.getConstraintValidator();
    buffer.append("String_Node_Str" + name + "String_Node_Str"+ message+ "String_Node_Str").append(this.generateConstraintValidator(vars,validator)).append(this.generateGroups(descriptor.getGroups())).append("String_Node_Str");
  }
  return buffer.toString();
}

Fixed version (ground truth):
protected String generateConstraintDescriptor(Vars vars,ValidationContext.Accessor context){
  StringBuilder buffer=new StringBuilder();
  for (  ConstraintDescriptor descriptor : context.getConstraintDescriptors()) {
    String name=descriptor.getName();
    String message=vars.messageInterpolator.interpolateBundleMessage(descriptor.getMessageTemplate(),context.getResourceBundleLocator());
    if (message != null) {
      message=message.replaceAll("String_Node_Str","String_Node_Str");
    }
    ConstraintValidator validator=descriptor.getConstraintValidator();
    Class<?> type=validator.getClass();
    ConstraintMetaData metadata=vars.cmdManager.getConstraintMetaData(type);
    if (metadata.hasScriptAnnotation()) {
      buffer.append("String_Node_Str" + name + "String_Node_Str"+ message+ "String_Node_Str").append(this.generateConstraintValidator(vars,validator)).append(this.generateGroups(descriptor.getGroups())).append("String_Node_Str");
    }
  }
  return buffer.toString();
}
Program: 171509
Project: 171509
Buggy source:
@Override public void updatePassenger(Entity passenger){
  if (this.isPassenger(passenger) && passengerPositions.containsKey(passenger.getPersistentID())) {
    Vec3d pos=this.getDefinition().getPassengerCenter(gauge);
    pos=pos.add(passengerPositions.get(passenger.getPersistentID()));
    pos=VecUtil.rotateYaw(pos,this.rotationYaw);
    pos=pos.add(this.getPositionVector());
    if (passenger instanceof EntityPlayer && shouldRiderSit()) {
      pos=pos.subtract(0,0.75,0);
    }
    passenger.setPosition(pos.x,pos.y,pos.z);
    passenger.setVelocity(this.motionX,this.motionY,this.motionZ);
    passenger.prevRotationYaw=passenger.rotationYaw;
    passenger.rotationYaw+=(this.rotationYaw - this.prevRotationYaw);
  }
}

Fixed version (ground truth):
@Override public void updatePassenger(Entity passenger){
  if (this.isPassenger(passenger) && passengerPositions.containsKey(passenger.getPersistentID())) {
    Vec3d pos=this.getDefinition().getPassengerCenter(gauge);
    pos=pos.add(passengerPositions.get(passenger.getPersistentID()));
    pos=VecUtil.rotateYaw(pos,this.rotationYaw);
    pos=pos.add(this.getPositionVector());
    if (passenger instanceof EntityPlayer && shouldRiderSit()) {
      pos=pos.subtract(0,0.75,0);
    }
    passenger.setPosition(pos.x,pos.y,pos.z);
    passenger.motionX=this.motionX;
    passenger.motionY=this.motionY;
    passenger.motionZ=this.motionZ;
    passenger.prevRotationYaw=passenger.rotationYaw;
    passenger.rotationYaw+=(this.rotationYaw - this.prevRotationYaw);
  }
}
Program: 171512
Project: 171512
Buggy source:
@Override protected void readEntityFromNBT(NBTTagCompound nbttagcompound){
  super.readEntityFromNBT(nbttagcompound);
  setEngineTemperature(nbttagcompound.getFloat("String_Node_Str"));
  setTurnedOn(nbttagcompound.getBoolean("String_Node_Str"));
  setEngineOverheated(nbttagcompound.getBoolean("String_Node_Str"));
}

Fixed version (ground truth):
@Override protected void readEntityFromNBT(NBTTagCompound nbttagcompound){
  setEngineTemperature(nbttagcompound.getFloat("String_Node_Str"));
  setTurnedOn(nbttagcompound.getBoolean("String_Node_Str"));
  setEngineOverheated(nbttagcompound.getBoolean("String_Node_Str"));
  super.readEntityFromNBT(nbttagcompound);
}
Program: 171513
Project: 171513
Buggy source:
public void draw(){
  Entity riding=mc.player.getRidingEntity();
  if (riding == null) {
    return;
  }
  if (!(riding instanceof LocomotiveDiesel)) {
    return;
  }
  LocomotiveDiesel loco=(LocomotiveDiesel)riding;
  drawGauge(0xAA79650c,((float)loco.getLiquidAmount()) / Fluid.BUCKET_VOLUME,loco.getTankCapacity().Buckets(),"String_Node_Str");
  int heatColor=cold;
  if (loco.getEngineTemperature() > 75) {
    heatColor=warm;
  }
  if (loco.getEngineTemperature() > 100) {
    heatColor=hot;
  }
  if (loco.getEngineTemperature() > 140) {
    heatColor=danger;
  }
  drawGauge(heatColor,loco.getEngineTemperature(),150,"String_Node_Str");
  drawScalar(GuiText.LABEL_BRAKE.toString(),loco.getAirBrake() * 10,0,10);
  drawScalar(GuiText.LABEL_THROTTLE.toString(),loco.getThrottle() * 10,-10,10);
  double speed=loco.getCurrentSpeed().metric();
  if (speed < 0) {
    speed=speed * (-1);
  }
  if (ConfigGraphics.speedUnit == "String_Node_Str") {
    drawSpeedText(String.format("String_Node_Str",speed));
  }
 else   if (ConfigGraphics.speedUnit == "String_Node_Str") {
    speed=speed * 0.621371;
    drawSpeedText(String.format("String_Node_Str",speed));
  }
 else   if (ConfigGraphics.speedUnit == "String_Node_Str") {
    speed=speed / 3.6;
    drawSpeedText(String.format("String_Node_Str",speed));
  }
}

Fixed version (ground truth):
public void draw(){
  Entity riding=mc.player.getRidingEntity();
  if (riding == null) {
    return;
  }
  if (!(riding instanceof LocomotiveDiesel)) {
    return;
  }
  LocomotiveDiesel loco=(LocomotiveDiesel)riding;
  drawGauge(0xAA79650c,((float)loco.getLiquidAmount()) / Fluid.BUCKET_VOLUME,loco.getTankCapacity().Buckets(),"String_Node_Str");
  int heatColor=cold;
  if (loco.getEngineTemperature() > 75) {
    heatColor=warm;
  }
  if (loco.getEngineTemperature() > 100) {
    heatColor=hot;
  }
  if (loco.getEngineTemperature() > 140) {
    heatColor=danger;
  }
  drawGauge(heatColor,loco.getEngineTemperature(),150,"String_Node_Str");
  drawScalar(GuiText.LABEL_BRAKE.toString(),loco.getAirBrake() * 10,0,10);
  drawScalar(GuiText.LABEL_THROTTLE.toString(),loco.getThrottle() * 10,-10,10);
  double speed=Math.abs(loco.getCurrentSpeed().metric());
  if (ConfigGraphics.speedUnit == "String_Node_Str") {
    drawSpeedText(String.format("String_Node_Str",speed));
  }
 else   if (ConfigGraphics.speedUnit == "String_Node_Str") {
    speed=speed * 0.621371;
    drawSpeedText(String.format("String_Node_Str",speed));
  }
 else   if (ConfigGraphics.speedUnit == "String_Node_Str") {
    speed=speed / 3.6;
    drawSpeedText(String.format("String_Node_Str",speed));
  }
 else {
    speed=speed * 0.621371;
    drawSpeedText(String.format("String_Node_Str",speed));
  }
}
Program: 171514
Project: 171514
Buggy source:
public void draw(){
  Entity riding=mc.player.getRidingEntity();
  if (riding == null) {
    return;
  }
  if (!(riding instanceof LocomotiveSteam)) {
    return;
  }
  LocomotiveSteam loco=(LocomotiveSteam)riding;
  drawGauge(0xAA0F0FFF,((float)loco.getLiquidAmount()) / Fluid.BUCKET_VOLUME,loco.getTankCapacity().Buckets(),"String_Node_Str");
  drawGauge(0x99DDDDDD,loco.getBoilerPressure(),loco.getDefinition().getMaxPSI(loco.gauge),"String_Node_Str");
  int boilerColor=0x99d1c715;
  if (loco.getBoilerTemperature() > 95) {
    boilerColor=0x99d16c15;
  }
  if (loco.getBoilerTemperature() > 105) {
    boilerColor=0x99a21010;
  }
  drawGauge(boilerColor,loco.getBoilerTemperature(),150,"String_Node_Str");
  drawScalar(GuiText.LABEL_BRAKE.toString(),loco.getAirBrake() * 10,0,10);
  drawScalar(GuiText.LABEL_THROTTLE.toString(),loco.getThrottle() * 10,-10,10);
  double speed=loco.getCurrentSpeed().metric();
  if (speed < 0) {
    speed=speed * (-1);
  }
  if (ConfigGraphics.speedUnit == "String_Node_Str") {
    drawSpeedText(String.format("String_Node_Str",speed));
  }
 else   if (ConfigGraphics.speedUnit == "String_Node_Str") {
    speed=speed * 0.621371;
    drawSpeedText(String.format("String_Node_Str",speed));
  }
 else   if (ConfigGraphics.speedUnit == "String_Node_Str") {
    speed=speed / 3.6;
    drawSpeedText(String.format("String_Node_Str",speed));
  }
}

Fixed version (ground truth):
public void draw(){
  Entity riding=mc.player.getRidingEntity();
  if (riding == null) {
    return;
  }
  if (!(riding instanceof LocomotiveSteam)) {
    return;
  }
  LocomotiveSteam loco=(LocomotiveSteam)riding;
  drawGauge(0xAA0F0FFF,((float)loco.getLiquidAmount()) / Fluid.BUCKET_VOLUME,loco.getTankCapacity().Buckets(),"String_Node_Str");
  drawGauge(0x99DDDDDD,loco.getBoilerPressure(),loco.getDefinition().getMaxPSI(loco.gauge),"String_Node_Str");
  int boilerColor=0x99d1c715;
  if (loco.getBoilerTemperature() > 95) {
    boilerColor=0x99d16c15;
  }
  if (loco.getBoilerTemperature() > 105) {
    boilerColor=0x99a21010;
  }
  drawGauge(boilerColor,loco.getBoilerTemperature(),150,"String_Node_Str");
  drawScalar(GuiText.LABEL_BRAKE.toString(),loco.getAirBrake() * 10,0,10);
  drawScalar(GuiText.LABEL_THROTTLE.toString(),loco.getThrottle() * 10,-10,10);
  double speed=Math.abs(loco.getCurrentSpeed().metric());
  if (ConfigGraphics.speedUnit == "String_Node_Str") {
    drawSpeedText(String.format("String_Node_Str",speed));
  }
 else   if (ConfigGraphics.speedUnit == "String_Node_Str") {
    speed=speed * 0.621371;
    drawSpeedText(String.format("String_Node_Str",speed));
  }
 else   if (ConfigGraphics.speedUnit == "String_Node_Str") {
    speed=speed / 3.6;
    drawSpeedText(String.format("String_Node_Str",speed));
  }
 else {
    speed=speed * 0.621371;
    drawSpeedText(String.format("String_Node_Str",speed));
  }
}
Program: 171516
Project: 171516
Buggy source:
public LocomotiveDiesel(World world,String defID){
  super(world,defID);
  this.getDataManager().register(ENGINE_TEMPERATURE,ambientTemperature());
  this.getDataManager().register(TURNED_ON,false);
  this.getDataManager().register(ENGINE_OVERHEATED,false);
}

Fixed version (ground truth):
public LocomotiveDiesel(World world,String defID){
  super(world,defID);
  this.getDataManager().register(ENGINE_TEMPERATURE,ambientTemperature());
  this.getDataManager().register(TURNED_ON,false);
  this.getDataManager().register(ENGINE_OVERHEATED,false);
  setEngineTemperature(ambientTemperature());
}
Program: 171517
Project: 171517
Buggy source:
@Override public void handleKeyPress(Entity source,KeyTypes key){
switch (key) {
case START_STOP_ENGINE:
    if (turnOnOffDelay == 0) {
      turnOnOffDelay=10;
      setTurnedOn(!isTurnedOn());
    }
  break;
case THROTTLE_UP:
if (getEngineTemperature() > 75 && getThrottle() < 1 && !isEngineOverheated()) {
  setThrottle(getThrottle() + throttleNotch);
}
break;
case THROTTLE_DOWN:
if (getEngineTemperature() > 75 && getThrottle() > -1 && !isEngineOverheated()) {
setThrottle(getThrottle() - throttleNotch);
}
break;
default :
super.handleKeyPress(source,key);
}
this.mapTrain(this,true,false,this::setThrottleMap);
}

Fixed version (ground truth):
@Override public void handleKeyPress(Entity source,KeyTypes key){
switch (key) {
case START_STOP_ENGINE:
    if (turnOnOffDelay == 0) {
      turnOnOffDelay=10;
      setTurnedOn(!isTurnedOn());
    }
  break;
default :
super.handleKeyPress(source,key);
}
this.mapTrain(this,true,false,this::setThrottleMap);
}
Program: 171519
Project: 171519
Buggy source:
@Override public void handleKeyPress(Entity source,KeyTypes key){
switch (key) {
case START_STOP_ENGINE:
    if (turnOnOffDelay == 0) {
      turnOnOffDelay=10;
      setTurnedOn(!isTurnedOn());
    }
  break;
default :
super.handleKeyPress(source,key);
}
this.mapTrain(this,true,false,this::setThrottleMap);
}

Fixed version (ground truth):
@Override public void handleKeyPress(Entity source,KeyTypes key){
switch (key) {
case START_STOP_ENGINE:
    if (turnOnOffDelay == 0) {
      turnOnOffDelay=10;
      setTurnedOn(!isTurnedOn());
    }
  break;
case THROTTLE_UP:
if (getEngineTemperature() > 75 && getThrottle() < 1 && !isEngineOverheated()) {
  setThrottle(getThrottle() + throttleNotch);
}
break;
case THROTTLE_DOWN:
if (getEngineTemperature() > 75 && getThrottle() > -1 && !isEngineOverheated()) {
setThrottle(getThrottle() - throttleNotch);
}
break;
default :
super.handleKeyPress(source,key);
}
this.mapTrain(this,true,false,this::setThrottleMap);
}
Program: 171520
Project: 171520
Buggy source:
@Override protected int getAvailableHP(){
  if (isRunning() && getEngineTemperature() > 70) {
    return this.getDefinition().getHorsePower(gauge);
  }
  return 0;
}

Fixed version (ground truth):
@Override protected int getAvailableHP(){
  if (isRunning() && getEngineTemperature() > 75) {
    return this.getDefinition().getHorsePower(gauge);
  }
  return 0;
}
Program: 171522
Project: 171522
Buggy source:
public LocomotiveDiesel(World world,String defID){
  super(world,defID);
  this.getDataManager().register(ENGINE_TEMPERATURE,ambientTemperature());
  this.getDataManager().register(TURNED_ON,false);
  this.getDataManager().register(ENGINE_OVERHEATED,false);
  setEngineTemperature(ambientTemperature());
}

Fixed version (ground truth):
public LocomotiveDiesel(World world,String defID){
  super(world,defID);
  this.getDataManager().register(ENGINE_TEMPERATURE,ambientTemperature());
  this.getDataManager().register(TURNED_ON,false);
  this.getDataManager().register(ENGINE_OVERHEATED,false);
}
Program: 171524
Project: 171524
Buggy source:
public BuilderTurn(RailInfo info,BlockPos pos){
  super(info,pos);
  positions=new HashSet<Pair<Integer,Integer>>();
  HashSet<Pair<Integer,Integer>> flexPositions=new HashSet<Pair<Integer,Integer>>();
  float flexAngle=6;
  followCurve(info,0.25f,(  double gagX,  double gagZ,  float angle,  float angleDelta,  int counter,  float startAngle,  float endAngle) -> {
    for (double q=-gauge.value(); q <= gauge.value(); q+=0.1) {
      int posX=(int)(gagX + Math.sin(Math.toRadians(angle)) * q);
      int posZ=(int)(gagZ + Math.cos(Math.toRadians(angle)) * q);
      positions.add(Pair.of(posX,posZ));
      if (angle > startAngle - flexAngle || angle < endAngle + flexAngle)       flexPositions.add(Pair.of(posX,posZ));
    }
    if (Math.ceil(angle) == Math.ceil((startAngle + endAngle) / 2)) {
      mainX=(int)gagX;
      mainZ=(int)gagZ;
    }
  }
);
  this.setParentPos(new BlockPos(mainX,0,mainZ));
  TrackRail turnTrack=new TrackRail(this,mainX,0,mainZ,EnumFacing.NORTH,TrackItems.TURN,info.length,info.quarter,info.placementPosition);
  turnTrack.setDirection(info.direction);
  turnTrack.setTurnQuarters(info.quarters);
  tracks.add(turnTrack);
  for (  Pair<Integer,Integer> pair : positions) {
    int gagX=pair.getLeft();
    int gagZ=pair.getRight();
    if (gagX == mainX && gagZ == mainZ) {
      continue;
    }
    TrackBase tg=new TrackGag(this,gagX,0,gagZ);
    if (flexPositions.contains(pair)) {
      tg.setFlexible();
    }
    tracks.add(tg);
  }
}

Fixed version (ground truth):
public BuilderTurn(RailInfo info,BlockPos pos){
  super(info,pos);
  positions=new HashSet<Pair<Integer,Integer>>();
  HashSet<Pair<Integer,Integer>> flexPositions=new HashSet<Pair<Integer,Integer>>();
  float flexAngle=6;
  followCurve(info,0.25f,(  double gagX,  double gagZ,  float angle,  float angleDelta,  int counter,  float startAngle,  float endAngle) -> {
    for (double q=-gauge.value(); q <= gauge.value(); q+=0.1) {
      int posX=(int)Math.round(gagX + Math.sin(Math.toRadians(angle)) * q);
      int posZ=(int)Math.round(gagZ + Math.cos(Math.toRadians(angle)) * q);
      positions.add(Pair.of(posX,posZ));
      if (angle > startAngle - flexAngle || angle < endAngle + flexAngle)       flexPositions.add(Pair.of(posX,posZ));
    }
    if (Math.ceil(angle) == Math.ceil((startAngle + endAngle) / 2)) {
      mainX=(int)gagX;
      mainZ=(int)gagZ;
    }
  }
);
  this.setParentPos(new BlockPos(mainX,0,mainZ));
  TrackRail turnTrack=new TrackRail(this,mainX,0,mainZ,EnumFacing.NORTH,TrackItems.TURN,info.length,info.quarter,info.placementPosition);
  turnTrack.setDirection(info.direction);
  turnTrack.setTurnQuarters(info.quarters);
  tracks.add(turnTrack);
  for (  Pair<Integer,Integer> pair : positions) {
    int gagX=pair.getLeft();
    int gagZ=pair.getRight();
    if (gagX == mainX && gagZ == mainZ) {
      continue;
    }
    TrackBase tg=new TrackGag(this,gagX,0,gagZ);
    if (flexPositions.contains(pair)) {
      tg.setFlexible();
    }
    tracks.add(tg);
  }
}
Program: 171528
Project: 171528
Buggy source:
public void draw(){
  Entity riding=mc.player.getRidingEntity();
  if (riding == null) {
    return;
  }
  if (!(riding instanceof LocomotiveDiesel)) {
    return;
  }
  LocomotiveDiesel loco=(LocomotiveDiesel)riding;
  drawGauge(0xAA79650c,((float)loco.getLiquidAmount()) / Fluid.BUCKET_VOLUME,loco.getTankCapacity().Buckets(),"String_Node_Str");
  drawScalar(GuiText.LABEL_BRAKE.toString(),loco.getAirBrake() * 10,0,10);
  drawScalar(GuiText.LABEL_THROTTLE.toString(),loco.getThrottle() * 10,-10,10);
  int boilerColor=0x99d1c715;
  if (loco.getEngineTemperature() > 75) {
    boilerColor=0x99d16c15;
  }
  if (loco.getEngineTemperature() > 100) {
    boilerColor=0x99a21010;
  }
  drawGauge(boilerColor,loco.getEngineTemperature(),150,"String_Node_Str");
}

Fixed version (ground truth):
public void draw(){
  Entity riding=mc.player.getRidingEntity();
  if (riding == null) {
    return;
  }
  if (!(riding instanceof LocomotiveDiesel)) {
    return;
  }
  LocomotiveDiesel loco=(LocomotiveDiesel)riding;
  drawGauge(0xAA79650c,((float)loco.getLiquidAmount()) / Fluid.BUCKET_VOLUME,loco.getTankCapacity().Buckets(),"String_Node_Str");
  int boilerColor=0x99d1c715;
  if (loco.getEngineTemperature() > 75) {
    boilerColor=0x99d16c15;
  }
  if (loco.getEngineTemperature() > 100) {
    boilerColor=0x99a21010;
  }
  drawGauge(boilerColor,loco.getEngineTemperature(),150,"String_Node_Str");
  drawScalar(GuiText.LABEL_BRAKE.toString(),loco.getAirBrake() * 10,0,10);
  drawScalar(GuiText.LABEL_THROTTLE.toString(),loco.getThrottle() * 10,-10,10);
}
Program: 171529
Project: 171529
Buggy source:
public double percentFloating(){
  RailInfo buildInfo=new RailInfo(getPos(),getWorld(),getFacing().getOpposite(),getType(),getDirection(),getLength(),getRotationQuarter(),getTurnQuarters(),getGauge(),getPlacementPosition(),getRailBed(),ItemStack.EMPTY,switchState);
  List<TrackBase> tracks=buildInfo.getBuilder(pos).getTracksForRender();
  double floating=0;
  for (  TrackBase track : tracks) {
    if (!world.isSideSolid(track.getPos().down(),EnumFacing.UP,false)) {
      floating+=1.0 / tracks.size();
    }
  }
  return floating;
}

Fixed version (ground truth):
public double percentFloating(){
  RailInfo buildInfo=this.getRailRenderInfo().clone();
  if (info == null) {
    return 0;
  }
  List<TrackBase> tracks=buildInfo.getBuilder().getTracksForRender();
  double floating=0;
  BlockPos offset=null;
  for (  TrackBase track : tracks) {
    if (track instanceof TrackRail) {
      offset=this.getPos().subtract(new BlockPos(track.getPos().getX(),0,track.getPos().getZ()));
      break;
    }
  }
  for (  TrackBase track : tracks) {
    BlockPos tpos=track.getPos().down().add(offset);
    boolean isOnRealBlock=world.isSideSolid(tpos,EnumFacing.UP,false) || !Config.ConfigDamage.requireSolidBlocks && !world.isAirBlock(tpos);
    if (!isOnRealBlock) {
      floating+=1.0 / tracks.size();
    }
  }
  return floating;
}
Program: 171532
Project: 171532
Buggy source:
public RailInfo getRailRenderInfo(){
  if (!hasTileData && world.isRemote) {
    return null;
  }
  if (info == null) {
    info=new RailInfo(getPos(),getWorld(),getFacing().getOpposite(),getType(),getDirection(),getLength(),getRotationQuarter(),getTurnQuarters(),getGauge(),getPlacementPosition(),getRailBed(),ItemStack.EMPTY);
  }
  info.snowRenderFlagDirty=this.snowRenderFlagDirty;
  this.snowRenderFlagDirty=false;
  info.switchState=this.switchState;
  return info;
}

Fixed version (ground truth):
public RailInfo getRailRenderInfo(){
  if (!hasTileData && world.isRemote) {
    return null;
  }
  if (info == null) {
    info=new RailInfo(getPos(),getWorld(),getFacing().getOpposite(),getType(),getDirection(),getLength(),getRotationQuarter(),getTurnQuarters(),getGauge(),getPlacementPosition(),getRailBed(),ItemStack.EMPTY,null);
  }
  info.switchState=switchState;
  return info;
}
Program: 171533
Project: 171533
Buggy source:
public double percentFloating(){
  RailInfo buildInfo=new RailInfo(getPos(),getWorld(),getFacing().getOpposite(),getType(),getDirection(),getLength(),getRotationQuarter(),getTurnQuarters(),getGauge(),getPlacementPosition(),getRailBed(),ItemStack.EMPTY);
  List<TrackBase> tracks=buildInfo.getBuilder(pos).getTracksForRender();
  double floating=0;
  for (  TrackBase track : tracks) {
    if (!world.isSideSolid(track.getPos().down(),EnumFacing.UP,false)) {
      floating+=1.0 / tracks.size();
    }
  }
  return floating;
}

Fixed version (ground truth):
public double percentFloating(){
  RailInfo buildInfo=new RailInfo(getPos(),getWorld(),getFacing().getOpposite(),getType(),getDirection(),getLength(),getRotationQuarter(),getTurnQuarters(),getGauge(),getPlacementPosition(),getRailBed(),ItemStack.EMPTY,switchState);
  List<TrackBase> tracks=buildInfo.getBuilder(pos).getTracksForRender();
  double floating=0;
  for (  TrackBase track : tracks) {
    if (!world.isSideSolid(track.getPos().down(),EnumFacing.UP,false)) {
      floating+=1.0 / tracks.size();
    }
  }
  return floating;
}
Program: 171534
Project: 171534
Buggy source:
@Override public void readFromNBT(NBTTagCompound nbt){
  super.readFromNBT(nbt);
  int version=0;
  if (nbt.hasKey("String_Node_Str")) {
    version=nbt.getInteger("String_Node_Str");
  }
  height=nbt.getFloat("String_Node_Str");
  int oldSnowLayers=snowLayers;
  snowLayers=nbt.getInteger("String_Node_Str");
  if (oldSnowLayers > snowLayers && world != null && world.isRemote) {
    for (int i=0; i < 30 * (oldSnowLayers); i++) {
      ParticleUtil.spawnParticle(world,EnumParticleTypes.SNOWBALL,this.getCenterOfRail().addVector(Math.random() * 4 - 2,1,Math.random() * 4 - 2));
    }
  }
  flexible=nbt.getBoolean("String_Node_Str");
  if (nbt.hasKey("String_Node_Str")) {
    replaced=nbt.getCompoundTag("String_Node_Str");
  }
  if (nbt.hasKey("String_Node_Str")) {
    augment=Augment.values()[nbt.getInteger("String_Node_Str")];
  }
switch (version) {
case 0:
case 1:
    setNBTBlockPos(nbt,"String_Node_Str",getNBTBlockPos(nbt,"String_Node_Str").subtract(pos));
case 2:
case 3:
}
parent=getNBTBlockPos(nbt,"String_Node_Str");
if (world != null && this.getParentTile() != null) {
  this.getParentTile().snowRenderFlagDirty=true;
}
if (nbt.hasKey("String_Node_Str")) {
  createAugmentTank();
  augmentTank.readFromNBT(nbt.getCompoundTag("String_Node_Str"));
}
if (nbt.hasKey("String_Node_Str")) {
  augmentFilterID=nbt.getString("String_Node_Str");
}
if (nbt.hasKey("String_Node_Str")) {
  redstoneMode=StockDetectorMode.values()[nbt.getInteger("String_Node_Str")];
}
if (nbt.hasKey("String_Node_Str")) {
  controlMode=LocoControlMode.values()[nbt.getInteger("String_Node_Str")];
}
}

Fixed version (ground truth):
@Override public void readFromNBT(NBTTagCompound nbt){
  super.readFromNBT(nbt);
  int version=0;
  if (nbt.hasKey("String_Node_Str")) {
    version=nbt.getInteger("String_Node_Str");
  }
  height=nbt.getFloat("String_Node_Str");
  int oldSnowLayers=snowLayers;
  snowLayers=nbt.getInteger("String_Node_Str");
  if (oldSnowLayers > snowLayers && world != null && world.isRemote) {
    for (int i=0; i < 30 * (oldSnowLayers); i++) {
      ParticleUtil.spawnParticle(world,EnumParticleTypes.SNOWBALL,this.getCenterOfRail().addVector(Math.random() * 4 - 2,1,Math.random() * 4 - 2));
    }
  }
  flexible=nbt.getBoolean("String_Node_Str");
  if (nbt.hasKey("String_Node_Str")) {
    replaced=nbt.getCompoundTag("String_Node_Str");
  }
  if (nbt.hasKey("String_Node_Str")) {
    augment=Augment.values()[nbt.getInteger("String_Node_Str")];
  }
switch (version) {
case 0:
case 1:
    setNBTBlockPos(nbt,"String_Node_Str",getNBTBlockPos(nbt,"String_Node_Str").subtract(pos));
case 2:
case 3:
}
parent=getNBTBlockPos(nbt,"String_Node_Str");
if (nbt.hasKey("String_Node_Str")) {
  createAugmentTank();
  augmentTank.readFromNBT(nbt.getCompoundTag("String_Node_Str"));
}
if (nbt.hasKey("String_Node_Str")) {
  augmentFilterID=nbt.getString("String_Node_Str");
}
if (nbt.hasKey("String_Node_Str")) {
  redstoneMode=StockDetectorMode.values()[nbt.getInteger("String_Node_Str")];
}
if (nbt.hasKey("String_Node_Str")) {
  controlMode=LocoControlMode.values()[nbt.getInteger("String_Node_Str")];
}
}
Program: 171535
Project: 171535
Buggy source:
@Override public RailInfo clone(){
  RailInfo c=new RailInfo(position,world,facing,type,direction,length,quarter,quarters,gauge,placementPosition,railBed,railBedFill);
  return c;
}

Fixed version (ground truth):
@Override public RailInfo clone(){
  RailInfo c=new RailInfo(position,world,facing,type,direction,length,quarter,quarters,gauge,placementPosition,railBed,railBedFill,switchState);
  return c;
}
Program: 171536
Project: 171536
Buggy source:
@Override public void onResourceManagerReload(IResourceManager resourceManager){
  try {
    DefinitionManager.initDefinitions();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  StockRenderCache.clearRenderCache();
}

Fixed version (ground truth):
@Override public void onResourceManagerReload(IResourceManager resourceManager){
  if (skipFirst) {
    skipFirst=false;
    return;
  }
  try {
    DefinitionManager.initDefinitions();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  StockRenderCache.clearRenderCache();
}
Program: 171537
Project: 171537
Buggy source:
@SubscribeEvent public static void onClientTick(TickEvent.ClientTickEvent event){
  if (event.phase != Phase.START) {
    return;
  }
  if (magical != null) {
    magical.onUpdate();
  }
  if (tickCount % 40 == 39) {
    StockRenderCache.doImageCache();
  }
  tickCount++;
  manager.tick();
  StockRenderCache.tryCache();
}

Fixed version (ground truth):
@SubscribeEvent public static void onClientTick(TickEvent.ClientTickEvent event){
  if (event.phase != Phase.START) {
    return;
  }
  if (magical != null) {
    magical.onUpdate();
    if (magical.isDead) {
      magical.isDead=false;
      ImmersiveRailroading.warn("String_Node_Str");
      magical.world.spawnEntity(magical);
    }
    if (tickCount % 20 == 0) {
      if (!magical.world.loadedEntityList.contains(magical)) {
        ImmersiveRailroading.warn("String_Node_Str");
        magical.isDead=false;
        magical.world.spawnEntity(magical);
      }
    }
  }
  if (tickCount % 40 == 39) {
    StockRenderCache.doImageCache();
  }
  tickCount++;
  manager.tick();
  StockRenderCache.tryCache();
}
Program: 171538
Project: 171538
Buggy source:
public static Gauge get(ItemStack stack){
  if (stack.getTagCompound() != null && stack.getTagCompound().hasKey("String_Node_Str")) {
    return Gauge.from(stack.getTagCompound().getDouble("String_Node_Str"));
  }
  EntityRollingStockDefinition def=ItemDefinition.get(stack);
  if (def != null) {
    return def.recommended_gauge;
  }
  return Gauge.STANDARD;
}

Fixed version (ground truth):
public static Gauge get(ItemStack stack){
  if (stack.getTagCompound() != null && stack.getTagCompound().hasKey("String_Node_Str")) {
    return Gauge.from(stack.getTagCompound().getDouble("String_Node_Str"));
  }
  EntityRollingStockDefinition def=ItemDefinition.get(stack.copy());
  if (def != null) {
    return def.recommended_gauge;
  }
  return Gauge.STANDARD;
}
Program: 171539
Project: 171539
Buggy source:
public ActionResult<ItemStack> onItemRightClick(World worldIn,EntityPlayer playerIn,EnumHand handIn){
  if (worldIn.isRemote) {
    playerIn.openGui(ImmersiveRailroading.instance,GuiTypes.RAIL.ordinal(),worldIn,(int)playerIn.posX,(int)playerIn.posY,(int)playerIn.posZ);
  }
  return super.onItemRightClick(worldIn,playerIn,handIn);
}

Fixed version (ground truth):
public ActionResult<ItemStack> onItemRightClick(World worldIn,EntityPlayer playerIn,EnumHand handIn){
  if (worldIn.isRemote && handIn == EnumHand.MAIN_HAND) {
    playerIn.openGui(ImmersiveRailroading.instance,GuiTypes.RAIL.ordinal(),worldIn,(int)playerIn.posX,(int)playerIn.posY,(int)playerIn.posZ);
  }
  return super.onItemRightClick(worldIn,playerIn,handIn);
}
Program: 171540
Project: 171540
Buggy source:
public EntitySmokeParticle(World worldIn,int lifespan,float darken,float thickness,double diameter){
  super(worldIn);
  this.rot=Math.random() * 360;
  this.lifespan=lifespan;
  this.darken=darken;
  this.thickness=thickness;
  this.diameter=diameter;
}

Fixed version (ground truth):
public EntitySmokeParticle(World worldIn,int lifespan,float darken,float thickness,double diameter){
  super(worldIn);
  this.rot=Math.random() * 360;
  this.lifespan=lifespan;
  this.darken=darken;
  this.thickness=thickness;
  this.diameter=diameter;
  this.startTick=ImmersiveRailroading.proxy.getTicks() - 1;
}
Program: 171541
Project: 171541
Buggy source:
@Override public void onUpdate(){
  if (!world.isRemote) {
    return;
  }
  this.prevPosX=this.posX;
  this.prevPosY=this.posY;
  this.prevPosZ=this.posZ;
  double life=this.ticksExisted / (float)this.lifespan;
  double expansionRate=16;
  this.radius=this.diameter * (Math.sqrt(life) * expansionRate + 1) * 0.5;
  this.alpha=(thickness + 0.2f) * (1 - (float)Math.sqrt(life));
  this.motionY*=0.9f;
  this.motionX*=0.97f;
  this.motionZ*=0.97f;
  this.posX+=this.motionX;
  this.posY+=this.motionY;
  this.posZ+=this.motionZ;
  if (this.ticksExisted >= this.lifespan) {
    world.removeEntity(this);
  }
}

Fixed version (ground truth):
@Override public void onUpdate(){
  if (!world.isRemote) {
    return;
  }
  this.prevPosX=this.posX;
  this.prevPosY=this.posY;
  this.prevPosZ=this.posZ;
  int ticks=ImmersiveRailroading.proxy.getTicks() - this.startTick;
  double life=ticks / (float)this.lifespan;
  double expansionRate=16;
  this.radius=this.diameter * (Math.sqrt(life) * expansionRate + 1) * 0.5;
  this.alpha=(thickness + 0.2f) * (1 - (float)Math.sqrt(life));
  this.motionY*=0.9f;
  this.motionX*=0.97f;
  this.motionZ*=0.97f;
  this.posX+=this.motionX;
  this.posY+=this.motionY;
  this.posZ+=this.motionZ;
  if (ticks >= this.lifespan) {
    world.removeEntity(this);
  }
}
Program: 171542
Project: 171542
Buggy source:
@SubscribeEvent public static void onWorldTick(WorldTickEvent event){
  if (!event.world.isRemote) {
    ChunkManager.handleWorldTick(event.world);
    WorldServer world=event.world.getMinecraftServer().getWorld(event.world.provider.getDimension());
    List<EntityCoupleableRollingStock> entities=world.getEntities(EntityCoupleableRollingStock.class,EntitySelectors.IS_ALIVE);
    for (    EntityCoupleableRollingStock stock : entities) {
      stock=stock.findByUUID(stock.getPersistentID());
      stock.tickPosRemainingCheck();
    }
  }
}

Fixed version (ground truth):
@SubscribeEvent public static void onWorldTick(WorldTickEvent event){
  if (!event.world.isRemote) {
    ChunkManager.handleWorldTick(event.world);
    WorldServer world=event.world.getMinecraftServer().getWorld(event.world.provider.getDimension());
    List<EntityCoupleableRollingStock> entities=world.getEntities(EntityCoupleableRollingStock.class,EntitySelectors.IS_ALIVE);
    for (    EntityCoupleableRollingStock stock : entities) {
      stock=stock.findByUUID(stock.getPersistentID());
      stock.tickPosRemainingCheck();
    }
  }
  if (event.world.provider.getDimension() == 0) {
    ticks++;
  }
}
Program: 171543
Project: 171543
Buggy source:
public static void draw(BufferBuilder vertexBufferIn){
  if (vertexBufferIn == null) {
    return;
  }
  VertexFormat vertexformat=vertexBufferIn.getVertexFormat();
  int i=vertexformat.getNextOffset();
  ByteBuffer bytebuffer=vertexBufferIn.getByteBuffer();
  List<VertexFormatElement> list=vertexformat.getElements();
  for (int j=0; j < list.size(); ++j) {
    VertexFormatElement vertexformatelement=list.get(j);
    bytebuffer.position(vertexformat.getOffset(j));
    vertexformatelement.getUsage().preDraw(vertexformat,j,i,bytebuffer);
  }
  GL11.glDrawArrays(vertexBufferIn.getDrawMode(),0,vertexBufferIn.getVertexCount());
  int i1=0;
  for (int j1=list.size(); i1 < j1; ++i1) {
    VertexFormatElement vertexformatelement1=list.get(i1);
    vertexformatelement1.getUsage().postDraw(vertexformat,i1,i,bytebuffer);
  }
  try {
    Method cleanerMethod=vertexBufferIn.getClass().getMethod("String_Node_Str");
    cleanerMethod.setAccessible(true);
    Object cleaner=cleanerMethod.invoke(vertexBufferIn);
    Method cleanMethod=cleaner.getClass().getMethod("String_Node_Str");
    cleanMethod.setAccessible(true);
    cleanMethod.invoke(cleaner);
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
}

Fixed version (ground truth):
public static void draw(BufferBuilder vertexBufferIn){
  if (vertexBufferIn == null) {
    return;
  }
  VertexFormat vertexformat=vertexBufferIn.getVertexFormat();
  int i=vertexformat.getNextOffset();
  ByteBuffer bytebuffer=vertexBufferIn.getByteBuffer();
  List<VertexFormatElement> list=vertexformat.getElements();
  for (int j=0; j < list.size(); ++j) {
    VertexFormatElement vertexformatelement=list.get(j);
    bytebuffer.position(vertexformat.getOffset(j));
    vertexformatelement.getUsage().preDraw(vertexformat,j,i,bytebuffer);
  }
  GL11.glDrawArrays(vertexBufferIn.getDrawMode(),0,vertexBufferIn.getVertexCount());
  int i1=0;
  for (int j1=list.size(); i1 < j1; ++i1) {
    VertexFormatElement vertexformatelement1=list.get(i1);
    vertexformatelement1.getUsage().postDraw(vertexformat,i1,i,bytebuffer);
  }
  try {
    ByteBuffer buffer=vertexBufferIn.getByteBuffer();
    Method cleanerMethod=buffer.getClass().getMethod("String_Node_Str");
    cleanerMethod.setAccessible(true);
    Object cleaner=cleanerMethod.invoke(buffer);
    Method cleanMethod=cleaner.getClass().getMethod("String_Node_Str");
    cleanMethod.setAccessible(true);
    cleanMethod.invoke(cleaner);
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
}
Program: 171544
Project: 171544
Buggy source:
public void preInit(FMLPreInitializationEvent event) throws IOException {
  configDir=event.getModConfigurationDirectory().getAbsolutePath() + File.separator + ImmersiveRailroading.MODID;
  cacheDir=configDir + File.separator + "String_Node_Str"+ File.separator+ "String_Node_Str"+ File.separator+ "String_Node_Str"+ File.separator;
  new File(cacheDir).mkdirs();
  DefinitionManager.initDefinitions();
  OreDictionary.registerOre(ImmersiveRailroading.ORE_RAIL_BED,Blocks.BRICK_BLOCK);
  OreDictionary.registerOre(ImmersiveRailroading.ORE_RAIL_BED,Blocks.COBBLESTONE);
  OreDictionary.registerOre(ImmersiveRailroading.ORE_RAIL_BED,new ItemStack(Blocks.CONCRETE,1,OreDictionary.WILDCARD_VALUE));
  OreDictionary.registerOre(ImmersiveRailroading.ORE_RAIL_BED,Blocks.DIRT);
  OreDictionary.registerOre(ImmersiveRailroading.ORE_RAIL_BED,Blocks.GRAVEL);
  OreDictionary.registerOre(ImmersiveRailroading.ORE_RAIL_BED,new ItemStack(Blocks.HARDENED_CLAY,1,OreDictionary.WILDCARD_VALUE));
  OreDictionary.registerOre(ImmersiveRailroading.ORE_RAIL_BED,new ItemStack(Blocks.LOG,1,OreDictionary.WILDCARD_VALUE));
  OreDictionary.registerOre(ImmersiveRailroading.ORE_RAIL_BED,new ItemStack(Blocks.LOG2,1,OreDictionary.WILDCARD_VALUE));
  OreDictionary.registerOre(ImmersiveRailroading.ORE_RAIL_BED,Blocks.NETHER_BRICK);
  OreDictionary.registerOre(ImmersiveRailroading.ORE_RAIL_BED,new ItemStack(Blocks.PLANKS,1,OreDictionary.WILDCARD_VALUE));
}

Fixed version (ground truth):
public void preInit(FMLPreInitializationEvent event) throws IOException {
  configDir=event.getModConfigurationDirectory().getAbsolutePath() + File.separator + ImmersiveRailroading.MODID;
  cacheDir=configDir + File.separator + "String_Node_Str"+ File.separator+ "String_Node_Str"+ File.separator+ "String_Node_Str"+ File.separator;
  new File(configDir).mkdirs();
  new File(cacheDir).mkdirs();
  DefinitionManager.initDefinitions();
  OreDictionary.registerOre(ImmersiveRailroading.ORE_RAIL_BED,Blocks.BRICK_BLOCK);
  OreDictionary.registerOre(ImmersiveRailroading.ORE_RAIL_BED,Blocks.COBBLESTONE);
  OreDictionary.registerOre(ImmersiveRailroading.ORE_RAIL_BED,new ItemStack(Blocks.CONCRETE,1,OreDictionary.WILDCARD_VALUE));
  OreDictionary.registerOre(ImmersiveRailroading.ORE_RAIL_BED,Blocks.DIRT);
  OreDictionary.registerOre(ImmersiveRailroading.ORE_RAIL_BED,Blocks.GRAVEL);
  OreDictionary.registerOre(ImmersiveRailroading.ORE_RAIL_BED,new ItemStack(Blocks.HARDENED_CLAY,1,OreDictionary.WILDCARD_VALUE));
  OreDictionary.registerOre(ImmersiveRailroading.ORE_RAIL_BED,new ItemStack(Blocks.LOG,1,OreDictionary.WILDCARD_VALUE));
  OreDictionary.registerOre(ImmersiveRailroading.ORE_RAIL_BED,new ItemStack(Blocks.LOG2,1,OreDictionary.WILDCARD_VALUE));
  OreDictionary.registerOre(ImmersiveRailroading.ORE_RAIL_BED,Blocks.NETHER_BRICK);
  OreDictionary.registerOre(ImmersiveRailroading.ORE_RAIL_BED,new ItemStack(Blocks.PLANKS,1,OreDictionary.WILDCARD_VALUE));
}
Program: 171546
Project: 171546
Buggy source:
public double[][] createHeightMap(EntityBuildableRollingStock stock){
  double[][] heightMap=new double[xRes][zRes];
  List<RenderComponentType> availComponents=new ArrayList<RenderComponentType>();
  for (  ItemComponentType item : stock.getItemComponents()) {
    availComponents.addAll(item.render);
  }
  for (  List<RenderComponent> rcl : this.renderComponents.values()) {
    for (    RenderComponent rc : rcl) {
      if (availComponents.contains(rc.type)) {
        availComponents.remove(rc.type);
      }
 else       if (rc.type == RenderComponentType.REMAINING && stock.isBuilt()) {
      }
 else {
        continue;
      }
      double[][] pm=partMapCache.get(rc);
      for (int x=0; x < xRes; x++) {
        for (int z=1; z < zRes; z++) {
          heightMap[x][z]=Math.max(heightMap[x][z],pm[x][z]);
        }
      }
    }
  }
  return heightMap;
}

Fixed version (ground truth):
public double[][] createHeightMap(EntityBuildableRollingStock stock){
  double[][] heightMap=new double[xRes][zRes];
  List<RenderComponentType> availComponents=new ArrayList<RenderComponentType>();
  for (  ItemComponentType item : stock.getItemComponents()) {
    availComponents.addAll(item.render);
  }
  for (  List<RenderComponent> rcl : this.renderComponents.values()) {
    for (    RenderComponent rc : rcl) {
      if (availComponents.contains(rc.type)) {
        availComponents.remove(rc.type);
      }
 else       if (rc.type == RenderComponentType.REMAINING && stock.isBuilt()) {
      }
 else {
        continue;
      }
      double[][] pm=partMapCache.get(rc);
      for (int x=0; x < xRes; x++) {
        for (int z=0; z < zRes; z++) {
          heightMap[x][z]=Math.max(heightMap[x][z],pm[x][z]);
        }
      }
    }
  }
  return heightMap;
}