nus-yam/ex-repair huggingface dataset:
Program: 623
Project: 623
Buggy source:
/** 
 * Returns the content of the color buffer of the FBO "sceneFinal", from GPU memory as a ByteBuffer. If the FBO "sceneFinal" is unavailable, returns null.
 * @return a ByteBuffer or null
 */
public ByteBuffer getSceneFinalRawData(){
  FBO fboSceneFinal=get(ReadOnlyGBuffer.getName());
  if (fboSceneFinal == null) {
    logger.error("String_Node_Str");
    return null;
  }
  ByteBuffer buffer=BufferUtils.createByteBuffer(fboSceneFinal.width() * fboSceneFinal.height() * 4);
  fboSceneFinal.bindTexture();
  GL11.glGetTexImage(GL11.GL_TEXTURE_2D,0,GL11.GL_RGBA,GL11.GL_UNSIGNED_BYTE,buffer);
  FBO.unbindTexture();
  return buffer;
}

Fixed version (ground truth):
/** 
 * Returns the content of the color buffer of the FBO "sceneFinal", from GPU memory as a ByteBuffer. If the FBO "sceneFinal" is unavailable, returns null.
 * @return a ByteBuffer or null
 */
public ByteBuffer getSceneFinalRawData(){
  FBO fboSceneFinal=get(READ_ONLY_GBUFFER.getName());
  if (fboSceneFinal == null) {
    logger.error("String_Node_Str");
    return null;
  }
  ByteBuffer buffer=BufferUtils.createByteBuffer(fboSceneFinal.width() * fboSceneFinal.height() * 4);
  fboSceneFinal.bindTexture();
  GL11.glGetTexImage(GL11.GL_TEXTURE_2D,0,GL11.GL_RGBA,GL11.GL_UNSIGNED_BYTE,buffer);
  FBO.unbindTexture();
  return buffer;
}
Program: 624
Project: 624
Buggy source:
private void generateDefaultFBOs(){
  generateDefaultFBO(ReadOnlyGBuffer);
  generateDefaultFBO(WriteOnlyGBuffer);
  generateDefaultFBO(Final);
}

Fixed version (ground truth):
private void generateDefaultFBOs(){
  generateDefaultFBO(READ_ONLY_GBUFFER);
  generateDefaultFBO(WRITE_ONLY_GBUFFER);
  generateDefaultFBO(FINAL);
}
Program: 630
Project: 630
Buggy source:
@Override public void applyParameters(Material program){
  super.applyParameters(program);
  int texId=0;
  GL13.glActiveTexture(GL13.GL_TEXTURE0 + texId);
  CoreRegistry.get(DynamicFBOsManager.class).bindFboColorTexture(DefaultDynamicFBOs.Final.getName());
  program.setInt("String_Node_Str",texId++,true);
}

Fixed version (ground truth):
@Override public void applyParameters(Material program){
  super.applyParameters(program);
  int texId=0;
  GL13.glActiveTexture(GL13.GL_TEXTURE0 + texId);
  CoreRegistry.get(DynamicFBOsManager.class).bindFboColorTexture(DefaultDynamicFBOs.FINAL.getName());
  program.setInt("String_Node_Str",texId++,true);
}
Program: 633
Project: 633
Buggy source:
@Override public void applyParameters(Material program){
  super.applyParameters(program);
  FBO scene=CoreRegistry.get(DynamicFBOsManager.class).get(DefaultDynamicFBOs.ReadOnlyGBuffer.getName());
  int texId=0;
  if (scene != null) {
    GL13.glActiveTexture(GL13.GL_TEXTURE0);
    scene.bindDepthTexture();
    program.setInt("String_Node_Str",texId++,true);
    GL13.glActiveTexture(GL13.GL_TEXTURE1);
    scene.bindNormalsTexture();
    program.setInt("String_Node_Str",texId++,true);
  }
  Texture ssaoNoiseTexture=updateNoiseTexture();
  GL13.glActiveTexture(GL13.GL_TEXTURE2);
  glBindTexture(GL11.GL_TEXTURE_2D,ssaoNoiseTexture.getId());
  program.setInt("String_Node_Str",texId++,true);
  program.setFloat4("String_Node_Str",ssaoStrength,ssaoRad,0.0f,0.0f,true);
  if (CoreRegistry.get(WorldRenderer.class) != null) {
    Camera activeCamera=CoreRegistry.get(WorldRenderer.class).getActiveCamera();
    if (activeCamera != null) {
      program.setMatrix4("String_Node_Str",activeCamera.getInverseProjectionMatrix(),true);
      program.setMatrix4("String_Node_Str",activeCamera.getProjectionMatrix(),true);
    }
  }
}

Fixed version (ground truth):
@Override public void applyParameters(Material program){
  super.applyParameters(program);
  FBO scene=CoreRegistry.get(DynamicFBOsManager.class).get(DefaultDynamicFBOs.READ_ONLY_GBUFFER.getName());
  int texId=0;
  if (scene != null) {
    GL13.glActiveTexture(GL13.GL_TEXTURE0);
    scene.bindDepthTexture();
    program.setInt("String_Node_Str",texId++,true);
    GL13.glActiveTexture(GL13.GL_TEXTURE1);
    scene.bindNormalsTexture();
    program.setInt("String_Node_Str",texId++,true);
  }
  Texture ssaoNoiseTexture=updateNoiseTexture();
  GL13.glActiveTexture(GL13.GL_TEXTURE2);
  glBindTexture(GL11.GL_TEXTURE_2D,ssaoNoiseTexture.getId());
  program.setInt("String_Node_Str",texId++,true);
  program.setFloat4("String_Node_Str",ssaoStrength,ssaoRad,0.0f,0.0f,true);
  if (CoreRegistry.get(WorldRenderer.class) != null) {
    Camera activeCamera=CoreRegistry.get(WorldRenderer.class).getActiveCamera();
    if (activeCamera != null) {
      program.setMatrix4("String_Node_Str",activeCamera.getInverseProjectionMatrix(),true);
      program.setMatrix4("String_Node_Str",activeCamera.getProjectionMatrix(),true);
    }
  }
}
Program: 634
Project: 634
Buggy source:
@Override public void applyParameters(Material program){
  super.applyParameters(program);
  FBO scene=CoreRegistry.get(DynamicFBOsManager.class).get(DefaultDynamicFBOs.ReadOnlyGBuffer.getName());
  if (scene != null) {
    GL13.glActiveTexture(GL13.GL_TEXTURE0);
    scene.bindDepthTexture();
    program.setInt("String_Node_Str",0);
    program.setFloat("String_Node_Str",1.0f / scene.width());
    program.setFloat("String_Node_Str",1.0f / scene.height());
  }
  program.setFloat("String_Node_Str",pixelOffsetX);
  program.setFloat("String_Node_Str",pixelOffsetY);
}

