Skip to content

Commit

Permalink
[java] fixed format of expires in Cookie.toString #13927
Browse files Browse the repository at this point in the history
  • Loading branch information
joerg1985 committed May 13, 2024
1 parent 4e59ac8 commit d1b84e4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions java/src/org/openqa/selenium/Cookie.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.Date;
import java.util.Map;
import java.util.Objects;
import java.util.TimeZone;
import java.util.TreeMap;

public class Cookie implements Serializable {
Expand Down Expand Up @@ -255,12 +256,12 @@ public Map<String, Object> toJson() {

@Override
public String toString() {
SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z");
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
return name
+ "="
+ value
+ (expiry == null
? ""
: "; expires=" + new SimpleDateFormat("EEE, dd MMM yyyy hh:mm:ss z").format(expiry))
+ (expiry == null ? "" : "; expires=" + sdf.format(expiry))
+ ("".equals(path) ? "" : "; path=" + path)
+ (domain == null ? "" : "; domain=" + domain)
+ (isSecure ? ";secure;" : "")
Expand Down

0 comments on commit d1b84e4

Please sign in to comment.