Program: 57108
Project: 57108
Buggy source:
@Override protected PerspectiveInitializationData cluster(){
  if (progressAndCancel(1,false))   return canceled();
  final int nrDimensions=oppositeVA.size();
  final int[] assignments=new int[va.size()];
  Arrays.fill(assignments,-1);
  float[] vector=new float[nrDimensions];
  final List<Cluster> clusters=createClusters(nrSamples);
  if (cache != null) {
    for (int i=0; i < assignments.length; ++i) {
      Integer vid=va.get(i);
      cache.put(vid,fillVector(null,vid));
    }
  }
  int iteration=0;
  boolean converged=false;
  if (progressAndCancel(10,false))   return canceled();
  int lastP=10;
  final float scale=(80.f - 10.f) / MAX_ITERATIONS;
  for (; !converged && iteration < MAX_ITERATIONS; ++iteration) {
    converged=true;
    for (    Cluster c : clusters) {
      c.prepareRound();
    }
    for (int i=0; i < assignments.length; ++i) {
      Integer vid=va.get(i);
      vector=cache != null ? (float[])cache.get(vid) : fillVector(vector,vid);
      int best=-1;
      float distance=Float.POSITIVE_INFINITY;
      for (      Cluster cluster : clusters) {
        float dc=cluster.distance(vid,vector);
        if (dc < distance) {
          best=cluster.index;
          distance=dc;
        }
      }
      if (assignments[i] != best) {
        converged=false;
        assignments[i]=best;
      }
    }
    for (    Cluster c : clusters)     c.prepareMoving();
    for (int i=0; i < assignments.length; ++i) {
      int best=assignments[i];
      Integer vid=va.get(i);
      vector=cache != null ? (float[])cache.get(vid) : fillVector(vector,vid);
      clusters.get(best).add(vector);
    }
    eventListeners.processEvents();
    if (isClusteringCanceled) {
      return canceled();
    }
    int p=10 + Math.round(scale * iteration);
    if (p > lastP)     progress(p,false);
    lastP=p;
  }
  for (  Cluster c : clusters)   c.stopMoving();
  if (progressAndCancel(80,false))   return canceled();
  List<Integer> clusterSamples=transformClusters(assignments,clusters);
  return postProcess(assignments,clusterSamples);
}

Fixed version (ground truth):
@Override protected PerspectiveInitializationData cluster(){
  if (progressAndCancel(1,false))   return canceled();
  final int nrDimensions=oppositeVA.size();
  final int[] assignments=new int[va.size()];
  Arrays.fill(assignments,-1);
  float[] vector=new float[nrDimensions];
  final List<Cluster> clusters=createClusters(nrSamples);
  if (cache != null) {
    for (int i=0; i < assignments.length; ++i) {
      Integer vid=va.get(i);
      cache.put(vid,fillVector(null,vid));
    }
  }
  int iteration=0;
  boolean converged=false;
  if (progressAndCancel(10,false))   return canceled();
  int lastP=10;
  final float scale=(80.f - 10.f) / MAX_ITERATIONS;
  for (; !converged && iteration < MAX_ITERATIONS; ++iteration) {
    converged=true;
    for (    Cluster c : clusters) {
      c.prepareRound();
    }
    for (int i=0; i < assignments.length; ++i) {
      Integer vid=va.get(i);
      vector=getValue(vector,vid);
      int best=-1;
      float distance=Float.POSITIVE_INFINITY;
      for (      Cluster cluster : clusters) {
        float dc=cluster.distance(vid,vector);
        if (dc < distance) {
          best=cluster.index;
          distance=dc;
        }
      }
      if (assignments[i] != best) {
        converged=false;
        assignments[i]=best;
      }
    }
    for (    Cluster c : clusters)     c.prepareMoving();
    for (int i=0; i < assignments.length; ++i) {
      int best=assignments[i];
      Integer vid=va.get(i);
      vector=getValue(vector,vid);
      clusters.get(best).add(vector);
    }
    eventListeners.processEvents();
    if (isClusteringCanceled) {
      return canceled();
    }
    int p=10 + Math.round(scale * iteration);
    if (p > lastP)     progress(p,false);
    lastP=p;
  }
  for (  Cluster c : clusters)   c.stopMoving();
  if (progressAndCancel(80,false))   return canceled();
  List<Integer> clusterSamples=transformClusters(assignments,clusters);
  return postProcess(assignments,clusterSamples);
}