Fixed version (ground truth):
@Override public void applyParameters(Material program){
  super.applyParameters(program);
  FBO scene=CoreRegistry.get(DynamicFBOsManager.class).get(DefaultDynamicFBOs.READ_ONLY_GBUFFER.getName());
  if (scene != null) {
    GL13.glActiveTexture(GL13.GL_TEXTURE0);
    scene.bindDepthTexture();
    program.setInt("String_Node_Str",0);
    program.setFloat("String_Node_Str",1.0f / scene.width());
    program.setFloat("String_Node_Str",1.0f / scene.height());
  }
  program.setFloat("String_Node_Str",pixelOffsetX);
  program.setFloat("String_Node_Str",pixelOffsetY);
}
Program: 635
Project: 635
Buggy source:
@Override public String toString(){
  return this.getClass().getSimpleName() + "String_Node_Str" + node.getClass().getSimpleName();
}

Fixed version (ground truth):
@Override public String toString(){
  return String.format("String_Node_Str",this.getClass().getSimpleName(),node.getClass().getSimpleName());
}
Program: 636
Project: 636
Buggy source:
private void generateTaskList(){
  taskList.clear();
  Map map=Maps.newHashMap();
  for (  Object object : intermediateList) {
    if (object instanceof StateChange) {
      map.put(object.getClass(),object);
    }
 else {
      for (      Object o : map.values()) {
        taskList.add(((StateChange)o).generateTask());
      }
      map.clear();
      taskList.add(new NodeTask((Node)object));
    }
  }
}

Fixed version (ground truth):
private void generateTaskList(){
  taskList.clear();
  Map intranodesStateChanges=Maps.newHashMap();
  for (  Object object : intermediateList) {
    if (object instanceof StateChange) {
      intranodesStateChanges.put(object.getClass(),object);
    }
 else {
      for (      Object stateChange : intranodesStateChanges.values()) {
        taskList.add(((StateChange)stateChange).generateTask());
      }
      intranodesStateChanges.clear();
      taskList.add(((Node)object).generateTask());
    }
  }
}
Program: 637
Project: 637
Buggy source:
@Override public RenderPipelineTask generateTask(){
  if (task == null) {
    task=new BindFBOTask(fboId);
    if (fboId != DEFAULT_FRAME_BUFFER_ID) {
      frameBuffersManager.subscribe(this);
    }
  }
 else {
    if (fboId != DEFAULT_FRAME_BUFFER_ID) {
      update();
    }
  }
  return task;
}

Fixed version (ground truth):
@Override public RenderPipelineTask generateTask(){
  if (task == null) {
    task=new BindFBOTask(fboId,fboName);
    if (fboId != DEFAULT_FRAME_BUFFER_ID) {
      frameBuffersManager.subscribe(this);
    }
  }
 else {
    if (fboId != DEFAULT_FRAME_BUFFER_ID) {
      update();
    }
  }
  return task;
}
Program: 638
Project: 638
Buggy source:
@Override public void update(){
  fboId=frameBuffersManager.getFBO(fboName).fboId;
  task.setFboToBind(fboId);
}

Fixed version (ground truth):
@Override public void update(){
  fboId=frameBuffersManager.getFBO(fboName).fboId;
  task.setFboId(fboId);
  task.setFboName(fboName);
}
Program: 639
Project: 639
Buggy source:
@Override public String toString(){
  return this.getClass().getSimpleName() + "String_Node_Str" + fboName;
}

Fixed version (ground truth):
@Override public String toString(){
  return String.format("String_Node_Str",this.getClass().getSimpleName(),fboName,fboId);
}
Program: 640
Project: 640
Buggy source:
@Override public RenderPipelineTask generateTask(){
  if (enabled) {
    return new SetWireframeTask(GL_FILL);
  }
 else {
    return new SetWireframeTask(GL_LINE);
  }
}

Fixed version (ground truth):
@Override public RenderPipelineTask generateTask(){
  if (enabled) {
    return new SetWireframeTask(ENABLED);
  }
 else {
    return new SetWireframeTask(DISABLED);
  }
}
Program: 641
Project: 641
Buggy source:
@Override public String toString(){
  return this.getClass().getSimpleName() + "String_Node_Str" + enabled;
}

Fixed version (ground truth):
@Override public String toString(){
  String status="String_Node_Str";
  if (enabled) {
    status="String_Node_Str";
  }
  return String.format("String_Node_Str",this.getClass().getSimpleName(),status);
}
Program: 642
Project: 642
Buggy source:
@Override public String toString(){
  return this.getClass().getSimpleName() + "String_Node_Str" + fboToBind;
}

Fixed version (ground truth):
@Override public String toString(){
  return String.format("String_Node_Str",this.getClass().getSimpleName(),fboName,fboId);
}
Program: 643
Project: 643
Buggy source:
public BindFBOTask(int fboToBind){
  this.fboToBind=fboToBind;
}

Fixed version (ground truth):
public BindFBOTask(int fboId,String fboName){
  this.fboId=fboId;
  this.fboName=fboName;
}
Program: 644
Project: 644
Buggy source:
@Override public void execute(){
  glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,fboToBind);
}

Fixed version (ground truth):
@Override public void execute(){
  glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,fboId);
}
Program: 645
Project: 645
Buggy source:
@Override public String toString(){
  return this.getClass().getSimpleName() + "String_Node_Str" + mode;
}

Fixed version (ground truth):
@Override public String toString(){
  String status="String_Node_Str";
  if (mode == SetWireframe.ENABLED) {
    status="String_Node_Str";
  }
  return String.format("String_Node_Str",this.getClass().getSimpleName(),status);
}
Program: 646
Project: 646
Buggy source:
@Override public void update(){
  fboId=frameBuffersManager.getFBO(fboName).fboId;
  task.setFboId(fboId);
  task.setFboName(fboName);
}

Fixed version (ground truth):
@Override public void update(){
  fboId=frameBuffersManager.getFBO(fboName).fboId;
  task.setFboId(fboId);
}
Program: 647
Project: 647
Buggy source:
@Override public RenderPipelineTask generateTask(){
  if (enabled) {
    return new SetWireframeTask(ENABLED);
  }
 else {
    return new SetWireframeTask(DISABLED);
  }
}

Fixed version (ground truth):
@Override public RenderPipelineTask generateTask(){
  if (enabled) {
    if (enablingTask == null) {
      enablingTask=new SetWireframeTask(true);
    }
    return enablingTask;
  }
 else {
    if (disablingTask == null) {
      disablingTask=new SetWireframeTask(false);
    }
    return enablingTask;
  }
}
Program: 648
Project: 648
Buggy source:
public SetWireframeTask(int mode){
  this.mode=mode;
}

Fixed version (ground truth):
public SetWireframeTask(boolean enabled){
  if (enabled) {
    this.mode=ENABLED;
  }
 else {
    this.mode=DISABLED;
  }
}
Program: 649
Project: 649
Buggy source:
@Override public String toString(){
  String status="String_Node_Str";
  if (mode == SetWireframe.ENABLED) {
    status="String_Node_Str";
  }
  return String.format("String_Node_Str",this.getClass().getSimpleName(),status);
}

