From: Dale A. <dal...@us...> - 2004-10-19 03:55:53
|
Update of /cvsroot/ant-contrib/ant-contrib/src/net/sf/antcontrib/net In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6090 Modified Files: PostTask.java Log Message: updated to ensure uniqueness of cookie id Index: PostTask.java =================================================================== RCS file: /cvsroot/ant-contrib/ant-contrib/src/net/sf/antcontrib/net/PostTask.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PostTask.java 16 Oct 2004 05:12:39 -0000 1.8 --- PostTask.java 19 Oct 2004 03:55:43 -0000 1.9 *************** *** 33,36 **** --- 33,38 ---- import java.net.URLEncoder; + import java.rmi.server.UID; + import java.util.*; *************** *** 618,622 **** /** ! * Represents a cookie. See RFC 2109. */ public class Cookie { --- 620,624 ---- /** ! * Represents a cookie. See RFC 2109 and 2965. */ public class Cookie { *************** *** 624,629 **** private String value; private String domain; ! private String path; ! private long id = new Date().getTime(); /** --- 626,631 ---- private String value; private String domain; ! private String path = "/"; ! private String id; /** *************** *** 646,649 **** --- 648,656 ---- domain = parts[ 1 ]; } + if (name == null) + throw new IllegalArgumentException("Raw cookie does not contain a cookie name."); + if (path == null) + path = "/"; + setId(path, name); } *************** *** 653,658 **** --- 660,669 ---- */ public Cookie( String name, String value ) { + if (name == null) + throw new IllegalArgumentException("Cookie name may not be null."); + this.name = name; this.value = value; + setId(name); } *************** *** 662,666 **** */ public String getId() { ! return String.valueOf( id ); } --- 673,689 ---- */ public String getId() { ! if (id == null) ! setId(path, name); ! return id.toString(); ! } ! ! private void setId(String name) { ! setId(path, name); ! } ! ! private void setId(String path, String name) { ! if (name == null) ! name = ""; ! id = path + name; } |