Program: 50863
Project: 50863
Buggy source:
NativeEvaluator createEvaluator(RolapEvaluator evaluator,FunDef fun,Exp[] args){
  if (!isEnabled()) {
    return null;
  }
  if (!FilterConstraint.isValidContext(evaluator,restrictMemberTypes())) {
    return null;
  }
  String funName=fun.getName();
  if (!"String_Node_Str".equalsIgnoreCase(funName)) {
    return null;
  }
  if (args.length != 2) {
    return null;
  }
  List<CrossJoinArg[]> allArgs=crossJoinArgFactory().checkCrossJoinArg(evaluator,args[0]);
  if (allArgs == null || allArgs.isEmpty() || allArgs.get(0) == null) {
    return null;
  }
  CrossJoinArg[] cjArgs=allArgs.get(0);
  if (isPreferInterpreter(cjArgs,false)) {
    return null;
  }
  SchemaReader schemaReader=evaluator.getSchemaReader();
  DataSource ds=schemaReader.getDataSource();
  SqlQuery sqlQuery=SqlQuery.newQuery(ds,"String_Node_Str");
  RolapNativeSql sql=new RolapNativeSql(sqlQuery,null,evaluator,cjArgs[0].getLevel());
  final Exp filterExpr=args[1];
  String filterExprStr=sql.generateFilterCondition(filterExpr);
  if (filterExprStr == null) {
    return null;
  }
  if (SqlConstraintUtils.containsCalculatedMember(evaluator.getNonAllMembers(),true)) {
    return null;
  }
  LOGGER.debug("String_Node_Str");
  final int savepoint=evaluator.savepoint();
  try {
    overrideContext(evaluator,cjArgs,sql.getStoredMeasure());
    if (!evaluator.isNonEmpty() && sql.getStoredMeasure() == null) {
      for (      Member m : evaluator.getMembers()) {
        evaluator.setContext(m.getLevel().getHierarchy().getDefaultMember());
      }
    }
    CrossJoinArg[] combinedArgs=cjArgs;
    if (allArgs.size() == 2) {
      CrossJoinArg[] predicateArgs=allArgs.get(1);
      if (predicateArgs != null) {
        combinedArgs=Util.appendArrays(cjArgs,predicateArgs);
      }
    }
    TupleConstraint constraint=new FilterConstraint(combinedArgs,evaluator,filterExpr);
    return new SetEvaluator(cjArgs,schemaReader,constraint);
  }
  finally {
    evaluator.restore(savepoint);
  }
}

Fixed version (ground truth):
NativeEvaluator createEvaluator(RolapEvaluator evaluator,FunDef fun,Exp[] args){
  if (!isEnabled()) {
    return null;
  }
  if (!FilterConstraint.isValidContext(evaluator,restrictMemberTypes())) {
    return null;
  }
  String funName=fun.getName();
  if (!"String_Node_Str".equalsIgnoreCase(funName)) {
    return null;
  }
  if (args.length != 2) {
    return null;
  }
  List<CrossJoinArg[]> allArgs=crossJoinArgFactory().checkCrossJoinArg(evaluator,args[0]);
  if (allArgs == null || allArgs.isEmpty() || allArgs.get(0) == null) {
    return null;
  }
  CrossJoinArg[] cjArgs=allArgs.get(0);
  if (isPreferInterpreter(cjArgs,false)) {
    return null;
  }
  SchemaReader schemaReader=evaluator.getSchemaReader();
  DataSource ds=schemaReader.getDataSource();
  SqlQuery sqlQuery=SqlQuery.newQuery(ds,"String_Node_Str");
  RolapNativeSql sql=new RolapNativeSql(sqlQuery,null,evaluator,cjArgs[0].getLevel());
  final Exp filterExpr=args[1];
  String filterExprStr=sql.generateFilterCondition(filterExpr);
  if (filterExprStr == null) {
    return null;
  }
  if (SqlConstraintUtils.containsCalculatedMember(Arrays.asList(evaluator.getNonAllMembers()),true)) {
    return null;
  }
  LOGGER.debug("String_Node_Str");
  final int savepoint=evaluator.savepoint();
  try {
    overrideContext(evaluator,cjArgs,sql.getStoredMeasure());
    if (!evaluator.isNonEmpty() && sql.getStoredMeasure() == null) {
      for (      Member m : evaluator.getMembers()) {
        evaluator.setContext(m.getLevel().getHierarchy().getDefaultMember());
      }
    }
    CrossJoinArg[] combinedArgs=cjArgs;
    if (allArgs.size() == 2) {
      CrossJoinArg[] predicateArgs=allArgs.get(1);
      if (predicateArgs != null) {
        combinedArgs=Util.appendArrays(cjArgs,predicateArgs);
      }
    }
    TupleConstraint constraint=new FilterConstraint(combinedArgs,evaluator,filterExpr);
    return new SetEvaluator(cjArgs,schemaReader,constraint);
  }
  finally {
    evaluator.restore(savepoint);
  }
}