Program: 46357
Project: 46357
Buggy source:
/** 
 * Return the space that encloses this point, if the space does not exist, create it
 * @param position
 * @return
 */
public Iterable<Space> getEnclosingSpace(BoundingVolume volume){
  ArrayList retList=new ArrayList();
  Vector3f point=volume.getCenter();
  int x=(int)(point.x / (SPACE_SIZE * 2));
  int y=(int)(point.y / (SPACE_SIZE * 2));
  int z=(int)(point.z / (SPACE_SIZE * 2));
  if (point.x < 0)   x-=1;
  if (point.y < 0)   y-=1;
  if (point.z < 0)   z-=1;
  Space sp=getEnclosingSpaceImpl(x,y,z);
  if (sp == null)   sp=createSpace(point,x,y,z);
  if (!sp.getWorldBounds().contains(point))   throw new RuntimeException("String_Node_Str" + sp.getWorldBounds() + "String_Node_Str"+ point+ "String_Node_Str"+ getSpaceBindingName(x,y,z));
  retList.add(sp);
  float radius;
  if (volume instanceof BoundingBox) {
    radius=((BoundingBox)volume).xExtent;
  }
 else   if (volume instanceof BoundingSphere) {
    radius=((BoundingSphere)volume).getRadius();
  }
 else   throw new RuntimeException("String_Node_Str" + volume.getClass().getName());
  int step=(int)(radius / (SPACE_SIZE * 2));
  for (int xs=0; xs < x + step; xs++) {
    for (int ys=0; ys < y + step; ys++) {
      for (int zs=0; zs < z + step; zs++) {
        sp=getEnclosingSpaceImpl(x + xs,y + ys,z + zs);
        if (sp != null && sp.getWorldBounds().intersects(volume)) {
          retList.add(sp);
        }
        sp=getEnclosingSpaceImpl(x - xs,y - ys,z - zs);
        if (sp != null && sp.getWorldBounds().intersects(volume)) {
          retList.add(sp);
        }
      }
    }
  }
  return retList;
}

Fixed version (ground truth):
/** 
 * Return the space that encloses this point, if the space does not exist, create it
 * @param position
 * @return
 */
public Iterable<Space> getEnclosingSpace(BoundingVolume volume){
  ArrayList retList=new ArrayList();
  Vector3f point=volume.getCenter();
  int x=(int)(point.x / (SPACE_SIZE * 2));
  int y=(int)(point.y / (SPACE_SIZE * 2));
  int z=(int)(point.z / (SPACE_SIZE * 2));
  if (point.x < 0)   x-=1;
  if (point.y < 0)   y-=1;
  if (point.z < 0)   z-=1;
  Space sp=getEnclosingSpaceImpl(x,y,z);
  if (sp == null) {
    sp=createSpace(point,x,y,z);
  }
  if (!sp.getWorldBounds().contains(point))   throw new RuntimeException("String_Node_Str" + sp.getWorldBounds() + "String_Node_Str"+ point+ "String_Node_Str"+ getSpaceBindingName(x,y,z));
  retList.add(sp);
  float radius;
  if (volume instanceof BoundingBox) {
    radius=((BoundingBox)volume).xExtent;
  }
 else   if (volume instanceof BoundingSphere) {
    radius=((BoundingSphere)volume).getRadius();
  }
 else   throw new RuntimeException("String_Node_Str" + volume.getClass().getName());
  int step=(int)(radius / (SPACE_SIZE * 2));
  for (int xs=0; xs < step; xs++) {
    for (int ys=0; ys < step; ys++) {
      for (int zs=0; zs < step; zs++) {
        sp=getEnclosingSpaceImpl(x + xs,y + ys,z + zs);
        if (sp != null && sp.getWorldBounds().intersects(volume)) {
          retList.add(sp);
        }
        sp=getEnclosingSpaceImpl(x - xs,y - ys,z - zs);
        if (sp != null && sp.getWorldBounds().intersects(volume)) {
          retList.add(sp);
        }
      }
    }
  }
  return retList;
}