nus-yam/ex-repair huggingface dataset:
Program: 1232
Project: 1232
Buggy source:
public UIScrollBar(Vector2f size,ScrollType scrollType){
  setScrollType(scrollType);
  for (int i=0; i < 3; i++) {
    _scrollGraphicsElements.add(new UIGraphicsElement("String_Node_Str"));
    _scrollGraphicsElements.get(i).setVisible(true);
    addDisplayElement(_scrollGraphicsElements.get(i));
  }
switch (_scrollType) {
case vertical:
    setSize(new Vector2f(15f,size.y));
  setVerticalOptions(size);
break;
case horizontal:
setSize(new Vector2f(size.x,15f));
setHorizontalPositions();
break;
}
}

Fixed version (ground truth):
public UIScrollBar(Vector2f size,ScrollType scrollType){
  setScrollType(scrollType);
switch (_scrollType) {
case vertical:
    setSize(new Vector2f(15f,size.y));
  _scrolBarThumb=new UIScrollBarThumb(getSize(),ScrollType.vertical);
break;
case horizontal:
setSize(new Vector2f(size.x,15f));
_scrolBarThumb=new UIScrollBarThumb(getSize(),ScrollType.horizontal);
break;
}
_scrolBarThumb.setVisible(true);
addDisplayElement(_scrolBarThumb);
}
Program: 1233
Project: 1233
Buggy source:
private void scrolled(float mousePos){
  if (_max < (getScrollBarPosition() + mousePos - _prevMousePos + getScrollBarSize())) {
    mousePos=_max - getScrollBarSize() + _prevMousePos - getScrollBarPosition();
  }
 else   if (_min > (getScrollBarPosition() + mousePos - _prevMousePos)) {
    mousePos=_min + _prevMousePos - getScrollBarPosition();
  }
  _scrollShift=(mousePos - _prevMousePos) / _step;
  setScrollBarPosition((getScrollBarPosition() + mousePos - _prevMousePos));
  _prevMousePos=mousePos;
  for (int i=0; i < _scrollListeners.size(); i++) {
    _scrollListeners.get(i).scrolled(this);
  }
}

Fixed version (ground truth):
private void scrolled(float mousePos){
  if (_max < (_scrolBarThumb.getThumbPosition() + mousePos - _prevMousePos + _scrolBarThumb.getThumbSize())) {
    mousePos=_max - _scrolBarThumb.getThumbSize() + _prevMousePos - _scrolBarThumb.getThumbPosition();
  }
 else   if (_min > (_scrolBarThumb.getThumbPosition() + mousePos - _prevMousePos)) {
    mousePos=_min + _prevMousePos - _scrolBarThumb.getThumbPosition();
  }
  _scrolBarThumb.setThumbPosition((_scrolBarThumb.getThumbPosition() + mousePos - _prevMousePos));
  calculateValue();
  _prevMousePos=mousePos;
  for (int i=0; i < _scrollListeners.size(); i++) {
    _scrollListeners.get(i).scrolled(this);
  }
}
Program: 1234
Project: 1234
Buggy source:
public void setMaxMin(float min,float max){
  _min=min;
  _max=max;
}

Fixed version (ground truth):
public void setMaxMin(float min,float max){
  _min=min;
  _max=max;
switch (_scrollType) {
case vertical:
    setSize(new Vector2f(15f,max));
  break;
case horizontal:
setSize(new Vector2f(max,15f));
break;
}
}
Program: 1235
Project: 1235
Buggy source:
public void setStep(float contentLength,float containerLength){
  try {
    _step=1.0f / (contentLength / containerLength);
    if (_step > 1.0f) {
      _step=1.0f;
    }
  }
 catch (  ArithmeticException e) {
    _step=1.0f;
  }
  _containerLength=containerLength;
}

Fixed version (ground truth):
public void setStep(float contentLength,float containerLength){
  try {
    _step=containerLength / contentLength;
    if (_step > 1.0f) {
      _step=1.0f;
    }
  }
 catch (  ArithmeticException e) {
    _step=1.0f;
  }
  _containerLength=containerLength;
  _contentLength=contentLength;
}
Program: 1236
Project: 1236
Buggy source:
public UIList(Vector2f size){
  setSize(size);
  setCrop(false);
  setCropMargin(new Vector4f(0.0f,25f,0.0f,5f));
  setScrollBarPosition(new Vector2f(getPosition().x + size.x,getPosition().y));
  _borderTop=new UIGraphicsElement("String_Node_Str");
  _borderTop.setVisible(true);
  _borderTop.getTextureSize().set(new Vector2f(256f / 512f,4f / 512f));
  _borderRight=new UIGraphicsElement("String_Node_Str");
  _borderRight.setVisible(true);
  _borderRight.setPosition(new Vector2f(getSize().x,getPosition().y));
  _borderRight.setRotateAngle(90f);
  _borderRight.getTextureSize().set(new Vector2f(256f / 512f,4f / 512f));
  _borderBottom=new UIGraphicsElement("String_Node_Str");
  _borderBottom.setVisible(true);
  _borderBottom.setPosition(new Vector2f(getSize().x,getSize().y));
  _borderBottom.setRotateAngle(180f);
  _borderBottom.getTextureSize().set(new Vector2f(256f / 512f,4f / 512f));
  _borderLeft=new UIGraphicsElement("String_Node_Str");
  _borderLeft.setVisible(true);
  _borderLeft.setRotateAngle(90f);
  _borderLeft.getTextureSize().set(new Vector2f(256f / 512f,4f / 512f));
  addDisplayElement(_borderTop);
  addDisplayElement(_borderRight);
  addDisplayElement(_borderBottom);
  addDisplayElement(_borderLeft);
}

Fixed version (ground truth):
public UIList(Vector2f size){
  setSize(size);
  setCrop(true);
  setCropMargin(new Vector4f(0.0f,25f,0.0f,5f));
  setScrollBarPosition(new Vector2f(getPosition().x + size.x,getPosition().y));
  _borderTop=new UIGraphicsElement("String_Node_Str");
  _borderTop.setVisible(true);
  _borderTop.getTextureSize().set(new Vector2f(256f / 512f,4f / 512f));
  _borderRight=new UIGraphicsElement("String_Node_Str");
  _borderRight.setVisible(true);
  _borderRight.setPosition(new Vector2f(getSize().x,getPosition().y));
  _borderRight.setRotateAngle(90f);
  _borderRight.getTextureSize().set(new Vector2f(256f / 512f,4f / 512f));
  _borderBottom=new UIGraphicsElement("String_Node_Str");
  _borderBottom.setVisible(true);
  _borderBottom.setPosition(new Vector2f(getSize().x,getSize().y));
  _borderBottom.setRotateAngle(180f);
  _borderBottom.getTextureSize().set(new Vector2f(256f / 512f,4f / 512f));
  _borderLeft=new UIGraphicsElement("String_Node_Str");
  _borderLeft.setVisible(true);
  _borderLeft.setRotateAngle(90f);
  _borderLeft.getTextureSize().set(new Vector2f(256f / 512f,4f / 512f));
  addDisplayElement(_borderTop);
  addDisplayElement(_borderRight);
  addDisplayElement(_borderBottom);
  addDisplayElement(_borderLeft);
}
Program: 1237
Project: 1237
Buggy source:
public void update(){
  Vector2f mousePos=new Vector2f(Mouse.getX(),Display.getHeight() - Mouse.getY());
  if (intersects(mousePos)) {
    for (int i=(_items.size() - 1); i >= 0; i--) {
      UIListItem item=_items.get(i);
      if (item.isVisible()) {
        if (item.intersects(mousePos)) {
          if (_mouseDown) {
            _items.get(_selectedItemIndex).setSelected(false);
            item.setSelected(true);
            _selectedItem=item;
            _selectedItemIndex=i;
            _mouseDown=false;
          }
        }
      }
    }
  }
 else {
    _mouseUp=false;
    _mouseDown=false;
  }
  updateBorders();
  super.update();
}

