You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by David Corbin <dc...@imperitek.com> on 2001/08/23 23:09:29 UTC
findForward failures
When a findForward("name") fails, because "name" isn't known, why isn't
there an exception thrown? It seems like misspelling this (or my case,
miscapitalizing) would be common occurrence that a programmer would like to
find out about soonest....
Am I missing something?
Re: findForward failures
Posted by David Corbin <dc...@imperitek.com>.
Yes, I understand that, and I CAN check the return value, but since the most
common idomatic usage is:
return mapping.findForward("foo");
and the returning of a null means I have to write
ActionForward forward = mapping.findForward("foo");
if (forward != null)
return forward;
throw new Exception()
That becomes extremely verbose. I would further argue, that it is perfectly
normal to try to extract attributes and hash values that may not exists, but
I can't see any real reason why someone would intentionally attempt to
"findForward" on a non-existant forward mapping.
David
----- Original Message -----
From: "Craig R. McClanahan" <cr...@apache.org>
To: "Struts User" <st...@jakarta.apache.org>
Sent: Monday, August 27, 2001 7:53 PM
Subject: Re: findForward failures
>
>
> On Thu, 23 Aug 2001, David Corbin wrote:
>
> > Date: Thu, 23 Aug 2001 17:09:29 -0400
> > From: David Corbin <dc...@imperitek.com>
> > Reply-To: struts-user@jakarta.apache.org
> > To: Struts User <st...@jakarta.apache.org>
> > Subject: findForward failures
> >
> > When a findForward("name") fails, because "name" isn't known, why isn't
> > there an exception thrown? It seems like misspelling this (or my case,
> > miscapitalizing) would be common occurrence that a programmer would like
to
> > find out about soonest....
> >
>
> Well, it *does* return null if the forward wasn't found ... that is
> consistent, for example, with the way that the Java collection classes, to
> say nothing of request and session attributes, work.
>
> > Am I missing something?
> >
> >
> >
> >
>
> Craig
>
>
>
>
Re: findForward failures
Posted by "Craig R. McClanahan" <cr...@apache.org>.
On Thu, 23 Aug 2001, David Corbin wrote:
> Date: Thu, 23 Aug 2001 17:09:29 -0400
> From: David Corbin <dc...@imperitek.com>
> Reply-To: struts-user@jakarta.apache.org
> To: Struts User <st...@jakarta.apache.org>
> Subject: findForward failures
>
> When a findForward("name") fails, because "name" isn't known, why isn't
> there an exception thrown? It seems like misspelling this (or my case,
> miscapitalizing) would be common occurrence that a programmer would like to
> find out about soonest....
>
Well, it *does* return null if the forward wasn't found ... that is
consistent, for example, with the way that the Java collection classes, to
say nothing of request and session attributes, work.
> Am I missing something?
>
>
>
>
Craig