Program: 65536
Project: 65536
Buggy source:
/** 
 * @throws FileNotFoundException
 * @throws DataException 
 */
private void createCacheOutputStream() throws FileNotFoundException, DataException {
  File tmpDir=new File(resultService.getSession().getTempDir());
  if (!FileSecurity.fileExist(tmpDir) || !FileSecurity.fileIsDirectory(tmpDir)) {
    FileSecurity.fileMakeDirs(tmpDir);
  }
  String id=resultService.getQueryResults().getID();
  int currentParentQueryRowId=0;
  if (this.resultService != null && this.resultService.getQueryDefn() instanceof ISubqueryDefinition) {
    if (this.resultService.getQueryResults() instanceof QueryResults) {
      QueryResults results=(QueryResults)this.resultService.getQueryResults();
      if (results.getQueryService().getQueryExecutor() instanceof ISubQueryExecutor) {
        SubQueryExecutor executor=(SubQueryExecutor)results.getQueryService().getQueryExecutor();
        if (executor.getParentIterator() != null) {
          currentParentQueryRowId=executor.getParentIterator().getCurrentResultIndex();
        }
      }
    }
    id=QuerySharingUtil.getSubQueryID(id,this.resultService.getQueryDefn().getName(),currentParentQueryRowId);
  }
  metaOutputStream=new BufferedOutputStream(FileSecurity.createFileOutputStream(ResultSetCacheUtil.getMetaFile(resultService.getSession().getTempDir(),id)),1024);
  rowOutputStream=new DataOutputStream(new BufferedOutputStream(FileSecurity.createFileOutputStream(ResultSetCacheUtil.getDataFile(resultService.getSession().getTempDir(),id)),1024));
  File file=ResultSetCacheUtil.getDataFile(resultService.getSession().getTempDir(),id);
  FileSecurity.fileDeleteOnExit(file);
  file=ResultSetCacheUtil.getMetaFile(resultService.getSession().getTempDir(),id);
  FileSecurity.fileDeleteOnExit(file);
}

Fixed version (ground truth):
/** 
 * @throws FileNotFoundException
 * @throws DataException 
 */
private void createCacheOutputStream() throws FileNotFoundException, DataException {
  File tmpDir=new File(resultService.getSession().getTempDir());
  if (!FileSecurity.fileExist(tmpDir) || !FileSecurity.fileIsDirectory(tmpDir)) {
    FileSecurity.fileMakeDirs(tmpDir);
  }
  String id=resultService.getQueryResults().getID();
  int currentParentQueryRowId=0;
  if (this.resultService != null && this.resultService.getQueryDefn() instanceof ISubqueryDefinition) {
    if (this.resultService.getQueryResults() instanceof QueryResults) {
      QueryResults results=(QueryResults)this.resultService.getQueryResults();
      if (results.getQueryService().getQueryExecutor() instanceof ISubQueryExecutor) {
        SubQueryExecutor executor=(SubQueryExecutor)results.getQueryService().getQueryExecutor();
        if (executor.getParentIterator() != null) {
          currentParentQueryRowId=executor.getParentIterator().getCurrentResultIndex();
        }
      }
    }
    id=QuerySharingUtil.getSubQueryID(id,this.resultService.getQueryDefn().getName(),currentParentQueryRowId);
  }
  metaOutputStream=new BufferedOutputStream(FileSecurity.createFileOutputStream(ResultSetCacheUtil.getMetaFile(resultService.getSession().getTempDir(),id)),1024);
  rowOutputStream=new DataOutputStream(new BufferedOutputStream(FileSecurity.createFileOutputStream(ResultSetCacheUtil.getDataFile(resultService.getSession().getTempDir(),id)),1024));
  File file=ResultSetCacheUtil.getDataFile(resultService.getSession().getTempDir(),id);
  file=ResultSetCacheUtil.getMetaFile(resultService.getSession().getTempDir(),id);
}