Program: 108343
Project: 108343
Buggy source:
/** 
 * Creates a new set of domain shares derived from the given attribute
 * @param hierarchy
 */
public DomainShare(GeneralizationHierarchy hierarchy,String[] dictvalues){
  int[][] array=hierarchy.getArray();
  this.size=array.length;
  this.duplicates=new LongDoubleOpenHashMap();
  this.shares=new double[dictvalues.length];
  Arrays.fill(shares,NOT_AVAILABLE);
  IntIntOpenHashMap[] maps=new IntIntOpenHashMap[array[0].length];
  for (int level=0; level < maps.length; level++) {
    maps[level]=new IntIntOpenHashMap(hierarchy.getDistinctValues()[level]);
  }
  for (int value=0; value < array.length; value++) {
    int[] transformation=array[value];
    for (int level=0; level < transformation.length; level++) {
      maps[level].putOrAdd(transformation[level],1,1);
    }
  }
  for (int level=0; level < maps.length; level++) {
    IntIntOpenHashMap map=maps[level];
    boolean[] allocated=map.allocated;
    int[] keys=map.keys;
    int[] values=map.values;
    for (int index=0; index < allocated.length; index++) {
      if (allocated[index]) {
        int key=keys[index];
        double share=(double)values[index] / size;
        double stored=shares[key];
        if (stored != NOT_AVAILABLE) {
          if (stored == share) {
            continue;
          }
          if (stored >= 0d) {
            shares[key]=-shares[key];
          }
          long dkey=(((long)key) << 32) | (level & 0xffffffffL);
          duplicates.put(dkey,share);
        }
 else {
          shares[key]=share;
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Creates a new set of domain shares derived from the given attribute
 * @param hierarchy
 */
public DomainShare(String[][] hierarchy,String[] distinctvalues){
  String[][] array=hierarchy;
  Map<String,Integer> internaldict=new HashMap<String,Integer>();
  for (int i=0; i < distinctvalues.length; i++) {
    internaldict.put(distinctvalues[i],i);
  }
  this.size=array.length;
  this.duplicates=new LongDoubleOpenHashMap();
  this.shares=new double[distinctvalues.length];
  Arrays.fill(shares,NOT_AVAILABLE);
  @SuppressWarnings("String_Node_Str") Map<String,Integer>[] maps=new HashMap[array[0].length];
  for (int level=0; level < maps.length; level++) {
    maps[level]=new HashMap<String,Integer>();
  }
  for (int value=0; value < array.length; value++) {
    String[] transformation=array[value];
    for (int level=0; level < transformation.length; level++) {
      Map<String,Integer> map=maps[level];
      String key=transformation[level];
      if (!map.containsKey(key)) {
        map.put(key,0);
      }
      map.put(key,map.get(key) + 1);
    }
  }
  for (int level=0; level < maps.length; level++) {
    Map<String,Integer> map=maps[level];
    for (    Entry<String,Integer> entry : map.entrySet()) {
      String keyString=entry.getKey();
      double share=(double)entry.getValue() / size;
      Integer key=internaldict.get(keyString);
      if (key == null) {
        continue;
      }
      double stored=shares[key];
      if (stored != NOT_AVAILABLE) {
        if (stored == share) {
          continue;
        }
        if (stored >= 0d) {
          shares[key]=-shares[key];
        }
        long dkey=(((long)key) << 32) | (level & 0xffffffffL);
        duplicates.put(dkey,share);
      }
 else {
        shares[key]=share;
      }
    }
  }
}