Program: 88744
Project: 88744
Buggy source:
/** 
 * Evaluates the specified query given a particular context
 * @param context		EObject of the context that the query should be run against (e.g., self)
 * @param queryString	Valid OCL string that to be evaluated in the context
 * @param verbose		Turns on OCL debugging if true, off if false 
 * @return				Object of the result whose type should be known by the caller
 */
public static Object evaluateQuery(Object context,String queryString,boolean verbose){
  setupEnvironment();
  OclEvaluator.createOclInstance(envFactory);
  boolean wasOn=Debug.isOn();
  Debug.turnOn();
  verbose=true;
  setOclTracingEnabled(verbose);
  queryStatus=QueryStatus.VALID_OCL;
  if (context instanceof EObject) {
    getHelper().setContext(context == null ? null : ((EObject)context).eClass());
  }
 else   if (context instanceof Collection) {
    getHelper().setContext(context == null ? null : OCLStandardLibraryImpl.INSTANCE.getCollection());
  }
  Object result=null;
  OCLExpression<EClassifier> query=null;
  basicDiagnostic=null;
  problemHandler=null;
  try {
    query=getHelper().createQuery(queryString);
  }
 catch (  ParserException e) {
    queryStatus=QueryStatus.PARSE_EXCEPTION;
    if (verbose) {
      e.printStackTrace();
      Debug.outln("String_Node_Str" + getBasicDiagnostic());
      Object analyzer=getBasicDiagnostic().getData().get(0);
      Debug.outln("String_Node_Str" + analyzer);
      Debug.outln("String_Node_Str" + getProblemHandler());
      if (getProblemHandler() != null) {
        int offset=getProblemHandler().getErrorReportLineOffset();
        Debug.outln("String_Node_Str" + offset);
        Debug.outln("String_Node_Str" + Utils2.toString(ProblemHandler.ERROR_MESSAGES));
        AbstractParser parser=getProblemHandler().getParser();
        Debug.outln("String_Node_Str" + parser);
        if (parser != null) {
          ParseTable pt=parser.getParseTable();
          Debug.outln("String_Node_Str" + pt);
          AbstractLexer lexer=parser.getLexer();
          Debug.outln("String_Node_Str" + lexer);
          if (lexer != null) {
            pt=lexer.getParseTable();
            Debug.outln("String_Node_Str" + pt);
          }
        }
      }
    }
  }
  if (query != null) {
    result=getOcl().evaluate(context,query);
    if (getOcl().isInvalid(result)) {
      queryStatus=QueryStatus.INVALID_OCL;
    }
  }
  Debug.outln("String_Node_Str" + DocGenUtils.fixString(context) + "String_Node_Str"+ queryString+ "String_Node_Str"+ verbose+ "String_Node_Str"+ DocGenUtils.fixString(result));
  if (!wasOn)   Debug.turnOff();
  return result;
}

Fixed version (ground truth):
/** 
 * Evaluates the specified query given a particular context
 * @param context		EObject of the context that the query should be run against (e.g., self)
 * @param queryString	Valid OCL string that to be evaluated in the context
 * @param verbose		Turns on OCL debugging if true, off if false 
 * @return				Object of the result whose type should be known by the caller
 */
public static Object evaluateQuery(Object context,String queryString,boolean verbose){
  setupEnvironment();
  OclEvaluator.createOclInstance(envFactory);
  setOclTracingEnabled(verbose);
  queryStatus=QueryStatus.VALID_OCL;
  if (context instanceof EObject) {
    getHelper().setContext(context == null ? null : ((EObject)context).eClass());
  }
 else   if (context instanceof Collection) {
    getHelper().setContext(context == null ? null : OCLStandardLibraryImpl.INSTANCE.getCollection());
  }
  Object result=null;
  OCLExpression<EClassifier> query=null;
  basicDiagnostic=null;
  problemHandler=null;
  try {
    query=getHelper().createQuery(queryString);
  }
 catch (  ParserException e) {
    queryStatus=QueryStatus.PARSE_EXCEPTION;
    if (verbose) {
      e.printStackTrace();
      Debug.outln("String_Node_Str" + getBasicDiagnostic());
      Object analyzer=getBasicDiagnostic().getData().get(0);
      Debug.outln("String_Node_Str" + analyzer);
      Debug.outln("String_Node_Str" + getProblemHandler());
      if (getProblemHandler() != null) {
        int offset=getProblemHandler().getErrorReportLineOffset();
        Debug.outln("String_Node_Str" + offset);
        Debug.outln("String_Node_Str" + Utils2.toString(ProblemHandler.ERROR_MESSAGES));
        AbstractParser parser=getProblemHandler().getParser();
        Debug.outln("String_Node_Str" + parser);
        if (parser != null) {
          ParseTable pt=parser.getParseTable();
          Debug.outln("String_Node_Str" + pt);
          AbstractLexer lexer=parser.getLexer();
          Debug.outln("String_Node_Str" + lexer);
          if (lexer != null) {
            pt=lexer.getParseTable();
            Debug.outln("String_Node_Str" + pt);
          }
        }
      }
    }
  }
  if (query != null) {
    result=getOcl().evaluate(context,query);
    if (getOcl().isInvalid(result)) {
      queryStatus=QueryStatus.INVALID_OCL;
    }
  }
  Debug.outln("String_Node_Str" + DocGenUtils.fixString(context) + "String_Node_Str"+ queryString+ "String_Node_Str"+ verbose+ "String_Node_Str"+ DocGenUtils.fixString(result));
  return result;
}