Fixed version (ground truth):
public void update(){
  Vector2f mousePos=new Vector2f(Mouse.getX(),Display.getHeight() - Mouse.getY());
  if (intersects(mousePos)) {
    for (int i=(_items.size() - 1); i >= 0; i--) {
      UIListItem item=_items.get(i);
      if (item.isVisible()) {
        if (item.intersects(mousePos)) {
          if (_mouseDown) {
            if (_selectedItemIndex > 0) {
              _items.get(_selectedItemIndex).setSelected(false);
            }
            item.setSelected(true);
            _selectedItem=item;
            _selectedItemIndex=i;
            _mouseDown=false;
          }
        }
      }
    }
  }
 else {
    _mouseUp=false;
    _mouseDown=false;
  }
  updateBorders();
  super.update();
}
Program: 1238
Project: 1238
Buggy source:
public void removeSelectedItem(){
  Vector2f deletedElementPosition=_items.get(_selectedItemIndex).getPosition();
  removeDisplayElement(_selectedItem);
  _items.remove(_selectedItemIndex);
  for (int i=_selectedItemIndex; i < _items.size(); i++) {
    _items.get(i).getPosition().y-=32f;
  }
  _selectedItemIndex=_items.size() - 1;
}

Fixed version (ground truth):
public void removeSelectedItem(){
  if (_selectedItemIndex < 0 || _selectedItem == null) {
    return;
  }
  Vector2f deletedElementPosition=_items.get(_selectedItemIndex).getPosition();
  removeDisplayElement(_selectedItem);
  _items.remove(_selectedItemIndex);
  _selectedItem=null;
  for (int i=_selectedItemIndex; i < _items.size(); i++) {
    _items.get(i).getPosition().y-=32f;
  }
  if (_selectedItemIndex > _items.size() - 1) {
    if (_items.size() - 1 >= 0) {
      _selectedItemIndex=_items.size() - 1;
      _items.get(_selectedItemIndex).setSelected(true);
    }
 else {
      _selectedItemIndex=-1;
    }
  }
  if (_selectedItemIndex >= 0) {
    _selectedItem=_items.get(_selectedItemIndex);
    _selectedItem.setSelected(true);
  }
}
Program: 1239
Project: 1239
Buggy source:
public UIListItem(Vector2f size,String text,Object value){
  setSize(size);
  _text=text;
  _value=value;
  _label=new UIText();
  _label.setVisible(true);
  _label.setColor(Color.red);
  _label.setPosition(new Vector2f((getPosition().x + _padding.x),(getPosition().y + _padding.y)));
  _label.setText(_text);
  addDisplayElement(_label);
}

Fixed version (ground truth):
public UIListItem(Vector2f size,String text,Object value){
  setSize(size);
  _text=text;
  _value=value;
  _label=new UIText();
  _label.setVisible(true);
  _label.setColor(Color.black);
  _label.setPosition(new Vector2f((getPosition().x + _padding.x),(getPosition().y + _padding.y)));
  _label.setText(_text);
  addDisplayElement(_label);
}
Program: 1240
Project: 1240
Buggy source:
public void setSelected(boolean selected){
  _isSelected=selected;
  if (_isSelected) {
    _label.setColor(Color.orange);
  }
 else {
    _label.setColor(Color.red);
  }
}

Fixed version (ground truth):
public void setSelected(boolean selected){
  _isSelected=selected;
  if (_isSelected) {
    _label.setColor(Color.orange);
  }
 else {
    _label.setColor(Color.black);
  }
}
Program: 1241
Project: 1241
Buggy source:
private void setHorizontalPositions(){
}

Fixed version (ground truth):
private void setHorizontalPositions(){
  _scrollGraphicsElements.get(0).setPosition(getPosition());
  _scrollGraphicsElements.get(0).setSize(new Vector2f(7f,15f));
  _scrollGraphicsElements.get(0).getTextureSize().set(new Vector2f(7f / 512f,15f / 512f));
  _scrollGraphicsElements.get(1).setPosition(new Vector2f(getPosition().x + _scrollGraphicsElements.get(0).getSize().x,getPosition().y));
  _scrollGraphicsElements.get(1).getTextureSize().set(new Vector2f(10f / 512f,15f / 512f));
  _scrollGraphicsElements.get(2).setRotateAngle(180);
  _scrollGraphicsElements.get(2).setPosition(new Vector2f((getPosition().x + 2 * _scrollGraphicsElements.get(0).getTextureSize().x + _scrollGraphicsElements.get(1).getSize().x),getPosition().y));
  _scrollGraphicsElements.get(2).setSize(new Vector2f(7f,15f));
  _scrollGraphicsElements.get(2).getTextureSize().set(new Vector2f(7f / 512f,15f / 512f));
}
Program: 1242
Project: 1242
Buggy source:
public void render(){
  super.render();
  updateCameraParameters();
  if (SHOW_PLACING_BOX) {
    if (_selectedBlock != null) {
      Block block=BlockManager.getInstance().getBlock(_parent.getWorldProvider().getBlockAtPosition(_selectedBlock.getBlockPosition().toVector3d()));
      if (block.isRenderBoundingBox()) {
        block.getBounds(_selectedBlock.getBlockPosition()).render(8f);
      }
    }
  }
  if (isRenderPlayerModel())   getAABB().render(4f);
}

Fixed version (ground truth):
public void render(){
  super.render();
  updateCameraParameters();
  if (SHOW_PLACING_BOX) {
    if (_selectedBlock != null) {
      Block block=BlockManager.getInstance().getBlock(_parent.getWorldProvider().getBlockAtPosition(_selectedBlock.getBlockPosition().toVector3d()));
      if (block.isRenderBoundingBox()) {
        block.getBounds(_selectedBlock.getBlockPosition()).render(2f);
      }
    }
  }
  if (isRenderPlayerModel())   getAABB().render(1f);
}
Program: 1243
Project: 1243
Buggy source:
/** 
 * Updates the status if the entity is currently swimming (in water).
 */
