Program: 58866
Project: 58866
Buggy source:
/** 
 * Render a node of the dendrogram (recursive)
 * @param gl
 * @param currentNode
 */
private void renderDendrogram(final GL gl,ClusterNode currentNode){
  if (currentNode.getSelectionType() == ESelectionType.MOUSE_OVER) {
    gl.glColor4fv(MOUSE_OVER_COLOR,0);
    gl.glBegin(GL.GL_QUADS);
    gl.glVertex3f(currentNode.getPos().x() - 0.05f,currentNode.getPos().y() - 0.05f,currentNode.getPos().z());
    gl.glVertex3f(currentNode.getPos().x() + 0.05f,currentNode.getPos().y() - 0.05f,currentNode.getPos().z());
    gl.glVertex3f(currentNode.getPos().x() + 0.05f,currentNode.getPos().y() + 0.05f,currentNode.getPos().z());
    gl.glVertex3f(currentNode.getPos().x() - 0.05f,currentNode.getPos().y() + 0.05f,currentNode.getPos().z());
    gl.glEnd();
  }
 else   if (currentNode.getSelectionType() == ESelectionType.SELECTION) {
    gl.glColor4fv(SELECTED_COLOR,0);
    gl.glBegin(GL.GL_QUADS);
    gl.glVertex3f(currentNode.getPos().x() - 0.05f,currentNode.getPos().y() - 0.05f,currentNode.getPos().z());
    gl.glVertex3f(currentNode.getPos().x() + 0.05f,currentNode.getPos().y() - 0.05f,currentNode.getPos().z());
    gl.glVertex3f(currentNode.getPos().x() + 0.05f,currentNode.getPos().y() + 0.05f,currentNode.getPos().z());
    gl.glVertex3f(currentNode.getPos().x() - 0.05f,currentNode.getPos().y() + 0.05f,currentNode.getPos().z());
    gl.glEnd();
  }
 else {
    float fLookupValue=currentNode.getAverageExpressionValue();
    float[] fArMappingColor=colorMapper.getColor(fLookupValue);
    float fOpacity=1;
    gl.glColor4f(fArMappingColor[0],fArMappingColor[1],fArMappingColor[2],fOpacity);
  }
  float fDiff=0;
  float fTemp=currentNode.getPos().x();
  List<ClusterNode> listGraph=null;
  if (tree.hasChildren(currentNode)) {
    listGraph=tree.getChildren(currentNode);
    int iNrChildsNode=listGraph.size();
    float xmin=Float.MAX_VALUE;
    float ymax=Float.MIN_VALUE;
    float ymin=Float.MAX_VALUE;
    Vec3f[] temp=new Vec3f[iNrChildsNode];
    for (int i=0; i < iNrChildsNode; i++) {
      ClusterNode current=(ClusterNode)listGraph.get(i);
      temp[i]=new Vec3f();
      temp[i].setX(current.getPos().x());
      temp[i].setY(current.getPos().y());
      temp[i].setZ(current.getPos().z());
      xmin=Math.min(xmin,current.getPos().x());
      ymax=Math.max(ymax,current.getPos().y());
      ymin=Math.min(ymin,current.getPos().y());
      renderDendrogram(gl,current);
    }
    fDiff=fTemp - xmin;
    float fLookupValue=currentNode.getAverageExpressionValue();
    float[] fArMappingColor=colorMapper.getColor(fLookupValue);
    float fOpacity=1;
    gl.glColor4f(fArMappingColor[0],fArMappingColor[1],fArMappingColor[2],fOpacity);
    gl.glPushName(pickingManager.getPickingID(iUniqueID,EPickingType.DENDROGRAM_SELECTION,currentNode.getClusterNr()));
    gl.glBegin(GL.GL_LINES);
    gl.glVertex3f(xmin - 0.1f,ymin,currentNode.getPos().z());
    gl.glVertex3f(xmin - 0.1f,ymax,currentNode.getPos().z());
    gl.glEnd();
    gl.glColor4f(0,0,0,1);
    for (int i=0; i < iNrChildsNode; i++) {
      gl.glBegin(GL.GL_LINES);
      gl.glVertex3f(xmin - 0.1f,temp[i].y(),temp[i].z());
      gl.glVertex3f(temp[i].x() - 0.1f,temp[i].y(),temp[i].z());
      gl.glEnd();
    }
    gl.glPopName();
  }
 else {
    gl.glPushName(pickingManager.getPickingID(iUniqueID,EPickingType.DENDROGRAM_SELECTION,currentNode.getClusterNr()));
    float fLookupValue=currentNode.getAverageExpressionValue();
    float[] fArMappingColor=colorMapper.getColor(fLookupValue);
    float fOpacity=1;
    gl.glColor4f(fArMappingColor[0],fArMappingColor[1],fArMappingColor[2],fOpacity);
    gl.glBegin(GL.GL_LINES);
    gl.glVertex3f(currentNode.getPos().x(),currentNode.getPos().y(),currentNode.getPos().z());
    gl.glVertex3f(currentNode.getPos().x() - 0.1f,currentNode.getPos().y(),currentNode.getPos().z());
    gl.glEnd();
    gl.glPopName();
  }
  float fLookupValue=currentNode.getAverageExpressionValue();
  float[] fArMappingColor=colorMapper.getColor(fLookupValue);
  float fOpacity=1;
  gl.glColor4f(fArMappingColor[0],fArMappingColor[1],fArMappingColor[2],fOpacity);
  gl.glBegin(GL.GL_LINES);
  gl.glVertex3f(currentNode.getPos().x() - fDiff - 0.1f,currentNode.getPos().y(),currentNode.getPos().z());
  gl.glVertex3f(currentNode.getPos().x() - 0.1f,currentNode.getPos().y(),currentNode.getPos().z());
  gl.glEnd();
}

