private boolean isForPublicSuffix(Cookie cookie) { String domain = cookie.getDomain(); if (domain.startsWith(".")) domain = domain.substring(1); domain = Punycode.toUnicode(domain); // An exception rule takes priority over any other matching rule. if (this.exceptions != null) { if (this.exceptions.contains(domain)) return false; } if (this.suffixes == null) return false; do { if (this.suffixes.contains(domain)) return true; // patterns if (domain.startsWith("*.")) domain = domain.substring(2); int nextdot = domain.indexOf('.'); if (nextdot == -1) break; domain = "*" + domain.substring(nextdot); } while (domain.length() > 0); return false; }
private boolean isForPublicSuffix(final Cookie cookie) { String domain = cookie.getDomain(); if (domain.startsWith(".")) { domain = domain.substring(1); } domain = Punycode.toUnicode(domain); // An exception rule takes priority over any other matching rule. if (this.exceptions != null) { if (this.exceptions.contains(domain)) { return false; } } if (this.suffixes == null) { return false; } do { if (this.suffixes.contains(domain)) { return true; } // patterns if (domain.startsWith("*.")) { domain = domain.substring(2); } final int nextdot = domain.indexOf('.'); if (nextdot == -1) { break; } domain = "*" + domain.substring(nextdot); } while (domain.length() > 0); return false; }