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

    • Bug
    • Resolution: Fixed
    • Major
    • 12.6
    • 12.2
    • User
    • None
    • Unit
    • Unknown
    • N/A
    • N/A

    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

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

            Dates

              Created:
              Updated:
              Resolved: