mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8210311: IllegalArgumentException in CookieManager - Comparison method violates its general contract
Reviewed-by: chegar, dfuchs
This commit is contained in:
parent
b395d380e8
commit
b5fb6b3566
6 changed files with 240 additions and 19 deletions
|
@ -142,6 +142,13 @@ public final class HttpCookie implements Cloneable {
|
|||
}
|
||||
|
||||
private HttpCookie(String name, String value, String header) {
|
||||
this(name, value, header, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
/**
|
||||
* Package private for testing purposes.
|
||||
*/
|
||||
HttpCookie(String name, String value, String header, long creationTime) {
|
||||
name = name.trim();
|
||||
if (name.length() == 0 || !isToken(name) || name.charAt(0) == '$') {
|
||||
throw new IllegalArgumentException("Illegal cookie name");
|
||||
|
@ -152,7 +159,7 @@ public final class HttpCookie implements Cloneable {
|
|||
toDiscard = false;
|
||||
secure = false;
|
||||
|
||||
whenCreated = System.currentTimeMillis();
|
||||
whenCreated = creationTime;
|
||||
portlist = null;
|
||||
this.header = header;
|
||||
}
|
||||
|
@ -756,6 +763,11 @@ public final class HttpCookie implements Cloneable {
|
|||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
}
|
||||
// ---------------- Package private operations --------------
|
||||
|
||||
long getCreationTime() {
|
||||
return whenCreated;
|
||||
}
|
||||
|
||||
// ---------------- Private operations --------------
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue