Program: 66814
Project: 66814
Buggy source:
public void shutdown(){
  logger.entering("String_Node_Str","String_Node_Str");
  if (dataSources == null) {
    logger.fine("String_Node_Str");
    return;
  }
  Collection col=dataSources.values();
  Iterator it=col.iterator();
  while (it.hasNext()) {
    DataSourceRuntime ds=(DataSourceRuntime)it.next();
    try {
      closeDataSource(ds);
    }
 catch (    DataException e) {
      if (logger.isLoggable(Level.FINE))       logger.log(Level.FINE,"String_Node_Str" + ds + "String_Node_Str",e);
    }
  }
  this.dataSourceManager.close();
  releaseValidationContexts();
  if (shutdownListenerList != null) {
    for (int i=0; i < shutdownListenerList.size(); i++) {
      ((IShutdownListener)shutdownListenerList.get(i)).dataEngineShutdown();
    }
    shutdownListenerList.clear();
  }
  logger.logp(Level.FINE,DataEngineImpl.class.getName(),"String_Node_Str","String_Node_Str");
  dataSetDesigns=null;
  dataSources=null;
  try {
    DataEngineThreadLocal.getInstance().getCloseListener().dataEngineShutDown();
    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;
  }
  Collection col=dataSources.values();
  Iterator it=col.iterator();
  while (it.hasNext()) {
    DataSourceRuntime ds=(DataSourceRuntime)it.next();
    try {
      closeDataSource(ds);
    }
 catch (    DataException e) {
      if (logger.isLoggable(Level.FINE))       logger.log(Level.FINE,"String_Node_Str" + ds + "String_Node_Str",e);
    }
  }
  this.dataSourceManager.close();
  releaseValidationContexts();
  if (shutdownListenerList != null) {
    for (int i=0; i < shutdownListenerList.size(); i++) {
      ((IShutdownListener)shutdownListenerList.get(i)).dataEngineShutdown();
    }
    shutdownListenerList.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");
}