Program: 89352
Project: 89352
Buggy source:
/** 
 * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action,org.alfresco.service.cmr.repository.NodeRef)
 */
@Override protected void executeImpl(Action action,NodeRef actionedUponNodeRef){
  nodeService.getType(actionedUponNodeRef);
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str" + actionedUponNodeRef);
  }
  if (recordService.isRecord(actionedUponNodeRef)) {
    if (recordService.isDeclared(actionedUponNodeRef) == false) {
      ChildAssociationRef parent=nodeService.getPrimaryParent(actionedUponNodeRef);
      List<AssociationRef> refs=nodeService.getTargetAssocs(actionedUponNodeRef,ImapModel.ASSOC_IMAP_ATTACHMENT);
      if (refs.size() > 0) {
        if (logger.isDebugEnabled()) {
          logger.debug("String_Node_Str");
        }
        return;
      }
      try {
        ContentReader reader=contentService.getReader(actionedUponNodeRef,ContentModel.PROP_CONTENT);
        InputStream is=reader.getContentInputStream();
        MimeMessage mimeMessage=new MimeMessage(null,is);
        Object content=mimeMessage.getContent();
        if (content instanceof Multipart) {
          Multipart multipart=(Multipart)content;
          for (int i=0, n=multipart.getCount(); i < n; i++) {
            Part part=multipart.getBodyPart(i);
            if ("String_Node_Str".equalsIgnoreCase(part.getDisposition())) {
              createAttachment(actionedUponNodeRef,parent.getParentRef(),part);
            }
          }
        }
      }
 catch (      Exception e) {
        throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NO_READ_MIME_MESSAGE,e.toString()),e);
      }
    }
 else {
      throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_EMAIL_DECLARED,actionedUponNodeRef.toString()));
    }
  }
 else {
    throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_EMAIL_NOT_RECORD,actionedUponNodeRef.toString()));
  }
}

Fixed version (ground truth):
/** 
 * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action,org.alfresco.service.cmr.repository.NodeRef)
 */
@Override protected void executeImpl(Action action,NodeRef actionedUponNodeRef){
  nodeService.getType(actionedUponNodeRef);
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str" + actionedUponNodeRef);
  }
  if (recordService.isRecord(actionedUponNodeRef)) {
    if (!recordService.isDeclared(actionedUponNodeRef)) {
      ChildAssociationRef parent=nodeService.getPrimaryParent(actionedUponNodeRef);
      List<AssociationRef> refs=nodeService.getTargetAssocs(actionedUponNodeRef,ImapModel.ASSOC_IMAP_ATTACHMENT);
      if (refs.size() > 0) {
        if (logger.isDebugEnabled()) {
          logger.debug("String_Node_Str");
        }
        return;
      }
      try {
        ContentReader reader=contentService.getReader(actionedUponNodeRef,ContentModel.PROP_CONTENT);
        InputStream is=reader.getContentInputStream();
        MimeMessage mimeMessage=new MimeMessage(null,is);
        Object content=mimeMessage.getContent();
        if (content instanceof Multipart) {
          Multipart multipart=(Multipart)content;
          for (int i=0, n=multipart.getCount(); i < n; i++) {
            Part part=multipart.getBodyPart(i);
            if ("String_Node_Str".equalsIgnoreCase(part.getDisposition())) {
              createAttachment(actionedUponNodeRef,parent.getParentRef(),part);
            }
          }
        }
      }
 catch (      Exception e) {
        throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NO_READ_MIME_MESSAGE,e.toString()),e);
      }
    }
 else {
      throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_EMAIL_DECLARED,actionedUponNodeRef.toString()));
    }
  }
 else {
    throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_EMAIL_NOT_RECORD,actionedUponNodeRef.toString()));
  }
}