struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karr, David" <David.K...@wamu.net>
Subject RE: [Struts-src] Creating a form-bean
Date Tue, 28 Jan 2003 22:23:58 GMT
Looks like a bug to me.  I'm not familiar with that code, but it looks
like the "isAssignableFrom" is trying to only use an existing attribute
as the ActionForm if it's of the correct type (or subtype) of the
specified ActionForm type.  The result of the second "return" is that it
will use that attribute even if it's not of that type.  If the second
"return" was removed, it would instead try to create a new instance of
the specified ActionForm type.

It looks like this change went in (by Craig) quite a while ago (version
1.36, 6/22/2002).  I have a feeling it was an accident.

-----Original Message-----
From: Sri Sankaran [mailto:Sri.Sankaran@sas.com] 
Sent: Tuesday, January 28, 2003 1:57 PM
To: Struts-User
Subject: [Struts-src] Creating a form-bean

I was wading through the source code to figure out the process of
creation of a form bean and found the following snippet in
o.a.s.u.RequestUtils in the method createActionForm (line 654 in the
1/28 nightly source):

(beginning at line 709)

if (configClass.isAssignableFrom(instance.getClass())) { 
  if (log.isDebugEnabled()) {
    // snip
  }
  return (instance);
}
return (instance);

Can you tell me what this the if-statement is accomplishing?  It looks
like 'instance' will be returned regardless.

Sri

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message