Fixed version (ground truth):
@Override public String toString(){
  String status="String_Node_Str";
  if (mode == ENABLED) {
    status="String_Node_Str";
  }
  return String.format("String_Node_Str",this.getClass().getSimpleName(),status);
}
Program: 651
Project: 651
Buggy source:
@Override public void preRender(){
  glDisable(GL_DEPTH_TEST);
  glEnable(GL_BLEND);
  glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
  glMatrixMode(GL_PROJECTION);
  glPushMatrix();
  glLoadIdentity();
  glOrtho(0,Display.getWidth(),Display.getHeight(),0,0,2048f);
  glMatrixMode(GL_MODELVIEW);
  glPushMatrix();
  modelView=new Matrix4f();
  modelView.setIdentity();
  modelView.setTranslation(new Vector3f(0,0,-1024f));
  MatrixUtils.matrixToFloatBuffer(modelView,matrixBuffer);
  glLoadMatrix(matrixBuffer);
  matrixBuffer.rewind();
  requestedCropRegion=Rect2i.createFromMinAndSize(0,0,Display.getWidth(),Display.getHeight());
  currentTextureCropRegion=requestedCropRegion;
  textureMat.setFloat4(CROPPING_BOUNDARIES_PARAM,requestedCropRegion.minX(),requestedCropRegion.maxX() + 1,requestedCropRegion.minY(),requestedCropRegion.maxY() + 1);
}

Fixed version (ground truth):
@Override public void preRender(){
  glDisable(GL_DEPTH_TEST);
  glEnable(GL_BLEND);
  glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
  glMatrixMode(GL_PROJECTION);
  glPushMatrix();
  glLoadIdentity();
  glOrtho(0,Display.getWidth(),Display.getHeight(),0,0,2048f);
  glMatrixMode(GL_MODELVIEW);
  glPushMatrix();
  modelView=new Matrix4f();
  modelView.setIdentity();
  modelView.setTranslation(new Vector3f(0,0,-1024f));
  MatrixUtils.matrixToFloatBuffer(modelView,matrixBuffer);
  glLoadMatrix(matrixBuffer);
  matrixBuffer.rewind();
  requestedCropRegion=Rect2i.createFromMinAndSize(0,0,Display.getWidth(),Display.getHeight());
  currentTextureCropRegion=requestedCropRegion;
  textureMat.setFloat4(CROPPING_BOUNDARIES_PARAM,requestedCropRegion.minX(),requestedCropRegion.maxX(),requestedCropRegion.minY(),requestedCropRegion.maxY());
}
Program: 652
Project: 652
Buggy source:
@Override public void drawText(String text,Font font,HorizontalAlign hAlign,VerticalAlign vAlign,Rect2i absoluteRegion,Color color,Color shadowColor,float alpha,boolean underlined){
  TextCacheKey key=new TextCacheKey(text,font,absoluteRegion.width(),hAlign,color,shadowColor,underlined);
  usedText.add(key);
  Map<Material,Mesh> fontMesh=cachedText.get(key);
  List<String> lines=TextLineBuilder.getLines(font,text,absoluteRegion.width());
  if (fontMesh != null) {
    for (    Mesh mesh : fontMesh.values()) {
      if (mesh.isDisposed()) {
        fontMesh=null;
        break;
      }
    }
  }
  if (fontMesh == null) {
    fontMesh=fontMeshBuilder.createTextMesh(font,lines,absoluteRegion.width(),hAlign,color,shadowColor,underlined);
    cachedText.put(key,fontMesh);
  }
  Vector2i offset=new Vector2i(absoluteRegion.minX(),absoluteRegion.minY());
  offset.y+=vAlign.getOffset(lines.size() * font.getLineHeight(),absoluteRegion.height());
  fontMesh.entrySet().stream().filter(entry -> entry.getKey().isRenderable()).forEach(entry -> {
    entry.getKey().bindTextures();
    entry.getKey().setFloat4(CROPPING_BOUNDARIES_PARAM,requestedCropRegion.minX(),requestedCropRegion.maxX() + 1,requestedCropRegion.minY(),requestedCropRegion.maxY() + 1);
    entry.getKey().setFloat2("String_Node_Str",offset.x,offset.y);
    entry.getKey().setFloat("String_Node_Str",alpha);
    entry.getValue().render();
  }
);
}

Fixed version (ground truth):
@Override public void drawText(String text,Font font,HorizontalAlign hAlign,VerticalAlign vAlign,Rect2i absoluteRegion,Color color,Color shadowColor,float alpha,boolean underlined){
  TextCacheKey key=new TextCacheKey(text,font,absoluteRegion.width(),hAlign,color,shadowColor,underlined);
  usedText.add(key);
  Map<Material,Mesh> fontMesh=cachedText.get(key);
  List<String> lines=TextLineBuilder.getLines(font,text,absoluteRegion.width());
  if (fontMesh != null) {
    for (    Mesh mesh : fontMesh.values()) {
      if (mesh.isDisposed()) {
        fontMesh=null;
        break;
      }
    }
  }
  if (fontMesh == null) {
    fontMesh=fontMeshBuilder.createTextMesh(font,lines,absoluteRegion.width(),hAlign,color,shadowColor,underlined);
    cachedText.put(key,fontMesh);
  }
  Vector2i offset=new Vector2i(absoluteRegion.minX(),absoluteRegion.minY());
  offset.y+=vAlign.getOffset(lines.size() * font.getLineHeight(),absoluteRegion.height());
  fontMesh.entrySet().stream().filter(entry -> entry.getKey().isRenderable()).forEach(entry -> {
    entry.getKey().bindTextures();
    entry.getKey().setFloat4(CROPPING_BOUNDARIES_PARAM,requestedCropRegion.minX(),requestedCropRegion.maxX(),requestedCropRegion.minY(),requestedCropRegion.maxY());
    entry.getKey().setFloat2("String_Node_Str",offset.x,offset.y);
    entry.getKey().setFloat("String_Node_Str",alpha);
    entry.getValue().render();
  }
);
}
Program: 655
Project: 655
Buggy source:
@Override public void onMouseOver(NUIMouseOverEvent event){
  super.onMouseOver(event);
  onItemMouseOver(index,MouseOverItemType.BOTTOM);
}

Fixed version (ground truth):
@Override public void onMouseOver(NUIMouseOverEvent event){
  super.onMouseOver(event);
  if (!model.get().getItem(index).isRoot()) {
    onItemMouseOver(index,MouseOverItemType.BOTTOM);
  }
}
Program: 656
Project: 656
Buggy source:
private void drawDragHint(Canvas canvas,Rect2i itemRegion){
  if (mouseOverItemType == MouseOverItemType.TOP) {
    canvas.drawLine(itemRegion.minX(),itemRegion.minY(),itemRegion.maxX(),itemRegion.minY(),Color.WHITE);
  }
 else   if (mouseOverItemType == MouseOverItemType.CENTER) {
    canvas.drawLine(itemRegion.minX(),itemRegion.minY(),itemRegion.maxX(),itemRegion.minY(),Color.WHITE);
    canvas.drawLine(itemRegion.maxX(),itemRegion.minY(),itemRegion.maxX(),itemRegion.maxY(),Color.WHITE);
    canvas.drawLine(itemRegion.maxX(),itemRegion.maxY(),itemRegion.minX(),itemRegion.maxY(),Color.WHITE);
    canvas.drawLine(itemRegion.minX(),itemRegion.maxY(),itemRegion.minX(),itemRegion.minY(),Color.WHITE);
  }
 else   if (mouseOverItemType == MouseOverItemType.BOTTOM) {
    canvas.drawLine(itemRegion.maxX(),itemRegion.maxY(),itemRegion.minX(),itemRegion.maxY(),Color.WHITE);
  }
}

Fixed version (ground truth):
private void drawDragHint(Canvas canvas,Rect2i itemRegion){
  if (mouseOverItemType == MouseOverItemType.TOP) {
    canvas.drawLine(itemRegion.minX(),itemRegion.minY(),itemRegion.maxX(),itemRegion.minY(),Color.WHITE);
  }
 else   if (mouseOverItemType == MouseOverItemType.CENTER) {
    canvas.drawLine(itemRegion.minX(),itemRegion.minY(),itemRegion.maxX(),itemRegion.minY(),Color.WHITE);
    canvas.drawLine(itemRegion.maxX(),itemRegion.minY(),itemRegion.maxX(),itemRegion.maxY(),Color.WHITE);
    canvas.drawLine(itemRegion.minX(),itemRegion.minY(),itemRegion.minX(),itemRegion.maxY(),Color.WHITE);
    canvas.drawLine(itemRegion.minX(),itemRegion.maxY(),itemRegion.maxX(),itemRegion.maxY(),Color.WHITE);
  }
 else   if (mouseOverItemType == MouseOverItemType.BOTTOM) {
    canvas.drawLine(itemRegion.minX(),itemRegion.maxY(),itemRegion.maxX(),itemRegion.maxY(),Color.WHITE);
  }
}
Program: 657
Project: 657
Buggy source:
@Override public void set(JsonTree value){
  if (value != null) {
    item.setValue(value.getValue());
    editorTreeView.clearAlternativeWidgets();
    updateTreeView(item.getRoot());
    updateWidget(item.getRoot());
  }
}

Fixed version (ground truth):
@Override public void set(JsonTree value){
  if (value != null) {
    item.setValue(value.getValue());
    editorTreeView.clearAlternativeWidgets();
    JsonTree tree=(JsonTree)(editorTreeView.getModel().getItem(0).getRoot());
    if (editorHistoryPosition < editorHistory.size() - 1) {
      editorHistory=editorHistory.subList(0,editorHistoryPosition + 1);
    }
    editorHistory.add(tree);
    editorHistoryPosition++;
    updateTreeView((JsonTree)item.getRoot());
    updateWidget((JsonTree)item.getRoot());
  }
}
Program: 659
Project: 659
Buggy source:
private void updateWidget(Tree tree){
  UIWidget widget;
  try {
    JsonElement element=JsonTreeConverter.deserialize(tree);
    widget=new UIFormat().load(element).getRootWidget();
  }
 catch (  Exception e) {
    widget=new UILabel(ExceptionUtils.getStackTrace(e));
  }
  selectedScreenContainer.setContent(widget);
}

Fixed version (ground truth):
private void updateWidget(JsonTree tree){
  UIWidget widget;
  try {
    JsonElement element=JsonTreeConverter.deserialize(tree);
    widget=new UIFormat().load(element).getRootWidget();
  }
 catch (  Exception e) {
    widget=new UILabel(ExceptionUtils.getStackTrace(e));
  }
  selectedScreenContainer.setContent(widget);
}
Program: 660
Project: 660
Buggy source:
private void updateTreeView(Tree tree){
  Iterator it=tree.getDepthFirstIterator(false);
  while (it.hasNext()) {
    ((Tree<JsonTreeNode>)it.next()).setExpanded(true);
  }
  editorTreeView.setModel(tree.copy());
}

Fixed version (ground truth):
private void updateTreeView(JsonTree tree){
  JsonTree fixedTree=JsonTreeConverter.serialize(JsonTreeConverter.deserialize(tree));
  Iterator it=fixedTree.getDepthFirstIterator(false);
  while (it.hasNext()) {
    ((JsonTree)it.next()).setExpanded(true);
  }
  editorTreeView.setModel(fixedTree.copy());
}
Program: 661
Project: 661
Buggy source:
private void addWidget(JsonTree item){
  getManager().pushScreen(WidgetSelectionScreen.ASSET_URI,WidgetSelectionScreen.class);
  WidgetSelectionScreen widgetSelectionScreen=(WidgetSelectionScreen)getManager().getScreen(WidgetSelectionScreen.ASSET_URI);
  widgetSelectionScreen.setItem(item);
  widgetSelectionScreen.subscribeClose(() -> {
    editorTreeView.setModel(item.getRoot());
    editorTreeView.fireUpdateListeners();
    updateTreeView(item.getRoot());
  }
);
}

Fixed version (ground truth):
private void addWidget(JsonTree item){
  getManager().pushScreen(WidgetSelectionScreen.ASSET_URI,WidgetSelectionScreen.class);
  WidgetSelectionScreen widgetSelectionScreen=(WidgetSelectionScreen)getManager().getScreen(WidgetSelectionScreen.ASSET_URI);
  widgetSelectionScreen.setItem(item);
  widgetSelectionScreen.subscribeClose(() -> {
    editorTreeView.setModel(item.getRoot());
    editorTreeView.fireUpdateListeners();
    updateTreeView((JsonTree)item.getRoot());
  }
);
}
Program: 663
Project: 663
Buggy source:
/** 
 * @param urn The Urn of the file to be edited.
 */
public void selectFile(ResourceUrn urn){
  if (assetManager.getAsset(urn,UIElement.class).isPresent()) {
    UIElement element=assetManager.getAsset(urn,UIElement.class).get();
    AssetDataFile source=element.getSource();
    String content=null;
    try (JsonReader reader=new JsonReader(new InputStreamReader(source.openStream(),Charsets.UTF_8))){
      reader.setLenient(true);
      content=new JsonParser().parse(reader).toString();
    }
 catch (    IOException e) {
      logger.error(String.format("String_Node_Str",urn.toString()),e);
    }
    if (content != null) {
      JsonTree tree=JsonTreeConverter.serialize(new JsonParser().parse(content));
      updateTreeView(tree);
      updateWidget(tree);
      editorHistory.clear();
      editorHistory.add(tree);
      editorHistoryPosition=0;
    }
    if (selectedUrn != null) {
      assetManager.getAsset(selectedUrn,UIElement.class).get().dispose();
    }
    selectedUrn=urn;
  }
}

Fixed version (ground truth):
/** 
 * @param urn The Urn of the file to be edited.
 */
