nus-yam/ex-repair huggingface dataset:
Program: 11035
Project: 11035
Buggy source:
/** 
 * Bind this VBO's buffer. Also uploads the buffer to the video card if it is dirty.
 * @param gl OpenGL context
 */
public void bind(GL gl){
  if (vboId < 0) {
    int[] vboIds=new int[1];
    gl.glGenBuffers(vboIds.length,vboIds,0);
    vboId=vboIds[0];
  }
  gl.glBindBuffer(getTarget(),vboId);
  if (dirty) {
    Buffer b=wrapBuffer(buffer);
    gl.glBufferData(getTarget(),b.limit() * getDataSize(),b.rewind(),GL.GL_STATIC_DRAW);
    dirty=false;
  }
}

Fixed version (ground truth):
/** 
 * Bind this VBO's buffer. Also uploads the buffer to the video card if it is dirty.
 * @param gl OpenGL context
 */
public void bind(GL gl){
  if (vboId < 0) {
    int[] vboIds=new int[1];
    gl.glGenBuffers(vboIds.length,vboIds,0);
    vboId=vboIds[0];
  }
  gl.glBindBuffer(getTarget(),vboId);
  if (dirty) {
    boolean locked=false;
    if (uploadRequired) {
      lock.lock();
      uploadRequired=false;
      locked=true;
    }
 else {
      locked=lock.tryLock();
    }
    if (locked) {
      try {
        Buffer b=wrapBuffer(buffer);
        gl.glBufferData(getTarget(),b.limit() * getDataSize(),b.rewind(),GL.GL_STATIC_DRAW);
        dirty=false;
      }
  finally {
        lock.unlock();
      }
    }
  }
}
Program: 11036
Project: 11036
Buggy source:
/** 
 * Set this VBO's data array. The array will be passed to the video card upon the next call to   {@link #bind(GL)}.
 * @param buffer
 */
public void setBuffer(ARRAY buffer){
  this.buffer=buffer;
  markDirty();
}

Fixed version (ground truth):
/** 
 * Set this VBO's data array. The array will be passed to the video card upon the next call to   {@link #bind(GL)}.
 * @param buffer
 */
public void setBuffer(ARRAY buffer){
  if (!uploadRequired) {
    uploadRequired=this.buffer != buffer;
  }
  this.buffer=buffer;
  markDirty();
}
Program: 11038
Project: 11038
Buggy source:
protected synchronized void resortIndices(final DrawContext dc,final Vec4 eyePoint){
  Runnable runnable=new Runnable(){
    @Override public void run(){
      float[] vertices=vertexVBO.getBuffer();
      if (vertices == null) {
        return;
      }
      int[] indices=indexVBO.getBuffer();
      int size=indices != null ? indices.length : vertices.length / 3;
      int[] sortedIndices=sortedIndexVBO.getBuffer();
      if (sortedIndices == null || sortedIndices.length != size) {
        sortedIndices=new int[size];
      }
      sortIndices(dc,eyePoint,vertices,indices,sortedIndices);
      sortedIndexVBO.setBuffer(sortedIndices);
    }
  }
;
  IndexUpdater.run(this,runnable);
}

Fixed version (ground truth):
protected synchronized void resortIndices(final DrawContext dc,final Vec4 eyePoint){
  Runnable runnable=new Runnable(){
    @Override public void run(){
      float[] vertices=vertexVBO.getBuffer();
      if (vertices == null) {
        return;
      }
      int[] indices=indexVBO.getBuffer();
      int size=indices != null ? indices.length : vertices.length / 3;
      sortedIndexVBO.lock();
      try {
        int[] sortedIndices=sortedIndexVBO.getBuffer();
        if (sortedIndices == null || sortedIndices.length != size) {
          sortedIndices=new int[size];
        }
        sortIndices(dc,eyePoint,vertices,indices,sortedIndices);
        sortedIndexVBO.setBuffer(sortedIndices);
      }
  finally {
        sortedIndexVBO.unlock();
      }
    }
  }
;
  IndexUpdater.run(this,runnable);
}
Program: 11039
Project: 11039
Buggy source:
@Override public void run(){
  float[] vertices=vertexVBO.getBuffer();
  if (vertices == null) {
    return;
  }
  int[] indices=indexVBO.getBuffer();
  int size=indices != null ? indices.length : vertices.length / 3;
  int[] sortedIndices=sortedIndexVBO.getBuffer();
  if (sortedIndices == null || sortedIndices.length != size) {
    sortedIndices=new int[size];
  }
  sortIndices(dc,eyePoint,vertices,indices,sortedIndices);
  sortedIndexVBO.setBuffer(sortedIndices);
}

Fixed version (ground truth):
@Override public void run(){
  float[] vertices=vertexVBO.getBuffer();
  if (vertices == null) {
    return;
  }
  int[] indices=indexVBO.getBuffer();
  int size=indices != null ? indices.length : vertices.length / 3;
  sortedIndexVBO.lock();
  try {
    int[] sortedIndices=sortedIndexVBO.getBuffer();
    if (sortedIndices == null || sortedIndices.length != size) {
      sortedIndices=new int[size];
    }
    sortIndices(dc,eyePoint,vertices,indices,sortedIndices);
    sortedIndexVBO.setBuffer(sortedIndices);
  }
  finally {
    sortedIndexVBO.unlock();
  }
}
Program: 11040
Project: 11040
Buggy source:
protected void recalculateVertices(final DrawContext dc,boolean runNow){
  Runnable runnable=new Runnable(){
    @Override public void run(){
      positionsLock.readLock().lock();
      try {
        int size=positions.size() * 3;
        float[] vertices=vertexVBO.getBuffer();
        if (vertices == null || vertices.length != size) {
          vertices=new float[size];
        }
        calculateVertices(dc,vertices);
        vertexVBO.setBuffer(vertices);
        if (willCalculateNormals()) {
          float[] normals=normalVBO.getBuffer();
          if (normals == null || normals.length != size) {
            normals=new float[size];
          }
          calculateNormals(vertices,normals);
          normalVBO.setBuffer(normals);
        }
        Sphere temp=boundingSphere;
        boundingSphere=modBoundingSphere;
        modBoundingSphere=temp;
      }
  finally {
        positionsLock.readLock().unlock();
      }
      if (lastLayer != null && !followTerrain) {
        lastLayer.firePropertyChange(AVKey.LAYER,null,lastLayer);
      }
    }
  }
;
  if (runNow) {
    runnable.run();
  }
 else {
    VertexUpdater.run(this,runnable);
  }
}

Fixed version (ground truth):
protected boolean recalculateVertices(final DrawContext dc,boolean runNow){
  Runnable runnable=new Runnable(){
    @Override public void run(){
      positionsLock.readLock().lock();
      try {
        int size=positions.size() * 3;
        float[] vertices;
        vertexVBO.lock();
        try {
          vertices=vertexVBO.getBuffer();
          if (vertices == null || vertices.length != size) {
            vertices=new float[size];
          }
          calculateVertices(dc,vertices);
          vertexVBO.setBuffer(vertices);
        }
  finally {
          vertexVBO.unlock();
        }
        if (willCalculateNormals()) {
          normalVBO.lock();
          try {
            float[] normals=normalVBO.getBuffer();
            if (normals == null || normals.length != size) {
              normals=new float[size];
            }
            calculateNormals(vertices,normals);
            normalVBO.setBuffer(normals);
          }
  finally {
            normalVBO.unlock();
          }
        }
        Sphere temp=boundingSphere;
        boundingSphere=modBoundingSphere;
        modBoundingSphere=temp;
      }
  finally {
        positionsLock.readLock().unlock();
      }
      if (lastLayer != null) {
        lastLayer.firePropertyChange(AVKey.LAYER,null,lastLayer);
      }
    }
  }
;
  if (runNow) {
    runnable.run();
    return true;
  }
 else {
    return VertexUpdater.run(this,runnable);
  }
}
Program: 11041
Project: 11041
Buggy source:
protected void recalculateIfRequired(DrawContext dc,double alpha){
  boolean recalculateVertices=isVertexRecalculationRequired(dc) || verticesDirty || lastGlobe != dc.getGlobe();
  if (recalculateVertices) {
    lastGlobe=dc.getGlobe();
    DrawContextDelegateVerticalExaggerationOverride dcve=new DrawContextDelegateVerticalExaggerationOverride(dc);
    dcve.overrideVerticalExaggeration(dc.getVerticalExaggeration());
    recalculateVertices(dcve,false);
    verticesDirty=false;
  }
  Vec4 eyePoint=dc.getView().getEyePoint();
  boolean recalculateIndices=(forceSortedPrimitives || (sortTransparentPrimitives && alpha < 1.0)) && (mode == GL.GL_TRIANGLES || mode == GL.GL_POINTS) && !eyePoint.equals(lastEyePoint);
  if (recalculateIndices) {
    lastEyePoint=eyePoint;
    resortIndices(dc,lastEyePoint);
  }
}

Fixed version (ground truth):
protected void recalculateIfRequired(DrawContext dc,double alpha){
  boolean followTerrainRecalculationRequired=false;
  if (followTerrain) {
    long currentTime=System.currentTimeMillis();
    if (currentTime - lastFollowTerrainUpdateTime > getFollowTerrainUpdateFrequency()) {
      lastFollowTerrainUpdateTime=currentTime;
      followTerrainRecalculationRequired=true;
    }
  }
  boolean recalculateVertices=followTerrainRecalculationRequired || elevationChanged || verticesDirty|| lastGlobe != dc.getGlobe() || VerticalExaggerationAccessor.isVerticalExaggerationChanged(this,dc);
  if (recalculateVertices) {
    boolean willRecalculate=recalculateVertices(dc,false);
    if (willRecalculate) {
      lastGlobe=dc.getGlobe();
      verticesDirty=false;
      elevationChanged=false;
      VerticalExaggerationAccessor.markVerticalExaggeration(this,dc);
    }
  }
  Vec4 eyePoint=dc.getView().getEyePoint();
  boolean recalculateIndices=(forceSortedPrimitives || (sortTransparentPrimitives && alpha < 1.0)) && (mode == GL.GL_TRIANGLES || mode == GL.GL_POINTS) && !eyePoint.equals(lastEyePoint);
  if (recalculateIndices) {
    lastEyePoint=eyePoint;
    resortIndices(dc,lastEyePoint);
  }
}
Program: 11042
Project: 11042
Buggy source:
protected synchronized void calculateVertices(DrawContext dc,float[] vertices){
  double ve=dc.getVerticalExaggeration();
  int index=0;
  for (  LatLon position : positions) {
    Vec4 v=calculateVertex(dc,position);
    vertices[index++]=(float)v.x;
    vertices[index++]=(float)v.y;
    vertices[index++]=(float)v.z;
    if (ve != dc.getVerticalExaggeration()) {
      System.out.println(ve + "String_Node_Str" + dc.getVerticalExaggeration());
    }
  }
  BufferWrapper wrapper=new BufferWrapper.FloatBufferWrapper(FloatBuffer.wrap(vertices));
  modBoundingSphere=createBoundingSphere(wrapper);
  if (modBoundingSphere == null) {
    modBoundingSphere=new Sphere(Vec4.ZERO,1);
  }
  for (int i=0; i < vertices.length; i+=3) {
    vertices[i + 0]-=(float)modBoundingSphere.getCenter().x;
    vertices[i + 1]-=(float)modBoundingSphere.getCenter().y;
    vertices[i + 2]-=(float)modBoundingSphere.getCenter().z;
  }
}

Fixed version (ground truth):
protected synchronized void calculateVertices(DrawContext dc,float[] vertices){
  int index=0;
  for (  LatLon position : positions) {
    Vec4 v=calculateVertex(dc,position);
    vertices[index++]=(float)v.x;
    vertices[index++]=(float)v.y;
    vertices[index++]=(float)v.z;
  }
  BufferWrapper wrapper=new BufferWrapper.FloatBufferWrapper(FloatBuffer.wrap(vertices));
  modBoundingSphere=createBoundingSphere(wrapper);
  if (modBoundingSphere == null) {
    modBoundingSphere=new Sphere(Vec4.ZERO,1);
  }
  for (int i=0; i < vertices.length; i+=3) {
    vertices[i + 0]-=(float)modBoundingSphere.getCenter().x;
    vertices[i + 1]-=(float)modBoundingSphere.getCenter().y;
    vertices[i + 2]-=(float)modBoundingSphere.getCenter().z;
  }
}
Program: 11043
Project: 11043
Buggy source:
public synchronized void run(Object owner,Runnable runnable){
  OwnerRunnable or=new OwnerRunnable(owner,runnable);
  if (!set.contains(or)) {
    set.add(or);
    queue.add(or);
  }
}

Fixed version (ground truth):
public synchronized boolean run(Object owner,Runnable runnable){
  OwnerRunnable or=new OwnerRunnable(owner,runnable);
  if (!set.contains(or)) {
    set.add(or);
    queue.add(or);
    return true;
  }
  return false;
}
Program: 11045
Project: 11045
Buggy source:
protected void update(DrawContext dc){
  this.time=System.currentTimeMillis();
  if (dc.getGLRuntimeCapabilities().isUseVertexBufferObject()) {
    this.fillVerticesVBO(dc);
  }
}

Fixed version (ground truth):
protected void update(DrawContext dc,Vec4 referenceCenter){
  this.time=System.currentTimeMillis();
  this.referenceCenter=referenceCenter;
  if (dc.getGLRuntimeCapabilities().isUseVertexBufferObject()) {
    this.fillVerticesVBO(dc);
  }
}
Program: 11046
Project: 11046
Buggy source:
protected IWorker<MutableTreeNode[]> getWorkerInterface(final LazyTreeNode node){
  return new IWorker<MutableTreeNode[]>(){
    @Override public MutableTreeNode[] work() throws Exception {
      return node.loadChildren(model);
    }
    @Override public void done(    MutableTreeNode[] nodes){
      node.setChildren(nodes);
      tree.getUI().relayout();
    }
    @Override public void error(    Exception e){
      node.setErrorLoading(true);
      node.setChildren(createErrorNode(e));
    }
  }
;
}

Fixed version (ground truth):
protected IWorker<MutableTreeNode[]> getWorkerInterface(final LazyTreeNode node){
  return new IWorker<MutableTreeNode[]>(){
    @Override public MutableTreeNode[] work() throws Exception {
      return node.loadChildren(model);
    }
    @Override public void done(    MutableTreeNode[] nodes){
      node.setChildren(nodes);
      tree.getUI().relayout();
      tree.repaint();
    }
    @Override public void error(    Exception e){
      node.setErrorLoading(true);
      node.setChildren(createErrorNode(e));
    }
  }
;
}
Program: 11047
Project: 11047
Buggy source:
private void fireTreeNodesRemoved(Object source,Object[] path,int[] childIndices,Object[] children){
  TreeModelEvent e=new TreeModelEvent(source,path,childIndices,children);
  for (int i=listeners.size() - 1; i >= 0; i--) {
    listeners.get(i).treeNodesRemoved(e);
  }
}

Fixed version (ground truth):
private void fireTreeNodesRemoved(final Object source,final Object[] path,final int[] childIndices,final Object[] children){
  SwingUtil.invokeLaterTaskOnEDT(new Runnable(){
    @Override public void run(){
      TreeModelEvent e=new TreeModelEvent(source,path,childIndices,children);
      for (int i=listeners.size() - 1; i >= 0; i--) {
        listeners.get(i).treeNodesRemoved(e);
      }
    }
  }
);
}
Program: 11048
Project: 11048
Buggy source:
@Override public void run(){
  tree.getUI().relayout(expand);
  tree.scrollPathToVisible(expand);
}

Fixed version (ground truth):
@Override public void run(){
  TreeModelEvent e=new TreeModelEvent(source,path,childIndices,children);
  for (int i=listeners.size() - 1; i >= 0; i--) {
    listeners.get(i).treeNodesRemoved(e);
  }
}
Program: 11049
Project: 11049
Buggy source:
protected void fireTreeNodesChanged(Object source,Object[] path,int[] childIndices,Object[] children){
  TreeModelEvent e=new TreeModelEvent(source,path,childIndices,children);
  for (int i=listeners.size() - 1; i >= 0; i--) {
    listeners.get(i).treeNodesChanged(e);
  }
}

Fixed version (ground truth):
protected void fireTreeNodesChanged(final Object source,final Object[] path,final int[] childIndices,final Object[] children){
  SwingUtil.invokeLaterTaskOnEDT(new Runnable(){
    @Override public void run(){
      TreeModelEvent e=new TreeModelEvent(source,path,childIndices,children);
      for (int i=listeners.size() - 1; i >= 0; i--) {
        listeners.get(i).treeNodesChanged(e);
      }
    }
  }
);
}
Program: 11050
Project: 11050
Buggy source:
private void fireTreeNodesInserted(Object source,Object[] path,int[] childIndices,Object[] children){
  TreeModelEvent e=new TreeModelEvent(source,path,childIndices,children);
  for (int i=listeners.size() - 1; i >= 0; i--) {
    listeners.get(i).treeNodesInserted(e);
  }
}

Fixed version (ground truth):
private void fireTreeNodesInserted(final Object source,final Object[] path,final int[] childIndices,final Object[] children){
  SwingUtil.invokeLaterTaskOnEDT(new Runnable(){
    @Override public void run(){
      TreeModelEvent e=new TreeModelEvent(source,path,childIndices,children);
      for (int i=listeners.size() - 1; i >= 0; i--) {
        listeners.get(i).treeNodesInserted(e);
      }
    }
  }
);
}
Program: 11052
Project: 11052
Buggy source:
public synchronized void setPositions(List<LatLon> positions){
  this.positions.clear();
  double[] distances=new double[positions.size()];
  double total=0d;
  for (int i=0; i < positions.size() - 1; i++) {
    Angle distance=LatLon.greatCircleDistance(positions.get(i),positions.get(i + 1));
    distances[i]=distance.radians;
    total+=distance.radians;
  }
  this.length=Angle.fromRadians(total);
  double sum=0d;
  for (int i=0; i < positions.size(); i++) {
    this.positions.put(sum / total,positions.get(i));
    sum+=distances[i];
  }
}

Fixed version (ground truth):
private synchronized void setPositions(List<LatLon> positions){
  this.positions.clear();
  double[] distances=new double[positions.size()];
  double total=0d;
  for (int i=0; i < positions.size() - 1; i++) {
    Angle distance=LatLon.greatCircleDistance(positions.get(i),positions.get(i + 1));
    distances[i]=distance.radians;
    total+=distance.radians;
  }
  this.length=Angle.fromRadians(total);
  double sum=0d;
  for (int i=0; i < positions.size(); i++) {
    this.positions.put(sum / total,positions.get(i));
    sum+=distances[i];
  }
}
Program: 11055
Project: 11055
Buggy source:
/** 
 * Insert a clipping plane vector into the given array. The vector is calculated by finding a plane that intersects the three given points.
 * @param clippingPlaneArray Array to insert clipping plane vector into
 * @param arrayOffset Array start offset to begin inserting values at
 * @param v1 First point that the plane must intersect
 * @param v2 Second point that the plane must intersect
 * @param v3 Third point that the plane must intersect
 */
protected void insertClippingPlaneForPoints(double[] clippingPlaneArray,int arrayOffset,Vec4 v1,Vec4 v2,Vec4 v3){
  Line l1=Line.fromSegment(v1,v3);
  Line l2=Line.fromSegment(v1,v2);
  Plane plane=GeometryUtil.createPlaneContainingLines(l1,l2);
  Vec4 v=plane.getVector();
  clippingPlaneArray[arrayOffset + 0]=v.x;
  clippingPlaneArray[arrayOffset + 1]=v.y;
  clippingPlaneArray[arrayOffset + 2]=v.z;
  clippingPlaneArray[arrayOffset + 3]=v.w;
}

Fixed version (ground truth):
/** 
 * Insert a clipping plane vector into the given array. The vector is calculated by finding a plane that intersects the three given points.
 * @param clippingPlaneArray Array to insert clipping plane vector into
 * @param arrayOffset Array start offset to begin inserting values at
 * @param v1 First point that the plane must intersect
 * @param v2 Second point that the plane must intersect
 * @param v3 Third point that the plane must intersect
 */
protected void insertClippingPlaneForPoints(double[] clippingPlaneArray,int arrayOffset,Vec4 v1,Vec4 v2,Vec4 v3){
  if (v1 == null || v2 == null || v3 == null || v1.equals(v2) || v1.equals(v3)) {
    return;
  }
  Line l1=Line.fromSegment(v1,v3);
  Line l2=Line.fromSegment(v1,v2);
  Plane plane=GeometryUtil.createPlaneContainingLines(l1,l2);
  Vec4 v=plane.getVector();
  clippingPlaneArray[arrayOffset + 0]=v.x;
  clippingPlaneArray[arrayOffset + 1]=v.y;
  clippingPlaneArray[arrayOffset + 2]=v.z;
  clippingPlaneArray[arrayOffset + 3]=v.w;
}
Program: 11057
Project: 11057
Buggy source:
protected void parseLine(String line){
  Matcher matcher=paintedVariablePattern.matcher(line);
  if (matcher.matches()) {
    paintedVariableName=matcher.group(1);
  }
  matcher=axisPattern.matcher(line);
  if (matcher.matches()) {
    if (matcher.group(1).equals("String_Node_Str")) {
      xSize=(int)Double.parseDouble(matcher.group(2));
      ySize=(int)Double.parseDouble(matcher.group(3));
      zSize=(int)Double.parseDouble(matcher.group(4));
    }
  }
  matcher=propAlignmentPattern.matcher(line);
  if (matcher.matches()) {
    String propAlignment=matcher.group(1);
    cellCentered=propAlignment.toLowerCase().equals("String_Node_Str");
  }
  matcher=asciiDataFilePattern.matcher(line);
  if (matcher.matches()) {
    asciiDataFile=matcher.group(1);
  }
  matcher=propertyNamePattern.matcher(line);
  if (matcher.matches()) {
    int propertyId=Integer.parseInt(matcher.group(1));
    String propertyName=matcher.group(2);
    if (propertyName.equals(paintedVariableName)) {
      paintedVariableId=propertyId;
    }
  }
  matcher=propertyNoDataPattern.matcher(line);
  if (matcher.matches()) {
    int propertyId=Integer.parseInt(matcher.group(1));
    float noDataValue=Float.parseFloat(matcher.group(2));
    if (propertyId == paintedVariableId) {
      this.noDataValue=noDataValue;
    }
  }
}

Fixed version (ground truth):
protected void parseLine(String line){
  Matcher matcher=paintedVariablePattern.matcher(line);
  if (matcher.matches()) {
    paintedVariableName=matcher.group(1);
    return;
  }
  matcher=axisPattern.matcher(line);
  if (matcher.matches()) {
    if (matcher.group(1).equals("String_Node_Str")) {
      xSize=(int)Double.parseDouble(matcher.group(2));
      ySize=(int)Double.parseDouble(matcher.group(3));
      zSize=(int)Double.parseDouble(matcher.group(4));
    }
    return;
  }
  matcher=propAlignmentPattern.matcher(line);
  if (matcher.matches()) {
    String propAlignment=matcher.group(1);
    cellCentered=propAlignment.toLowerCase().equals("String_Node_Str");
    return;
  }
  matcher=asciiDataFilePattern.matcher(line);
  if (matcher.matches()) {
    asciiDataFile=matcher.group(1);
    return;
  }
  matcher=propertyNamePattern.matcher(line);
  if (matcher.matches()) {
    int propertyId=Integer.parseInt(matcher.group(1));
    String propertyName=matcher.group(2);
    if (propertyName.equals(paintedVariableName)) {
      paintedVariableId=propertyId;
    }
    return;
  }
  matcher=propertyNoDataPattern.matcher(line);
  if (matcher.matches()) {
    int propertyId=Integer.parseInt(matcher.group(1));
    float noDataValue=Float.parseFloat(matcher.group(2));
    if (propertyId == paintedVariableId) {
      this.noDataValue=noDataValue;
    }
    return;
  }
}
Program: 11058
Project: 11058
Buggy source:
@Test public void testSave() throws Exception {
  INode root=createNodeTree();
  Document document=LayerTreePersistance.saveToDocument(root);
  String result=getFormattedXml(document);
  String expected=TestUtils.readStreamToString(getClass().getResourceAsStream("String_Node_Str"));
  assertEquals(convertLineBreaks(expected.trim()),convertLineBreaks(result.trim()));
}

Fixed version (ground truth):
@Test public void testSave() throws Exception {
  INode root=createNodeTree();
  Document document=LayerTreePersistance.saveToDocument(root);
  String result=getFormattedXml(document);
  String expected=TestUtils.readStreamToString(getClass().getResourceAsStream("String_Node_Str"));
  assertEquals(removeXmlDeclaration(convertLineBreaks(expected.trim())),removeXmlDeclaration(convertLineBreaks(result.trim())));
}
Program: 11059
Project: 11059
Buggy source:
@Override public void afterRetrieve(Retriever retriever){
  SectorPolyline s=retrievingLines.get(retriever);
  if (s != null) {
    removeRenderable(s);
    firePropertyChange(AVKey.LAYER,null,this);
  }
}

Fixed version (ground truth):
@Override public void afterRetrieve(Retriever retriever){
  SectorPolyline s=retrievingLines.remove(retriever);
  if (s != null) {
    removeRenderable(s);
    firePropertyChange(AVKey.LAYER,null,this);
  }
}
Program: 11061
Project: 11061
Buggy source:
@Override public TopBottomFastShape createLatitudeCurtain(int y){
  List<Position> positions=new ArrayList<Position>();
  FloatBuffer textureCoordinateBuffer=BufferUtil.newFloatBuffer(ySize * 4);
  for (int x=0; x < xSize; x++) {
    Position position=this.positions.get(x + y * xSize);
    TopBottomPosition top=new TopBottomPosition(position.latitude,position.longitude,position.elevation,false);
    TopBottomPosition bottom=new TopBottomPosition(position.latitude,position.longitude,position.elevation,true);
    positions.add(top);
    positions.add(bottom);
    float u=x / (float)Math.max(1,xSize - 1);
    textureCoordinateBuffer.put(u).put(0);
    textureCoordinateBuffer.put(u).put(1);
  }
  TopBottomFastShape shape=new TopBottomFastShape(positions,GL.GL_TRIANGLE_STRIP);
  shape.setTextureCoordinateBuffer(textureCoordinateBuffer);
  return shape;
}

Fixed version (ground truth):
@Override public TopBottomFastShape createLatitudeCurtain(int y){
  List<Position> positions=new ArrayList<Position>();
  FloatBuffer textureCoordinateBuffer=BufferUtil.newFloatBuffer(xSize * 4);
  for (int x=0; x < xSize; x++) {
    Position position=this.positions.get(x + y * xSize);
    TopBottomPosition top=new TopBottomPosition(position.latitude,position.longitude,position.elevation,false);
    TopBottomPosition bottom=new TopBottomPosition(position.latitude,position.longitude,position.elevation,true);
    positions.add(top);
    positions.add(bottom);
    float u=x / (float)Math.max(1,xSize - 1);
    textureCoordinateBuffer.put(u).put(0);
    textureCoordinateBuffer.put(u).put(1);
  }
  TopBottomFastShape shape=new TopBottomFastShape(positions,GL.GL_TRIANGLE_STRIP);
  shape.setTextureCoordinateBuffer(textureCoordinateBuffer);
  return shape;
}
Program: 11063
Project: 11063
Buggy source:
private synchronized static ByteBuffer takeByteBuffer(int size){
  Entry<Integer,ByteBuffer> entry=availableBuffers.higherEntry(size);
  if (entry != null) {
    ByteBuffer buffer=entry.getValue();
    availableBuffers.remove(entry.getKey());
    buffer.rewind();
    buffer.limit(size);
    return buffer;
  }
  return ByteBuffer.allocateDirect(size);
}

Fixed version (ground truth):
private synchronized static ByteBuffer takeByteBuffer(int size){
  Entry<Integer,ByteBuffer> entry=availableBuffers.ceilingEntry(size);
  if (entry != null) {
    ByteBuffer buffer=entry.getValue();
    availableBuffers.remove(entry.getKey());
    buffer.rewind();
    buffer.limit(size);
    return buffer;
  }
  return ByteBuffer.allocateDirect(size);
}
Program: 11064
Project: 11064
Buggy source:
@Override public void paint(Graphics g,JComponent c){
synchronized (invalidatedPaths) {
    if (relayout || !invalidatedPaths.isEmpty()) {
      if (relayout) {
        treeState.invalidateSizes();
      }
 else {
        for (        TreePath path : invalidatedPaths) {
          treeState.invalidatePathBounds(path);
        }
      }
      updateSize();
      relayout=false;
      invalidatedPaths.clear();
    }
  }
  super.paint(g,c);
}

Fixed version (ground truth):
@Override public void paint(Graphics g,JComponent c){
  if (relayout || !invalidatedPaths.isEmpty()) {
    if (relayout) {
      treeState.invalidateSizes();
    }
 else {
      for (      TreePath path : invalidatedPaths) {
        treeState.invalidatePathBounds(path);
      }
    }
    updateSize();
    relayout=false;
    invalidatedPaths.clear();
  }
  super.paint(g,c);
}
Program: 11066
Project: 11066
Buggy source:
@Override public void setup(Theme theme){
  super.setup(theme);
  tree.addTreeSelectionListener(new TreeSelectionListener(){
    @Override public void valueChanged(    TreeSelectionEvent e){
      treeSelectionChanged();
      enableActions();
    }
  }
);
  treeSelectionChanged();
  enableActions();
  createPopupMenus();
  linkPanels(theme.getPanels());
  setupDrag();
  if (!layersFileExisted) {
    for (    IDataset dataset : theme.getDatasets()) {
      addDefaultLayersFromDataset(dataset);
    }
  }
  window=SwingUtilities.getWindowAncestor(this);
}

Fixed version (ground truth):
@Override public void setup(final Theme theme){
  super.setup(theme);
  tree.addTreeSelectionListener(new TreeSelectionListener(){
    @Override public void valueChanged(    TreeSelectionEvent e){
      treeSelectionChanged();
      enableActions();
    }
  }
);
  treeSelectionChanged();
  enableActions();
  createPopupMenus();
  linkPanels(theme.getPanels());
  setupDrag();
  if (!layersFileExisted) {
    Thread thread=new Thread(new Runnable(){
      @Override public void run(){
        for (        IDataset dataset : theme.getDatasets()) {
          addDefaultLayersFromDataset(dataset);
        }
      }
    }
);
    thread.setDaemon(true);
    thread.start();
  }
  window=SwingUtilities.getWindowAncestor(this);
}
Program: 11067
Project: 11067
Buggy source:
private void addLayersToList(INode parent,List<ILayerNode> layers){
  if (parent instanceof ILayerNode) {
    layers.add((ILayerNode)parent);
  }
  for (int i=0; i < parent.getChildCount(); i++) {
    addLayersToList(parent.getChild(i),layers);
  }
}

Fixed version (ground truth):
private void addLayersToList(INode parent,List<ILayerNode> layers){
  if (parent instanceof ILayerNode && !parent.isTransient()) {
    layers.add((ILayerNode)parent);
  }
  for (int i=0; i < parent.getChildCount(); i++) {
    addLayersToList(parent.getChild(i),layers);
  }
}
Program: 11069
Project: 11069
Buggy source:
protected void buildMesh(float maxVariance,int x,int y,int width,int height,boolean reverseX,boolean reverseY,List<BTTTriangle> triangles){
  int yStart=y;
  int remainingHeight=height;
  while (remainingHeight > 1) {
    int xStart=x;
    int remainingWidth=width;
    int currentHeight=nextLowestPowerOf2Plus1(Math.min(remainingWidth,remainingHeight));
    while (remainingWidth > 1) {
      int currentWidth=nextLowestPowerOf2Plus1(Math.min(remainingWidth,remainingHeight));
      for (int yOffset=0; yOffset < currentHeight - 1; yOffset+=currentWidth - 1) {
        int tx=reverseX ? width - xStart - currentWidth + x * 2 : xStart;
        int ty=reverseY ? height - yStart - yOffset- currentWidth + y * 2 : yStart + yOffset;
        buildTree(maxVariance,tx,ty,currentWidth,triangles);
      }
      remainingWidth-=currentWidth - 1;
      xStart+=currentWidth - 1;
    }
    remainingHeight-=currentHeight - 1;
    yStart+=currentHeight - 1;
  }
}

Fixed version (ground truth):
protected void buildMesh(float maxVariance,int x,int y,int width,int height,boolean reverseX,boolean reverseY,List<BTTTriangle> triangles){
  if (width < 2 || height < 2)   return;
  int yStart=y;
  int remainingHeight=height;
  while (remainingHeight > 1) {
    int xStart=x;
    int remainingWidth=width;
    int currentHeight=nextLowestPowerOf2Plus1(Math.min(remainingWidth,remainingHeight));
    while (remainingWidth > 1) {
      int currentWidth=nextLowestPowerOf2Plus1(Math.min(remainingWidth,remainingHeight));
      for (int yOffset=0; yOffset < currentHeight - 1; yOffset+=currentWidth - 1) {
        int tx=reverseX ? width - xStart - currentWidth + x * 2 : xStart;
        int ty=reverseY ? height - yStart - yOffset- currentWidth + y * 2 : yStart + yOffset;
        buildTree(maxVariance,tx,ty,currentWidth,triangles);
      }
      remainingWidth-=currentWidth - 1;
      xStart+=currentWidth - 1;
    }
    remainingHeight-=currentHeight - 1;
    yStart+=currentHeight - 1;
  }
}
Program: 11070
Project: 11070
Buggy source:
public void enableClipping(DrawContext dc){
  if (dirty) {
    if (sector == null) {
      planes=null;
    }
 else {
      planes=computeSectorClippingPlanes(dc.getGlobe(),sector);
    }
  }
  if (planes != null) {
    GL gl=dc.getGL();
    gl.glClipPlane(GL.GL_CLIP_PLANE0,planes,0);
    gl.glClipPlane(GL.GL_CLIP_PLANE1,planes,4);
    gl.glClipPlane(GL.GL_CLIP_PLANE2,planes,8);
    gl.glClipPlane(GL.GL_CLIP_PLANE3,planes,12);
    gl.glEnable(GL.GL_CLIP_PLANE0);
    gl.glEnable(GL.GL_CLIP_PLANE1);
    gl.glEnable(GL.GL_CLIP_PLANE2);
    gl.glEnable(GL.GL_CLIP_PLANE3);
  }
}

Fixed version (ground truth):
public void enableClipping(DrawContext dc){
  if (dirty) {
    if (sector == null) {
      planes=null;
    }
 else {
      planes=computeSectorClippingPlanes(dc.getGlobe(),sector);
    }
    dirty=false;
  }
  if (planes != null) {
    GL gl=dc.getGL();
    gl.glClipPlane(GL.GL_CLIP_PLANE0,planes,0);
    gl.glClipPlane(GL.GL_CLIP_PLANE1,planes,4);
    gl.glClipPlane(GL.GL_CLIP_PLANE2,planes,8);
    gl.glClipPlane(GL.GL_CLIP_PLANE3,planes,12);
    gl.glEnable(GL.GL_CLIP_PLANE0);
    gl.glEnable(GL.GL_CLIP_PLANE1);
    gl.glEnable(GL.GL_CLIP_PLANE2);
    gl.glEnable(GL.GL_CLIP_PLANE3);
  }
}
Program: 11071
Project: 11071
Buggy source:
protected void buildMesh(float maxVariance,int x,int y,int width,int height,boolean reverseX,boolean reverseY,List<BTTTriangle> triangles){
  int yStart=y;
  int remainingHeight=height;
  while (remainingHeight > 1) {
    int xStart=x;
    int remainingWidth=width;
    int currentHeight=nextLowestPowerOf2Plus1(Math.min(remainingWidth,remainingHeight));
    while (remainingWidth > 1) {
      int currentWidth=nextLowestPowerOf2Plus1(Math.min(remainingWidth,remainingHeight));
      for (int yOffset=0; yOffset < currentHeight - 1; yOffset+=currentWidth - 1) {
        int tx=reverseX ? width - xStart - currentWidth : xStart;
        int ty=reverseY ? height - yStart - yOffset- currentWidth : yStart + yOffset;
        buildTree(maxVariance,tx,ty,currentWidth,triangles);
      }
      remainingWidth-=currentWidth - 1;
      xStart+=currentWidth - 1;
    }
    remainingHeight-=currentHeight - 1;
    yStart+=currentHeight - 1;
  }
}

Fixed version (ground truth):
protected void buildMesh(float maxVariance,int x,int y,int width,int height,boolean reverseX,boolean reverseY,List<BTTTriangle> triangles){
  int yStart=y;
  int remainingHeight=height;
  while (remainingHeight > 1) {
    int xStart=x;
    int remainingWidth=width;
    int currentHeight=nextLowestPowerOf2Plus1(Math.min(remainingWidth,remainingHeight));
    while (remainingWidth > 1) {
      int currentWidth=nextLowestPowerOf2Plus1(Math.min(remainingWidth,remainingHeight));
      for (int yOffset=0; yOffset < currentHeight - 1; yOffset+=currentWidth - 1) {
        int tx=reverseX ? width - xStart - currentWidth + x * 2 : xStart;
        int ty=reverseY ? height - yStart - yOffset- currentWidth + y * 2 : yStart + yOffset;
        buildTree(maxVariance,tx,ty,currentWidth,triangles);
      }
      remainingWidth-=currentWidth - 1;
      xStart+=currentWidth - 1;
    }
    remainingHeight-=currentHeight - 1;
    yStart+=currentHeight - 1;
  }
}
Program: 11072
Project: 11072
Buggy source:
public List<? extends LatLon> getPositions(){
  return positions;
}

Fixed version (ground truth):
public List<Position> getPositions(){
  return positions;
}
Program: 11073
Project: 11073
Buggy source:
protected static Sphere createBoundingSphere(BufferWrapper wrapper){
  Vec4[] extrema=Vec4.computeExtrema(wrapper);
  Vec4 center=new Vec4((extrema[0].x + extrema[1].x) / 2.0,(extrema[0].y + extrema[1].y) / 2.0,(extrema[0].z + extrema[1].z) / 2.0);
  double radius=Math.max(1,extrema[0].distanceTo3(extrema[1]) / 2.0);
  return new Sphere(center,radius);
}

Fixed version (ground truth):
protected static Sphere createBoundingSphere(BufferWrapper wrapper){
  Vec4[] extrema=Vec4.computeExtrema(wrapper);
  if (extrema == null)   return null;
  Vec4 center=new Vec4((extrema[0].x + extrema[1].x) / 2.0,(extrema[0].y + extrema[1].y) / 2.0,(extrema[0].z + extrema[1].z) / 2.0);
  double radius=Math.max(1,extrema[0].distanceTo3(extrema[1]) / 2.0);
  return new Sphere(center,radius);
}
Program: 11074
Project: 11074
Buggy source:
protected void calculateVertices(DrawContext dc){
  modVertexBuffer.rewind();
  for (  LatLon position : positions) {
    Vec4 v=calculateVertex(dc,position);
    modVertexBuffer.put(v.x).put(v.y).put(v.z);
  }
  modVertexBuffer.rewind();
  BufferWrapper wrapper=new BufferWrapper.DoubleBufferWrapper(modVertexBuffer);
  modBoundingSphere=createBoundingSphere(wrapper);
  modVertexBuffer.rewind();
  for (int i=0; modVertexBuffer.remaining() >= 3; i+=3) {
    modVertexBuffer.put(i + 0,modVertexBuffer.get() - modBoundingSphere.getCenter().x);
    modVertexBuffer.put(i + 1,modVertexBuffer.get() - modBoundingSphere.getCenter().y);
    modVertexBuffer.put(i + 2,modVertexBuffer.get() - modBoundingSphere.getCenter().z);
  }
}

Fixed version (ground truth):
protected void calculateVertices(DrawContext dc){
  modVertexBuffer.rewind();
  for (  LatLon position : positions) {
    Vec4 v=calculateVertex(dc,position);
    modVertexBuffer.put(v.x).put(v.y).put(v.z);
  }
  modVertexBuffer.rewind();
  BufferWrapper wrapper=new BufferWrapper.DoubleBufferWrapper(modVertexBuffer);
  modBoundingSphere=createBoundingSphere(wrapper);
  if (modBoundingSphere == null)   modBoundingSphere=new Sphere(Vec4.ZERO,1);
  modVertexBuffer.rewind();
  for (int i=0; modVertexBuffer.remaining() >= 3; i+=3) {
    modVertexBuffer.put(i + 0,modVertexBuffer.get() - modBoundingSphere.getCenter().x);
    modVertexBuffer.put(i + 1,modVertexBuffer.get() - modBoundingSphere.getCenter().y);
    modVertexBuffer.put(i + 2,modVertexBuffer.get() - modBoundingSphere.getCenter().z);
  }
}
Program: 11075
Project: 11075
Buggy source:
@Override public Sector getSector(){
  frontLock.readLock().unlock();
  try {
    return sector;
  }
  finally {
    frontLock.readLock().unlock();
  }
}

Fixed version (ground truth):
@Override public Sector getSector(){
  frontLock.readLock().lock();
  try {
    return sector;
  }
  finally {
    frontLock.readLock().unlock();
  }
}
Program: 11076
Project: 11076
Buggy source:
/** 
 * @return The extent of this shape. This is calculated by{@link FastShape#render(DrawContext)}, so don't use this for frustum culling.
 */
public Extent getExtent(){
  frontLock.readLock().unlock();
  try {
    return boundingSphere;
  }
  finally {
    frontLock.readLock().unlock();
  }
}

Fixed version (ground truth):
/** 
 * @return The extent of this shape. This is calculated by{@link FastShape#render(DrawContext)}, so don't use this for frustum culling.
 */
public Extent getExtent(){
  frontLock.readLock().lock();
  try {
    return boundingSphere;
  }
  finally {
    frontLock.readLock().unlock();
  }
}
Program: 11077
Project: 11077
Buggy source:
/** 
 * Load the data from the file pointed to by the url. Delegates the loading to the subclass.
 * @param url
 * @param layer
 * @return True if the data was loaded successfully
 */
protected boolean loadData(URL url,L layer){
synchronized (getFileLock()) {
    loading=false;
    loadingListeners.notifyListeners(isLoading());
    if (!loaded)     loaded=doLoadData(url,layer);
    return loaded;
  }
}

Fixed version (ground truth):
/** 
 * Load the data from the file pointed to by the url. Delegates the loading to the subclass.
 * @param url
 * @param layer
 * @return True if the data was loaded successfully
 */
protected boolean loadData(URL url,L layer){
synchronized (readLock) {
    reading=true;
  }
synchronized (getFileLock()) {
    if (!loaded) {
      loaded=doLoadData(url,layer);
    }
  }
synchronized (readLock) {
    loading=false;
    loadingListeners.notifyListeners(isLoading());
    reading=false;
  }
  return loaded;
}
Program: 11078
Project: 11078
Buggy source:
@Override public void requestData(L layer){
  if (!loaded) {
    loading=true;
    loadingListeners.notifyListeners(isLoading());
    RequestTask task=new RequestTask(this,layer);
    WorldWind.getTaskService().addTask(task);
  }
}

Fixed version (ground truth):
@Override public void requestData(L layer){
synchronized (readLock) {
    if (!loaded && !reading) {
      RequestTask task=new RequestTask(this,layer);
      if (!WorldWind.getTaskService().isFull()) {
        loading=true;
        loadingListeners.notifyListeners(isLoading());
        WorldWind.getTaskService().addTask(task);
      }
    }
  }
}
Program: 11079
Project: 11079
Buggy source:
public XMLPointProvider(Element element){
  XPath xpath=XMLUtil.makeXPath();
  Element[] pointElements=XMLUtil.getElements(element,"String_Node_Str",xpath);
  if (pointElements != null) {
    for (    Element pointElement : pointElements) {
      Position position=XMLUtil.getPosition(pointElement,null,xpath);
      if (position != null) {
        points.add(position);
        sector=sector != null ? sector.union(position.latitude,position.longitude) : new Sector(position.latitude,position.longitude,position.latitude,position.longitude);
        AVList attributes=new AVListImpl();
        this.attributes.add(attributes);
        NamedNodeMap elementAttributes=pointElement.getAttributes();
        for (int i=0; i < elementAttributes.getLength(); i++) {
          Node child=elementAttributes.item(i);
          attributes.setValue(child.getNodeName(),child.getTextContent());
        }
        NodeList children=pointElement.getChildNodes();
        for (int i=0; i < children.getLength(); i++) {
          Node child=children.item(i);
          attributes.setValue(child.getNodeName(),child.getTextContent());
        }
      }
    }
  }
}

Fixed version (ground truth):
public XMLPointProvider(Element element){
  XPath xpath=XMLUtil.makeXPath();
  Element[] pointElements=XMLUtil.getElements(element,"String_Node_Str",xpath);
  if (pointElements != null) {
    for (    Element pointElement : pointElements) {
      Position position=XMLUtil.getPosition(pointElement,null,xpath);
      if (position != null) {
        points.add(position);
        sector=sector != null ? sector.union(position.latitude,position.longitude) : new Sector(position.latitude,position.latitude,position.longitude,position.longitude);
        AVList attributes=new AVListImpl();
        this.attributes.add(attributes);
        NamedNodeMap elementAttributes=pointElement.getAttributes();
        for (int i=0; i < elementAttributes.getLength(); i++) {
          Node child=elementAttributes.item(i);
          attributes.setValue(child.getNodeName(),child.getTextContent());
        }
        NodeList children=pointElement.getChildNodes();
        for (int i=0; i < children.getLength(); i++) {
          Node child=children.item(i);
          attributes.setValue(child.getNodeName(),child.getTextContent());
        }
      }
    }
  }
}
Program: 11080
Project: 11080
Buggy source:
public void setPositions(List<Position> positions){
  frontLock.writeLock().lock();
  try {
    this.positions=positions;
    verticesDirty=true;
    sector=null;
    for (    Position position : positions) {
      sector=sector != null ? sector.union(position.latitude,position.longitude) : new Sector(position.latitude,position.longitude,position.latitude,position.longitude);
    }
  }
  finally {
    frontLock.writeLock().unlock();
  }
}

