Gopal here is the link.
http://sourceforge.net/project/showfiles.php?group_id=39190&release_id=7
2737
However you might have seen Deryl's e-mail, the he is going to
take care of this in the next release.
Pavan.
-----Original Message-----
From: Gopal Ram [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 18, 2002 2:19 PM
To: Cactus Users List
Subject: RE: NullPointerException from actionPerform method
Pavan,
Thanks for the reply. I am trying to look for the
CactusStrutsTestCase.java. where can I get the
distribution from. Can you provide me the link from
which I can get the source file so that I can change
it.
Thanks
Gopal
--- Pavan Aripirala Venkata
<[EMAIL PROTECTED]> wrote:
> Gopal,
> I encountered the same problem. I sent an e-mail to
> Deryl. But
> no reply from him. Probably he is busy.
> You get this problem if the action element, you are
> testing, in
> struts-config.xml does not contain the attribute
> "name". This is because
> in CactusStrutsTestCase.java, the code doesn't check
> for null value of
> 'mapping.getAttribute()' (which returns the value of
> the attribute :
> "name" (name is the attribute specifying the form
> name)).
>
> I am attaching the entire e-mail that I sent Deryl
> (see at the
> end). The work around for this is I modified the
> CactusStrutsTestCase.java at the place where
> mapping.getAttribute() is
> supposed to be checked for null value
> i.e. I added
> if (mapping.getAttribute() != null) { // This
> condition I added.
> if ("request".equals(scope)) {
> retForm =
>
(ActionForm)getRequest().getAttribute(mapping.getAttribute());
> } else if ("session".equals(scope)) {
> retForm =
>
(ActionForm)getSession().getAttribute(mapping.getAttribute());
> }
> setActionForm(retForm);
> }
> And it works!
> I suppose this is a bug. Please let me know if
> there is any
> mailing list for Cactus Struts tests in SourceForge.
>
> Pavan.
>
> Here is the e-mail
>
------------------------------------------------------------------------
> ------------------
> Hi Deryl, I am sending you this query because I
> don't know if
> there is any mailing list for Cactus Struts testing
> using the
> SourceForge's "strutstest.jar" (version 1.6). Please
> let me know if
> there is any mailing list and I'll post this there.
> Here is the problem, I am using
> CactusStrutsTestCase for testing
> our struts. We have in our struts-config.xml, one of
> the action elements
> without "name" attribute and without "scope"
> attribute. Example:
>
> <action path="/getDocs"
>
>
type="com.h5.struts.webapp.actions.retrieve.GetDocumentsAction"
> validate="false">
> <forward name="view_documents"
> path="/popBrowseCollectionForm.do"
> redirect="false"/>
> <forward name="corpusmissing.exception"
> path="/getConRes.do?forward=change_collection"
> redirect="false"/>
> </action>
>
> When I test this action class, the actionPerform
> method in
> CactusStrutsTestCase.java is being executed and I
> receive a
> NullPointerException (approximate line number 384)
> at
> String scope = mapping.getScope();
> if ("request".equals(scope)) {
> retForm =
>
(ActionForm)getRequest().getAttribute(mapping.getAttribute());
> } else if ("session".equals(scope)) {
> -------> retForm =
>
(ActionForm)getSession().getAttribute(mapping.getAttribute());
> }
> setActionForm(retForm);
>
> because mapping.getAttribute() is null and
> value of the variable
> scope is "session", even though I don't have the
> "scope" attribute set.
> Question 1) Will the scope attribute defaults to
> session? (I don't know
> much about struts)
> Question 2) In the CactusStrutsTestCase.java the
> code does not check for
> null value of mapping.getAttribute(). However at
> around line 340, you
> check for null value
> of mapping.getAttribute() to get the ActionForm. So
> should there have
> been a if condition in CactusStrutsTestCase.java ?
> Thanks Deryl
>
> Pavan.
>
>
------------------------------------------------------------------------
> ------------------
>
> -----Original Message-----
> From: Gopal Ram [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 17, 2002 4:07 PM
> To: [EMAIL PROTECTED]
> Subject: NullPointerException from actionPerform
> method
>
>
> Hi,
>
> My test case extends from CactusStrutsTestCase. When
> I
> run the test case , it redirects to the server and
> calls the actionPerform method. But before returning
> back to the Client it gives me a
> NullPointerException
> on the client side where I execute my test case.
>
> public void testXXX() {
> addRequestParameter("Action","init");
> setRequestPathInfo("/s001.do");
> actionPerform();
> verifyForwardPath("success");
> }
>
> java.lang.NullPointerException
> at java.util.Hashtable.get(Hashtable.java:320)
> at
>
org.apache.tomcat.session.StandardSession.getAttribute(StandardSession.j
> ava:506)
> at
>
servletunit.struts.CactusStrutsTestCase.actionPerform(CactusStrutsTestCa
> se.java:384)
>
> Can somebody tell me why is this happening ? I guess
> I
> have set up the cactus.properties file properly
> otherwise the server will not get the request
> itself?
>
> Thanks
> Gopal
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Tax Center - online filing with TurboTax
> http://taxes.yahoo.com/
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/
--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>