Program: 58896
Project: 58896
Buggy source:
/** 
 * Calculates the similarity matrix for a given set and VA�s
 * @param set
 * @param iVAIdContent
 * @param iVAIdStorage
 * @return
 */
public void determineSimilarities(ISet set,Integer iVAIdContent,Integer iVAIdStorage,EClustererType eClustererType){
  IVirtualArray contentVA=set.getVA(iVAIdContent);
  IVirtualArray storageVA=set.getVA(iVAIdStorage);
  IDistanceMeasure distanceMeasure=new EuclideanDistance();
  int icnt1=0, icnt2=0, isto=0;
  if (eClustererType == EClustererType.GENE_CLUSTERING) {
    float[] dArInstance1=new float[storageVA.size()];
    float[] dArInstance2=new float[storageVA.size()];
    for (    Integer iContentIndex1 : contentVA) {
      isto=0;
      for (      Integer iStorageIndex1 : storageVA) {
        dArInstance1[isto]=set.get(iStorageIndex1).getFloat(EDataRepresentation.RAW,iContentIndex1);
        isto++;
      }
      icnt2=0;
      for (      Integer iContentIndex2 : contentVA) {
        isto=0;
        if (icnt2 < icnt1) {
          for (          Integer iStorageIndex2 : storageVA) {
            dArInstance2[isto]=set.get(iStorageIndex2).getFloat(EDataRepresentation.RAW,iContentIndex2);
            isto++;
          }
          similarities[icnt1][icnt2]=distanceMeasure.getMeasure(dArInstance1,dArInstance2);
        }
        icnt2++;
      }
      icnt1++;
    }
  }
 else {
    float[] dArInstance1=new float[contentVA.size()];
    float[] dArInstance2=new float[contentVA.size()];
    for (    Integer iStorageIndex1 : storageVA) {
      isto=0;
      for (      Integer iContentIndex1 : contentVA) {
        dArInstance1[isto]=set.get(iStorageIndex1).getFloat(EDataRepresentation.RAW,iContentIndex1);
        isto++;
      }
      icnt2=0;
      for (      Integer iStorageIndex2 : storageVA) {
        isto=0;
        if (icnt2 < icnt1) {
          for (          Integer iContentIndex2 : contentVA) {
            dArInstance2[isto]=set.get(iStorageIndex2).getFloat(EDataRepresentation.RAW,iContentIndex2);
            isto++;
          }
          similarities[icnt1][icnt2]=distanceMeasure.getMeasure(dArInstance1,dArInstance2);
        }
        icnt2++;
      }
      icnt1++;
    }
  }
}

Fixed version (ground truth):
/** 
 * Calculates the similarity matrix for a given set and VA�s
 * @param set
 * @param iVAIdContent
 * @param iVAIdStorage
 * @return
 */
public void determineSimilarities(ISet set,Integer iVAIdContent,Integer iVAIdStorage,EClustererType eClustererType){
  IVirtualArray contentVA=set.getVA(iVAIdContent);
  IVirtualArray storageVA=set.getVA(iVAIdStorage);
  IDistanceMeasure distanceMeasure=new EuclideanDistance();
  int icnt1=0, icnt2=0, isto=0;
  if (eClustererType == EClustererType.GENE_CLUSTERING) {
    bStart0=true;
    float[] dArInstance1=new float[storageVA.size()];
    float[] dArInstance2=new float[storageVA.size()];
    for (    Integer iContentIndex1 : contentVA) {
      isto=0;
      for (      Integer iStorageIndex1 : storageVA) {
        dArInstance1[isto]=set.get(iStorageIndex1).getFloat(EDataRepresentation.RAW,iContentIndex1);
        isto++;
      }
      icnt2=0;
      for (      Integer iContentIndex2 : contentVA) {
        isto=0;
        if (icnt2 < icnt1) {
          for (          Integer iStorageIndex2 : storageVA) {
            dArInstance2[isto]=set.get(iStorageIndex2).getFloat(EDataRepresentation.RAW,iContentIndex2);
            isto++;
          }
          similarities[icnt1][icnt2]=distanceMeasure.getMeasure(dArInstance1,dArInstance2);
        }
        icnt2++;
      }
      icnt1++;
    }
  }
 else {
    bStart0=false;
    float[] dArInstance1=new float[contentVA.size()];
    float[] dArInstance2=new float[contentVA.size()];
    for (    Integer iStorageIndex1 : storageVA) {
      isto=0;
      for (      Integer iContentIndex1 : contentVA) {
        dArInstance1[isto]=set.get(iStorageIndex1).getFloat(EDataRepresentation.RAW,iContentIndex1);
        isto++;
      }
      icnt2=0;
      for (      Integer iStorageIndex2 : storageVA) {
        isto=0;
        if (icnt2 < icnt1) {
          for (          Integer iContentIndex2 : contentVA) {
            dArInstance2[isto]=set.get(iStorageIndex2).getFloat(EDataRepresentation.RAW,iContentIndex2);
            isto++;
          }
          similarities[icnt1][icnt2]=distanceMeasure.getMeasure(dArInstance1,dArInstance2);
        }
        icnt2++;
      }
      icnt1++;
    }
  }
  normalizeSimilarities();
}