public void selectFile(ResourceUrn urn){
  Optional<UIElement> asset=assetManager.getAsset(urn,UIElement.class);
  if (asset.isPresent()) {
    UIElement element=asset.get();
    AssetDataFile source=element.getSource();
    String content=null;
    try (JsonReader reader=new JsonReader(new InputStreamReader(source.openStream(),Charsets.UTF_8))){
      reader.setLenient(true);
      content=new JsonParser().parse(reader).toString();
    }
 catch (    IOException e) {
      logger.error(String.format("String_Node_Str",urn.toString()),e);
    }
    if (content != null) {
      JsonTree tree=JsonTreeConverter.serialize(new JsonParser().parse(content));
      updateTreeView(tree);
      updateWidget(tree);
      editorHistory.clear();
      editorHistory.add(tree);
      editorHistoryPosition=0;
    }
    if (selectedUrn != null) {
      Optional<UIElement> selectedAsset=assetManager.getAsset(selectedUrn,UIElement.class);
      if (selectedAsset.isPresent()) {
        selectedAsset.get().dispose();
      }
    }
    selectedUrn=urn;
  }
}
Program: 664
Project: 664
Buggy source:
/** 
 * @return The central listener.
 */
public ItemCenterListener getCenterListener(){
  return centerListener;
}

Fixed version (ground truth):
/** 
 * @return The central listener.
 */
ItemCenterListener getCenterListener(){
  return centerListener;
}
Program: 665
Project: 665
Buggy source:
/** 
 * @return The top listener.
 */
public ItemTopListener getTopListener(){
  return topListener;
}

Fixed version (ground truth):
/** 
 * @return The top listener.
 */
ItemTopListener getTopListener(){
  return topListener;
}
Program: 666
Project: 666
Buggy source:
/** 
 * @return The bottom listener.
 */
public ItemBottomListener getBottomListener(){
  return bottomListener;
}

Fixed version (ground truth):
/** 
 * @return The bottom listener.
 */
ItemBottomListener getBottomListener(){
  return bottomListener;
}
Program: 667
Project: 667
Buggy source:
private void updateListeners(){
  boolean mouseOver=false;
  for (  TreeViewListenerSet set : treeViewListenerSets) {
    if (set.isMouseOver()) {
      mouseOver=true;
      break;
    }
  }
  if (!mouseOver) {
    onItemMouseRelease();
  }
  while (treeViewListenerSets.size() > model.get().getItemCount()) {
    treeViewListenerSets.remove(treeViewListenerSets.size() - 1);
    expandListeners.remove(expandListeners.size() - 1);
  }
  while (treeViewListenerSets.size() < model.get().getItemCount()) {
    treeViewListenerSets.add(new TreeViewListenerSet(new ItemTopListener(treeViewListenerSets.size()),new ItemCenterListener(treeViewListenerSets.size()),new ItemBottomListener(treeViewListenerSets.size())));
    expandListeners.add(new ExpandButtonInteractionListener(expandListeners.size()));
  }
}

Fixed version (ground truth):
private void updateListeners(){
  boolean mouseOver=false;
  for (  TreeViewListenerSet set : treeViewListenerSets) {
    if (set.isMouseOver()) {
      mouseOver=true;
      break;
    }
  }
  if (!mouseOver) {
    if (draggedItemIndex.get() != null) {
      selectedIndex.set(null);
      draggedItemIndex.set(null);
    }
    if (mouseOverItemIndex.get() != null) {
      mouseOverItemIndex.set(null);
      mouseOverItemType.set(null);
    }
  }
  while (treeViewListenerSets.size() > model.get().getItemCount()) {
    treeViewListenerSets.remove(treeViewListenerSets.size() - 1);
    expandListeners.remove(expandListeners.size() - 1);
  }
  while (treeViewListenerSets.size() < model.get().getItemCount()) {
    treeViewListenerSets.add(new TreeViewListenerSet(new ItemTopListener(treeViewListenerSets.size()),new ItemCenterListener(treeViewListenerSets.size()),new ItemBottomListener(treeViewListenerSets.size())));
    expandListeners.add(new ExpandButtonInteractionListener(expandListeners.size()));
  }
}
Program: 668
Project: 668
Buggy source:
private void onItemMouseOver(int index,MouseOverItemType type){
  if (draggedItemIndex.get() != null) {
    if (mouseOverItemIndex.get() != null) {
      model.get().getItem(mouseOverItemIndex.get()).setSelected(false);
    }
    if (draggedItemIndex.get() != index) {
      mouseOverItemIndex.set(index);
      model.get().getItem(index).setSelected(true);
      mouseOverItemType.set(type);
    }
 else {
      mouseOverItemIndex.set(null);
      mouseOverItemType.set(null);
    }
  }
}

Fixed version (ground truth):
private void onItemMouseOver(int index,MouseOverItemType type){
  if (draggedItemIndex.get() != null) {
    if (draggedItemIndex.get() != index) {
      mouseOverItemIndex.set(index);
      mouseOverItemType.set(type);
    }
 else {
      mouseOverItemIndex.set(null);
      mouseOverItemType.set(null);
    }
  }
}
Program: 669
Project: 669
Buggy source:
private void onItemMouseRelease(){
  if (draggedItemIndex.get() != null && mouseOverItemIndex.get() != null) {
    Tree<T> child=model.get().getItem(draggedItemIndex.get());
    Tree<T> parent=model.get().getItem(mouseOverItemIndex.get());
    if (mouseOverItemType.get() == MouseOverItemType.TOP) {
      child.getParent().removeChild(child);
      parent.getParent().addChild(parent.getParent().indexOf(parent),child);
    }
 else     if (mouseOverItemType.get() == MouseOverItemType.CENTER) {
      child.getParent().removeChild(child);
      parent.addChild(child);
    }
 else {
      child.getParent().removeChild(child);
      parent.getParent().addChild(parent.getParent().indexOf(parent) + 1,child);
    }
    fireUpdateListeners();
  }
  if (draggedItemIndex.get() != null) {
    selectedIndex.set(null);
    draggedItemIndex.set(null);
  }
  if (mouseOverItemIndex.get() != null) {
    model.get().getItem(mouseOverItemIndex.get()).setSelected(false);
    mouseOverItemIndex.set(null);
    mouseOverItemType.set(null);
  }
}

Fixed version (ground truth):
private void onItemMouseRelease(){
  if (draggedItemIndex.get() != null && mouseOverItemIndex.get() != null) {
    Tree<T> child=model.get().getItem(draggedItemIndex.get());
    Tree<T> parent=model.get().getItem(mouseOverItemIndex.get());
    if (mouseOverItemType.get() == MouseOverItemType.TOP) {
      child.getParent().removeChild(child);
      parent.getParent().addChild(parent.getParent().indexOf(parent),child);
    }
 else     if (mouseOverItemType.get() == MouseOverItemType.CENTER) {
      child.getParent().removeChild(child);
      parent.addChild(child);
    }
 else {
      child.getParent().removeChild(child);
      parent.getParent().addChild(parent.getParent().indexOf(parent) + 1,child);
    }
    fireUpdateListeners();
  }
  if (draggedItemIndex.get() != null) {
    selectedIndex.set(null);
    draggedItemIndex.set(null);
  }
  if (mouseOverItemIndex.get() != null) {
    mouseOverItemIndex.set(null);
    mouseOverItemType.set(null);
  }
}
Program: 670
Project: 670
Buggy source:
@Override public void onMouseOver(NUIMouseOverEvent event){
  super.onMouseOver(event);
  if (!model.get().getItem(index).isRoot()) {
    onItemMouseOver(index,MouseOverItemType.BOTTOM);
  }
}