private void updateSwimStatus(){
  ArrayList<BlockPosition> blockPositions=gatherAdjacentBlockPositions(getPosition());
  boolean swimming=false, headUnderWater=false;
  Vector3d eyePos=calcEyePosition();
  eyePos.y+=0.25;
  for (int i=0; i < blockPositions.size(); i++) {
    BlockPosition p=blockPositions.get(i);
    byte blockType=_parent.getWorldProvider().getBlockAtPosition(new Vector3d(p.x,p.y,p.z));
    Block block=BlockManager.getInstance().getBlock(blockType);
    if (block.isLiquid()) {
      for (      AABB blockAABB : block.getColliders(p.x,p.y,p.z)) {
        if (getAABB().overlaps(blockAABB)) {
          swimming=true;
          if (blockAABB.contains(eyePos)) {
            headUnderWater=true;
            break;
          }
        }
      }
    }
  }
  _headUnderWater=headUnderWater;
  _isSwimming=swimming;
}

Fixed version (ground truth):
/** 
 * Updates the status if the entity is currently swimming (in water).
 */
private void updateSwimStatus(){
  ArrayList<BlockPosition> blockPositions=gatherAdjacentBlockPositions(getPosition());
  boolean swimming=false, headUnderWater=false;
  Vector3d eyePos=calcEyePosition();
  eyePos.y+=0.25;
  for (int i=0; i < blockPositions.size(); i++) {
    BlockPosition p=blockPositions.get(i);
    byte blockType=_parent.getWorldProvider().getBlockAtPosition(new Vector3d(p.x,p.y,p.z));
    Block block=BlockManager.getInstance().getBlock(blockType);
    if (block.isLiquid()) {
      for (      AABB blockAABB : block.getColliders(p.x,p.y,p.z)) {
        if (getAABB().overlaps(blockAABB)) {
          swimming=true;
        }
        if (swimming=true) {
          if (blockAABB.contains(eyePos)) {
            headUnderWater=true;
            break;
          }
        }
      }
    }
  }
  _headUnderWater=headUnderWater;
  _isSwimming=swimming;
}
Program: 1244
Project: 1244
Buggy source:
public void render(){
  setViewingDirection(_yaw,_pitch);
  if (Config.getInstance().isDebugCollision()) {
    getAABB().render(2f);
    ArrayList<BlockPosition> blocks=gatherAdjacentBlockPositions(getPosition());
    for (int i=0; i < blocks.size(); i++) {
      BlockPosition p=blocks.get(i);
      byte blockType=_parent.getWorldProvider().getBlockAtPosition(new Vector3d(p.x,p.y,p.z));
      Block block=BlockManager.getInstance().getBlock(blockType);
      for (      AABB blockAABB : block.getColliders(p.x,p.y,p.z)) {
        blockAABB.render(2f);
      }
    }
  }
}

Fixed version (ground truth):
public void render(){
  setViewingDirection(_yaw,_pitch);
  if (Config.getInstance().isDebugCollision()) {
    getAABB().render(1f);
    ArrayList<BlockPosition> blocks=gatherAdjacentBlockPositions(getPosition());
    for (int i=0; i < blocks.size(); i++) {
      BlockPosition p=blocks.get(i);
      byte blockType=_parent.getWorldProvider().getBlockAtPosition(new Vector3d(p.x,p.y,p.z));
      Block block=BlockManager.getInstance().getBlock(blockType);
      for (      AABB blockAABB : block.getColliders(p.x,p.y,p.z)) {
        blockAABB.render(1f);
      }
    }
  }
}
Program: 1245
Project: 1245
Buggy source:
/** 
 * Draws the opaque or translucent elements of a chunk.
 * @param type The type of vertices to render
 */
public void render(ChunkMesh.RENDER_PHASE type){
  if (isReadyForRendering()) {
    ShaderProgram shader=ShaderManager.getInstance().getShaderProgram("String_Node_Str");
    shader.setFloat3("String_Node_Str",(float)(getPosition().x * Chunk.CHUNK_DIMENSION_X),(float)(getPosition().y * Chunk.CHUNK_DIMENSION_Y),(float)(getPosition().z * Chunk.CHUNK_DIMENSION_Z));
    GL11.glPushMatrix();
    Vector3d cameraPosition=Terasology.getInstance().getActiveCamera().getPosition();
    GL11.glTranslated(getPosition().x * Chunk.CHUNK_DIMENSION_X - cameraPosition.x,getPosition().y * Chunk.CHUNK_DIMENSION_Y - cameraPosition.y,getPosition().z * Chunk.CHUNK_DIMENSION_Z - cameraPosition.z);
    for (int i=0; i < VERTICAL_SEGMENTS; i++) {
      if (!isSubMeshEmpty(i)) {
        if (Config.getInstance().isRenderChunkBoundingBoxes()) {
          getSubMeshAABB(i).renderLocally(2f);
          _statRenderedTriangles+=12;
        }
        shader.enable();
        _activeMeshes[i].render(type);
        _statRenderedTriangles+=_activeMeshes[i].triangleCount();
      }
    }
    GL11.glPopMatrix();
  }
 else {
    _statChunkNotReady++;
  }
}

Fixed version (ground truth):
/** 
 * Draws the opaque or translucent elements of a chunk.
 * @param type The type of vertices to render
 */
public void render(ChunkMesh.RENDER_PHASE type){
  if (isReadyForRendering()) {
    ShaderProgram shader=ShaderManager.getInstance().getShaderProgram("String_Node_Str");
    shader.setFloat3("String_Node_Str",(float)(getPosition().x * Chunk.CHUNK_DIMENSION_X),(float)(getPosition().y * Chunk.CHUNK_DIMENSION_Y),(float)(getPosition().z * Chunk.CHUNK_DIMENSION_Z));
    GL11.glPushMatrix();
    Vector3d cameraPosition=Terasology.getInstance().getActiveCamera().getPosition();
    GL11.glTranslated(getPosition().x * Chunk.CHUNK_DIMENSION_X - cameraPosition.x,getPosition().y * Chunk.CHUNK_DIMENSION_Y - cameraPosition.y,getPosition().z * Chunk.CHUNK_DIMENSION_Z - cameraPosition.z);
    for (int i=0; i < VERTICAL_SEGMENTS; i++) {
      if (!isSubMeshEmpty(i)) {
        if (Config.getInstance().isRenderChunkBoundingBoxes()) {
          getSubMeshAABB(i).renderLocally(1f);
          _statRenderedTriangles+=12;
        }
        shader.enable();
        _activeMeshes[i].render(type);
        _statRenderedTriangles+=_activeMeshes[i].triangleCount();
      }
    }
    GL11.glPopMatrix();
  }
 else {
    _statChunkNotReady++;
  }
}
Program: 1247
Project: 1247
Buggy source:
/** 
 * Returns true if no more chunks can be generated.
 * @return
 */
