Program: 89255
Project: 89255
Buggy source:
/** 
 * @see org.alfresco.module.org_alfresco_module_rm.transfer.TransferService#transfer(NodeRef,boolean)
 */
@Override public NodeRef transfer(NodeRef nodeRef,boolean isAccession){
  ParameterCheck.mandatory("String_Node_Str",nodeRef);
  NodeRef root=filePlanService.getFilePlan(nodeRef);
  NodeRef transferNodeRef=(NodeRef)AlfrescoTransactionSupport.getResource(KEY_TRANSFER_NODEREF);
  if (transferNodeRef == null) {
    QName nodeDbid=QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI,"String_Node_Str");
    Long dbId=(Long)nodeService.getProperty(nodeRef,nodeDbid);
    String transferName=StringUtils.leftPad(dbId.toString(),10,"String_Node_Str");
    Map<QName,Serializable> transferProps=new HashMap<QName,Serializable>(2);
    transferProps.put(ContentModel.PROP_NAME,transferName);
    transferProps.put(PROP_TRANSFER_ACCESSION_INDICATOR,isAccession);
    DispositionAction da=dispositionService.getNextDispositionAction(nodeRef);
    if (da != null) {
      DispositionActionDefinition actionDef=da.getDispositionActionDefinition();
      if (actionDef != null) {
        transferProps.put(PROP_TRANSFER_LOCATION,actionDef.getLocation());
      }
    }
    NodeRef transferContainer=filePlanService.getTransferContainer(root);
    transferNodeRef=nodeService.createNode(transferContainer,ContentModel.ASSOC_CONTAINS,QName.createQName(RM_URI,transferName),TYPE_TRANSFER,transferProps).getChildRef();
    AlfrescoTransactionSupport.bindResource(KEY_TRANSFER_NODEREF,transferNodeRef);
  }
 else {
    List<ChildAssociationRef> transferredAlready=nodeService.getChildAssocs(transferNodeRef,ASSOC_TRANSFERRED,ASSOC_TRANSFERRED);
    for (    ChildAssociationRef car : transferredAlready) {
      if (car.getChildRef().equals(nodeRef)) {
        throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NODE_ALREADY_TRANSFER,nodeRef.toString()));
      }
    }
  }
  nodeService.addChild(transferNodeRef,nodeRef,ASSOC_TRANSFERRED,ASSOC_TRANSFERRED);
  setPDFIndicationFlag(transferNodeRef,nodeRef);
  nodeService.addAspect(nodeRef,ASPECT_TRANSFERRING,null);
  if (isRecordFolder(nodeRef) == true) {
    for (    NodeRef record : recordService.getRecords(nodeRef)) {
      nodeService.addAspect(record,ASPECT_TRANSFERRING,null);
    }
  }
  return transferNodeRef;
}

Fixed version (ground truth):
/** 
 * @see org.alfresco.module.org_alfresco_module_rm.transfer.TransferService#transfer(NodeRef,boolean)
 */
@Override public NodeRef transfer(NodeRef nodeRef,boolean isAccession){
  ParameterCheck.mandatory("String_Node_Str",nodeRef);
  NodeRef root=filePlanService.getFilePlan(nodeRef);
  NodeRef transferNodeRef=(NodeRef)AlfrescoTransactionSupport.getResource(KEY_TRANSFER_NODEREF);
  if (transferNodeRef == null) {
    QName nodeDbid=QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI,"String_Node_Str");
    Long dbId=(Long)nodeService.getProperty(nodeRef,nodeDbid);
    String transferName=StringUtils.leftPad(dbId.toString(),10,"String_Node_Str");
    Map<QName,Serializable> transferProps=new HashMap<QName,Serializable>(2);
    transferProps.put(ContentModel.PROP_NAME,transferName);
    transferProps.put(PROP_TRANSFER_ACCESSION_INDICATOR,isAccession);
    DispositionAction da=dispositionService.getNextDispositionAction(nodeRef);
    if (da != null) {
      DispositionActionDefinition actionDef=da.getDispositionActionDefinition();
      if (actionDef != null) {
        transferProps.put(PROP_TRANSFER_LOCATION,actionDef.getLocation());
      }
    }
    NodeRef transferContainer=filePlanService.getTransferContainer(root);
    transferNodeRef=nodeService.createNode(transferContainer,ContentModel.ASSOC_CONTAINS,QName.createQName(RM_URI,transferName),TYPE_TRANSFER,transferProps).getChildRef();
    AlfrescoTransactionSupport.bindResource(KEY_TRANSFER_NODEREF,transferNodeRef);
  }
 else {
    List<ChildAssociationRef> transferredAlready=nodeService.getChildAssocs(transferNodeRef,ASSOC_TRANSFERRED,ASSOC_TRANSFERRED);
    for (    ChildAssociationRef car : transferredAlready) {
      if (car.getChildRef().equals(nodeRef)) {
        throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NODE_ALREADY_TRANSFER,nodeRef.toString()));
      }
    }
  }
  nodeService.addChild(transferNodeRef,nodeRef,ASSOC_TRANSFERRED,ASSOC_TRANSFERRED);
  setPDFIndicationFlag(transferNodeRef,nodeRef);
  nodeService.addAspect(nodeRef,ASPECT_TRANSFERRING,null);
  if (isRecordFolder(nodeRef)) {
    for (    NodeRef record : recordService.getRecords(nodeRef)) {
      nodeService.addAspect(record,ASPECT_TRANSFERRING,null);
    }
  }
  return transferNodeRef;
}