Fixed version (ground truth):
@Override public void onMouseOver(NUIMouseOverEvent event){
  super.onMouseOver(event);
  if (draggedItemIndex.get() != null && !model.get().getItem(index).isRoot() && model.get().getItem(index).getParent().acceptsChild(model.get().getItem(draggedItemIndex.get()))) {
    onItemMouseOver(index,MouseOverItemType.BOTTOM);
  }
}
Program: 671
Project: 671
Buggy source:
/** 
 * @param child The child to be added.
 * @return Whether the specified child can be added to the tree.
 */
public boolean acceptsChild(Tree<T> child){
  if (child == null) {
    return false;
  }
  if (this.isChildOf(child)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * @param child The child to be added.
 * @return Whether the specified child can be added to the tree.
 */
public boolean acceptsChild(Tree<T> child){
  if (child == null) {
    return false;
  }
  if (this == child) {
    return false;
  }
  if (this.isChildOf(child)) {
    return false;
  }
  return true;
}
Program: 673
Project: 673
Buggy source:
private void scheduleTimeout(){
  timeoutPoint=System.currentTimeMillis() + timeoutThreshold;
  timeoutTimer.schedule(new java.util.TimerTask(){
    @Override public void run(){
synchronized (joinStatus) {
        if (System.currentTimeMillis() > timeoutPoint && joinStatus.getStatus() != JoinStatus.Status.COMPLETE && joinStatus.getStatus() != JoinStatus.Status.FAILED) {
          joinStatus.setErrorMessage("String_Node_Str");
          logger.error("String_Node_Str",timeoutThreshold);
        }
      }
    }
  }
,timeoutThreshold + 200);
}

Fixed version (ground truth):
private void scheduleTimeout(Channel inputChannel){
  channel=inputChannel;
  timeoutPoint=System.currentTimeMillis() + timeoutThreshold;
  timeoutTimer.schedule(new java.util.TimerTask(){
    @Override public void run(){
synchronized (joinStatus) {
        if (System.currentTimeMillis() > timeoutPoint && joinStatus.getStatus() != JoinStatus.Status.COMPLETE && joinStatus.getStatus() != JoinStatus.Status.FAILED) {
          joinStatus.setErrorMessage("String_Node_Str");
          channel.close();
          logger.error("String_Node_Str",timeoutThreshold);
        }
      }
    }
  }
,timeoutThreshold + 200);
}
Program: 674
Project: 674
Buggy source:
@Override public void messageReceived(ChannelHandlerContext ctx,MessageEvent e){
  scheduleTimeout();
  if (joinStatus.getStatus() == JoinStatus.Status.FAILED) {
    return;
  }
  NetData.NetMessage message=(NetData.NetMessage)e.getMessage();
synchronized (joinStatus) {
    timeoutPoint=System.currentTimeMillis() + timeoutThreshold;
    if (message.hasServerInfo()) {
      receivedServerInfo(ctx,message.getServerInfo());
    }
 else     if (message.hasModuleDataHeader()) {
      receiveModuleStart(ctx,message.getModuleDataHeader());
    }
 else     if (message.hasModuleData()) {
      receiveModule(ctx,message.getModuleData());
    }
 else     if (message.hasJoinComplete()) {
      if (missingModules.size() > 0) {
        logger.error("String_Node_Str");
      }
      completeJoin(ctx,message.getJoinComplete());
    }
 else {
      logger.error("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
@Override public void messageReceived(ChannelHandlerContext ctx,MessageEvent e){
  if (joinStatus.getStatus() == JoinStatus.Status.FAILED) {
    return;
  }
  scheduleTimeout(ctx.getChannel());
  NetData.NetMessage message=(NetData.NetMessage)e.getMessage();
synchronized (joinStatus) {
    timeoutPoint=System.currentTimeMillis() + timeoutThreshold;
    if (message.hasServerInfo()) {
      receivedServerInfo(ctx,message.getServerInfo());
    }
 else     if (message.hasModuleDataHeader()) {
      receiveModuleStart(ctx,message.getModuleDataHeader());
    }
 else     if (message.hasModuleData()) {
      receiveModule(ctx,message.getModuleData());
    }
 else     if (message.hasJoinComplete()) {
      if (missingModules.size() > 0) {
        logger.error("String_Node_Str");
      }
      completeJoin(ctx,message.getJoinComplete());
    }
 else {
      logger.error("String_Node_Str");
    }
  }
}
Program: 675
Project: 675
Buggy source:
public ClientConnectionHandler(JoinStatusImpl joinStatus,NetworkSystemImpl networkSystem){
  this.networkSystem=networkSystem;
  this.joinStatus=joinStatus;
  this.moduleManager=CoreRegistry.get(ModuleManager.class);
  scheduleTimeout();
}

Fixed version (ground truth):
public ClientConnectionHandler(JoinStatusImpl joinStatus,NetworkSystemImpl networkSystem){
  this.networkSystem=networkSystem;
  this.joinStatus=joinStatus;
  this.moduleManager=CoreRegistry.get(ModuleManager.class);
}
Program: 676
Project: 676
Buggy source:
@Override public void run(){
synchronized (joinStatus) {
    if (System.currentTimeMillis() > timeoutPoint && joinStatus.getStatus() != JoinStatus.Status.COMPLETE && joinStatus.getStatus() != JoinStatus.Status.FAILED) {
      joinStatus.setErrorMessage("String_Node_Str");
      logger.error("String_Node_Str",timeoutThreshold);
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
synchronized (joinStatus) {
    if (System.currentTimeMillis() > timeoutPoint && joinStatus.getStatus() != JoinStatus.Status.COMPLETE && joinStatus.getStatus() != JoinStatus.Status.FAILED) {
      joinStatus.setErrorMessage("String_Node_Str");
      channel.close();
      logger.error("String_Node_Str",timeoutThreshold);
    }
  }
}
Program: 677
Project: 677
Buggy source:
@Override public void shutdown(){
  if (mode != NetworkMode.NONE) {
    allChannels.close().awaitUninterruptibly();
    factory.releaseExternalResources();
  }
  processPendingDisconnects();
  clientList.forEach(this::processRemovedClient);
  server=null;
  nextNetId=1;
  netIdToEntityId.clear();
  if (mode != NetworkMode.CLIENT) {
    if (this.entityManager != null) {
      for (      EntityRef entity : entityManager.getEntitiesWith(NetworkComponent.class)) {
        NetworkComponent netComp=entity.getComponent(NetworkComponent.class);
        netComp.setNetworkId(0);
        entity.saveComponent(netComp);
      }
      this.entityManager.unsubscribe(this);
    }
  }
  mode=NetworkMode.NONE;
  entityManager=null;
  eventLibrary=null;
  componentLibrary=null;
  eventSerializer=null;
  entitySerializer=null;
  clientList.clear();
  netClientList.clear();
  blockManager=null;
  biomeManager=null;
  ownerLookup.clear();
  ownedLookup.clear();
  ownershipHelper=null;
  storageManager=null;
  logger.info("String_Node_Str");
}

Fixed version (ground truth):
@Override public void shutdown(){
  allChannels.close().awaitUninterruptibly();
  factory.releaseExternalResources();
  processPendingDisconnects();
  clientList.forEach(this::processRemovedClient);
  server=null;
  nextNetId=1;
  netIdToEntityId.clear();
  if (mode != NetworkMode.CLIENT) {
    if (this.entityManager != null) {
      for (      EntityRef entity : entityManager.getEntitiesWith(NetworkComponent.class)) {
        NetworkComponent netComp=entity.getComponent(NetworkComponent.class);
        netComp.setNetworkId(0);
        entity.saveComponent(netComp);
      }
      this.entityManager.unsubscribe(this);
    }
  }
  mode=NetworkMode.NONE;
  entityManager=null;
  eventLibrary=null;
  componentLibrary=null;
  eventSerializer=null;
  entitySerializer=null;
  clientList.clear();
  netClientList.clear();
  blockManager=null;
  biomeManager=null;
  ownerLookup.clear();
  ownedLookup.clear();
  ownershipHelper=null;
  storageManager=null;
  logger.info("String_Node_Str");
}
Program: 678
Project: 678
Buggy source:
@Override public void set(Object value){
  getManager().closeScreen(ContextMenuScreen.ASSET_URI);
  ((JsonTree)item).setSelected(false);
  if (value.equals(OPTION_COPY)) {
    editorTreeView.copy(item);
  }
 else   if (value.equals(OPTION_PASTE)) {
    editorTreeView.paste(item);
  }
 else   if (value.equals(OPTION_ADD_WIDGET)) {
    addWidget((JsonTree)item);
  }
 else {
    throw new IllegalStateException(String.format("String_Node_Str",value));
  }
}

Fixed version (ground truth):
@Override public void set(ResourceUrn value){
  if (selectedUrn != value) {
    selectFile(value);
  }
}
Program: 679
Project: 679
Buggy source:
@Override public Object get(){
  return null;
}

Fixed version (ground truth):
@Override public ResourceUrn get(){
  return selectedUrn;
}
Program: 681
Project: 681
Buggy source:
@Override public void initialise(){
  availableWidgets=find("String_Node_Str",UIDropdownScrollable.class);
  ClassLibrary<UIWidget> metadataLibrary=getManager().getWidgetMetadataLibrary();
  for (  ClassMetadata metadata : metadataLibrary) {
    if (!CoreScreenLayer.class.isAssignableFrom(metadata.getType())) {
      widgets.put(metadata.toString(),metadata);
    }
  }
  List options=Lists.newArrayList(widgets.keySet());
  Collections.sort(options);
  availableWidgets.setOptions(options);
  WidgetUtil.trySubscribe(this,"String_Node_Str",button -> {
    String selection=availableWidgets.getSelection().toString();
    ClassMetadata metadata=widgets.get(selection);
    JsonTree scaffolding=new JsonTree(new JsonTreeNode(null,null,JsonTreeNode.ElementType.OBJECT));
    scaffolding.addChild(new JsonTreeNode("String_Node_Str",selection,JsonTreeNode.ElementType.KEY_VALUE_PAIR));
    if (UILayout.class.isAssignableFrom(metadata.getType())) {
      scaffolding.addChild(new JsonTreeNode("String_Node_Str",null,JsonTreeNode.ElementType.ARRAY));
    }
    item.addChild(scaffolding);
    closeListeners.forEach(UpdateListener::onChange);
    getManager().closeScreen(ASSET_URI);
  }
);
  find("String_Node_Str",UIButton.class).bindEnabled(new ReadOnlyBinding<Boolean>(){
    @Override public Boolean get(){
      return availableWidgets.getSelection() != null;
    }
  }
);
  WidgetUtil.trySubscribe(this,"String_Node_Str",button -> {
    getManager().closeScreen(ASSET_URI);
  }
);
}

Fixed version (ground truth):
@Override public void initialise(){
  availableWidgets=find("String_Node_Str",UIDropdownScrollable.class);
  ClassLibrary<UIWidget> metadataLibrary=getManager().getWidgetMetadataLibrary();
  for (  ClassMetadata metadata : metadataLibrary) {
    if (!CoreScreenLayer.class.isAssignableFrom(metadata.getType())) {
      widgets.put(metadata.toString(),metadata);
    }
  }
  List options=Lists.newArrayList(widgets.keySet());
  Collections.sort(options);
  availableWidgets.setOptions(options);
  WidgetUtil.trySubscribe(this,"String_Node_Str",button -> {
    String selection=availableWidgets.getSelection().toString();
    ClassMetadata metadata=widgets.get(selection);
    JsonTree scaffolding=new JsonTree(new JsonTreeNode(null,null,JsonTreeNode.ElementType.OBJECT));
    scaffolding.addChild(new JsonTreeNode("String_Node_Str",selection,JsonTreeNode.ElementType.KEY_VALUE_PAIR));
    if (UILayout.class.isAssignableFrom(metadata.getType())) {
      scaffolding.addChild(new JsonTreeNode("String_Node_Str",null,JsonTreeNode.ElementType.ARRAY));
    }
    item.addChild(scaffolding);
    closeListeners.forEach(UpdateListener::onAction);
    getManager().closeScreen(ASSET_URI);
  }
);
  find("String_Node_Str",UIButton.class).bindEnabled(new ReadOnlyBinding<Boolean>(){
    @Override public Boolean get(){
      return availableWidgets.getSelection() != null;
    }
  }
);
  WidgetUtil.trySubscribe(this,"String_Node_Str",button -> {
    getManager().closeScreen(ASSET_URI);
  }
);
}
Program: 682
Project: 682
Buggy source:
private void fireUpdateListeners(){
  updateListeners.forEach(UpdateListener::onChange);
}

Fixed version (ground truth):
private void fireUpdateListeners(){
  updateListeners.forEach(UpdateListener::onAction);
}
Program: 683
Project: 683
Buggy source:
@Override public String toString(){
  if (type == ElementType.KEY_VALUE_PAIR) {
    if (key != null && value != null) {
      return key + "String_Node_Str" + value;
    }
    return key == null ? value.toString() : key;
  }
 else   if (type == ElementType.VALUE) {
    return value.toString();
  }
 else   if (type == ElementType.ARRAY) {
    return key != null ? key : ARRAY_STRING;
  }
 else   if (type == ElementType.OBJECT) {
    System.out.println(key);
    return key != null ? key : OBJECT_STRING;
  }
 else {
    return key != null ? key : NULL_STRING;
  }
}

Fixed version (ground truth):
@Override public String toString(){
  if (type == ElementType.KEY_VALUE_PAIR) {
    if (key != null && value != null) {
      return key + "String_Node_Str" + value;
    }
    return key == null ? value.toString() : key;
  }
 else   if (type == ElementType.VALUE) {
    return value.toString();
  }
 else   if (type == ElementType.ARRAY) {
    return key != null ? key : ARRAY_STRING;
  }
 else   if (type == ElementType.OBJECT) {
    return key != null ? key : OBJECT_STRING;
  }
 else {
    return key != null ? key : NULL_STRING;
  }
}
Program: 685
Project: 685
Buggy source:
@Override public void messageReceived(ChannelHandlerContext ctx,MessageEvent e){
  timeoutTimer.schedule(new java.util.TimerTask(){
    @Override public void run(){
synchronized (joinStatus) {
        if (System.currentTimeMillis() > timeoutPoint && joinStatus.getStatus() != JoinStatus.Status.COMPLETE) {
          joinStatus.setErrorMessage("String_Node_Str");
          logger.error("String_Node_Str",timeoutThreshold);
        }
      }
    }
  }
,timeoutThreshold + 200);
  if (joinStatus.getStatus() == JoinStatus.Status.FAILED) {
    return;
  }
  NetData.NetMessage message=(NetData.NetMessage)e.getMessage();
synchronized (joinStatus) {
    timeoutPoint=System.currentTimeMillis() + timeoutThreshold;
    if (message.hasServerInfo()) {
      receivedServerInfo(ctx,message.getServerInfo());
    }
 else     if (message.hasModuleDataHeader()) {
      receiveModuleStart(ctx,message.getModuleDataHeader());
    }
 else     if (message.hasModuleData()) {
      receiveModule(ctx,message.getModuleData());
    }
 else     if (message.hasJoinComplete()) {
      if (missingModules.size() > 0) {
        logger.error("String_Node_Str");
      }
      completeJoin(ctx,message.getJoinComplete());
    }
 else {
      logger.error("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
@Override public void messageReceived(ChannelHandlerContext ctx,MessageEvent e){
  scheduleTimeout();
  if (joinStatus.getStatus() == JoinStatus.Status.FAILED) {
    return;
  }
  NetData.NetMessage message=(NetData.NetMessage)e.getMessage();
synchronized (joinStatus) {
    timeoutPoint=System.currentTimeMillis() + timeoutThreshold;
    if (message.hasServerInfo()) {
      receivedServerInfo(ctx,message.getServerInfo());
    }
 else     if (message.hasModuleDataHeader()) {
      receiveModuleStart(ctx,message.getModuleDataHeader());
    }
 else     if (message.hasModuleData()) {
      receiveModule(ctx,message.getModuleData());
    }
 else     if (message.hasJoinComplete()) {
      if (missingModules.size() > 0) {
        logger.error("String_Node_Str");
      }
      completeJoin(ctx,message.getJoinComplete());
    }
 else {
      logger.error("String_Node_Str");
    }
  }
}
Program: 686
Project: 686
Buggy source:
public ClientConnectionHandler(JoinStatusImpl joinStatus,NetworkSystemImpl networkSystem){
  this.networkSystem=networkSystem;
  this.joinStatus=joinStatus;
  this.moduleManager=CoreRegistry.get(ModuleManager.class);
  logger.info("String_Node_Str");
  timeoutPoint=System.currentTimeMillis() + timeoutThreshold;
  timeoutTimer.schedule(new java.util.TimerTask(){
    @Override public void run(){
synchronized (joinStatus) {
        logger.info("String_Node_Str");
        if (System.currentTimeMillis() > timeoutPoint && joinStatus.getStatus() != JoinStatus.Status.COMPLETE) {
          joinStatus.setErrorMessage("String_Node_Str");
          logger.error("String_Node_Str",timeoutThreshold);
        }
      }
    }
  }
,timeoutThreshold + 200);
}

Fixed version (ground truth):
public ClientConnectionHandler(JoinStatusImpl joinStatus,NetworkSystemImpl networkSystem){
  this.networkSystem=networkSystem;
  this.joinStatus=joinStatus;
  this.moduleManager=CoreRegistry.get(ModuleManager.class);
  scheduleTimeout();
}
Program: 687
Project: 687
Buggy source:
@Override public void run(){
synchronized (joinStatus) {
    if (System.currentTimeMillis() > timeoutPoint && joinStatus.getStatus() != JoinStatus.Status.COMPLETE) {
      joinStatus.setErrorMessage("String_Node_Str");
      logger.error("String_Node_Str",timeoutThreshold);
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
synchronized (joinStatus) {
    if (System.currentTimeMillis() > timeoutPoint && joinStatus.getStatus() != JoinStatus.Status.COMPLETE && joinStatus.getStatus() != JoinStatus.Status.FAILED) {
      joinStatus.setErrorMessage("String_Node_Str");
      logger.error("String_Node_Str",timeoutThreshold);
    }
  }
}
Program: 688
Project: 688
Buggy source:
@Override public void process(){
  PerformanceMonitor.startActivity("String_Node_Str");
  enableWireframeIf(renderingDebugConfig.isWireframe());
  worldRenderer.renderChunks(renderQueues.chunksAlphaReject,ChunkMesh.RenderPhase.ALPHA_REJECT,playerCamera,WorldRendererImpl.ChunkRenderMode.DEFAULT);
  PerformanceMonitor.endActivity();
}

Fixed version (ground truth):
@Override public void process(){
  PerformanceMonitor.startActivity("String_Node_Str");
  enableWireframeIf(renderingDebugConfig.isWireframe());
  worldRenderer.renderChunks(renderQueues.chunksAlphaReject,ChunkMesh.RenderPhase.ALPHA_REJECT,playerCamera,WorldRendererImpl.ChunkRenderMode.DEFAULT);
  disableWireframeIf(renderingDebugConfig.isWireframe());
  PerformanceMonitor.endActivity();
}
Program: 689
Project: 689
Buggy source:
@Override public void process(){
  PerformanceMonitor.startActivity("String_Node_Str");
  enableWireframeIf(renderingDebugConfig.isWireframe());
  worldRenderer.renderChunks(renderQueues.chunksOpaque,ChunkMesh.RenderPhase.OPAQUE,playerCamera,WorldRendererImpl.ChunkRenderMode.DEFAULT);
  PerformanceMonitor.endActivity();
}

Fixed version (ground truth):
@Override public void process(){
  PerformanceMonitor.startActivity("String_Node_Str");
  enableWireframeIf(renderingDebugConfig.isWireframe());
  worldRenderer.renderChunks(renderQueues.chunksOpaque,ChunkMesh.RenderPhase.OPAQUE,playerCamera,WorldRendererImpl.ChunkRenderMode.DEFAULT);
  disableWireframeIf(renderingDebugConfig.isWireframe());
  PerformanceMonitor.endActivity();
}