Menu

setRequestParameter failure??

2002-07-03
2002-07-04
  • Network simulator

    Is this the way to set extra parameters??

    <setRequestParameter name="x" value="test"/>
    <set name="req" value="http://lalala:8080/test/TestServlet"/>
    <httpGet  response="response1"/>

    I get the following nullpointer exception:

        <error type="java.lang.NullPointerException">java.lang.NullPointerException
        at net.sourceforge.jxweb.HttpSetRequestParameter.eval(HttpSetRequestParameter.java:95)
        at net.sourceforge.jxunit.JXDo.eval(Unknown Source)
        at net.sourceforge.jxunit.JXTestCase.runTest(Unknown Source)

     
    • Thomas.P.Varghese

      While carefully examining the code i found a small bug.Thanks for catching :-) it actually fails to check if the request doest applies to any of the predefined types( WebLink or WebForm or WebRequest).
                     If you have the acess to the source you can add this else statement  after line 53 of  HttpSetRequestParameter.java and build the binaries or you have to waite for the next release.

      //after all the else if statements

          else
          {
              req = new GetMethodWebRequest((String)webThing);
          }

      Bingo!

      Its my sample jxw file which i have tested.
      <jxw>
              <set name="req" value="http://localhost:8080/examples/servlet/RequestParamExample"/>
          <setRequestParameter name="firstname" value="thomas"/>
          <setRequestParameter name="lastname" value="varghese"/>
              <httpGet/>   
          <save name="respText" file="output.html"/>
      </jxw>

      Thanks and Regards
      Thomas

       

Log in to post a comment.