Program: 68777
Project: 68777
Buggy source:
/** 
 * populate output columns
 * @throws BirtException
 */
private void populateOutputColums() throws BirtException {
  ClassLoader oldContextLoader=Thread.currentThread().getContextClassLoader();
  ClassLoader parentLoader=oldContextLoader;
  if (parentLoader == null)   parentLoader=this.getClass().getClassLoader();
  ClassLoader newContextLoader=DataSetProvider.getCustomScriptClassLoader(parentLoader,((DataSetEditor)getContainer()).getHandle().getModuleHandle());
  ModuleHandle handle=((DataSetEditor)getContainer()).getHandle().getModuleHandle();
  DataSessionContext context;
  if (handle instanceof ReportDesignHandle) {
    Map dataSetMap=new HashMap();
    Map dataSourceMap=new HashMap();
    try {
      EngineConfig ec=new EngineConfig();
      ec.getAppContext().put(EngineConstants.APPCONTEXT_CLASSLOADER_KEY,newContextLoader);
      ReportEngine engine=(ReportEngine)new ReportEngineFactory().createReportEngine(ec);
      DataSetUIUtil.clearPropertyBindingMap(((DataSetEditor)getContainer()).getHandle(),dataSetMap,dataSourceMap);
      DummyEngineTask engineTask=new DummyEngineTask(engine,new ReportEngineHelper(engine).openReportDesign((ReportDesignHandle)handle),handle);
      DataRequestSession session=engineTask.getDataSession();
      engineTask.run();
      DataSetViewData[] viewDatas=DataSetProvider.getCurrentInstance().populateAllOutputColumns(((DataSetEditor)getContainer()).getHandle(),session);
      if (viewDatas == null) {
        viewDatas=((DataSetEditor)getContainer()).getCurrentItemModel(false,false);
      }
      if (((DataSetEditor)getContainer()).getHandle() instanceof JointDataSetHandle) {
        PropertyHandle properyHandle=((DataSetEditor)getContainer()).getHandle().getPropertyHandle(DataSetHandle.COLUMN_HINTS_PROP);
        if (properyHandle != null) {
          for (int i=0; i < viewDatas.length; i++) {
            for (Iterator columns=properyHandle.iterator(); columns.hasNext(); ) {
              ColumnHintHandle column=(ColumnHintHandle)columns.next();
              if (viewDatas[i].getName().equalsIgnoreCase(column.getColumnName())) {
                viewDatas[i].setAlias(column.getAlias());
                break;
              }
            }
          }
        }
      }
      viewer.getViewer().setInput(viewDatas);
      engineTask.close();
      engine.destroy();
    }
  finally {
      DataSetUIUtil.resetPropertyBinding(((DataSetEditor)getContainer()).getHandle(),dataSetMap,dataSourceMap);
    }
  }
 else {
    context=new DataSessionContext(DataSessionContext.MODE_DIRECT_PRESENTATION,((DataSetEditor)getContainer()).getHandle().getModuleHandle());
    DataRequestSession session=DataRequestSession.newSession(context);
    DataSetViewData[] viewDatas=DataSetProvider.getCurrentInstance().populateAllOutputColumns(((DataSetEditor)getContainer()).getHandle(),session);
    if (viewDatas == null) {
      viewDatas=((DataSetEditor)getContainer()).getCurrentItemModel(false,false);
    }
    viewer.getViewer().setInput(viewDatas);
    session.shutdown();
  }
  Thread.currentThread().setContextClassLoader(oldContextLoader);
}

Fixed version (ground truth):
/** 
 * populate output columns
 * @throws BirtException
 */
private void populateOutputColums() throws BirtException {
  ClassLoader oldContextLoader=Thread.currentThread().getContextClassLoader();
  ClassLoader parentLoader=oldContextLoader;
  if (parentLoader == null)   parentLoader=this.getClass().getClassLoader();
  ClassLoader newContextLoader=DataSetProvider.getCustomScriptClassLoader(parentLoader,((DataSetEditor)getContainer()).getHandle().getModuleHandle());
  ModuleHandle handle=((DataSetEditor)getContainer()).getHandle().getModuleHandle();
  DataSessionContext context;
  if (handle instanceof ReportDesignHandle) {
    Map dataSetMap=new HashMap();
    Map dataSourceMap=new HashMap();
    try {
      EngineConfig ec=new EngineConfig();
      ec.getAppContext().put(EngineConstants.APPCONTEXT_CLASSLOADER_KEY,newContextLoader);
      ReportEngine engine=(ReportEngine)new ReportEngineFactory().createReportEngine(ec);
      DataSetUIUtil.clearPropertyBindingMap(((DataSetEditor)getContainer()).getHandle(),dataSetMap,dataSourceMap);
      DummyEngineTask engineTask=new DummyEngineTask(engine,new ReportEngineHelper(engine).openReportDesign((ReportDesignHandle)handle),handle);
      DataRequestSession session=engineTask.getDataSession();
      engineTask.run();
      DataSetViewData[] viewDatas=DataSetProvider.getCurrentInstance().populateAllOutputColumns(((DataSetEditor)getContainer()).getHandle(),session);
      if (viewDatas == null) {
        viewDatas=((DataSetEditor)getContainer()).getCurrentItemModel(false,false);
      }
      if (((DataSetEditor)getContainer()).getHandle() instanceof JointDataSetHandle) {
        PropertyHandle properyHandle=((DataSetEditor)getContainer()).getHandle().getPropertyHandle(DataSetHandle.COLUMN_HINTS_PROP);
        if (properyHandle != null) {
          for (int i=0; i < viewDatas.length; i++) {
            for (Iterator columns=properyHandle.iterator(); columns.hasNext(); ) {
              ColumnHintHandle column=(ColumnHintHandle)columns.next();
              if (viewDatas[i].getName().equals(column.getColumnName())) {
                viewDatas[i].setAlias(column.getAlias());
                break;
              }
            }
          }
        }
      }
      viewer.getViewer().setInput(viewDatas);
      engineTask.close();
      engine.destroy();
    }
  finally {
      DataSetUIUtil.resetPropertyBinding(((DataSetEditor)getContainer()).getHandle(),dataSetMap,dataSourceMap);
    }
  }
 else {
    context=new DataSessionContext(DataSessionContext.MODE_DIRECT_PRESENTATION,((DataSetEditor)getContainer()).getHandle().getModuleHandle());
    DataRequestSession session=DataRequestSession.newSession(context);
    DataSetViewData[] viewDatas=DataSetProvider.getCurrentInstance().populateAllOutputColumns(((DataSetEditor)getContainer()).getHandle(),session);
    if (viewDatas == null) {
      viewDatas=((DataSetEditor)getContainer()).getCurrentItemModel(false,false);
    }
    viewer.getViewer().setInput(viewDatas);
    session.shutdown();
  }
  Thread.currentThread().setContextClassLoader(oldContextLoader);
}