Userlister plugin causes NullPointerException

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Low
    • 2.5.5
    • Affects Version/s: 2.5.4
    • Component/s: None
    • Environment:

      Confluence 2.5.4, Sun JDK 1.6, Linux/i686, Resin Professional 3

      When using the User Lister Macro to display group that doesn't exists, an unhandled null pointer exception will be raised in com.atlassian.user.search.page.PagerUtils.toList() method. Example wiki markup to trigger the bug:

      {userlister:groups=nosuchgroup}

      On the rendered wiki page, the macro is expanded to the error message:

      Error formatting macro: userlister: java.lang.NullPointerException

      Relevant parts of the stack trace:

      [15:40:13.959] 2007-07-09 15:40:13,955 ERROR [resin-tcp-connection-*:7811-13] [renderer.v2.components.MacroRendererComponent] processMacro Unexpected error formatting macro: userlister
      [15:40:13.959] – url: /wiki-devel/display/SAND/Home | userName: tj | action: viewpage | page: 268
      [15:40:13.959] java.lang.NullPointerException
      [15:40:13.959] at com.atlassian.user.search.page.PagerUtils.toList(PagerUtils.java:25)
      [15:40:13.959] at com.atlassian.confluence.extra.userlister.model.UserList.getGroupUsers(UserList.java:91)
      [15:40:13.959] at com.atlassian.confluence.extra.userlister.model.UserList.build(UserList.java:39)
      [15:40:13.959] at com.atlassian.confluence.extra.userlister.UserLister.execute(UserLister.java:79)
      [15:40:13.959] at com.atlassian.renderer.v2.macro.ResourceAwareMacroDecorator.execute(ResourceAwareMacroDecorator.java:45)
      [15:40:13.959] at com.atlassian.renderer.v2.components.MacroRendererComponent.processMacro(MacroRendererComponent.java:340)
      [15:40:13.959] at com.atlassian.renderer.v2.components.MacroRendererComponent.makeMacro(MacroRendererComponent.java:241)
      [15:40:13.959] at com.atlassian.renderer.v2.components.MacroRendererComponent.makeMacro(MacroRendererComponent.java:130)
      [15:40:13.959] at com.atlassian.renderer.v2.components.MacroRendererComponent.handlePotentialMacro(MacroRendererComponent.java:115)
      [15:40:13.959] at com.atlassian.renderer.v2.components.MacroRendererComponent.render(MacroRendererComponent.java:77)
      [15:40:13.959] at com.atlassian.renderer.v2.V2Renderer.render(V2Renderer.java:54)
      [15:40:13.959] at com.atlassian.renderer.v2.V2RendererFacade.convertWikiToXHtml(V2RendererFacade.java:57)
      [ .... ]

      The method com.atlassian.user.search.page.PagerUtils.toList() should check that the Pager argument is not null before invoking methods of the object and either return null if the argument was null or throw an IllegalArgumentException (in which case the possible errors should be avoided by checking the nullness of the argument in each instances where com.atlassian.user.search.page.PagerUtils.toList() is invoked prior the invocation). See the attached patch.

        1. handle-null-argument.diff
          0.5 kB
          Tuomas Jormola

            Assignee:
            Unassigned
            Reporter:
            Tuomas Jormola
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: