You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Colin Rogers <Co...@objectconsulting.com.au> on 2013/10/28 06:41:44 UTC

NullAjaxRequestTarget

Wicketeers,

I have a minor issue, rather than any bug, and thought I'd throw it out there.

We tend to use a lot of AjaxFallbackLinks, for obvious reasons. The biggest problem of AjaxFallbackLink is the line of code;

@Override
public final void onClick()
{
        onClick(null);
}

Because null can potentially be passed to the onClick(AjaxRequestTarget target) method, in every case we has to use code as;

If( target != null ) {
       target.add(...);
}

Ad infinitum. When we don't we are potentially letting in bugs each time and 99 times out of 100 developers will forget, which means we have bugs that usually only trigger when a user does a "open in new window" click or if they've happened to turn of JavaScript - so while they are difficult for the user to trigger they are still there.

Is there any chance of un-finalising onClick(), or better yet, having it provide a Null Object (http://en.wikipedia.org/wiki/Null_Object_pattern) instead of null, in order to reduce developer effort and reduce hard to find bugs?

Obviously this is a minor, minor thing...

Cheers,
Col.
EMAIL DISCLAIMER This email message and its attachments are confidential and may also contain copyright or privileged material. If you are not the intended recipient, you may not forward the email or disclose or use the information contained in it. If you have received this email message in error, please advise the sender immediately by replying to this email and delete the message and any associated attachments. Any views, opinions, conclusions, advice or statements expressed in this email message are those of the individual sender and should not be relied upon as the considered view, opinion, conclusions, advice or statement of this company except where the sender expressly, and with authority, states them to be the considered view, opinion, conclusions, advice or statement of this company. Every care is taken but we recommend that you scan any attachments for viruses.

RE: NullAjaxRequestTarget

Posted by Colin Rogers <Co...@objectconsulting.com.au>.
Martin,

Ah, wicked! Thanks! :)

Cheers,
Col.

-----Original Message-----
From: Martin Grigorov [mailto:mgrigorov@apache.org]
Sent: Monday, October 28, 2013 7:11 PM
To: users@wicket.apache.org
Subject: Re: NullAjaxRequestTarget

Hi,

It is a known issue: https://issues.apache.org/jira/browse/WICKET-3317
You can also check the mail archives for the discussions


On Mon, Oct 28, 2013 at 7:41 AM, Colin Rogers < Colin.Rogers@objectconsulting.com.au> wrote:

> Wicketeers,
>
> I have a minor issue, rather than any bug, and thought I'd throw it
> out there.
>
> We tend to use a lot of AjaxFallbackLinks, for obvious reasons. The
> biggest problem of AjaxFallbackLink is the line of code;
>
> @Override
> public final void onClick()
> {
>         onClick(null);
> }
>
> Because null can potentially be passed to the
> onClick(AjaxRequestTarget
> target) method, in every case we has to use code as;
>
> If( target != null ) {
>        target.add(...);
> }
>
> Ad infinitum. When we don't we are potentially letting in bugs each
> time and 99 times out of 100 developers will forget, which means we
> have bugs that usually only trigger when a user does a "open in new
> window" click or if they've happened to turn of JavaScript - so while
> they are difficult for the user to trigger they are still there.
>
> Is there any chance of un-finalising onClick(), or better yet, having
> it provide a Null Object
> (http://en.wikipedia.org/wiki/Null_Object_pattern)
> instead of null, in order to reduce developer effort and reduce hard
> to find bugs?
>
> Obviously this is a minor, minor thing...
>
> Cheers,
> Col.
> EMAIL DISCLAIMER This email message and its attachments are
> confidential and may also contain copyright or privileged material. If
> you are not the intended recipient, you may not forward the email or
> disclose or use the information contained in it. If you have received
> this email message in error, please advise the sender immediately by
> replying to this email and delete the message and any associated
> attachments. Any views, opinions, conclusions, advice or statements
> expressed in this email message are those of the individual sender and
> should not be relied upon as the considered view, opinion,
> conclusions, advice or statement of this company except where the
> sender expressly, and with authority, states them to be the considered view, opinion, conclusions, advice or statement of this company.
> Every care is taken but we recommend that you scan any attachments for
> viruses.
>
EMAIL DISCLAIMER This email message and its attachments are confidential and may also contain copyright or privileged material. If you are not the intended recipient, you may not forward the email or disclose or use the information contained in it. If you have received this email message in error, please advise the sender immediately by replying to this email and delete the message and any associated attachments. Any views, opinions, conclusions, advice or statements expressed in this email message are those of the individual sender and should not be relied upon as the considered view, opinion, conclusions, advice or statement of this company except where the sender expressly, and with authority, states them to be the considered view, opinion, conclusions, advice or statement of this company. Every care is taken but we recommend that you scan any attachments for viruses.

Re: NullAjaxRequestTarget

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

It is a known issue: https://issues.apache.org/jira/browse/WICKET-3317
You can also check the mail archives for the discussions


On Mon, Oct 28, 2013 at 7:41 AM, Colin Rogers <
Colin.Rogers@objectconsulting.com.au> wrote:

> Wicketeers,
>
> I have a minor issue, rather than any bug, and thought I'd throw it out
> there.
>
> We tend to use a lot of AjaxFallbackLinks, for obvious reasons. The
> biggest problem of AjaxFallbackLink is the line of code;
>
> @Override
> public final void onClick()
> {
>         onClick(null);
> }
>
> Because null can potentially be passed to the onClick(AjaxRequestTarget
> target) method, in every case we has to use code as;
>
> If( target != null ) {
>        target.add(...);
> }
>
> Ad infinitum. When we don't we are potentially letting in bugs each time
> and 99 times out of 100 developers will forget, which means we have bugs
> that usually only trigger when a user does a "open in new window" click or
> if they've happened to turn of JavaScript - so while they are difficult for
> the user to trigger they are still there.
>
> Is there any chance of un-finalising onClick(), or better yet, having it
> provide a Null Object (http://en.wikipedia.org/wiki/Null_Object_pattern)
> instead of null, in order to reduce developer effort and reduce hard to
> find bugs?
>
> Obviously this is a minor, minor thing...
>
> Cheers,
> Col.
> EMAIL DISCLAIMER This email message and its attachments are confidential
> and may also contain copyright or privileged material. If you are not the
> intended recipient, you may not forward the email or disclose or use the
> information contained in it. If you have received this email message in
> error, please advise the sender immediately by replying to this email and
> delete the message and any associated attachments. Any views, opinions,
> conclusions, advice or statements expressed in this email message are those
> of the individual sender and should not be relied upon as the considered
> view, opinion, conclusions, advice or statement of this company except
> where the sender expressly, and with authority, states them to be the
> considered view, opinion, conclusions, advice or statement of this company.
> Every care is taken but we recommend that you scan any attachments for
> viruses.
>