Program: 90935
Project: 90935
Buggy source:
private void addBranch(final Spot start,final double vx,final double vy,final int iteration,final int nDivisions,final int nFramesPerDivision){
  if (iteration >= nDivisions) {
    return;
  }
  final Spot previousSpot=model.getGraph().vertexRef();
  final Spot spot=model.getGraph().vertexRef();
  final Spot daughter=model.getGraph().vertexRef();
  final Link link=model.getGraph().edgeRef();
  final double[] pos=new double[3];
  final double[][] cov=new double[][]{{RADIUS,0,0},{0,RADIUS,0},{0,0,RADIUS}};
  previousSpot.refTo(start);
  for (int it=0; it < nFramesPerDivision; it++) {
    pos[0]=previousSpot.getDoublePosition(0) + vx;
    pos[1]=previousSpot.getDoublePosition(1) + vy;
    pos[2]=previousSpot.getDoublePosition(2);
    final int frame=previousSpot.getTimepoint() + 1;
    model.addSpot(frame,pos,cov,spot);
    model.addLink(previousSpot,spot,link);
    previousSpot.refTo(spot);
  }
  for (int id=0; id < 2; id++) {
    final double sign=id == 0 ? 1 : -1;
    final double x;
    final double y;
    final double z;
    if (iteration % 2 == 0) {
      x=previousSpot.getDoublePosition(0);
      y=previousSpot.getDoublePosition(1);
      z=previousSpot.getDoublePosition(2) + sign * VELOCITY * (1 - 0.5d * iteration / nDivisions)* 2;
    }
 else {
      x=previousSpot.getDoublePosition(0) - sign * vy * (1 - 0.5d * iteration / nDivisions)* 2;
      y=previousSpot.getDoublePosition(1) + sign * vx * (1 - 0.5d * iteration / nDivisions)* 2;
      z=previousSpot.getDoublePosition(2);
    }
    final int frame=previousSpot.getTimepoint() + 1;
    pos[0]=x;
    pos[1]=y;
    pos[2]=z;
    model.addSpot(frame,pos,cov,daughter);
    model.addLink(previousSpot,daughter,link);
    addBranch(daughter,vx,vy,iteration + 1,nDivisions,nFramesPerDivision);
  }
  model.getGraph().releaseRef(previousSpot);
  model.getGraph().releaseRef(spot);
  model.getGraph().releaseRef(daughter);
  model.getGraph().releaseRef(link);
}

Fixed version (ground truth):
private void addBranch(final Spot start,final double vx,final double vy,final int iteration,final int nDivisions,final int nFramesPerDivision){
  if (iteration >= nDivisions) {
    return;
  }
  final Spot previousSpot=model.getGraph().vertexRef();
  final Spot spot=model.getGraph().vertexRef();
  final Spot daughter=model.getGraph().vertexRef();
  final Link link=model.getGraph().edgeRef();
  final double[] pos=new double[3];
  final double[][] cov=new double[][]{{RADIUS,0,0},{0,RADIUS,0},{0,0,RADIUS}};
  previousSpot.refTo(start);
  for (int it=0; it < nFramesPerDivision; it++) {
    pos[0]=previousSpot.getDoublePosition(0) + vx;
    pos[1]=previousSpot.getDoublePosition(1) + vy;
    pos[2]=previousSpot.getDoublePosition(2);
    final int frame=previousSpot.getTimepoint() + 1;
    model.getGraph().addVertex(spot).init(frame,pos,cov);
    model.getGraph().addEdge(previousSpot,spot,link).init();
    previousSpot.refTo(spot);
  }
  for (int id=0; id < 2; id++) {
    final double sign=id == 0 ? 1 : -1;
    final double x;
    final double y;
    final double z;
    if (iteration % 2 == 0) {
      x=previousSpot.getDoublePosition(0);
      y=previousSpot.getDoublePosition(1);
      z=previousSpot.getDoublePosition(2) + sign * VELOCITY * (1 - 0.5d * iteration / nDivisions)* 2;
    }
 else {
      x=previousSpot.getDoublePosition(0) - sign * vy * (1 - 0.5d * iteration / nDivisions)* 2;
      y=previousSpot.getDoublePosition(1) + sign * vx * (1 - 0.5d * iteration / nDivisions)* 2;
      z=previousSpot.getDoublePosition(2);
    }
    final int frame=previousSpot.getTimepoint() + 1;
    pos[0]=x;
    pos[1]=y;
    pos[2]=z;
    model.getGraph().addVertex(daughter).init(frame,pos,cov);
    model.getGraph().addEdge(previousSpot,daughter,link).init();
    addBranch(daughter,vx,vy,iteration + 1,nDivisions,nFramesPerDivision);
  }
  model.getGraph().releaseRef(previousSpot);
  model.getGraph().releaseRef(spot);
  model.getGraph().releaseRef(daughter);
  model.getGraph().releaseRef(link);
}