Program: 71820
Project: 71820
Buggy source:
public IDataRowExpressionEvaluator prepareRowExpressionEvaluator(Chart cm,List columnExpression,int rowCount,boolean isStringType) throws ChartException {
  ClassLoader oldContextLoader=Thread.currentThread().getContextClassLoader();
  ClassLoader parentLoader=oldContextLoader;
  if (parentLoader == null)   parentLoader=this.getClass().getClassLoader();
  ClassLoader newContextLoader=getCustomScriptClassLoader(parentLoader);
  Thread.currentThread().setContextClassLoader(newContextLoader);
  IDataRowExpressionEvaluator evaluator=null;
  DataRequestSession session=null;
  try {
    CubeHandle cube=ChartXTabUtil.getBindingCube(itemHandle);
    if (cube != null) {
      session=prepareDataRequestSession(getMaxRow(),true);
      if (!isSharedBinding()) {
        evaluator=createCubeEvaluator(cube,session);
      }
 else {
        evaluator=createCubeEvaluatorForSharingQuery(session,cube);
      }
    }
 else {
      session=prepareDataRequestSession(getMaxRow(),false);
      if (isSharedBinding()) {
        evaluator=fShareBindingQueryHelper.createShareBindingEvaluator(cm,session);
      }
 else {
        evaluator=createBaseEvaluator(itemHandle,cm,columnExpression,session);
      }
    }
    session.shutdown();
    session=null;
    return evaluator;
  }
 catch (  BirtException e) {
    throw new ChartException(ChartReportItemUIActivator.ID,ChartException.DATA_BINDING,e);
  }
catch (  RuntimeException e) {
    throw new ChartException(ChartReportItemUIActivator.ID,ChartException.DATA_BINDING,e);
  }
 finally {
    Thread.currentThread().setContextClassLoader(oldContextLoader);
    if (session != null) {
      session.shutdown();
    }
  }
}

Fixed version (ground truth):
public IDataRowExpressionEvaluator prepareRowExpressionEvaluator(Chart cm,List columnExpression,int rowCount,boolean isStringType) throws ChartException {
  ClassLoader oldContextLoader=Thread.currentThread().getContextClassLoader();
  ClassLoader parentLoader=oldContextLoader;
  if (parentLoader == null)   parentLoader=this.getClass().getClassLoader();
  ClassLoader newContextLoader=getCustomScriptClassLoader(parentLoader);
  Thread.currentThread().setContextClassLoader(newContextLoader);
  IDataRowExpressionEvaluator evaluator=null;
  DataRequestSession session=null;
  try {
    CubeHandle cube=ChartXTabUtil.getBindingCube(itemHandle);
    if (cube != null) {
      session=prepareDataRequestSession(getMaxRow(),true);
      if (!isSharedBinding()) {
        evaluator=createCubeEvaluator(cube,session);
      }
 else {
        evaluator=createCubeEvaluatorForSharingQuery(session,cube);
      }
    }
 else {
      session=prepareDataRequestSession(getMaxRow(),false);
      if (isSharedBinding()) {
        evaluator=fShareBindingQueryHelper.createShareBindingEvaluator(cm,session);
      }
 else {
        evaluator=createBaseEvaluator(itemHandle,cm,columnExpression,session);
      }
    }
    return evaluator;
  }
 catch (  BirtException e) {
    throw new ChartException(ChartReportItemUIActivator.ID,ChartException.DATA_BINDING,e);
  }
catch (  RuntimeException e) {
    throw new ChartException(ChartReportItemUIActivator.ID,ChartException.DATA_BINDING,e);
  }
 finally {
    Thread.currentThread().setContextClassLoader(oldContextLoader);
  }
}