Program: 89250
Project: 89250
Buggy source:
/** 
 * onMoveRecord behaviour
 * @param sourceAssocRef        source association reference
 * @param destinationAssocRef   destination association reference
 */
public void onMoveRecord(final ChildAssociationRef sourceAssocRef,final ChildAssociationRef destinationAssocRef){
  AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Void>(){
    public Void doWork(){
      NodeRef record=sourceAssocRef.getChildRef();
      if (nodeService.exists(record) && nodeService.hasAspect(record,ASPECT_RECORD)) {
        Set<AccessPermission> keepPerms=new HashSet<AccessPermission>(5);
        Set<AccessPermission> origionalParentPerms=permissionService.getAllSetPermissions(sourceAssocRef.getParentRef());
        Set<AccessPermission> origionalRecordPerms=permissionService.getAllSetPermissions(record);
        for (        AccessPermission perm : origionalRecordPerms) {
          if (!ExtendedReaderDynamicAuthority.EXTENDED_READER.equals(perm.getAuthority()) && !ExtendedWriterDynamicAuthority.EXTENDED_WRITER.equals(perm.getAuthority())) {
            if ((perm.getPermission().equals(RMPermissionModel.FILING) || perm.getPermission().equals(RMPermissionModel.FILE_RECORDS)) && !origionalParentPerms.contains(perm)) {
              keepPerms.add(perm);
            }
          }
        }
        permissionService.deletePermissions(record);
        setupPermissions(destinationAssocRef.getParentRef(),record);
        for (        AccessPermission keeper : keepPerms) {
          setPermission(record,keeper.getAuthority(),keeper.getPermission());
        }
      }
      return null;
    }
  }
,AuthenticationUtil.getSystemUserName());
}

Fixed version (ground truth):
/** 
 * onMoveRecord behaviour
 * @param sourceAssocRef        source association reference
 * @param destinationAssocRef   destination association reference
 */
public void onMoveRecord(final ChildAssociationRef sourceAssocRef,final ChildAssociationRef destinationAssocRef){
  AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Void>(){
    public Void doWork(){
      NodeRef record=sourceAssocRef.getChildRef();
      if (nodeService.exists(record) && nodeService.hasAspect(record,ASPECT_RECORD)) {
        Set<AccessPermission> keepPerms=new HashSet<AccessPermission>(5);
        Set<AccessPermission> origionalParentPerms=permissionService.getAllSetPermissions(sourceAssocRef.getParentRef());
        Set<AccessPermission> origionalRecordPerms=permissionService.getAllSetPermissions(record);
        for (        AccessPermission perm : origionalRecordPerms) {
          if (!ExtendedReaderDynamicAuthority.EXTENDED_READER.equals(perm.getAuthority()) && !ExtendedWriterDynamicAuthority.EXTENDED_WRITER.equals(perm.getAuthority()) && (perm.getPermission().equals(RMPermissionModel.FILING) || perm.getPermission().equals(RMPermissionModel.FILE_RECORDS))&& !origionalParentPerms.contains(perm)) {
            keepPerms.add(perm);
          }
        }
        permissionService.deletePermissions(record);
        setupPermissions(destinationAssocRef.getParentRef(),record);
        for (        AccessPermission keeper : keepPerms) {
          setPermission(record,keeper.getAuthority(),keeper.getPermission());
        }
      }
      return null;
    }
  }
,AuthenticationUtil.getSystemUserName());
}