jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pavan Aripirala Venkata" <pvenk...@h5technologies.com>
Subject RE: NullPointerException from actionPerform method
Date Wed, 17 Apr 2002 23:20:40 GMT
	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 =
        } else if ("session".equals(scope)) {
           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.


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"
      <forward name="view_documents" path="/popBrowseCollectionForm.do"
      <forward name="corpusmissing.exception"
path="/getConRes.do?forward=change_collection" redirect="false"/>

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 =
              } else if ("session".equals(scope)) {
 ------->         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



-----Original Message-----
From: Gopal Ram [mailto:gramanuj2001@yahoo.com]
Sent: Wednesday, April 17, 2002 4:07 PM
To: cactus-user@jakarta.apache.org
Subject: NullPointerException from actionPerform method


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() {

  at java.util.Hashtable.get(Hashtable.java:320)

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?


Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax

To unsubscribe, e-mail:
For additional commands, e-mail:

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

View raw message