Fixed version (ground truth):
public void setPositions(List<Position> positions){
  frontLock.writeLock().lock();
  try {
    this.positions=positions;
    verticesDirty=true;
    sector=null;
    for (    Position position : positions) {
      sector=sector != null ? sector.union(position.latitude,position.longitude) : new Sector(position.latitude,position.latitude,position.longitude,position.longitude);
    }
  }
  finally {
    frontLock.writeLock().unlock();
  }
}
Program: 11081
Project: 11081
Buggy source:
@Override public void move(double deltaX,double deltaY,double deltaZ){
  View view=getView();
  if (view != null) {
    Vec4 forward=view.getForwardVector();
    Vec4 up=view.getUpVector();
    Vec4 side=up.cross3(forward);
    double scale=getScaleValueElevation();
    side=side.multiply3(deltaX * scale);
    up=up.multiply3(deltaY * scale);
    forward=forward.multiply3(deltaZ * scale);
    Vec4 eyePoint=view.getCurrentEyePoint();
    eyePoint=eyePoint.add3(forward.add3(up.add3(side)));
    Position newPosition=view.getGlobe().computePositionFromPoint(eyePoint);
    view.setEyePosition(newPosition);
    view.firePropertyChange(AVKey.VIEW,null,view);
  }
}

Fixed version (ground truth):
@Override public void move(double deltaX,double deltaY,double deltaZ){
  View view=getView();
  if (view != null) {
    Vec4 forward=view.getForwardVector();
    Vec4 up=view.getUpVector();
    Vec4 side=up.cross3(forward);
    Vec4 eyePoint=view.getCurrentEyePoint();
    Position eyePosition=view.getGlobe().computePositionFromPoint(eyePoint);
    double scale=getScaleValueElevation(eyePosition);
    side=side.multiply3(deltaX * scale);
    up=up.multiply3(deltaY * scale);
    forward=forward.multiply3(deltaZ * scale);
    eyePoint=eyePoint.add3(forward.add3(up.add3(side)));
    Position newPosition=view.getGlobe().computePositionFromPoint(eyePoint);
    view.setEyePosition(newPosition);
    view.firePropertyChange(AVKey.VIEW,null,view);
  }
}
Program: 11082
Project: 11082
Buggy source:
protected double getScaleValueElevation(){
  double[] range=new double[]{10,100000};
  View view=getView();
  Position eyePos=view.getEyePosition();
  Globe globe=getWorldWindow().getModel().getGlobe();
  double radius=globe.getRadius();
  double surfaceElevation=globe.getElevation(eyePos.getLatitude(),eyePos.getLongitude());
  double t=getScaleValue(range[0],range[1],eyePos.getElevation() - surfaceElevation,3.0 * radius,true);
  return t;
}

Fixed version (ground truth):
protected double getScaleValueElevation(Position eyePosition){
  double[] range=new double[]{10,100000};
  Globe globe=getView().getGlobe();
  double radius=globe.getRadius();
  double surfaceElevation=globe.getElevation(eyePosition.getLatitude(),eyePosition.getLongitude());
  double t=getScaleValue(range[0],range[1],eyePosition.getElevation() - surfaceElevation,3.0 * radius,true);
  return t;
}
Program: 11083
Project: 11083
Buggy source:
protected void afterDoApply(){
  this.lastEyePosition=null;
  this.lastEyePoint=null;
  this.lastUpVector=null;
  this.lastForwardVector=null;
  this.lastFrustumInModelCoords=null;
}

Fixed version (ground truth):
protected void afterDoApply(){
  this.lastEyePosition=this.computeEyePositionFromModelview();
  this.horizonDistance=this.computeHorizonDistance();
  this.lastEyePoint=null;
  this.lastUpVector=null;
  this.lastForwardVector=null;
  this.lastFrustumInModelCoords=null;
}
Program: 11084
Project: 11084
Buggy source:
protected void calculateVertices(DrawContext dc){
  modVertexBuffer.rewind();
  Globe globe=dc.getGlobe();
  for (  LatLon position : positions) {
    double elevation=this.elevation;
    if (followTerrain) {
      elevation+=globe.getElevation(position.getLatitude(),position.getLongitude());
    }
    if (position instanceof Position) {
      elevation+=((Position)position).getElevation();
    }
    elevation*=dc.getVerticalExaggeration();
    elevation=Math.max(elevation,-dc.getGlobe().getMaximumRadius());
    Vec4 v=dc.getGlobe().computePointFromPosition(position.getLatitude(),position.getLongitude(),elevation);
    modVertexBuffer.put(v.x).put(v.y).put(v.z);
  }
  modVertexBuffer.rewind();
  BufferWrapper wrapper=new BufferWrapper.DoubleBufferWrapper(modVertexBuffer);
  modBoundingSphere=Sphere.createBoundingSphere(wrapper);
  modVertexBuffer.rewind();
  for (int i=0; modVertexBuffer.remaining() >= 3; i+=3) {
    modVertexBuffer.put(i + 0,modVertexBuffer.get() - modBoundingSphere.getCenter().x);
    modVertexBuffer.put(i + 1,modVertexBuffer.get() - modBoundingSphere.getCenter().y);
    modVertexBuffer.put(i + 2,modVertexBuffer.get() - modBoundingSphere.getCenter().z);
  }
}

Fixed version (ground truth):
protected void calculateVertices(DrawContext dc){
  modVertexBuffer.rewind();
  Globe globe=dc.getGlobe();
  for (  LatLon position : positions) {
    double elevation=this.elevation;
    if (followTerrain) {
      elevation+=globe.getElevation(position.getLatitude(),position.getLongitude());
    }
    if (position instanceof Position) {
      elevation+=((Position)position).getElevation();
    }
    elevation*=dc.getVerticalExaggeration();
    elevation=Math.max(elevation,-dc.getGlobe().getMaximumRadius());
    Vec4 v=dc.getGlobe().computePointFromPosition(position.getLatitude(),position.getLongitude(),elevation);
    modVertexBuffer.put(v.x).put(v.y).put(v.z);
  }
  modVertexBuffer.rewind();
  BufferWrapper wrapper=new BufferWrapper.DoubleBufferWrapper(modVertexBuffer);
  modBoundingSphere=createBoundingSphere(wrapper);
  modVertexBuffer.rewind();
  for (int i=0; modVertexBuffer.remaining() >= 3; i+=3) {
    modVertexBuffer.put(i + 0,modVertexBuffer.get() - modBoundingSphere.getCenter().x);
    modVertexBuffer.put(i + 1,modVertexBuffer.get() - modBoundingSphere.getCenter().y);
    modVertexBuffer.put(i + 2,modVertexBuffer.get() - modBoundingSphere.getCenter().z);
  }
}
Program: 11085
Project: 11085
Buggy source:
protected String getPlaceholderString(StringWithPlaceholder string,AVList attributeValues){
  if (string == null || !attributeValues.hasKey(name))   return null;
  String stringValue=attributeValues.getValue(name).toString();
  return string.replacePlaceholder(stringValue);
}

Fixed version (ground truth):
protected String getPlaceholderString(StringWithPlaceholder string,AVList attributeValues){
  if (string == null || attributeValues.getValue(name) == null)   return null;
  String stringValue=attributeValues.getValue(name).toString();
  return string.replacePlaceholder(stringValue);
}