tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/util CookieTools.java
Date Tue, 25 Sep 2001 20:44:42 GMT
craigmcc    01/09/25 13:44:42

  Modified:    catalina/src/share/org/apache/catalina/util Tag:
                        tomcat_40_branch CookieTools.java
  Log:
  Port NPE avoidance on malformed cookies from the HEAD branch.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.5.2.1   +12 -5     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/util/CookieTools.java
  
  Index: CookieTools.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/util/CookieTools.java,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- CookieTools.java	2001/09/05 18:35:32	1.5
  +++ CookieTools.java	2001/09/25 20:44:42	1.5.2.1
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/util/CookieTools.java,v
1.5 2001/09/05 18:35:32 craigmcc Exp $
  - * $Revision: 1.5 $
  - * $Date: 2001/09/05 18:35:32 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/util/CookieTools.java,v
1.5.2.1 2001/09/25 20:44:42 craigmcc Exp $
  + * $Revision: 1.5.2.1 $
  + * $Date: 2001/09/25 20:44:42 $
    *
    * ====================================================================
    *
  @@ -108,9 +108,16 @@
   
           // this part is the same for all cookies
   
  -        buf.append(URLEncoder.encode(cookie.getName()));
  +        String name = cookie.getName();     // Avoid NPE on malformed cookies
  +        if (name == null)
  +            name = "";
  +        String value = cookie.getValue();
  +        if (value == null)
  +            value = "";
  +        
  +        buf.append(URLEncoder.encode(name));
           buf.append("=");
  -        maybeQuote(version, buf, URLEncoder.encode(cookie.getValue()));
  +        maybeQuote(version, buf, URLEncoder.encode(value));
   
           // add version 1 specific information
           if (version == 1) {
  
  
  

Mime
View raw message