Program: 172125
Project: 172125
Buggy source:
/** 
 * Create new node.
 * @param node
 * @param resolvedNodes
 * @param primaryParentAssoc
 */
private void create(TransferManifestNormalNode node,ResolvedParentChildPair resolvedNodes,ChildAssociationRef primaryParentAssoc){
  log.info("String_Node_Str" + node.getNodeRef());
  QName parentAssocType=primaryParentAssoc.getTypeQName();
  QName parentAssocName=primaryParentAssoc.getQName();
  NodeRef parentNodeRef=resolvedNodes.resolvedParent;
  if (parentNodeRef == null) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + node.getNodeRef() + "String_Node_Str"+ primaryParentAssoc.getParentRef()+ "String_Node_Str"+ node.getParentPath().toString());
    }
    ChildAssociationRef tempLocation=getTemporaryLocation(node.getNodeRef());
    parentNodeRef=tempLocation.getParentRef();
    parentAssocType=tempLocation.getTypeQName();
    parentAssocName=tempLocation.getQName();
    log.info("String_Node_Str" + node.getNodeRef());
    logComment("String_Node_Str" + node.getNodeRef());
    storeOrphanNode(primaryParentAssoc);
  }
  log.info("String_Node_Str" + parentNodeRef);
  Map<QName,Serializable> props=new HashMap<QName,Serializable>(node.getProperties());
  Map<QName,Serializable> contentProps=processProperties(null,props,null);
  injectTransferred(props);
  props.remove(TransferModel.PROP_INVADED_BY);
  if (header.isReadOnly()) {
    log.debug("String_Node_Str");
    props.put(ContentModel.PROP_LOCK_OWNER,AuthenticationUtil.getAdminUserName());
    props.put(ContentModel.PROP_LOCK_TYPE,LockType.NODE_LOCK.toString());
    props.put(ContentModel.PROP_EXPIRY_DATE,null);
  }
  ChildAssociationRef newNode=nodeService.createNode(parentNodeRef,parentAssocType,parentAssocName,node.getType(),props);
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str" + newNode.getChildRef() + "String_Node_Str"+ newNode.getParentRef());
  }
  logCreated(node.getNodeRef(),newNode.getChildRef(),newNode.getParentRef(),nodeService.getPath(newNode.getChildRef()),false);
  writeContent(newNode.getChildRef(),contentProps);
  Set<QName> aspects=new HashSet<QName>(node.getAspects());
  aspects.removeAll(nodeService.getAspects(newNode.getChildRef()));
  for (  QName aspect : aspects) {
    nodeService.addAspect(newNode.getChildRef(),aspect,null);
  }
  ManifestAccessControl acl=node.getAccessControl();
  if (acl != null) {
    permissionService.setInheritParentPermissions(newNode.getChildRef(),acl.isInherited());
    if (acl.getPermissions() != null) {
      for (      ManifestPermission permission : acl.getPermissions()) {
        log.debug("String_Node_Str");
        AccessStatus status=AccessStatus.valueOf(permission.getStatus());
        permissionService.setPermission(newNode.getChildRef(),permission.getAuthority(),permission.getPermission(),status == AccessStatus.ALLOWED);
      }
    }
  }
  if (nodeService.hasAspect(parentNodeRef,TransferModel.ASPECT_TRANSFERRED) || nodeService.hasAspect(parentNodeRef,TransferModel.ASPECT_ALIEN)) {
    alienProcessor.onCreateChild(newNode,header.getRepositoryId(),true);
  }
  checkOrphans(newNode.getChildRef());
}

Fixed version (ground truth):
/** 
 * Create new node.
 * @param node
 * @param resolvedNodes
 * @param primaryParentAssoc
 */
private void create(TransferManifestNormalNode node,ResolvedParentChildPair resolvedNodes,ChildAssociationRef primaryParentAssoc){
  log.info("String_Node_Str" + node.getNodeRef());
  QName parentAssocType=primaryParentAssoc.getTypeQName();
  QName parentAssocName=primaryParentAssoc.getQName();
  NodeRef parentNodeRef=resolvedNodes.resolvedParent;
  if (parentNodeRef == null) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + node.getNodeRef() + "String_Node_Str"+ primaryParentAssoc.getParentRef()+ "String_Node_Str"+ node.getParentPath().toString());
    }
    ChildAssociationRef tempLocation=getTemporaryLocation(node.getNodeRef());
    parentNodeRef=tempLocation.getParentRef();
    parentAssocType=tempLocation.getTypeQName();
    parentAssocName=tempLocation.getQName();
    log.info("String_Node_Str" + node.getNodeRef());
    logComment("String_Node_Str" + node.getNodeRef());
    storeOrphanNode(primaryParentAssoc);
  }
  log.info("String_Node_Str" + parentNodeRef);
  Map<QName,Serializable> props=new HashMap<QName,Serializable>(node.getProperties());
  Map<QName,Serializable> contentProps=processProperties(null,props,null);
  injectTransferred(props);
  props.remove(TransferModel.PROP_INVADED_BY);
  if (header.isReadOnly()) {
    log.debug("String_Node_Str");
    props.put(ContentModel.PROP_LOCK_OWNER,AuthenticationUtil.getAdminUserName());
    props.put(ContentModel.PROP_LOCK_TYPE,LockType.NODE_LOCK.toString());
    props.put(ContentModel.PROP_EXPIRY_DATE,null);
  }
  ChildAssociationRef newNode=nodeService.createNode(parentNodeRef,parentAssocType,parentAssocName,node.getType(),props);
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str" + newNode.getChildRef() + "String_Node_Str"+ newNode.getParentRef());
  }
  logCreated(node.getNodeRef(),newNode.getChildRef(),newNode.getParentRef(),nodeService.getPath(newNode.getChildRef()).toString(),false);
  writeContent(newNode.getChildRef(),contentProps);
  Set<QName> aspects=new HashSet<QName>(node.getAspects());
  aspects.removeAll(nodeService.getAspects(newNode.getChildRef()));
  for (  QName aspect : aspects) {
    nodeService.addAspect(newNode.getChildRef(),aspect,null);
  }
  ManifestAccessControl acl=node.getAccessControl();
  if (acl != null) {
    permissionService.setInheritParentPermissions(newNode.getChildRef(),acl.isInherited());
    if (acl.getPermissions() != null) {
      for (      ManifestPermission permission : acl.getPermissions()) {
        log.debug("String_Node_Str");
        AccessStatus status=AccessStatus.valueOf(permission.getStatus());
        permissionService.setPermission(newNode.getChildRef(),permission.getAuthority(),permission.getPermission(),status == AccessStatus.ALLOWED);
      }
    }
  }
  if (nodeService.hasAspect(parentNodeRef,TransferModel.ASPECT_TRANSFERRED) || nodeService.hasAspect(parentNodeRef,TransferModel.ASPECT_ALIEN)) {
    alienProcessor.onCreateChild(newNode,header.getRepositoryId(),true);
  }
  checkOrphans(newNode.getChildRef());
}