Program: 63292
Project: 63292
Buggy source:
private static void appendWhereStatement(JoinedFlatTableDesc intermediateTableDesc,StringBuilder sql){
  boolean hasCondition=false;
  StringBuilder whereBuilder=new StringBuilder();
  whereBuilder.append("String_Node_Str");
  CubeDesc cubeDesc=intermediateTableDesc.getCubeDesc();
  if (cubeDesc.getFilterCondition() != null && cubeDesc.getFilterCondition().equals("String_Node_Str") == false) {
    whereBuilder.append("String_Node_Str").append(cubeDesc.getFilterCondition()).append("String_Node_Str");
    hasCondition=true;
  }
  CubeSegment cubeSegment=intermediateTableDesc.getCubeSegment();
  if (null != cubeSegment) {
    long dateStart=cubeSegment.getDateRangeStart();
    long dateEnd=cubeSegment.getDateRangeEnd();
    if (cubeSegment.getCubeInstance().needMergeImmediatelyAfterBuild()) {
      dateStart=cubeSegment.getCubeInstance().getDateRange()[1];
    }
    if (!(dateStart == 0 && dateEnd == 0)) {
      String partitionColumnName=cubeDesc.getCubePartitionDesc().getPartitionDateColumn();
      whereBuilder.append(hasCondition ? "String_Node_Str" : "String_Node_Str");
      if (dateStart > 0) {
        whereBuilder.append(partitionColumnName + "String_Node_Str" + formatDateTimeInWhereClause(dateStart)+ "String_Node_Str");
        whereBuilder.append("String_Node_Str");
      }
      whereBuilder.append(partitionColumnName + "String_Node_Str" + formatDateTimeInWhereClause(dateEnd)+ "String_Node_Str");
      whereBuilder.append("String_Node_Str");
      hasCondition=true;
    }
  }
  if (hasCondition) {
    sql.append(whereBuilder.toString());
  }
}

Fixed version (ground truth):
private static void appendWhereStatement(JoinedFlatTableDesc intermediateTableDesc,StringBuilder sql){
  boolean hasCondition=false;
  StringBuilder whereBuilder=new StringBuilder();
  whereBuilder.append("String_Node_Str");
  CubeDesc cubeDesc=intermediateTableDesc.getCubeDesc();
  if (cubeDesc.getFilterCondition() != null && cubeDesc.getFilterCondition().equals("String_Node_Str") == false) {
    whereBuilder.append("String_Node_Str").append(cubeDesc.getFilterCondition()).append("String_Node_Str");
    hasCondition=true;
  }
  CubeSegment cubeSegment=intermediateTableDesc.getCubeSegment();
  if (null != cubeSegment) {
    long dateStart=cubeSegment.getDateRangeStart();
    long dateEnd=cubeSegment.getDateRangeEnd();
    if (cubeSegment.getCubeInstance().needMergeImmediatelyAfterBuild(cubeSegment)) {
      dateStart=cubeSegment.getCubeInstance().getDateRange()[1];
    }
    if (!(dateStart == 0 && dateEnd == 0)) {
      String partitionColumnName=cubeDesc.getCubePartitionDesc().getPartitionDateColumn();
      whereBuilder.append(hasCondition ? "String_Node_Str" : "String_Node_Str");
      if (dateStart > 0) {
        whereBuilder.append(partitionColumnName + "String_Node_Str" + formatDateTimeInWhereClause(dateStart)+ "String_Node_Str");
        whereBuilder.append("String_Node_Str");
      }
      whereBuilder.append(partitionColumnName + "String_Node_Str" + formatDateTimeInWhereClause(dateEnd)+ "String_Node_Str");
      whereBuilder.append("String_Node_Str");
      hasCondition=true;
    }
  }
  if (hasCondition) {
    sql.append(whereBuilder.toString());
  }
}