jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anil Agrawal" <a.agra...@popnet.co.in>
Subject Error in webRequest.addCookie
Date Tue, 22 Apr 2003 04:27:43 GMT
Hello,
   
   I am highly obliged for your prompt reply.

   I am sending you my simple test case TestCookie.java.
   which give me error on following line.
   
   webRequest.addCookie("alpha","abc")
   
   TestCookie.java has 3 simple methods
   
      beginTryCookie(WebRequest webRequest)
      testTryCookie()
      public void endTryCookie(WebResponse webResponse)
   
   webRequest.addParameter() etc. are working fine.
   Pl. forgive me, I did not put more comments in the code.
   
   Below code I pasted exception received.
   
   With regards
   anil

-----------------------------
Source code of a TestCookie
-----------------------------


package com.csam.wsc.sync.junit.cactus;

import junit.framework.TestCase;
import junit.framework.TestSuite;
import junit.framework.Assert;
import java.rmi.RemoteException;

import org.apache.cactus.ServletTestCase;

import org.apache.cactus.WebRequest;
import org.apache.cactus.WebResponse;

import org.apache.cactus.Cookie;

public class TestCookie extends ServletTestCase {
	
//=======================================    
  public TestCookie(String className) {
    super(className);
  }

//=======================================
  public static TestSuite suite() {
    return new TestSuite(TestCookie.class);
  }

//=======================================
  public void setUp() throws Exception {
      System.out.println("<<<<<<<setup called  on SERVER SIDE
>>>>>>>>>");

  }

//=======================================
  public void tearDown() throws Exception {
     System.out.println("<<<<<<tearDown called on SERVER
SIDE>>>>>>>>>>");
    
  }


//----------------------------------------------------------------------
----
//method  beginTryCookie

   public void beginTryCookie(WebRequest webRequest) throws Exception {
 
System.out.println("-----------------------------------------------");
      System.out.println("beginTryCookie******client
starts***************");
      
      System.out.println("before adding cookie");
      
      // following line gives error
      webRequest.addCookie("alpha","abc");
      
     System.out.println("beginTryCookie******client
ends***************");
 
System.out.println("-----------------------------------------------");
   }

//----------------------------------------------------------------------
----



   public  void testTryCookie() {	  
	  System.out.println("testTryCookie starts<<<<<<< server side
>>>>>>>>>");	  
	  System.out.println("testTryCookie ends<<<<<<< server side
>>>>>>>>>");
   }  	


//---------------------------------------------------------------

   public void endTryCookie(WebResponse webResponse)
       throws Exception {
 
System.out.println("-----------------------------------------------");
      System.out.println("endTryCookie******client
starts***************");
         
         //Cookie cookie = webResponse.getCookie("alpha");
         //System.out.println("value of cookie
alpha------>"+cookie.getValue());
      
      System.out.println("endTryCookie******client
ends***************");
 
System.out.println("-----------------------------------------------");
   }



}        // end of TryCookie   


Exception
-----------
--------------------------------------------------
> EXCEPTION
> ---------------------------------------------
> 16:25:00,740 [main] DEBUG cactus.TestCookie               -
> ------------- Test: testTryCookie
> 16:25:00,970 [main] DEBUG cactus.TestCookie               - Exception
in
> test
> java.lang.NullPointerException
> 	at
>
org.apache.cactus.client.AbstractConnectionHelper.dispatch1_getCookieStr
>
ing(AbstractConnectionHelper.java;org/apache/cactus/util/log/LogAspect.a
> j(1k):198)
> 	at
>
org.apache.cactus.client.AbstractConnectionHelper.around1_getCookieStrin
>
g(AbstractConnectionHelper.java;org/apache/cactus/util/log/LogAspect.aj(
> 1k):1236)
> 	at
>
org.apache.cactus.client.AbstractConnectionHelper.getCookieString(Abstra
>
ctConnectionHelper.java;org/apache/cactus/util/log/LogAspect.aj(1k):150)
> 	at
>
org.apache.cactus.client.HttpClientConnectionHelper.dispatch24_connect(H
>
ttpClientConnectionHelper.java;org/apache/cactus/util/log/LogAspect.aj(1
> k):148)
> 	at
>
org.apache.cactus.client.HttpClientConnectionHelper.around24_connect(Htt
>
pClientConnectionHelper.java;org/apache/cactus/util/log/LogAspect.aj(1k)
> :1236)
> 	at
>
org.apache.cactus.client.HttpClientConnectionHelper.connect(HttpClientCo
> nnectionHelper.java;org/apache/cactus/util/log/LogAspect.aj(1k):106)
> 	at
>

Mime
View raw message