Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-3534

Ajax components: provide a DummyAjaxRequestTarget instead of null if Ajax is not available, e.g. to onClick(AjaxRequestTarget)

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    Description

      It is a common pitfall not to think of AjaxRequestTarget maybe being null, e.g. in a Link's onClick method.
      Even if the developer has this fact in mind, it is the same piece of code used to avoid NullPointerExceptions or other problems arising of it.

      Wouldn't it be nice to have sort of a DummyAjaxRequestTarget? This could solve some common problems:

      • NullPointerException due to the passed AjaxRequestTarget being null
      • NullPointerExceptions due to AjaxRequestTarget#getPage() returning null
        there are probably more.

      Also, it would be possible to throw more distinct Exceptions in cases where DummyAjaxRequestTarget cannot handle method calls.

      I would love it, for better readibility and less runtime exceptions (even more as these runtime exceptions are only thrown under special conditions: js deactivated or similar)

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            ivaynberg Igor Vaynberg
            pparson Peter Parson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment