src/share/classes/java/net/HttpCookie.java
Print this page
*** 32,41 ****
--- 32,42 ----
import java.util.TimeZone;
import java.util.Date;
import java.lang.NullPointerException; // for javadoc
import java.util.Locale;
+ import java.util.Objects;
/**
* An HttpCookie object represents an http cookie, which carries state
* information between server and user agent. Cookie is widely adopted
* to create stateful sessions.
*** 815,825 ****
// 1. they come from same domain (case-insensitive),
// 2. have same name (case-insensitive),
// 3. and have same path (case-sensitive).
return equalsIgnoreCase(getName(), other.getName()) &&
equalsIgnoreCase(getDomain(), other.getDomain()) &&
! equals(getPath(), other.getPath());
}
/**
* Return hash code of this http cookie. The result is the sum of
--- 816,826 ----
// 1. they come from same domain (case-insensitive),
// 2. have same name (case-insensitive),
// 3. and have same path (case-sensitive).
return equalsIgnoreCase(getName(), other.getName()) &&
equalsIgnoreCase(getDomain(), other.getDomain()) &&
! Objects.equals(getPath(), other.getPath());
}
/**
* Return hash code of this http cookie. The result is the sum of
*** 1160,1177 ****
return s.equalsIgnoreCase(t);
}
return false;
}
- private static boolean equals(String s, String t) {
- if (s == t) return true;
- if ((s != null) && (t != null)) {
- return s.equals(t);
- }
- return false;
- }
-
private static boolean startsWithIgnoreCase(String s, String start) {
if (s == null || start == null) return false;
if (s.length() >= start.length() &&
start.equalsIgnoreCase(s.substring(0, start.length()))) {
--- 1161,1170 ----