Program: 65718
Project: 65718
Buggy source:
public void shutdown(){
  logger.entering("String_Node_Str","String_Node_Str");
  if (dataSources == null) {
    logger.fine("String_Node_Str");
    return;
  }
  for (  DataSourceRuntime ds : dataSources.values()) {
    try {
      closeDataSource(ds);
    }
 catch (    DataException e) {
      if (logger.isLoggable(Level.FINER))       logger.log(Level.FINER,"String_Node_Str" + ds + "String_Node_Str",e);
    }
  }
  this.dataSourceManager.close();
  releaseValidationContexts();
  if (shutdownListenerSet != null) {
    for (    IShutdownListener shutdownListener : shutdownListenerSet) {
      shutdownListener.dataEngineShutdown();
    }
    shutdownListenerSet.clear();
  }
  logger.logp(Level.FINE,DataEngineImpl.class.getName(),"String_Node_Str","String_Node_Str");
  dataSetDesigns=null;
  dataSources=null;
  try {
    DataEngineThreadLocal.getInstance().getCloseListener().dataEngineShutDown();
    DataEngineThreadLocal.getInstance().removeTempPathManger();
    if (DataEngineThreadLocal.getInstance().getCloseListener().getActivateDteCount() == 0) {
      DataEngineThreadLocal.getInstance().getCloseListener().closeAll();
      DataEngineThreadLocal.getInstance().removeCloseListener();
    }
    clearTempFile();
  }
 catch (  IOException e) {
  }
  if (this.getContext().getDocWriter() != null) {
    RAOutputStream outputStream;
    try {
      if (this.getContext().getDocWriter().exists(DataEngineContext.QUERY_STARTING_ID)) {
        outputStream=this.getContext().getDocWriter().getOutputStream(DataEngineContext.QUERY_STARTING_ID);
      }
 else {
        outputStream=this.getContext().getDocWriter().createOutputStream(DataEngineContext.QUERY_STARTING_ID);
      }
      outputStream.writeInt(this.getSession().getQueryResultIDUtil().getCurrentQueryId());
      outputStream.close();
    }
 catch (    IOException e) {
    }
  }
  logger.exiting(DataEngineImpl.class.getName(),"String_Node_Str");
}

Fixed version (ground truth):
public void shutdown(){
  logger.entering("String_Node_Str","String_Node_Str");
  if (dataSources == null) {
    logger.fine("String_Node_Str");
    return;
  }
  for (  DataSourceRuntime ds : dataSources.values()) {
    try {
      closeDataSource(ds);
    }
 catch (    DataException e) {
      if (logger.isLoggable(Level.FINER))       logger.log(Level.FINER,"String_Node_Str" + ds + "String_Node_Str",e);
    }
  }
  this.dataSourceManager.close();
  releaseValidationContexts();
  if (shutdownListenerSet != null) {
    for (    IShutdownListener shutdownListener : shutdownListenerSet.toArray(new IShutdownListener[0])) {
      shutdownListener.dataEngineShutdown();
    }
    shutdownListenerSet.clear();
    shutdownListenerSet=null;
  }
  logger.logp(Level.FINE,DataEngineImpl.class.getName(),"String_Node_Str","String_Node_Str");
  dataSetDesigns=null;
  dataSources=null;
  try {
    DataEngineThreadLocal.getInstance().getCloseListener().dataEngineShutDown();
    DataEngineThreadLocal.getInstance().removeTempPathManger();
    if (DataEngineThreadLocal.getInstance().getCloseListener().getActivateDteCount() == 0) {
      DataEngineThreadLocal.getInstance().getCloseListener().closeAll();
      DataEngineThreadLocal.getInstance().removeCloseListener();
    }
    clearTempFile();
  }
 catch (  IOException e) {
  }
  if (this.getContext().getDocWriter() != null) {
    RAOutputStream outputStream;
    try {
      if (this.getContext().getDocWriter().exists(DataEngineContext.QUERY_STARTING_ID)) {
        outputStream=this.getContext().getDocWriter().getOutputStream(DataEngineContext.QUERY_STARTING_ID);
      }
 else {
        outputStream=this.getContext().getDocWriter().createOutputStream(DataEngineContext.QUERY_STARTING_ID);
      }
      outputStream.writeInt(this.getSession().getQueryResultIDUtil().getCurrentQueryId());
      outputStream.close();
    }
 catch (    IOException e) {
    }
  }
  logger.exiting(DataEngineImpl.class.getName(),"String_Node_Str");
}