public boolean generateChunk(){
  updateChunksInProximity(false);
  for (int i=0; i < _chunksInProximity.size(); i++) {
    Chunk c=_chunksInProximity.get(i);
    if (c.isDirty() || c.isLightDirty() || c.isFresh()) {
      c.processChunk();
      c.generateVBOs();
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Returns true if no more chunks can be generated.
 * @return
 */
public boolean generateChunk(){
  for (int i=0; i < _chunksInProximity.size(); i++) {
    Chunk c=_chunksInProximity.get(i);
    if (c.isDirty() || c.isLightDirty() || c.isFresh()) {
      c.processChunk();
      c.generateVBOs();
      return false;
    }
  }
  return true;
}
Program: 1248
Project: 1248
Buggy source:
/** 
 * Sets a new player and spawns him at the spawning point.
 * @param p The player
 */
public void setPlayer(Player p){
  if (_player != null) {
    _player.unregisterObserver(_chunkUpdateManager);
    _player.unregisterObserver(_worldProvider.getGrowthSimulator());
    _player.unregisterObserver(_worldProvider.getLiquidSimulator());
  }
  _player=p;
  _player.registerObserver(_chunkUpdateManager);
  _player.registerObserver(_worldProvider.getGrowthSimulator());
  _player.registerObserver(_worldProvider.getLiquidSimulator());
  _player.load();
  _player.setSpawningPoint(_worldProvider.nextSpawningPoint());
  _player.reset();
  if (_player.getPosition().equals(new Vector3d(0.0,0.0,0.0))) {
    _player.respawn();
  }
}

Fixed version (ground truth):
/** 
 * Sets a new player and spawns him at the spawning point.
 * @param p The player
 */
public void setPlayer(Player p){
  if (_player != null) {
    _player.unregisterObserver(_chunkUpdateManager);
    _player.unregisterObserver(_worldProvider.getGrowthSimulator());
    _player.unregisterObserver(_worldProvider.getLiquidSimulator());
  }
  _player=p;
  _player.registerObserver(_chunkUpdateManager);
  _player.registerObserver(_worldProvider.getGrowthSimulator());
  _player.registerObserver(_worldProvider.getLiquidSimulator());
  _player.load();
  _player.setSpawningPoint(_worldProvider.nextSpawningPoint());
  updateChunksInProximity(true);
  _player.reset();
  if (_player.getPosition().equals(new Vector3d(0.0,0.0,0.0))) {
    _player.respawn();
  }
}
Program: 1249
Project: 1249
Buggy source:
public SoundSource setAudio(Sound sound){
  if (sound == null || sound.equals(this.audio)) {
    return this;
  }
  boolean playing=isPlaying();
  if (playing) {
    this.stop();
  }
  if (sound instanceof AbstractSound) {
    this.audio=(AbstractSound)sound;
    AL10.alSourcei(this.getSourceId(),AL10.AL_BUFFER,this.audio.getBufferId());
    OpenALException.checkState("String_Node_Str");
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (playing) {
    this.play();
  }
  return this;
}

Fixed version (ground truth):
public SoundSource setAudio(Sound sound){
  boolean playing=isPlaying();
  if (playing) {
    this.stop();
  }
  this.reset();
  if (sound instanceof AbstractSound) {
    this.audio=(AbstractSound)sound;
    AL10.alSourcei(this.getSourceId(),AL10.AL_BUFFER,this.audio.getBufferId());
    OpenALException.checkState("String_Node_Str");
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (playing) {
    this.play();
  }
  return this;
}
Program: 1250
Project: 1250
Buggy source:
private void updateFade(){
  if (!fade) {
    return;
  }
  float delta=(this.srcGain - this.targetGain) / 100;
  System.out.println("String_Node_Str" + this.audio.getName());
  this.setGain(this.getGain() - delta);
  if (this.getGain() >= this.targetGain) {
    if (this.targetGain == 0.0f) {
      this.stop();
    }
    fade=false;
  }
}

Fixed version (ground truth):
private void updateFade(){
  if (!fade) {
    return;
  }
  float delta=(this.srcGain - this.targetGain) / 100;
  this.setGain(this.getGain() - delta);
  if (this.getGain() >= this.targetGain) {
    if (this.targetGain == 0.0f) {
      this.stop();
    }
    fade=false;
  }
}
Program: 1251
Project: 1251
Buggy source:
public void load(File file){
  if (file == null || !file.exists()) {
    throw new IllegalArgumentException("String_Node_Str" + file.getName() + "String_Node_Str");
  }
  try {
    this.load(new FileInputStream(file));
  }
 catch (  IOException e) {
    throw new IllegalStateException("String_Node_Str" + e.getMessage(),e);
  }
}

Fixed version (ground truth):
public void load(URL source){
  try {
    this.load(source.openStream());
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}
Program: 1252
Project: 1252
Buggy source:
public AbstractStreamingSound(String name,InputStream source){
  super(name,source);
  this.audioStream=source;
  this.initializeBuffers();
}

Fixed version (ground truth):
public AbstractStreamingSound(String name,URL source){
  super(name);
  this.audioSource=source;
  this.initializeBuffers();
  this.reset();
}
Program: 1253
Project: 1253
Buggy source:
public void update(){
  this.updateFade();
  if (this.absolutePosition) {
    updatePosition(this.position);
  }
  if (_playing && alGetSourcei(this.sourceId,AL_SOURCE_STATE) != AL_PLAYING) {
    _playing=false;
  }
}

Fixed version (ground truth):
public void update(){
  this.updateFade();
  if (this.absolutePosition) {
    updatePosition(this.position);
  }
  this.updateState();
}
Program: 1254
Project: 1254
Buggy source:
public SoundSource setLooping(boolean looping){
  AL10.alSourcei(this.getSourceId(),AL10.AL_LOOPING,looping ? AL10.AL_TRUE : AL10.AL_FALSE);
  OpenALException.checkState("String_Node_Str");
  return this;
}

Fixed version (ground truth):
public SoundSource setLooping(boolean looping){
  alSourcei(this.getSourceId(),AL_LOOPING,looping ? AL_TRUE : AL_FALSE);
  OpenALException.checkState("String_Node_Str");
  return this;
}
Program: 1255
Project: 1255
Buggy source:
private void updateFade(){
  if (!fade) {
    return;
  }
  float delta=(this.srcGain - this.targetGain) / 10;
  this.setGain(this.srcGain - delta);
  if (this.getGain() == this.targetGain) {
    if (this.targetGain == 0.0f) {
      this.stop();
    }
    fade=false;
  }
}

Fixed version (ground truth):
private void updateFade(){
  if (!fade) {
    return;
  }
  float delta=(this.srcGain - this.targetGain) / 100;
  System.out.println("String_Node_Str" + this.audio.getName());
  this.setGain(this.getGain() - delta);
  if (this.getGain() >= this.targetGain) {
    if (this.targetGain == 0.0f) {
      this.stop();
    }
    fade=false;
  }
}
Program: 1256
Project: 1256
Buggy source:
public SoundSource stop(){
  alSourceRewind(this.getSourceId());
  AL10.alSourceStop(this.getSourceId());
  OpenALException.checkState("String_Node_Str");
  _playing=false;
  return this;
}

Fixed version (ground truth):
public SoundSource stop(){
  if (this.audio != null) {
    this.audio.reset();
  }
  alSourceStop(this.getSourceId());
  alSourceRewind(this.getSourceId());
  OpenALException.checkState("String_Node_Str");
  _playing=false;
  return this;
}
Program: 1257
Project: 1257
Buggy source:
@Override public void update(){
  int buffersProcessed=AL10.alGetSourcei(this.getSourceId(),AL10.AL_BUFFERS_PROCESSED);
  while (buffersProcessed-- > 0) {
    int buffer=AL10.alSourceUnqueueBuffers(this.getSourceId());
    if (((AbstractStreamingSound)audio).updateBuffer(buffer)) {
      AL10.alSourceQueueBuffers(this.getSourceId(),buffer);
    }
 else {
      _playing=false;
      continue;
    }
    OpenALException.checkState("String_Node_Str");
  }
  int state=AL10.alGetSourcei(getSourceId(),AL10.AL_SOURCE_STATE);
  if (_playing && state != AL10.AL_PLAYING) {
    AL10.alSourcePlay(this.getSourceId());
  }
  super.update();
}

Fixed version (ground truth):
@Override public void update(){
  System.out.println("String_Node_Str" + this.sourceId + "String_Node_Str"+ _playing+ "String_Node_Str"+ alGetSourcei(this.sourceId,AL_SOURCE_STATE));
  int buffersProcessed=alGetSourcei(this.getSourceId(),AL_BUFFERS_PROCESSED);
  while (buffersProcessed-- > 0) {
    int buffer=alSourceUnqueueBuffers(this.getSourceId());
    OpenALException.checkState("String_Node_Str");
    System.out.println("String_Node_Str" + buffer + "String_Node_Str"+ this.audio.getName()+ "String_Node_Str"+ this.sourceId);
    if (((AbstractStreamingSound)audio).updateBuffer(buffer)) {
      alSourceQueueBuffers(this.getSourceId(),buffer);
      OpenALException.checkState("String_Node_Str");
    }
 else {
      _playing=false;
      continue;
    }
  }
  super.update();
}
Program: 1258
Project: 1258
Buggy source:
public SoundSource setAudio(Sound sound){
  if (sound == null || sound.equals(this.audio)) {
    return this;
  }
  if (sound instanceof AbstractStreamingSound) {
    AbstractStreamingSound asa=(AbstractStreamingSound)sound;
    this.audio=asa;
    int[] buffers=asa.getBuffers();
    for (    int buffer : buffers) {
      asa.updateBuffer(buffer);
    }
    AL10.alSourceQueueBuffers(this.getSourceId(),(IntBuffer)BufferUtils.createIntBuffer(buffers.length).put(buffers).flip());
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
  return this;
}

Fixed version (ground truth):
public SoundSource setAudio(Sound sound){
  boolean playing=this.isPlaying();
  if (playing) {
    alSourceStop(this.sourceId);
    alSourceRewind(this.sourceId);
  }
  if (sound instanceof AbstractStreamingSound) {
    alSourcei(this.getSourceId(),AL_BUFFER,0);
    AbstractStreamingSound asa=(AbstractStreamingSound)sound;
    this.audio=asa;
    asa.reset();
    int[] buffers=asa.getBuffers();
    for (    int buffer : buffers) {
      asa.updateBuffer(buffer);
    }
    alSourceQueueBuffers(this.getSourceId(),(IntBuffer)BufferUtils.createIntBuffer(buffers.length).put(buffers).flip());
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (playing) {
    this.play();
  }
  return this;
}
Program: 1259
Project: 1259
Buggy source:
public void load(InputStream stream){
  if (stream == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  try {
    ByteArrayOutputStream bos=new ByteArrayOutputStream();
    OggReader reader=new OggReader(stream);
    FileOutputStream fos=new FileOutputStream("String_Node_Str");
    byte buffer[]=new byte[1024];
    int read;
    int totalRead=0;
    do {
      read=reader.read(buffer,0,buffer.length);
      if (read < 0) {
        break;
      }
      totalRead+=read;
      bos.write(buffer,0,read);
      fos.write(buffer,0,read);
    }
 while (read > 0);
    buffer=bos.toByteArray();
    ByteBuffer data=BufferUtils.createByteBuffer(totalRead).put(buffer);
    data.flip();
    this.channels=reader.getChannels();
    int sampleRate=reader.getRate();
    AL10.alBufferData(this.getBufferId(),this.channels == 1 ? AL10.AL_FORMAT_MONO16 : AL10.AL_FORMAT_STEREO16,data,sampleRate);
    OpenALException.checkState("String_Node_Str");
  }
 catch (  IOException e) {
    throw new IllegalStateException("String_Node_Str" + e.getMessage(),e);
  }
}

Fixed version (ground truth):
public void load(InputStream stream){
  if (stream == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  try {
    ByteArrayOutputStream bos=new ByteArrayOutputStream();
    OggReader reader=new OggReader(stream);
    byte buffer[]=new byte[1024];
    int read;
    int totalRead=0;
    do {
      read=reader.read(buffer,0,buffer.length);
      if (read < 0) {
        break;
      }
      totalRead+=read;
      bos.write(buffer,0,read);
    }
 while (read > 0);
    buffer=bos.toByteArray();
    ByteBuffer data=BufferUtils.createByteBuffer(totalRead).put(buffer);
    data.flip();
    this.channels=reader.getChannels();
    int sampleRate=reader.getRate();
    AL10.alBufferData(this.getBufferId(),this.channels == 1 ? AL10.AL_FORMAT_MONO16 : AL10.AL_FORMAT_STEREO16,data,sampleRate);
    OpenALException.checkState("String_Node_Str");
  }
 catch (  IOException e) {
    throw new IllegalStateException("String_Node_Str" + e.getMessage(),e);
  }
}
Program: 1260
Project: 1260
Buggy source:
public OggSound(String name){
  super(name);
}

Fixed version (ground truth):
public OggSound(String name,URL source){
  super(name,source);
}
Program: 1261
Project: 1261
Buggy source:
@Override protected ByteBuffer fetchData(){
  try {
    int read=file.read(dataBuffer,0,dataBuffer.capacity());
    dataBuffer.rewind();
    if (read <= 0) {
      return null;
    }
    return dataBuffer;
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
@Override protected ByteBuffer fetchData(){
  try {
    int read=file.read(dataBuffer,0,dataBuffer.capacity());
    dataBuffer.rewind();
    System.out.println("String_Node_Str" + read);
    if (read <= 0) {
      return null;
    }
    return dataBuffer;
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}
Program: 1262
Project: 1262
Buggy source:
@Override public void load(InputStream stream){
  super.load(stream);
  this.file=new OggReader(stream);
}

Fixed version (ground truth):
public void load(InputStream stream){
  if (this.file != null) {
    try {
      this.file.close();
    }
 catch (    IOException e) {
    }
  }
  this.file=new OggReader(stream);
}
Program: 1263
Project: 1263
Buggy source:
public OggStreamingSound(String name,InputStream source){
  super(name,source);
}

Fixed version (ground truth):
public OggStreamingSound(String name,URL source){
  super(name,source);
}
Program: 1264
Project: 1264
Buggy source:
public void update(){
  _defaultTexture.setSize(getSize());
  Vector2f mousePos=new Vector2f(Mouse.getX(),Display.getHeight() - Mouse.getY());
  if (intersects(mousePos)) {
    if (!_clickSoundPlayed) {
      AudioManager.getInstance().getAudio("String_Node_Str").playAsSoundEffect(1.0f,0.5f,false);
      _clickSoundPlayed=true;
    }
    if (_mouseUp) {
      _mouseUp=false;
    }
    if (_mouseDown) {
      clicked();
    }
  }
 else {
    if (_mouseDown) {
      _focused=false;
    }
    _clickSoundPlayed=false;
    _mouseUp=false;
    _mouseDown=false;
    _defaultTexture.getTextureOrigin().set(0f,90f / 512f);
  }
  if (_focused) {
    _defaultTexture.getTextureOrigin().set(0f,120f / 512f);
  }
 else {
    _defaultTexture.getTextureOrigin().set(0f,90f / 512f);
  }
  _inputText.setText(_inputValue.toString());
}

Fixed version (ground truth):
public void update(){
  _defaultTexture.setSize(getSize());
  Vector2f mousePos=new Vector2f(Mouse.getX(),Display.getHeight() - Mouse.getY());
  if (intersects(mousePos)) {
    if (!_clickSoundPlayed) {
      AudioManager.getInstance().getAudio("String_Node_Str").playAsSoundEffect(1.0f,0.5f,false);
      _clickSoundPlayed=true;
    }
    if (_mouseUp) {
      _mouseUp=false;
    }
    if (_mouseDown) {
      clicked();
    }
  }
 else {
    if (_mouseDown) {
      _focused=false;
    }
    _clickSoundPlayed=false;
    _mouseUp=false;
    _mouseDown=false;
    _defaultTexture.getTextureOrigin().set(0f,90f / 512f);
  }
  if (_focused) {
    if (!_textCursor.isVisible()) {
      _textCursor.setVisible(true);
    }
    _defaultTexture.getTextureOrigin().set(0f,120f / 512f);
  }
 else {
    if (_textCursor.isVisible()) {
      _textCursor.setVisible(false);
    }
    _defaultTexture.getTextureOrigin().set(0f,90f / 512f);
  }
  float textWidthWhithPos=_inputText.getTextWidth() + _inputText.getPosition().x + getPosition().x;
  if (textWidthWhithPos > (getPosition().x + getSize().x)) {
    _inputText.setPosition(new Vector2f((_inputText.getPosition().x - 8f),_inputText.getPosition().y));
  }
}
Program: 1265
Project: 1265
Buggy source:
public void processKeyboardInput(int key){
  if (_focused) {
    if (key == Keyboard.KEY_BACK) {
      int length=_inputValue.length() - 1;
      if (length < 0) {
        length=0;
      }
      _inputValue.setLength(length);
    }
 else {
      char c=Keyboard.getEventCharacter();
      _inputValue.append(c);
    }
  }
}

Fixed version (ground truth):
public void processKeyboardInput(int key){
  System.out.println(_inputText.getPosition().x);
  System.out.println(getPosition().x);
  System.out.println(_inputText.getTextWidth());
  System.out.println(getSize().x);
  System.out.println("String_Node_Str");
  if (_focused) {
    if (key == Keyboard.KEY_BACK) {
      int length=_inputValue.length() - 1;
      if (length < 0) {
        length=0;
      }
      _inputValue.setLength(length);
      float textPosition=_inputText.getPosition().x;
      if (textPosition < 0) {
        if (textPosition + 8f > 0 && textPosition + 8f < _padding.x) {
          _inputText.setPosition(new Vector2f(_padding.x,_inputText.getPosition().y));
        }
 else {
          _inputText.setPosition(new Vector2f(textPosition + 8f,_inputText.getPosition().y));
        }
      }
    }
 else {
      char c=Keyboard.getEventCharacter();
      if (c >= 'a' && c < 'z' + 1 || c >= '0' && c < '9' + 1 || c >= 'A' && c < 'Z' + 1 || c == ' ' || c == '_' || c == '.' || c == ',' || c == '!' || c == '-' || c == '(' || c == ')' || c == '"' || c == '\'' || c == ';' || c == '+') {
        _inputValue.append(c);
      }
    }
    _inputText.setText(_inputValue.toString());
    _textCursor.setPosition(new Vector2f(_padding.x / 2 + _inputText.getTextWidth() / 2,(_textCursor.getPosition().y)));
  }
}
Program: 1266
Project: 1266
Buggy source:
public UIInput(Vector2f size){
  setSize(size);
  setCrop(true);
  _defaultTexture=new UIGraphicsElement("String_Node_Str");
  _defaultTexture.setVisible(true);
  _defaultTexture.getTextureSize().set(new Vector2f(256f / 512f,30f / 512f));
  _inputText=new UIText();
  _inputText.setVisible(true);
  _inputText.setColor(Color.red);
  _inputText.setPosition(new Vector2f((getPosition().x + _padding.x),(getPosition().y + _padding.y)));
  addDisplayElement(_defaultTexture);
  addDisplayElement(_inputText);
}

Fixed version (ground truth):
public UIInput(Vector2f size){
  setSize(size);
  setCrop(true);
  _defaultTexture=new UIGraphicsElement("String_Node_Str");
  _defaultTexture.setVisible(true);
  _defaultTexture.getTextureSize().set(new Vector2f(256f / 512f,30f / 512f));
  _inputText=new UIText();
  _inputText.setVisible(true);
  _inputText.setPosition(new Vector2f((getPosition().x + _padding.x),(getPosition().y + _padding.y)));
  _textCursor=new UITextCursor();
  _textCursor.setVisible(false);
  _textCursor.setPosition(new Vector2f((getPosition().x + _padding.x + _inputText.getTextWidth()),(getPosition().y + _padding.y / 2)));
  System.out.println("String_Node_Str" + _textCursor.getPosition());
  addDisplayElement(_defaultTexture);
  addDisplayElement(_inputText);
  addDisplayElement(_textCursor);
}
Program: 1267
Project: 1267
Buggy source:
public void clicked(){
  System.out.println("String_Node_Str" + Mouse.getX() + "String_Node_Str"+ (Display.getHeight() - Mouse.getY()));
  System.out.println("String_Node_Str" + getPosition().y + "String_Node_Str"+ (Display.getHeight() - Mouse.getY()));
  _focused=true;
}

Fixed version (ground truth):
public void clicked(){
  _focused=true;
}
Program: 1269
Project: 1269
Buggy source:
public void render(){
  super.render();
  glPushMatrix();
  glTranslatef(getPosition().x - _parent.getWorldProvider().getRenderingReferencePoint().x,getPosition().y - _parent.getWorldProvider().getRenderingReferencePoint().y,getPosition().z - _parent.getWorldProvider().getRenderingReferencePoint().z);
  glRotatef((float)_yaw,0f,1f,0f);
  TextureManager.getInstance().bindTexture("String_Node_Str");
  ShaderManager.getInstance().enableShader("String_Node_Str");
  int tick=GL20.glGetUniformLocation(ShaderManager.getInstance().getShader("String_Node_Str"),"String_Node_Str");
  GL20.glUniform1f(tick,_parent.getTick());
  int cOffset=GL20.glGetUniformLocation(ShaderManager.getInstance().getShader("String_Node_Str"),"String_Node_Str");
  GL20.glUniform4f(cOffset,COLORS[_randomColorId].x,COLORS[_randomColorId].y,COLORS[_randomColorId].z,1.0f);
  int light=GL20.glGetUniformLocation(ShaderManager.getInstance().getShader("String_Node_Str"),"String_Node_Str");
  GL20.glUniform1f(light,calcLightValue());
  if (_displayListOuterBody == -1 || _displayListInnerBody == -1) {
    generateDisplayList();
  }
  glEnable(GL_BLEND);
  glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
  glPushMatrix();
  glScalef(_randomSize,_randomSize,_randomSize);
  glCallList(_displayListInnerBody);
  glCallList(_displayListOuterBody);
  glPopMatrix();
  ShaderManager.getInstance().enableShader(null);
  glPopMatrix();
}

Fixed version (ground truth):
public void render(){
  super.render();
  glPushMatrix();
  glTranslatef(getPosition().x - _parent.getWorldProvider().getRenderingReferencePoint().x,getPosition().y - _parent.getWorldProvider().getRenderingReferencePoint().y,getPosition().z - _parent.getWorldProvider().getRenderingReferencePoint().z);
  glRotatef((float)_yaw,0f,1f,0f);
  TextureManager.getInstance().bindTexture("String_Node_Str");
  ShaderManager.getInstance().enableShader("String_Node_Str");
  int tick=GL20.glGetUniformLocation(ShaderManager.getInstance().getShader("String_Node_Str"),"String_Node_Str");
  GL20.glUniform1f(tick,_parent.getTick());
  int cOffset=GL20.glGetUniformLocation(ShaderManager.getInstance().getShader("String_Node_Str"),"String_Node_Str");
  GL20.glUniform4f(cOffset,COLORS[_randomColorId].x,COLORS[_randomColorId].y,COLORS[_randomColorId].z,1.0f);
  int light=GL20.glGetUniformLocation(ShaderManager.getInstance().getShader("String_Node_Str"),"String_Node_Str");
  GL20.glUniform1f(light,calcLightValue());
  if (_displayListOuterBody == -1 || _displayListInnerBody == -1) {
    generateDisplayList();
  }
  glEnable(GL_BLEND);
  glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
  glPushMatrix();
  glScalef(_randomSize,_randomSize,_randomSize);
  glCallList(_displayListInnerBody);
  glCallList(_displayListOuterBody);
  glPopMatrix();
  glDisable(GL_BLEND);
  ShaderManager.getInstance().enableShader(null);
  glPopMatrix();
}
Program: 1270
Project: 1270
Buggy source:
public void blockRemoved(Chunk chunk,BlockPosition pos){
  for (int i=0; i < 6; i++) {
    BlockPosition nBp=new BlockPosition(pos.x + (int)NEIGHBORS6[i].x,pos.y + (int)NEIGHBORS6[i].x,pos.z + (int)NEIGHBORS6[i].z);
    if (_parent.getBlock(nBp.x,nBp.y,nBp.z) == DIRT_TYPE) {
      addActiveBlock(nBp);
    }
  }
}

Fixed version (ground truth):
public void blockRemoved(Chunk chunk,BlockPosition pos){
  for (int i=0; i < 6; i++) {
    BlockPosition nBp=new BlockPosition(pos.x + (int)NEIGHBORS6[i].x,pos.y + (int)NEIGHBORS6[i].y,pos.z + (int)NEIGHBORS6[i].z);
    if (_parent.getBlock(nBp.x,nBp.y,nBp.z) == DIRT_TYPE) {
      addActiveBlock(nBp);
    }
  }
}
Program: 1271
Project: 1271
Buggy source:
public void blockPlaced(Chunk chunk,BlockPosition pos){
  if (_parent.getBlock(pos.x,pos.y,pos.z) == DIRT_TYPE) {
    addActiveBlock(pos);
  }
  for (int i=0; i < 6; i++) {
    BlockPosition nBp=new BlockPosition(pos.x + (int)NEIGHBORS6[i].x,pos.y + (int)NEIGHBORS6[i].x,pos.z + (int)NEIGHBORS6[i].z);
    if (_parent.getBlock(nBp.x,nBp.y,nBp.z) == DIRT_TYPE) {
      addActiveBlock(nBp);
    }
  }
}

Fixed version (ground truth):
public void blockPlaced(Chunk chunk,BlockPosition pos){
  if (_parent.getBlock(pos.x,pos.y,pos.z) == DIRT_TYPE) {
    addActiveBlock(pos);
  }
  for (int i=0; i < 6; i++) {
    BlockPosition nBp=new BlockPosition(pos.x + (int)NEIGHBORS6[i].x,pos.y + (int)NEIGHBORS6[i].y,pos.z + (int)NEIGHBORS6[i].z);
    if (_parent.getBlock(nBp.x,nBp.y,nBp.z) == DIRT_TYPE) {
      addActiveBlock(nBp);
    }
  }
}
Program: 1272
Project: 1272
Buggy source:
/** 
 * Renders the world.
 */
public void render(){
  if (_player == null)   return;
  if (!_player.isHeadUnderWater()) {
    _player.applyNormalizedModelViewMatrix();
    glDisable(GL_CULL_FACE);
    glDisable(GL_DEPTH_TEST);
    glBegin(GL_QUADS);
    Primitives.drawSkyBox(getDaylight());
    glEnd();
    glEnable(GL_CULL_FACE);
    glEnable(GL_DEPTH_TEST);
  }
  _player.applyPlayerModelViewMatrix();
  renderSunMoon();
  if (!_player.isHeadUnderWater())   renderClouds();
  _player.render();
  ShaderManager.getInstance().enableShader("String_Node_Str");
  int daylight=GL20.glGetUniformLocation(ShaderManager.getInstance().getShader("String_Node_Str"),"String_Node_Str");
  int swimmimg=GL20.glGetUniformLocation(ShaderManager.getInstance().getShader("String_Node_Str"),"String_Node_Str");
  GL20.glUniform1f(daylight,(float)getDaylight());
  GL20.glUniform1i(swimmimg,_player.isHeadUnderWater() ? 1 : 0);
  ShaderManager.getInstance().enableShader("String_Node_Str");
  daylight=GL20.glGetUniformLocation(ShaderManager.getInstance().getShader("String_Node_Str"),"String_Node_Str");
  GL20.glUniform1f(daylight,(float)getDaylight());
  ShaderManager.getInstance().enableShader(null);
  renderChunks();
  renderEntities();
}

Fixed version (ground truth):
/** 
 * Renders the world.
 */
public void render(){
  if (_player == null)   return;
  if (!_player.isHeadUnderWater()) {
    _player.applyNormalizedModelViewMatrix();
    glDisable(GL_CULL_FACE);
    glDisable(GL_DEPTH_TEST);
    glBegin(GL_QUADS);
    Primitives.drawSkyBox(getDaylight());
    glEnd();
    glEnable(GL_CULL_FACE);
    glEnable(GL_DEPTH_TEST);
  }
  _player.applyPlayerModelViewMatrix();
  renderSunMoon();
  if (!_player.isHeadUnderWater())   renderClouds();
  _player.render();
  ShaderManager.getInstance().enableShader("String_Node_Str");
  int daylight=GL20.glGetUniformLocation(ShaderManager.getInstance().getShader("String_Node_Str"),"String_Node_Str");
  int swimmimg=GL20.glGetUniformLocation(ShaderManager.getInstance().getShader("String_Node_Str"),"String_Node_Str");
  GL20.glUniform1f(daylight,(float)getDaylight());
  GL20.glUniform1i(swimmimg,_player.isHeadUnderWater() ? 1 : 0);
  ShaderManager.getInstance().enableShader("String_Node_Str");
  daylight=GL20.glGetUniformLocation(ShaderManager.getInstance().getShader("String_Node_Str"),"String_Node_Str");
  GL20.glUniform1f(daylight,(float)getDaylight());
  ShaderManager.getInstance().enableShader(null);
  renderEntities();
  renderChunks();
}
Program: 1273
Project: 1273
Buggy source:
public void initGame(){
  _timerTicksPerSecond=Sys.getTimerResolution();
  _font1=new TrueTypeFont(new Font("String_Node_Str",Font.PLAIN,12),true);
  ShaderManager.getInstance();
  glEnable(GL_CULL_FACE);
  glEnable(GL_DEPTH_TEST);
  glDepthFunc(GL_LEQUAL);
  glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
  GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT,GL11.GL_NICEST);
  Chunk.init();
  World.init();
  _player=new Player();
  String worldSeed=Configuration.DEFAULT_SEED;
  if (worldSeed.length() == 0) {
    worldSeed=_rand.randomCharacterString(16);
  }
  initNewWorld("String_Node_Str",worldSeed);
}

Fixed version (ground truth):
public void initGame(){
  _timerTicksPerSecond=Sys.getTimerResolution();
  _font1=new TrueTypeFont(new Font("String_Node_Str",Font.PLAIN,12),true);
  ShaderManager.getInstance();
  glEnable(GL_CULL_FACE);
  glEnable(GL_DEPTH_TEST);
  glDepthFunc(GL_LEQUAL);
  glShadeModel(GL11.GL_SMOOTH);
  GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT,GL11.GL_NICEST);
  Chunk.init();
  World.init();
  _player=new Player();
  String worldSeed=Configuration.DEFAULT_SEED;
  if (worldSeed.length() == 0) {
    worldSeed=_rand.randomCharacterString(16);
  }
  initNewWorld("String_Node_Str",worldSeed);
}
Program: 1274
Project: 1274
Buggy source:
@Override public void update(){
  if (_newMesh != null) {
    if (_newMesh.isGenerated()) {
      ChunkMesh oldMesh=_activeMesh;
      if (oldMesh != null)       oldMesh.dispose();
      _activeMesh=_newMesh;
      _newMesh=null;
    }
  }
}

Fixed version (ground truth):
@Override public void update(){
  if (_newMesh != null) {
    for (    Chunk nc : loadOrCreateNeighbors()) {
      if (nc.isDirty()) {
        return;
      }
    }
    if (_newMesh.isGenerated()) {
      ChunkMesh oldMesh=_activeMesh;
      if (oldMesh != null)       oldMesh.dispose();
      _activeMesh=_newMesh;
      _newMesh=null;
    }
  }
}
Program: 1276
Project: 1276
Buggy source:
/** 
 * TODO
 */
public void updateDisplayLists(){
  if (!_displayListUpdates.isEmpty()) {
    Chunk c=_displayListUpdates.removeFirst();
    c.generateVBOs();
  }
}

Fixed version (ground truth):
/** 
 * TODO
 */
public void updateDisplayLists(){
  while (!_displayListUpdates.isEmpty()) {
    Chunk c=_displayListUpdates.removeFirst();
    c.generateVBOs();
  }
}
Program: 1278
Project: 1278
Buggy source:
/** 
 * @param c
 * @param x
 * @param y
 * @param z 
 */
protected void generateGrassAndFlowers(Chunk c,int x,int y,int z){
  float grassDens=calcGrassDensity(c.getBlockWorldPosX(x),c.getBlockWorldPosY(y),c.getBlockWorldPosZ(z));
  if (c.getBlock(x,y,z) == 0x1 && grassDens > 0.0) {
    double rand=_rand.standNormalDistrDouble();
    if (rand > -1 && rand < 1) {
      if (c.canBlockSeeTheSky(x,y + 1,z)) {
        c.setBlock(x,y + 1,z,(byte)0xB);
      }
    }
 else {
      if (c.canBlockSeeTheSky(x,y + 1,z)) {
        c.setBlock(x,y + 1,z,(byte)0xC);
      }
    }
    if (_rand.standNormalDistrDouble() < -2) {
      if (_rand.randomBoolean()) {
        if (c.canBlockSeeTheSky(x,y + 1,z)) {
          c.setBlock(x,y + 1,z,(byte)0x9);
        }
      }
 else {
        if (c.canBlockSeeTheSky(x,y + 1,z)) {
          c.setBlock(x,y + 1,z,(byte)0xA);
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * @param c
 * @param x
 * @param y
 * @param z 
 */
protected void generateGrassAndFlowers(Chunk c,int x,int y,int z){
  if (c.getBlock(x,y,z) == 0x1) {
    float grassDens=calcGrassDensity(c.getBlockWorldPosX(x),c.getBlockWorldPosY(y),c.getBlockWorldPosZ(z));
    if (grassDens > 0.0) {
      double rand=_rand.standNormalDistrDouble();
      if (rand > -1 && rand < 1) {
        if (c.canBlockSeeTheSky(x,y + 1,z)) {
          c.setBlock(x,y + 1,z,(byte)0xB);
        }
      }
 else {
        if (c.canBlockSeeTheSky(x,y + 1,z)) {
          c.setBlock(x,y + 1,z,(byte)0xC);
        }
      }
      if (_rand.standNormalDistrDouble() < -2) {
        if (_rand.randomBoolean()) {
          if (c.canBlockSeeTheSky(x,y + 1,z)) {
            c.setBlock(x,y + 1,z,(byte)0x9);
          }
        }
 else {
          if (c.canBlockSeeTheSky(x,y + 1,z)) {
            c.setBlock(x,y + 1,z,(byte)0xA);
          }
        }
      }
    }
  }
}