Program: 172092
Project: 172092
Buggy source:
/** 
 * Set file information
 * @param sess SrvSession
 * @param tree TreeConnection
 * @param name String
 * @param info FileInfo
 * @exception IOException
 */
public void setFileInformation(SrvSession sess,final TreeConnection tree,final String name,final FileInfo info) throws IOException {
  final ContentContext ctx=(ContentContext)tree.getContext();
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str" + name + "String_Node_Str"+ info);
  }
  NetworkFile networkFile=info.getNetworkFile();
  try {
    if (sess.isPseudoFilesEnabled() && ctx.isPseudoFilesEnabled()) {
      String[] paths=FileName.splitPath(name);
      NodeRef dirNodeRef=getNodeForPath(tree,paths[0]);
      if (ctx.getPseudoFileOverlay().isPseudoFile(dirNodeRef,paths[1])) {
        if (logger.isDebugEnabled()) {
          logger.debug("String_Node_Str");
        }
        return;
      }
    }
    NodeRef nodeRef=getNodeForPath(tree,name);
    if (permissionService.hasPermission(nodeRef,PermissionService.WRITE) == AccessStatus.DENIED) {
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str" + name);
      }
      throw new AccessDeniedException("String_Node_Str" + name);
    }
    getPolicyFilter().disableBehaviour(ContentModel.ASPECT_VERSIONABLE);
    if (info.hasSetFlag(FileInfo.SetDeleteOnClose) && info.hasDeleteOnClose()) {
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str" + name);
      }
      if (permissionService.hasPermission(nodeRef,PermissionService.DELETE) == AccessStatus.DENIED) {
        throw new AccessDeniedException("String_Node_Str" + name);
      }
      lockService.checkForLock(nodeRef);
      if (fileFolderService.exists(nodeRef)) {
        boolean isFolder=true;
        ContentFileInfo cInfo=getCifsHelper().getFileInformation(nodeRef,false,isLockedFilesAsOffline);
        if (cInfo != null && cInfo.isDirectory() == false) {
          isFolder=false;
        }
        if (isFolder == true && getCifsHelper().isFolderEmpty(nodeRef) == false) {
          throw new DirectoryNotEmptyException(name);
        }
      }
    }
    if (info.isHidden() && !nodeService.hasAspect(nodeRef,ContentModel.ASPECT_HIDDEN)) {
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str" + name);
      }
    }
    if (info.hasSetFlag(FileInfo.SetAllocationSize)) {
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str" + name + info.getAllocationSize());
      }
    }
    Map<QName,Serializable> auditableProps=new HashMap<QName,Serializable>(5);
    if (info.hasSetFlag(FileInfo.SetCreationDate) && info.hasCreationDateTime()) {
      Date createDate=new Date(info.getCreationDateTime());
      auditableProps.put(ContentModel.PROP_CREATED,createDate);
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str" + name + "String_Node_Str"+ createDate);
      }
    }
    if (info.hasSetFlag(FileInfo.SetModifyDate) && info.hasModifyDateTime()) {
      Date modifyDate=new Date(info.getModifyDateTime());
      auditableProps.put(ContentModel.PROP_MODIFIED,modifyDate);
      if (networkFile != null && !networkFile.isReadOnly()) {
        networkFile.setModifyDate(info.getModifyDateTime());
      }
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str" + name + "String_Node_Str"+ modifyDate);
      }
    }
    if (auditableProps.size() > 0) {
      getPolicyFilter().disableBehaviour(nodeRef,ContentModel.ASPECT_AUDITABLE);
      nodeService.addProperties(nodeRef,auditableProps);
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str" + auditableProps + "String_Node_Str"+ name);
      }
    }
    return;
  }
 catch (  org.alfresco.repo.security.permissions.AccessDeniedException ex) {
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str" + name);
    }
    throw new AccessDeniedException("String_Node_Str" + name);
  }
catch (  AlfrescoRuntimeException ex) {
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str",ex);
    }
    throw new IOException("String_Node_Str" + name,ex);
  }
}

Fixed version (ground truth):
/** 
 * Set file information
 * @param sess SrvSession
 * @param tree TreeConnection
 * @param name String
 * @param info FileInfo
 * @exception IOException
 */
public void setFileInformation(SrvSession sess,final TreeConnection tree,final String name,final FileInfo info) throws IOException {
  final ContentContext ctx=(ContentContext)tree.getContext();
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str" + name + "String_Node_Str"+ info);
  }
  NetworkFile networkFile=info.getNetworkFile();
  try {
    if (sess.isPseudoFilesEnabled() && ctx.isPseudoFilesEnabled()) {
      String[] paths=FileName.splitPath(name);
      NodeRef dirNodeRef=getNodeForPath(tree,paths[0]);
      if (ctx.getPseudoFileOverlay().isPseudoFile(dirNodeRef,paths[1])) {
        if (logger.isDebugEnabled()) {
          logger.debug("String_Node_Str");
        }
        return;
      }
    }
    NodeRef nodeRef=getNodeForPath(tree,name);
    if (permissionService.hasPermission(nodeRef,PermissionService.WRITE) == AccessStatus.DENIED) {
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str" + name);
      }
      throw new AccessDeniedException("String_Node_Str" + name);
    }
    getPolicyFilter().disableBehaviour(ContentModel.ASPECT_VERSIONABLE);
    if (info.hasSetFlag(FileInfo.SetDeleteOnClose) && info.hasDeleteOnClose()) {
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str" + name);
      }
      if (permissionService.hasPermission(nodeRef,PermissionService.DELETE) == AccessStatus.DENIED) {
        throw new AccessDeniedException("String_Node_Str" + name);
      }
      lockService.checkForLock(nodeRef);
      if (fileFolderService.exists(nodeRef)) {
        boolean isFolder=true;
        ContentFileInfo cInfo=getCifsHelper().getFileInformation(nodeRef,false,isLockedFilesAsOffline);
        if (cInfo != null && cInfo.isDirectory() == false) {
          isFolder=false;
        }
        if (isFolder == true && getCifsHelper().isFolderEmpty(nodeRef) == false) {
          throw new DirectoryNotEmptyException(name);
        }
      }
    }
    if (info.hasSetFlag(FileInfo.SetAttributes)) {
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str" + name + "String_Node_Str"+ info.getFileAttributes());
      }
      if (info.isHidden()) {
        if (!nodeService.hasAspect(nodeRef,ContentModel.ASPECT_HIDDEN)) {
          if (logger.isDebugEnabled()) {
            logger.debug("String_Node_Str" + name);
          }
        }
      }
 else {
        if (nodeService.hasAspect(nodeRef,ContentModel.ASPECT_HIDDEN)) {
          if (logger.isDebugEnabled()) {
            logger.debug("String_Node_Str" + name);
          }
        }
      }
    }
    if (info.hasSetFlag(FileInfo.SetAllocationSize)) {
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str" + name + info.getAllocationSize());
      }
    }
    Map<QName,Serializable> auditableProps=new HashMap<QName,Serializable>(5);
    if (info.hasSetFlag(FileInfo.SetCreationDate) && info.hasCreationDateTime()) {
      Date createDate=new Date(info.getCreationDateTime());
      auditableProps.put(ContentModel.PROP_CREATED,createDate);
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str" + name + "String_Node_Str"+ createDate);
      }
    }
    if (info.hasSetFlag(FileInfo.SetModifyDate) && info.hasModifyDateTime()) {
      Date modifyDate=new Date(info.getModifyDateTime());
      auditableProps.put(ContentModel.PROP_MODIFIED,modifyDate);
      if (networkFile != null && !networkFile.isReadOnly()) {
        networkFile.setModifyDate(info.getModifyDateTime());
      }
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str" + name + "String_Node_Str"+ modifyDate);
      }
    }
    if (auditableProps.size() > 0) {
      getPolicyFilter().disableBehaviour(nodeRef,ContentModel.ASPECT_AUDITABLE);
      nodeService.addProperties(nodeRef,auditableProps);
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str" + auditableProps + "String_Node_Str"+ name);
      }
    }
    return;
  }
 catch (  org.alfresco.repo.security.permissions.AccessDeniedException ex) {
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str" + name);
    }
    throw new AccessDeniedException("String_Node_Str" + name);
  }
catch (  AlfrescoRuntimeException ex) {
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str",ex);
    }
    throw new IOException("String_Node_Str" + name,ex);
  }
}