Fixed version (ground truth):
/** 
 * Render a node of the dendrogram (recursive)
 * @param gl
 * @param currentNode
 */
private void renderDendrogram(final GL gl,ClusterNode currentNode){
  if (currentNode.getSelectionType() == ESelectionType.MOUSE_OVER) {
    gl.glColor4fv(MOUSE_OVER_COLOR,0);
    gl.glBegin(GL.GL_QUADS);
    gl.glVertex3f(currentNode.getPos().x() - 0.05f,currentNode.getPos().y() - 0.05f,currentNode.getPos().z());
    gl.glVertex3f(currentNode.getPos().x() + 0.05f,currentNode.getPos().y() - 0.05f,currentNode.getPos().z());
    gl.glVertex3f(currentNode.getPos().x() + 0.05f,currentNode.getPos().y() + 0.05f,currentNode.getPos().z());
    gl.glVertex3f(currentNode.getPos().x() - 0.05f,currentNode.getPos().y() + 0.05f,currentNode.getPos().z());
    gl.glEnd();
  }
 else   if (currentNode.getSelectionType() == ESelectionType.SELECTION) {
    gl.glColor4fv(SELECTED_COLOR,0);
    gl.glBegin(GL.GL_QUADS);
    gl.glVertex3f(currentNode.getPos().x() - 0.05f,currentNode.getPos().y() - 0.05f,currentNode.getPos().z());
    gl.glVertex3f(currentNode.getPos().x() + 0.05f,currentNode.getPos().y() - 0.05f,currentNode.getPos().z());
    gl.glVertex3f(currentNode.getPos().x() + 0.05f,currentNode.getPos().y() + 0.05f,currentNode.getPos().z());
    gl.glVertex3f(currentNode.getPos().x() - 0.05f,currentNode.getPos().y() + 0.05f,currentNode.getPos().z());
    gl.glEnd();
  }
 else {
    float fLookupValue=currentNode.getAverageExpressionValue();
    float[] fArMappingColor=colorMapper.getColor(fLookupValue);
    float fOpacity=1;
    gl.glColor4f(fArMappingColor[0],fArMappingColor[1],fArMappingColor[2],fOpacity);
  }
  float fDiff=0;
  float fTemp=currentNode.getPos().x();
  List<ClusterNode> listGraph=null;
  if (tree.hasChildren(currentNode)) {
    listGraph=tree.getChildren(currentNode);
    int iNrChildsNode=listGraph.size();
    float xmin=Float.MAX_VALUE;
    float ymax=Float.MIN_VALUE;
    float ymin=Float.MAX_VALUE;
    Vec3f[] temp=new Vec3f[iNrChildsNode];
    for (int i=0; i < iNrChildsNode; i++) {
      ClusterNode current=(ClusterNode)listGraph.get(i);
      temp[i]=new Vec3f();
      temp[i].setX(current.getPos().x());
      temp[i].setY(current.getPos().y());
      temp[i].setZ(current.getPos().z());
      xmin=Math.min(xmin,current.getPos().x());
      ymax=Math.max(ymax,current.getPos().y());
      ymin=Math.min(ymin,current.getPos().y());
      if (current.getDepth() > iMaxDepth)       renderDendrogram(gl,current);
    }
    fDiff=fTemp - xmin;
    float fLookupValue=currentNode.getAverageExpressionValue();
    float[] fArMappingColor=colorMapper.getColor(fLookupValue);
    float fOpacity=1;
    gl.glColor4f(fArMappingColor[0],fArMappingColor[1],fArMappingColor[2],fOpacity);
    gl.glPushName(pickingManager.getPickingID(iUniqueID,EPickingType.DENDROGRAM_SELECTION,currentNode.getClusterNr()));
    gl.glBegin(GL.GL_LINES);
    gl.glVertex3f(xmin - 0.1f,ymin,currentNode.getPos().z());
    gl.glVertex3f(xmin - 0.1f,ymax,currentNode.getPos().z());
    gl.glEnd();
    gl.glColor4f(0,0,0,1);
    for (int i=0; i < iNrChildsNode; i++) {
      gl.glBegin(GL.GL_LINES);
      gl.glVertex3f(xmin - 0.1f,temp[i].y(),temp[i].z());
      gl.glVertex3f(temp[i].x() - 0.1f,temp[i].y(),temp[i].z());
      gl.glEnd();
    }
    gl.glPopName();
  }
 else {
    gl.glPushName(pickingManager.getPickingID(iUniqueID,EPickingType.DENDROGRAM_SELECTION,currentNode.getClusterNr()));
    float fLookupValue=currentNode.getAverageExpressionValue();
    float[] fArMappingColor=colorMapper.getColor(fLookupValue);
    float fOpacity=1;
    gl.glColor4f(fArMappingColor[0],fArMappingColor[1],fArMappingColor[2],fOpacity);
    gl.glBegin(GL.GL_LINES);
    gl.glVertex3f(currentNode.getPos().x(),currentNode.getPos().y(),currentNode.getPos().z());
    gl.glVertex3f(currentNode.getPos().x() - 0.1f,currentNode.getPos().y(),currentNode.getPos().z());
    gl.glEnd();
    gl.glPopName();
  }
  float fLookupValue=currentNode.getAverageExpressionValue();
  float[] fArMappingColor=colorMapper.getColor(fLookupValue);
  float fOpacity=1;
  gl.glColor4f(fArMappingColor[0],fArMappingColor[1],fArMappingColor[2],fOpacity);
  gl.glBegin(GL.GL_LINES);
  gl.glVertex3f(currentNode.getPos().x() - fDiff - 0.1f,currentNode.getPos().y(),currentNode.getPos().z());
  gl.glVertex3f(currentNode.getPos().x() - 0.1f,currentNode.getPos().y(),currentNode.getPos().z());
  gl.glEnd();
}