Program: 66743
Project: 66743
Buggy source:
public static void updateColumnCache(DataSetHandle dataSetHandle,boolean holdEvent) throws BirtException {
  if (dataSetHandle.getModuleHandle() instanceof ReportDesignHandle) {
    EngineConfig ec=new EngineConfig();
    ReportEngine engine=(ReportEngine)new ReportEngineFactory().createReportEngine(ec);
    ReportDesignHandle copy=(ReportDesignHandle)(dataSetHandle.getModuleHandle().copy().getHandle(null));
    DummyEngineTask engineTask=new DummyEngineTask(engine,new ReportEngineHelper(engine).openReportDesign(copy),copy);
    DataRequestSession session=engineTask.getDataSession();
    Map appContext=new HashMap();
    appContext.put(DataEngine.MEMORY_DATA_SET_CACHE,Integer.valueOf(dataSetHandle.getRowFetchLimit()));
    appContext.put(ResourceIdentifiers.ODA_APP_CONTEXT_KEY_CONSUMER_RESOURCE_IDS,createResourceIdentifiers());
    engineTask.setAppContext(appContext);
    try {
      engineTask.run();
      DataService.getInstance().registerSession(dataSetHandle,session);
      session.refreshMetaData(dataSetHandle,holdEvent);
    }
  finally {
      session.shutdown();
      engineTask.close();
      engine.destroy();
    }
  }
 else {
    DataSessionContext context=new DataSessionContext(DataEngineContext.DIRECT_PRESENTATION,dataSetHandle.getRoot());
    Map appContext=new HashMap();
    appContext.put(DataEngine.MEMORY_DATA_SET_CACHE,Integer.valueOf(dataSetHandle.getRowFetchLimit()));
    appContext.put(ResourceIdentifiers.ODA_APP_CONTEXT_KEY_CONSUMER_RESOURCE_IDS,createResourceIdentifiers());
    context.setAppContext(appContext);
    DataRequestSession drSession=DataRequestSession.newSession(context);
    try {
      drSession.refreshMetaData(dataSetHandle,holdEvent);
    }
  finally {
      drSession.shutdown();
    }
  }
}

Fixed version (ground truth):
public static void updateColumnCache(DataSetHandle dataSetHandle,boolean holdEvent) throws BirtException {
  if (dataSetHandle.getModuleHandle() instanceof ReportDesignHandle) {
    EngineConfig ec=new EngineConfig();
    ReportEngine engine=(ReportEngine)new ReportEngineFactory().createReportEngine(ec);
    ReportDesignHandle copy=(ReportDesignHandle)(dataSetHandle.getModuleHandle().copy().getHandle(null));
    DummyEngineTask engineTask=new DummyEngineTask(engine,new ReportEngineHelper(engine).openReportDesign(copy),copy);
    DataRequestSession session=engineTask.getDataSession();
    Map appContext=new HashMap();
    appContext.put(DataEngine.MEMORY_DATA_SET_CACHE,Integer.valueOf(dataSetHandle.getRowFetchLimit()));
    appContext.put(ResourceIdentifiers.ODA_APP_CONTEXT_KEY_CONSUMER_RESOURCE_IDS,createResourceIdentifiers());
    engineTask.setAppContext(appContext);
    try {
      engineTask.run();
      DataService.getInstance().registerSession(dataSetHandle,session);
      session.refreshMetaData(dataSetHandle,holdEvent);
    }
  finally {
      DataService.getInstance().unRegisterSession(session);
      session.shutdown();
      engineTask.close();
      engine.destroy();
    }
  }
 else {
    DataSessionContext context=new DataSessionContext(DataEngineContext.DIRECT_PRESENTATION,dataSetHandle.getRoot());
    Map appContext=new HashMap();
    appContext.put(DataEngine.MEMORY_DATA_SET_CACHE,Integer.valueOf(dataSetHandle.getRowFetchLimit()));
    appContext.put(ResourceIdentifiers.ODA_APP_CONTEXT_KEY_CONSUMER_RESOURCE_IDS,createResourceIdentifiers());
    context.setAppContext(appContext);
    DataRequestSession drSession=DataRequestSession.newSession(context);
    try {
      drSession.refreshMetaData(dataSetHandle,holdEvent);
    }
  finally {
      drSession.shutdown();
    }
  }
}