Program: 65765
Project: 65765
Buggy source:
/** 
 * Constructor.
 * @param engine
 * @throws BirtException 
 */
public DataEngineSession(DataEngineImpl engine) throws BirtException {
  Object[] params={engine};
  logger.entering(DataEngineSession.class.getName(),"String_Node_Str",params);
  this.context=new HashMap();
  this.engine=engine;
  this.scope=engine.getContext().getJavaScriptScope();
  this.stopSign=new StopSign();
  IDataScriptEngine scriptEngine=(IDataScriptEngine)engine.getContext().getScriptContext().getScriptEngine(IDataScriptEngine.ENGINE_NAME);
  if (this.scope == null) {
    this.scope=new ImporterTopLevel(scriptEngine.getJSContext(engine.getContext().getScriptContext()));
  }
  new CoreJavaScriptInitializer().initialize(scriptEngine.getJSContext(engine.getContext().getScriptContext()),scope);
  tempDir=engine.getContext().getTmpdir() + "String_Node_Str" + engine.hashCode()+ "String_Node_Str"+ getCount()+ File.separator;
  this.dataSetCacheManager=new DataSetCacheManager(this);
  this.cancelManager=new CancelManager();
  classLoaderHolder.set(engine.getContext().getClassLoader());
  engine.addShutdownListener(new IShutdownListener(){
    public void dataEngineShutdown(){
      classLoaderHolder.set(null);
      houseKeepCancelManager();
      saveGeneralACL();
      if (emtpryIDStream != null)       try {
        emtpryIDStream.close();
      }
 catch (      IOException e) {
      }
    }
  }
);
  engine.addShutdownListener(new ReportDocumentShutdownListener(this));
  this.queryResultIDUtil=new QueryResultIDUtil();
  this.loadGeneralACL();
  int currentQueryID=0;
  if (engine.getContext().getDocReader() != null) {
    try {
      if (engine.getContext().getDocReader().exists(DataEngineContext.QUERY_STARTING_ID)) {
        RAInputStream stream=engine.getContext().getDocReader().getInputStream(DataEngineContext.QUERY_STARTING_ID);
        currentQueryID=stream.readInt();
        stream.close();
      }
    }
 catch (    IOException e) {
    }
  }
  this.queryResultIDUtil=new QueryResultIDUtil(currentQueryID);
  logger.exiting(DataEngineSession.class.getName(),"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Constructor.
 * @param engine
 * @throws BirtException 
 */
public DataEngineSession(DataEngineImpl engine) throws BirtException {
  Object[] params={engine};
  logger.entering(DataEngineSession.class.getName(),"String_Node_Str",params);
  this.context=new HashMap();
  this.engine=engine;
  this.scope=engine.getContext().getJavaScriptScope();
  this.stopSign=new StopSign();
  IDataScriptEngine scriptEngine=(IDataScriptEngine)engine.getContext().getScriptContext().getScriptEngine(IDataScriptEngine.ENGINE_NAME);
  if (this.scope == null) {
    this.scope=new ImporterTopLevel(scriptEngine.getJSContext(engine.getContext().getScriptContext()));
  }
  new CoreJavaScriptInitializer().initialize(scriptEngine.getJSContext(engine.getContext().getScriptContext()),scope);
  tempDir=engine.getContext().getTmpdir() + "String_Node_Str" + engine.hashCode()+ "String_Node_Str"+ getCount()+ File.separator;
  this.dataSetCacheManager=new DataSetCacheManager(this);
  this.cancelManager=new CancelManager();
  if (engine.getContext().getClassLoader() != null) {
    classLoaderHolder.set(engine.getContext().getClassLoader());
  }
  engine.addShutdownListener(new IShutdownListener(){
    public void dataEngineShutdown(){
      classLoaderHolder.set(null);
      houseKeepCancelManager();
      saveGeneralACL();
      if (emtpryIDStream != null)       try {
        emtpryIDStream.close();
      }
 catch (      IOException e) {
      }
    }
  }
);
  engine.addShutdownListener(new ReportDocumentShutdownListener(this));
  this.queryResultIDUtil=new QueryResultIDUtil();
  this.loadGeneralACL();
  int currentQueryID=0;
  if (engine.getContext().getDocReader() != null) {
    try {
      if (engine.getContext().getDocReader().exists(DataEngineContext.QUERY_STARTING_ID)) {
        RAInputStream stream=engine.getContext().getDocReader().getInputStream(DataEngineContext.QUERY_STARTING_ID);
        currentQueryID=stream.readInt();
        stream.close();
      }
    }
 catch (    IOException e) {
    }
  }
  this.queryResultIDUtil=new QueryResultIDUtil(currentQueryID);
  logger.exiting(DataEngineSession.class.getName(),"String_Node_Str");
}