Program: 66251
Project: 66251
Buggy source:
/** 
 * @param qd1
 * @param qd2
 * @param onIVMode
 * @return
 * @throws DataException
 */
public static boolean isQueryDefnEqual(int mode,IBaseQueryDefinition qd1,IBaseQueryDefinition qd2,boolean onIVMode,boolean isSubQueryNameCared) throws DataException {
  if (qd1 == qd2)   return true;
  if (qd1 == null || qd2 == null)   return false;
  if (!isEqualSorts(qd1.getSorts(),qd2.getSorts()))   return false;
  if (!isEqualFilters(qd1.getFilters(),qd2.getFilters()))   return false;
  if (!isEqualBindings(qd1.getBindings(),qd2.getBindings()))   return false;
  if (!isEqualGroups(qd1.getGroups(),qd2.getGroups(),onIVMode))   return false;
  if (qd1.usesDetails() != qd2.usesDetails())   return false;
  if (qd1.getMaxRows() != qd2.getMaxRows())   return false;
  if (mode == DataEngineContext.MODE_PRESENTATION && qd1.cacheQueryResults() != qd2.cacheQueryResults())   return false;
  if (!isSubQueryEquals(qd1.getSubqueries(),qd2.getSubqueries(),onIVMode))   return false;
  if (qd1 instanceof IQueryDefinition && qd2 instanceof IQueryDefinition) {
    IQueryDefinition queryDefn1=(IQueryDefinition)qd1;
    IQueryDefinition queryDefn2=(IQueryDefinition)qd2;
    if (!onIVMode) {
      if (!isEqualString(queryDefn1.getDataSetName(),queryDefn2.getDataSetName()))       return false;
      if (!isInputParameterBindingEquals(queryDefn1.getInputParamBindings(),queryDefn2.getInputParamBindings()))       return false;
      if (!isColumnProjectionEquals(queryDefn1.getColumnProjection(),queryDefn2.getColumnProjection()))       return false;
    }
    IQueryExecutionHints hint1=queryDefn1.getQueryExecutionHints();
    IQueryExecutionHints hint2=queryDefn2.getQueryExecutionHints();
    if (!compareHints(hint1,hint2))     return false;
  }
  if (qd1 instanceof ISubqueryDefinition && qd2 instanceof ISubqueryDefinition) {
    ISubqueryDefinition subQueryDefn1=(ISubqueryDefinition)qd1;
    ISubqueryDefinition subQueryDefn2=(ISubqueryDefinition)qd2;
    if (isSubQueryNameCared && !isEqualString(subQueryDefn1.getName(),subQueryDefn2.getName()))     return false;
    if (subQueryDefn1.applyOnGroup() != subQueryDefn2.applyOnGroup())     return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * @param qd1
 * @param qd2
 * @param onIVMode
 * @return
 * @throws DataException
 */
public static boolean isQueryDefnEqual(int mode,IBaseQueryDefinition qd1,IBaseQueryDefinition qd2,boolean onIVMode,boolean isSubQueryNameCared) throws DataException {
  if (qd1 == qd2)   return true;
  if (qd1 == null || qd2 == null)   return false;
  if (!isEqualSorts(qd1.getSorts(),qd2.getSorts()))   return false;
  if (!isEqualFilters(qd1.getFilters(),qd2.getFilters()))   return false;
  if (!isEqualBindings(qd1.getBindings(),qd2.getBindings()))   return false;
  if (!isEqualGroups(qd1.getGroups(),qd2.getGroups(),onIVMode))   return false;
  if (qd1.usesDetails() != qd2.usesDetails())   return false;
  if (qd1.getMaxRows() >= 0 && qd2.getMaxRows() >= 0 && qd1.getMaxRows() != qd2.getMaxRows())   return false;
  if ((qd1.getMaxRows() > 0 && qd2.getMaxRows() < 0) || (qd1.getMaxRows() < 0 && qd2.getMaxRows() > 0))   return false;
  if (mode == DataEngineContext.MODE_PRESENTATION && qd1.cacheQueryResults() != qd2.cacheQueryResults())   return false;
  if (!isSubQueryEquals(qd1.getSubqueries(),qd2.getSubqueries(),onIVMode))   return false;
  if (qd1 instanceof IQueryDefinition && qd2 instanceof IQueryDefinition) {
    IQueryDefinition queryDefn1=(IQueryDefinition)qd1;
    IQueryDefinition queryDefn2=(IQueryDefinition)qd2;
    if (!onIVMode) {
      if (!isEqualString(queryDefn1.getDataSetName(),queryDefn2.getDataSetName()))       return false;
      if (!isInputParameterBindingEquals(queryDefn1.getInputParamBindings(),queryDefn2.getInputParamBindings()))       return false;
      if (!isColumnProjectionEquals(queryDefn1.getColumnProjection(),queryDefn2.getColumnProjection()))       return false;
    }
    IQueryExecutionHints hint1=queryDefn1.getQueryExecutionHints();
    IQueryExecutionHints hint2=queryDefn2.getQueryExecutionHints();
    if (!compareHints(hint1,hint2))     return false;
  }
  if (qd1 instanceof ISubqueryDefinition && qd2 instanceof ISubqueryDefinition) {
    ISubqueryDefinition subQueryDefn1=(ISubqueryDefinition)qd1;
    ISubqueryDefinition subQueryDefn2=(ISubqueryDefinition)qd2;
    if (isSubQueryNameCared && !isEqualString(subQueryDefn1.getName(),subQueryDefn2.getName()))     return false;
    if (subQueryDefn1.applyOnGroup() != subQueryDefn2.applyOnGroup())     return false;
  }
  return true;
}