Program: 135043
Project: 135043
Buggy source:
/** 
 * When the logs are ordered by entry type, it finds the position in the ordered list where the log has to be inserted. The algoritm has logaritmic complexity
 * @param The entry type of the log to be inserted
 * @return The position log to insert in the visible logs
 */
private int findPosLogarthmicType(int type){
  int minInter=0;
  int maxInter=visibleLogs.size() - 1;
  int middle=0;
  int maxType;
  int minType;
  boolean sortAscending=comparator.isSortAscending();
  do {
    maxType=cache.getLogType(maxInter);
    minType=cache.getLogType(minInter);
    if (maxInter - minInter <= 1) {
      if (sortAscending) {
        if (type > maxType) {
          return maxInter + 1;
        }
 else         if (type < minType) {
          return minInter;
        }
 else {
          return maxInter;
        }
      }
 else {
        if (type > minType) {
          return minInter;
        }
 else         if (type < maxType) {
          return maxInter + 1;
        }
 else {
          return maxInter;
        }
      }
    }
    middle=minInter + (maxInter - minInter) / 2;
    long typeShift=type - cache.getLogType(middle);
    if (sortAscending) {
      if (typeShift > 0) {
        minInter=middle;
        continue;
      }
 else       if (typeShift < 0) {
        maxInter=middle;
        continue;
      }
 else {
        return middle;
      }
    }
 else {
      if (typeShift > 0) {
        maxInter=middle;
        continue;
      }
 else       if (typeShift < 0) {
        minInter=middle;
        continue;
      }
 else {
        return middle;
      }
    }
  }
 while (true);
}

Fixed version (ground truth):
/** 
 * When the logs are ordered by entry type, it finds the position in the ordered list where the log has to be inserted. The algoritm has logaritmic complexity
 * @param The entry type of the log to be inserted
 * @return The position log to insert in the visible logs
 */
private int findPosLogarthmicType(int type){
  int minInter=0;
  int maxInter=visibleLogs.size() - 1;
  int middle=0;
  int maxType;
  int minType;
  boolean sortAscending=comparator.isSortAscending();
  do {
    maxType=cache.getLogType(visibleLogs.get(maxInter));
    minType=cache.getLogType(visibleLogs.get(minInter));
    if (maxInter - minInter <= 1) {
      if (sortAscending) {
        if (type > maxType) {
          return maxInter + 1;
        }
 else         if (type < minType) {
          return minInter;
        }
 else {
          return maxInter;
        }
      }
 else {
        if (type > minType) {
          return minInter;
        }
 else         if (type < maxType) {
          return maxInter + 1;
        }
 else {
          return maxInter;
        }
      }
    }
    middle=minInter + (maxInter - minInter) / 2;
    int typeShift=type - cache.getLogType(visibleLogs.get(middle));
    if (sortAscending) {
      if (typeShift >= 0) {
        minInter=middle;
        continue;
      }
 else {
        maxInter=middle;
        continue;
      }
    }
 else {
      if (typeShift >= 0) {
        maxInter=middle;
        continue;
      }
 else       if (typeShift < 0) {
        minInter=middle;
        continue;
      }
    }
  }
 while (true);
}