Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 10317 invoked from network); 4 Feb 2003 21:24:33 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 4 Feb 2003 21:24:33 -0000 Received: (qmail 15417 invoked by uid 97); 4 Feb 2003 21:26:05 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@nagoya.betaversion.org Received: (qmail 15410 invoked from network); 4 Feb 2003 21:26:05 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 4 Feb 2003 21:26:05 -0000 Received: (qmail 1190 invoked by uid 500); 4 Feb 2003 21:22:09 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 1133 invoked by uid 500); 4 Feb 2003 21:22:08 -0000 Received: (qmail 1107 invoked from network); 4 Feb 2003 21:22:08 -0000 Received: from icarus.apache.org (208.185.179.13) by daedalus.apache.org with SMTP; 4 Feb 2003 21:22:08 -0000 Received: (qmail 46007 invoked by uid 1624); 4 Feb 2003 21:22:07 -0000 Date: 4 Feb 2003 21:22:07 -0000 Message-ID: <20030204212207.46006.qmail@icarus.apache.org> From: olegk@apache.org To: jakarta-commons-cvs@apache.org Subject: cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient Cookie.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N olegk 2003/02/04 13:22:07 Modified: httpclient/src/java/org/apache/commons/httpclient Cookie.java Log: - Cookie#Cookie(String, String, String, String, int, boolean) constructor corrected to accept -1 MaxAge value (cookie never expires) Contributed by Oleg Kalnichevski Revision Changes Path 1.38 +12 -8 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/Cookie.java Index: Cookie.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/Cookie.java,v retrieving revision 1.37 retrieving revision 1.38 diff -u -r1.37 -r1.38 --- Cookie.java 4 Feb 2003 20:16:24 -0000 1.37 +++ Cookie.java 4 Feb 2003 21:22:07 -0000 1.38 @@ -160,7 +160,9 @@ * @param value the cookie value * @param domain the host this cookie will be sent to * @param path the path prefix for which this cookie will be sent - * @param maxAge the number of seconds for which this cookie is valid + * @param maxAge the number of seconds for which this cookie is valid. + * maxAge is expected to be a non-negative number. + * -1 signifies that the cookie should never expire. * @param secure if true this cookie will only be sent over secure * connections */ @@ -168,10 +170,12 @@ int maxAge, boolean secure) { this(domain, name, value, path, null, secure); - if (maxAge < 0) { - throw new IllegalArgumentException("Max age name may not be negative"); + if (maxAge < -1) { + throw new IllegalArgumentException("Invalid max age: " + Integer.toString(maxAge)); } - setExpiryDate(new Date(System.currentTimeMillis() + maxAge * 1000L)); + if (maxAge >= 0) { + setExpiryDate(new Date(System.currentTimeMillis() + maxAge * 1000L)); + } } /** --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org