Program: 16232
Project: 16232
Buggy source:
/** 
 * Get the length of the coding sequence
 * @param exonStarts
 * @param exonEnds
 * @param cdsStart
 * @param cdsEnd
 * @return
 */
public static int getCDSLengthReverse(List<Integer> exonStarts,List<Integer> exonEnds,int cdsStart,int cdsEnd){
  boolean inCoding=false;
  int codingLength=0;
  if (cdsEnd < cdsStart) {
    int tmp=cdsEnd;
    cdsEnd=cdsStart;
    cdsStart=tmp;
  }
  int lengthExons=0;
  for (int i=exonStarts.size() - 1; i >= 0; i--) {
    int end=exonStarts.get(i);
    int start=exonEnds.get(i);
    if (end < start) {
      int tmp=end;
      end=start;
      start=tmp;
    }
    lengthExons+=end - start;
    if (start <= cdsEnd && end >= cdsEnd) {
      inCoding=true;
      int tmpstart=start;
      if (start < cdsStart) {
        tmpstart=cdsStart;
      }
      codingLength+=(cdsEnd - tmpstart);
      boolean debug=logger.isDebugEnabled();
      if (debug) {
        StringBuffer b=new StringBuffer();
        b.append("String_Node_Str" + (cdsEnd + 1) + "String_Node_Str"+ (end)+ newline);
        if (tmpstart == start)         b.append("String_Node_Str");
 else         b.append("String_Node_Str");
        b.append("String_Node_Str" + tmpstart + "String_Node_Str"+ cdsEnd+ "String_Node_Str"+ (cdsEnd - tmpstart)+ "String_Node_Str"+ codingLength+ "String_Node_Str"+ (codingLength % 3)+ newline);
        if (tmpstart != start)         b.append("String_Node_Str" + (cdsStart - 1) + "String_Node_Str"+ start+ newline);
        logger.debug(b.toString());
      }
    }
 else     if (start <= cdsStart && end >= cdsStart) {
      inCoding=false;
      codingLength+=(end - cdsStart);
      logger.debug("String_Node_Str" + (cdsStart + 1) + "String_Node_Str"+ end+ "String_Node_Str"+ (end - cdsStart)+ "String_Node_Str"+ (codingLength - 3)+ "String_Node_Str"+ (codingLength % 3));
      logger.debug("String_Node_Str" + start + "String_Node_Str"+ (cdsStart));
    }
 else     if (inCoding) {
      codingLength+=(end - start);
      logger.debug("String_Node_Str" + start + "String_Node_Str"+ end+ "String_Node_Str"+ (end - start)+ "String_Node_Str"+ codingLength+ "String_Node_Str"+ (codingLength % 3));
    }
 else {
      logger.debug("String_Node_Str");
    }
  }
  logger.debug("String_Node_Str" + lengthExons + "String_Node_Str"+ (codingLength - 3));
  return codingLength - 3;
}

Fixed version (ground truth):
/** 
 * Get the length of the coding sequence
 * @param exonStarts
 * @param exonEnds
 * @param cdsStart
 * @param cdsEnd
 * @return
 */
public static int getCDSLengthReverse(List<Integer> exonStarts,List<Integer> exonEnds,int cdsStart,int cdsEnd){
  int codingLength=0;
  if (cdsEnd < cdsStart) {
    int tmp=cdsEnd;
    cdsEnd=cdsStart;
    cdsStart=tmp;
  }
  cdsStart=cdsStart + base;
  for (int i=exonStarts.size() - 1; i >= 0; i--) {
    int end=exonStarts.get(i);
    int start=exonEnds.get(i);
    if (end < start) {
      int tmp=end;
      end=start;
      start=tmp;
    }
    start=start + base;
    if ((start < cdsStart && end < cdsStart) || (start > cdsEnd && end > cdsEnd))     continue;
    if (start < cdsStart)     start=cdsStart;
    if (end > cdsEnd)     end=cdsEnd;
    codingLength+=(end - start + 1);
  }
  return codingLength - 3;
}