Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-17550

UserManager#exists fail when there's no current user and it's asked to check for existence for it

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 12.2
    • Fix Version/s: 12.6
    • Component/s: User
    • Labels:
      None
    • Tests:
      Unit
    • Difficulty:
      Unknown
    • Documentation:
      N/A
    • Documentation in Release Notes:
      N/A
    • Similar issues:

      Description

      @Inject
      private UserManager userManager;
      ...
      userManager.exists(CurrentUserReference.INSTANCE);
      

      Leads to:

      Caused by: java.lang.ClassCastException: org.xwiki.user.CurrentUserReference cannot be cast to org.xwiki.user.internal.document.DocumentUserReference
      	at org.xwiki.user.internal.document.DocumentUserManager.exists(DocumentUserManager.java:48)
      	at org.xwiki.user.internal.document.CurrentUserManager.exists(CurrentUserManager.java:69)
      	at org.xwiki.user.internal.DefaultUserManager.exists(DefaultUserManager.java:65)
      

        Attachments

          Activity

            People

            Assignee:
            vmassol Vincent Massol
            Reporter:
            vmassol Vincent Massol
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: