1171 lines
28 KiB
Smali
1171 lines
28 KiB
Smali
.class public final Lcom/google/common/net/InternetDomainName;
|
|
.super Ljava/lang/Object;
|
|
.source "InternetDomainName.java"
|
|
|
|
|
|
# annotations
|
|
.annotation build Lcom/google/common/annotations/Beta;
|
|
.end annotation
|
|
|
|
.annotation build Lcom/google/common/annotations/GwtCompatible;
|
|
emulated = true
|
|
.end annotation
|
|
|
|
.annotation runtime Lcom/google/common/net/ElementTypesAreNonnullByDefault;
|
|
.end annotation
|
|
|
|
.annotation runtime Lcom/google/errorprone/annotations/Immutable;
|
|
.end annotation
|
|
|
|
|
|
# static fields
|
|
.field private static final DASH_MATCHER:Lcom/google/common/base/CharMatcher;
|
|
|
|
.field private static final DIGIT_MATCHER:Lcom/google/common/base/CharMatcher;
|
|
|
|
.field private static final DOTS_MATCHER:Lcom/google/common/base/CharMatcher;
|
|
|
|
.field private static final DOT_JOINER:Lcom/google/common/base/Joiner;
|
|
|
|
.field private static final DOT_SPLITTER:Lcom/google/common/base/Splitter;
|
|
|
|
.field private static final LETTER_MATCHER:Lcom/google/common/base/CharMatcher;
|
|
|
|
.field private static final MAX_DOMAIN_PART_LENGTH:I = 0x3f
|
|
|
|
.field private static final MAX_LENGTH:I = 0xfd
|
|
|
|
.field private static final MAX_PARTS:I = 0x7f
|
|
|
|
.field private static final NO_SUFFIX_FOUND:I = -0x1
|
|
|
|
.field private static final PART_CHAR_MATCHER:Lcom/google/common/base/CharMatcher;
|
|
|
|
|
|
# instance fields
|
|
.field private final name:Ljava/lang/String;
|
|
|
|
.field private final parts:Lcom/google/common/collect/ImmutableList;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Lcom/google/common/collect/ImmutableList<",
|
|
"Ljava/lang/String;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
.field private final publicSuffixIndex:I
|
|
|
|
.field private final registrySuffixIndex:I
|
|
|
|
|
|
# direct methods
|
|
.method public static constructor <clinit>()V
|
|
.locals 5
|
|
|
|
const-string v0, ".\u3002\uff0e\uff61"
|
|
|
|
.line 1
|
|
invoke-static {v0}, Lcom/google/common/base/CharMatcher;->anyOf(Ljava/lang/CharSequence;)Lcom/google/common/base/CharMatcher;
|
|
|
|
move-result-object v0
|
|
|
|
sput-object v0, Lcom/google/common/net/InternetDomainName;->DOTS_MATCHER:Lcom/google/common/base/CharMatcher;
|
|
|
|
const/16 v0, 0x2e
|
|
|
|
.line 2
|
|
invoke-static {v0}, Lcom/google/common/base/Splitter;->on(C)Lcom/google/common/base/Splitter;
|
|
|
|
move-result-object v1
|
|
|
|
sput-object v1, Lcom/google/common/net/InternetDomainName;->DOT_SPLITTER:Lcom/google/common/base/Splitter;
|
|
|
|
.line 3
|
|
invoke-static {v0}, Lcom/google/common/base/Joiner;->on(C)Lcom/google/common/base/Joiner;
|
|
|
|
move-result-object v0
|
|
|
|
sput-object v0, Lcom/google/common/net/InternetDomainName;->DOT_JOINER:Lcom/google/common/base/Joiner;
|
|
|
|
const-string v0, "-_"
|
|
|
|
.line 4
|
|
invoke-static {v0}, Lcom/google/common/base/CharMatcher;->anyOf(Ljava/lang/CharSequence;)Lcom/google/common/base/CharMatcher;
|
|
|
|
move-result-object v0
|
|
|
|
sput-object v0, Lcom/google/common/net/InternetDomainName;->DASH_MATCHER:Lcom/google/common/base/CharMatcher;
|
|
|
|
const/16 v1, 0x30
|
|
|
|
const/16 v2, 0x39
|
|
|
|
.line 5
|
|
invoke-static {v1, v2}, Lcom/google/common/base/CharMatcher;->inRange(CC)Lcom/google/common/base/CharMatcher;
|
|
|
|
move-result-object v1
|
|
|
|
sput-object v1, Lcom/google/common/net/InternetDomainName;->DIGIT_MATCHER:Lcom/google/common/base/CharMatcher;
|
|
|
|
const/16 v2, 0x61
|
|
|
|
const/16 v3, 0x7a
|
|
|
|
.line 6
|
|
invoke-static {v2, v3}, Lcom/google/common/base/CharMatcher;->inRange(CC)Lcom/google/common/base/CharMatcher;
|
|
|
|
move-result-object v2
|
|
|
|
const/16 v3, 0x41
|
|
|
|
const/16 v4, 0x5a
|
|
|
|
invoke-static {v3, v4}, Lcom/google/common/base/CharMatcher;->inRange(CC)Lcom/google/common/base/CharMatcher;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-virtual {v2, v3}, Lcom/google/common/base/CharMatcher;->or(Lcom/google/common/base/CharMatcher;)Lcom/google/common/base/CharMatcher;
|
|
|
|
move-result-object v2
|
|
|
|
sput-object v2, Lcom/google/common/net/InternetDomainName;->LETTER_MATCHER:Lcom/google/common/base/CharMatcher;
|
|
|
|
.line 7
|
|
invoke-virtual {v1, v2}, Lcom/google/common/base/CharMatcher;->or(Lcom/google/common/base/CharMatcher;)Lcom/google/common/base/CharMatcher;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v1, v0}, Lcom/google/common/base/CharMatcher;->or(Lcom/google/common/base/CharMatcher;)Lcom/google/common/base/CharMatcher;
|
|
|
|
move-result-object v0
|
|
|
|
sput-object v0, Lcom/google/common/net/InternetDomainName;->PART_CHAR_MATCHER:Lcom/google/common/base/CharMatcher;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>(Ljava/lang/String;)V
|
|
.locals 5
|
|
|
|
.line 1
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
.line 2
|
|
sget-object v0, Lcom/google/common/net/InternetDomainName;->DOTS_MATCHER:Lcom/google/common/base/CharMatcher;
|
|
|
|
const/16 v1, 0x2e
|
|
|
|
invoke-virtual {v0, p1, v1}, Lcom/google/common/base/CharMatcher;->replaceFrom(Ljava/lang/CharSequence;C)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-static {p1}, Lcom/google/common/base/Ascii;->toLowerCase(Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
const-string v0, "."
|
|
|
|
.line 3
|
|
invoke-virtual {p1, v0}, Ljava/lang/String;->endsWith(Ljava/lang/String;)Z
|
|
|
|
move-result v0
|
|
|
|
const/4 v1, 0x1
|
|
|
|
const/4 v2, 0x0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
.line 4
|
|
invoke-virtual {p1}, Ljava/lang/String;->length()I
|
|
|
|
move-result v0
|
|
|
|
sub-int/2addr v0, v1
|
|
|
|
invoke-virtual {p1, v2, v0}, Ljava/lang/String;->substring(II)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
.line 5
|
|
:cond_0
|
|
invoke-virtual {p1}, Ljava/lang/String;->length()I
|
|
|
|
move-result v0
|
|
|
|
const/16 v3, 0xfd
|
|
|
|
if-gt v0, v3, :cond_1
|
|
|
|
move v0, v1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
move v0, v2
|
|
|
|
:goto_0
|
|
const-string v3, "Domain name too long: \'%s\':"
|
|
|
|
invoke-static {v0, v3, p1}, Lcom/google/common/base/Preconditions;->checkArgument(ZLjava/lang/String;Ljava/lang/Object;)V
|
|
|
|
.line 6
|
|
iput-object p1, p0, Lcom/google/common/net/InternetDomainName;->name:Ljava/lang/String;
|
|
|
|
.line 7
|
|
sget-object v0, Lcom/google/common/net/InternetDomainName;->DOT_SPLITTER:Lcom/google/common/base/Splitter;
|
|
|
|
invoke-virtual {v0, p1}, Lcom/google/common/base/Splitter;->split(Ljava/lang/CharSequence;)Ljava/lang/Iterable;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-static {v0}, Lcom/google/common/collect/ImmutableList;->copyOf(Ljava/lang/Iterable;)Lcom/google/common/collect/ImmutableList;
|
|
|
|
move-result-object v0
|
|
|
|
iput-object v0, p0, Lcom/google/common/net/InternetDomainName;->parts:Lcom/google/common/collect/ImmutableList;
|
|
|
|
.line 8
|
|
invoke-virtual {v0}, Ljava/util/AbstractCollection;->size()I
|
|
|
|
move-result v3
|
|
|
|
const/16 v4, 0x7f
|
|
|
|
if-gt v3, v4, :cond_2
|
|
|
|
goto :goto_1
|
|
|
|
:cond_2
|
|
move v1, v2
|
|
|
|
:goto_1
|
|
const-string v2, "Domain has too many parts: \'%s\'"
|
|
|
|
invoke-static {v1, v2, p1}, Lcom/google/common/base/Preconditions;->checkArgument(ZLjava/lang/String;Ljava/lang/Object;)V
|
|
|
|
.line 9
|
|
invoke-static {v0}, Lcom/google/common/net/InternetDomainName;->validateSyntax(Ljava/util/List;)Z
|
|
|
|
move-result v0
|
|
|
|
const-string v1, "Not a valid domain name: \'%s\'"
|
|
|
|
invoke-static {v0, v1, p1}, Lcom/google/common/base/Preconditions;->checkArgument(ZLjava/lang/String;Ljava/lang/Object;)V
|
|
|
|
.line 10
|
|
invoke-static {}, Lcom/google/common/base/Optional;->absent()Lcom/google/common/base/Optional;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-direct {p0, p1}, Lcom/google/common/net/InternetDomainName;->findSuffixOfType(Lcom/google/common/base/Optional;)I
|
|
|
|
move-result p1
|
|
|
|
iput p1, p0, Lcom/google/common/net/InternetDomainName;->publicSuffixIndex:I
|
|
|
|
.line 11
|
|
sget-object p1, Lcom/google/thirdparty/publicsuffix/PublicSuffixType;->REGISTRY:Lcom/google/thirdparty/publicsuffix/PublicSuffixType;
|
|
|
|
invoke-static {p1}, Lcom/google/common/base/Optional;->of(Ljava/lang/Object;)Lcom/google/common/base/Optional;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-direct {p0, p1}, Lcom/google/common/net/InternetDomainName;->findSuffixOfType(Lcom/google/common/base/Optional;)I
|
|
|
|
move-result p1
|
|
|
|
iput p1, p0, Lcom/google/common/net/InternetDomainName;->registrySuffixIndex:I
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private ancestor(I)Lcom/google/common/net/InternetDomainName;
|
|
.locals 3
|
|
|
|
.line 1
|
|
sget-object v0, Lcom/google/common/net/InternetDomainName;->DOT_JOINER:Lcom/google/common/base/Joiner;
|
|
|
|
iget-object v1, p0, Lcom/google/common/net/InternetDomainName;->parts:Lcom/google/common/collect/ImmutableList;
|
|
|
|
invoke-virtual {v1}, Ljava/util/AbstractCollection;->size()I
|
|
|
|
move-result v2
|
|
|
|
invoke-virtual {v1, p1, v2}, Lcom/google/common/collect/ImmutableList;->subList(II)Lcom/google/common/collect/ImmutableList;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {v0, p1}, Lcom/google/common/base/Joiner;->join(Ljava/lang/Iterable;)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-static {p1}, Lcom/google/common/net/InternetDomainName;->from(Ljava/lang/String;)Lcom/google/common/net/InternetDomainName;
|
|
|
|
move-result-object p1
|
|
|
|
return-object p1
|
|
.end method
|
|
|
|
.method private findSuffixOfType(Lcom/google/common/base/Optional;)I
|
|
.locals 4
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Lcom/google/common/base/Optional<",
|
|
"Lcom/google/thirdparty/publicsuffix/PublicSuffixType;",
|
|
">;)I"
|
|
}
|
|
.end annotation
|
|
|
|
.line 1
|
|
iget-object v0, p0, Lcom/google/common/net/InternetDomainName;->parts:Lcom/google/common/collect/ImmutableList;
|
|
|
|
invoke-virtual {v0}, Ljava/util/AbstractCollection;->size()I
|
|
|
|
move-result v0
|
|
|
|
const/4 v1, 0x0
|
|
|
|
:goto_0
|
|
if-ge v1, v0, :cond_3
|
|
|
|
.line 2
|
|
sget-object v2, Lcom/google/common/net/InternetDomainName;->DOT_JOINER:Lcom/google/common/base/Joiner;
|
|
|
|
iget-object v3, p0, Lcom/google/common/net/InternetDomainName;->parts:Lcom/google/common/collect/ImmutableList;
|
|
|
|
invoke-virtual {v3, v1, v0}, Lcom/google/common/collect/ImmutableList;->subList(II)Lcom/google/common/collect/ImmutableList;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-virtual {v2, v3}, Lcom/google/common/base/Joiner;->join(Ljava/lang/Iterable;)Ljava/lang/String;
|
|
|
|
move-result-object v2
|
|
|
|
.line 3
|
|
sget-object v3, Lcom/google/thirdparty/publicsuffix/PublicSuffixPatterns;->EXACT:Lcom/google/common/collect/ImmutableMap;
|
|
|
|
.line 4
|
|
invoke-virtual {v3, v2}, Lcom/google/common/collect/ImmutableMap;->get(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object v3
|
|
|
|
check-cast v3, Lcom/google/thirdparty/publicsuffix/PublicSuffixType;
|
|
|
|
invoke-static {v3}, Lcom/google/common/base/Optional;->fromNullable(Ljava/lang/Object;)Lcom/google/common/base/Optional;
|
|
|
|
move-result-object v3
|
|
|
|
.line 5
|
|
invoke-static {p1, v3}, Lcom/google/common/net/InternetDomainName;->matchesType(Lcom/google/common/base/Optional;Lcom/google/common/base/Optional;)Z
|
|
|
|
move-result v3
|
|
|
|
if-eqz v3, :cond_0
|
|
|
|
return v1
|
|
|
|
.line 6
|
|
:cond_0
|
|
sget-object v3, Lcom/google/thirdparty/publicsuffix/PublicSuffixPatterns;->EXCLUDED:Lcom/google/common/collect/ImmutableMap;
|
|
|
|
invoke-virtual {v3, v2}, Lcom/google/common/collect/ImmutableMap;->containsKey(Ljava/lang/Object;)Z
|
|
|
|
move-result v3
|
|
|
|
if-eqz v3, :cond_1
|
|
|
|
add-int/lit8 v1, v1, 0x1
|
|
|
|
return v1
|
|
|
|
.line 7
|
|
:cond_1
|
|
invoke-static {p1, v2}, Lcom/google/common/net/InternetDomainName;->matchesWildcardSuffixType(Lcom/google/common/base/Optional;Ljava/lang/String;)Z
|
|
|
|
move-result v2
|
|
|
|
if-eqz v2, :cond_2
|
|
|
|
return v1
|
|
|
|
:cond_2
|
|
add-int/lit8 v1, v1, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_3
|
|
const/4 p1, -0x1
|
|
|
|
return p1
|
|
.end method
|
|
|
|
.method public static from(Ljava/lang/String;)Lcom/google/common/net/InternetDomainName;
|
|
.locals 1
|
|
|
|
.line 1
|
|
new-instance v0, Lcom/google/common/net/InternetDomainName;
|
|
|
|
invoke-static {p0}, Lcom/google/common/base/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object p0
|
|
|
|
check-cast p0, Ljava/lang/String;
|
|
|
|
invoke-direct {v0, p0}, Lcom/google/common/net/InternetDomainName;-><init>(Ljava/lang/String;)V
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public static isValid(Ljava/lang/String;)Z
|
|
.locals 0
|
|
|
|
.line 1
|
|
:try_start_0
|
|
invoke-static {p0}, Lcom/google/common/net/InternetDomainName;->from(Ljava/lang/String;)Lcom/google/common/net/InternetDomainName;
|
|
:try_end_0
|
|
.catch Ljava/lang/IllegalArgumentException; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
const/4 p0, 0x1
|
|
|
|
return p0
|
|
|
|
:catch_0
|
|
const/4 p0, 0x0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method private static matchesType(Lcom/google/common/base/Optional;Lcom/google/common/base/Optional;)Z
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Lcom/google/common/base/Optional<",
|
|
"Lcom/google/thirdparty/publicsuffix/PublicSuffixType;",
|
|
">;",
|
|
"Lcom/google/common/base/Optional<",
|
|
"Lcom/google/thirdparty/publicsuffix/PublicSuffixType;",
|
|
">;)Z"
|
|
}
|
|
.end annotation
|
|
|
|
.line 1
|
|
invoke-virtual {p0}, Lcom/google/common/base/Optional;->isPresent()Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
invoke-virtual {p0, p1}, Lcom/google/common/base/Optional;->equals(Ljava/lang/Object;)Z
|
|
|
|
move-result p0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
invoke-virtual {p1}, Lcom/google/common/base/Optional;->isPresent()Z
|
|
|
|
move-result p0
|
|
|
|
:goto_0
|
|
return p0
|
|
.end method
|
|
|
|
.method private static matchesWildcardSuffixType(Lcom/google/common/base/Optional;Ljava/lang/String;)Z
|
|
.locals 3
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Lcom/google/common/base/Optional<",
|
|
"Lcom/google/thirdparty/publicsuffix/PublicSuffixType;",
|
|
">;",
|
|
"Ljava/lang/String;",
|
|
")Z"
|
|
}
|
|
.end annotation
|
|
|
|
.line 1
|
|
sget-object v0, Lcom/google/common/net/InternetDomainName;->DOT_SPLITTER:Lcom/google/common/base/Splitter;
|
|
|
|
const/4 v1, 0x2
|
|
|
|
invoke-virtual {v0, v1}, Lcom/google/common/base/Splitter;->limit(I)Lcom/google/common/base/Splitter;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v0, p1}, Lcom/google/common/base/Splitter;->splitToList(Ljava/lang/CharSequence;)Ljava/util/List;
|
|
|
|
move-result-object p1
|
|
|
|
.line 2
|
|
invoke-interface {p1}, Ljava/util/List;->size()I
|
|
|
|
move-result v0
|
|
|
|
const/4 v2, 0x1
|
|
|
|
if-ne v0, v1, :cond_0
|
|
|
|
sget-object v0, Lcom/google/thirdparty/publicsuffix/PublicSuffixPatterns;->UNDER:Lcom/google/common/collect/ImmutableMap;
|
|
|
|
.line 3
|
|
invoke-interface {p1, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {v0, p1}, Lcom/google/common/collect/ImmutableMap;->get(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object p1
|
|
|
|
check-cast p1, Lcom/google/thirdparty/publicsuffix/PublicSuffixType;
|
|
|
|
invoke-static {p1}, Lcom/google/common/base/Optional;->fromNullable(Ljava/lang/Object;)Lcom/google/common/base/Optional;
|
|
|
|
move-result-object p1
|
|
|
|
.line 4
|
|
invoke-static {p0, p1}, Lcom/google/common/net/InternetDomainName;->matchesType(Lcom/google/common/base/Optional;Lcom/google/common/base/Optional;)Z
|
|
|
|
move-result p0
|
|
|
|
if-eqz p0, :cond_0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const/4 v2, 0x0
|
|
|
|
:goto_0
|
|
return v2
|
|
.end method
|
|
|
|
.method private static validatePart(Ljava/lang/String;Z)Z
|
|
.locals 4
|
|
|
|
.line 1
|
|
invoke-virtual {p0}, Ljava/lang/String;->length()I
|
|
|
|
move-result v0
|
|
|
|
const/4 v1, 0x1
|
|
|
|
const/4 v2, 0x0
|
|
|
|
if-lt v0, v1, :cond_4
|
|
|
|
invoke-virtual {p0}, Ljava/lang/String;->length()I
|
|
|
|
move-result v0
|
|
|
|
const/16 v3, 0x3f
|
|
|
|
if-le v0, v3, :cond_0
|
|
|
|
goto :goto_0
|
|
|
|
.line 2
|
|
:cond_0
|
|
invoke-static {}, Lcom/google/common/base/CharMatcher;->ascii()Lcom/google/common/base/CharMatcher;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v0, p0}, Lcom/google/common/base/CharMatcher;->retainFrom(Ljava/lang/CharSequence;)Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
.line 3
|
|
sget-object v3, Lcom/google/common/net/InternetDomainName;->PART_CHAR_MATCHER:Lcom/google/common/base/CharMatcher;
|
|
|
|
invoke-virtual {v3, v0}, Lcom/google/common/base/CharMatcher;->matchesAllOf(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_1
|
|
|
|
return v2
|
|
|
|
.line 4
|
|
:cond_1
|
|
sget-object v0, Lcom/google/common/net/InternetDomainName;->DASH_MATCHER:Lcom/google/common/base/CharMatcher;
|
|
|
|
invoke-virtual {p0, v2}, Ljava/lang/String;->charAt(I)C
|
|
|
|
move-result v3
|
|
|
|
invoke-virtual {v0, v3}, Lcom/google/common/base/CharMatcher;->matches(C)Z
|
|
|
|
move-result v3
|
|
|
|
if-nez v3, :cond_4
|
|
|
|
.line 5
|
|
invoke-virtual {p0}, Ljava/lang/String;->length()I
|
|
|
|
move-result v3
|
|
|
|
sub-int/2addr v3, v1
|
|
|
|
invoke-virtual {p0, v3}, Ljava/lang/String;->charAt(I)C
|
|
|
|
move-result v3
|
|
|
|
invoke-virtual {v0, v3}, Lcom/google/common/base/CharMatcher;->matches(C)Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_2
|
|
|
|
goto :goto_0
|
|
|
|
:cond_2
|
|
if-eqz p1, :cond_3
|
|
|
|
.line 6
|
|
sget-object p1, Lcom/google/common/net/InternetDomainName;->DIGIT_MATCHER:Lcom/google/common/base/CharMatcher;
|
|
|
|
invoke-virtual {p0, v2}, Ljava/lang/String;->charAt(I)C
|
|
|
|
move-result p0
|
|
|
|
invoke-virtual {p1, p0}, Lcom/google/common/base/CharMatcher;->matches(C)Z
|
|
|
|
move-result p0
|
|
|
|
if-eqz p0, :cond_3
|
|
|
|
return v2
|
|
|
|
:cond_3
|
|
return v1
|
|
|
|
:cond_4
|
|
:goto_0
|
|
return v2
|
|
.end method
|
|
|
|
.method private static validateSyntax(Ljava/util/List;)Z
|
|
.locals 5
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/util/List<",
|
|
"Ljava/lang/String;",
|
|
">;)Z"
|
|
}
|
|
.end annotation
|
|
|
|
.line 1
|
|
invoke-interface {p0}, Ljava/util/List;->size()I
|
|
|
|
move-result v0
|
|
|
|
const/4 v1, 0x1
|
|
|
|
sub-int/2addr v0, v1
|
|
|
|
.line 2
|
|
invoke-interface {p0, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;
|
|
|
|
move-result-object v2
|
|
|
|
check-cast v2, Ljava/lang/String;
|
|
|
|
invoke-static {v2, v1}, Lcom/google/common/net/InternetDomainName;->validatePart(Ljava/lang/String;Z)Z
|
|
|
|
move-result v2
|
|
|
|
const/4 v3, 0x0
|
|
|
|
if-nez v2, :cond_0
|
|
|
|
return v3
|
|
|
|
:cond_0
|
|
move v2, v3
|
|
|
|
:goto_0
|
|
if-ge v2, v0, :cond_2
|
|
|
|
.line 3
|
|
invoke-interface {p0, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;
|
|
|
|
move-result-object v4
|
|
|
|
check-cast v4, Ljava/lang/String;
|
|
|
|
.line 4
|
|
invoke-static {v4, v3}, Lcom/google/common/net/InternetDomainName;->validatePart(Ljava/lang/String;Z)Z
|
|
|
|
move-result v4
|
|
|
|
if-nez v4, :cond_1
|
|
|
|
return v3
|
|
|
|
:cond_1
|
|
add-int/lit8 v2, v2, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_2
|
|
return v1
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public child(Ljava/lang/String;)Lcom/google/common/net/InternetDomainName;
|
|
.locals 3
|
|
|
|
.line 1
|
|
invoke-static {p1}, Lcom/google/common/base/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object p1
|
|
|
|
check-cast p1, Ljava/lang/String;
|
|
|
|
iget-object v0, p0, Lcom/google/common/net/InternetDomainName;->name:Ljava/lang/String;
|
|
|
|
const/4 v1, 0x1
|
|
|
|
invoke-static {p1, v1}, Lcom/android/billingclient/api/d;->a(Ljava/lang/String;I)I
|
|
|
|
move-result v1
|
|
|
|
invoke-static {v0, v1}, Lcom/android/billingclient/api/d;->a(Ljava/lang/String;I)I
|
|
|
|
move-result v1
|
|
|
|
new-instance v2, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v2, v1}, Ljava/lang/StringBuilder;-><init>(I)V
|
|
|
|
invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
const-string p1, "."
|
|
|
|
invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-static {p1}, Lcom/google/common/net/InternetDomainName;->from(Ljava/lang/String;)Lcom/google/common/net/InternetDomainName;
|
|
|
|
move-result-object p1
|
|
|
|
return-object p1
|
|
.end method
|
|
|
|
.method public equals(Ljava/lang/Object;)Z
|
|
.locals 1
|
|
.param p1 # Ljava/lang/Object;
|
|
.annotation runtime Ljavax/annotation/CheckForNull;
|
|
.end annotation
|
|
.end param
|
|
|
|
if-ne p1, p0, :cond_0
|
|
|
|
const/4 p1, 0x1
|
|
|
|
return p1
|
|
|
|
.line 1
|
|
:cond_0
|
|
instance-of v0, p1, Lcom/google/common/net/InternetDomainName;
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
.line 2
|
|
check-cast p1, Lcom/google/common/net/InternetDomainName;
|
|
|
|
.line 3
|
|
iget-object v0, p0, Lcom/google/common/net/InternetDomainName;->name:Ljava/lang/String;
|
|
|
|
iget-object p1, p1, Lcom/google/common/net/InternetDomainName;->name:Ljava/lang/String;
|
|
|
|
invoke-virtual {v0, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
|
|
|
move-result p1
|
|
|
|
return p1
|
|
|
|
:cond_1
|
|
const/4 p1, 0x0
|
|
|
|
return p1
|
|
.end method
|
|
|
|
.method public hasParent()Z
|
|
.locals 2
|
|
|
|
.line 1
|
|
iget-object v0, p0, Lcom/google/common/net/InternetDomainName;->parts:Lcom/google/common/collect/ImmutableList;
|
|
|
|
invoke-virtual {v0}, Ljava/util/AbstractCollection;->size()I
|
|
|
|
move-result v0
|
|
|
|
const/4 v1, 0x1
|
|
|
|
if-le v0, v1, :cond_0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const/4 v1, 0x0
|
|
|
|
:goto_0
|
|
return v1
|
|
.end method
|
|
|
|
.method public hasPublicSuffix()Z
|
|
.locals 2
|
|
|
|
.line 1
|
|
iget v0, p0, Lcom/google/common/net/InternetDomainName;->publicSuffixIndex:I
|
|
|
|
const/4 v1, -0x1
|
|
|
|
if-eq v0, v1, :cond_0
|
|
|
|
const/4 v0, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const/4 v0, 0x0
|
|
|
|
:goto_0
|
|
return v0
|
|
.end method
|
|
|
|
.method public hasRegistrySuffix()Z
|
|
.locals 2
|
|
|
|
.line 1
|
|
iget v0, p0, Lcom/google/common/net/InternetDomainName;->registrySuffixIndex:I
|
|
|
|
const/4 v1, -0x1
|
|
|
|
if-eq v0, v1, :cond_0
|
|
|
|
const/4 v0, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const/4 v0, 0x0
|
|
|
|
:goto_0
|
|
return v0
|
|
.end method
|
|
|
|
.method public hashCode()I
|
|
.locals 1
|
|
|
|
.line 1
|
|
iget-object v0, p0, Lcom/google/common/net/InternetDomainName;->name:Ljava/lang/String;
|
|
|
|
invoke-virtual {v0}, Ljava/lang/String;->hashCode()I
|
|
|
|
move-result v0
|
|
|
|
return v0
|
|
.end method
|
|
|
|
.method public isPublicSuffix()Z
|
|
.locals 1
|
|
|
|
.line 1
|
|
iget v0, p0, Lcom/google/common/net/InternetDomainName;->publicSuffixIndex:I
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
const/4 v0, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const/4 v0, 0x0
|
|
|
|
:goto_0
|
|
return v0
|
|
.end method
|
|
|
|
.method public isRegistrySuffix()Z
|
|
.locals 1
|
|
|
|
.line 1
|
|
iget v0, p0, Lcom/google/common/net/InternetDomainName;->registrySuffixIndex:I
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
const/4 v0, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const/4 v0, 0x0
|
|
|
|
:goto_0
|
|
return v0
|
|
.end method
|
|
|
|
.method public isTopDomainUnderRegistrySuffix()Z
|
|
.locals 2
|
|
|
|
.line 1
|
|
iget v0, p0, Lcom/google/common/net/InternetDomainName;->registrySuffixIndex:I
|
|
|
|
const/4 v1, 0x1
|
|
|
|
if-ne v0, v1, :cond_0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const/4 v1, 0x0
|
|
|
|
:goto_0
|
|
return v1
|
|
.end method
|
|
|
|
.method public isTopPrivateDomain()Z
|
|
.locals 2
|
|
|
|
.line 1
|
|
iget v0, p0, Lcom/google/common/net/InternetDomainName;->publicSuffixIndex:I
|
|
|
|
const/4 v1, 0x1
|
|
|
|
if-ne v0, v1, :cond_0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const/4 v1, 0x0
|
|
|
|
:goto_0
|
|
return v1
|
|
.end method
|
|
|
|
.method public isUnderPublicSuffix()Z
|
|
.locals 1
|
|
|
|
.line 1
|
|
iget v0, p0, Lcom/google/common/net/InternetDomainName;->publicSuffixIndex:I
|
|
|
|
if-lez v0, :cond_0
|
|
|
|
const/4 v0, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const/4 v0, 0x0
|
|
|
|
:goto_0
|
|
return v0
|
|
.end method
|
|
|
|
.method public isUnderRegistrySuffix()Z
|
|
.locals 1
|
|
|
|
.line 1
|
|
iget v0, p0, Lcom/google/common/net/InternetDomainName;->registrySuffixIndex:I
|
|
|
|
if-lez v0, :cond_0
|
|
|
|
const/4 v0, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const/4 v0, 0x0
|
|
|
|
:goto_0
|
|
return v0
|
|
.end method
|
|
|
|
.method public parent()Lcom/google/common/net/InternetDomainName;
|
|
.locals 3
|
|
|
|
.line 1
|
|
invoke-virtual {p0}, Lcom/google/common/net/InternetDomainName;->hasParent()Z
|
|
|
|
move-result v0
|
|
|
|
iget-object v1, p0, Lcom/google/common/net/InternetDomainName;->name:Ljava/lang/String;
|
|
|
|
const-string v2, "Domain \'%s\' has no parent"
|
|
|
|
invoke-static {v0, v2, v1}, Lcom/google/common/base/Preconditions;->checkState(ZLjava/lang/String;Ljava/lang/Object;)V
|
|
|
|
const/4 v0, 0x1
|
|
|
|
.line 2
|
|
invoke-direct {p0, v0}, Lcom/google/common/net/InternetDomainName;->ancestor(I)Lcom/google/common/net/InternetDomainName;
|
|
|
|
move-result-object v0
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public parts()Lcom/google/common/collect/ImmutableList;
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"()",
|
|
"Lcom/google/common/collect/ImmutableList<",
|
|
"Ljava/lang/String;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
.line 1
|
|
iget-object v0, p0, Lcom/google/common/net/InternetDomainName;->parts:Lcom/google/common/collect/ImmutableList;
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public publicSuffix()Lcom/google/common/net/InternetDomainName;
|
|
.locals 1
|
|
.annotation runtime Ljavax/annotation/CheckForNull;
|
|
.end annotation
|
|
|
|
.line 1
|
|
invoke-virtual {p0}, Lcom/google/common/net/InternetDomainName;->hasPublicSuffix()Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
iget v0, p0, Lcom/google/common/net/InternetDomainName;->publicSuffixIndex:I
|
|
|
|
invoke-direct {p0, v0}, Lcom/google/common/net/InternetDomainName;->ancestor(I)Lcom/google/common/net/InternetDomainName;
|
|
|
|
move-result-object v0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const/4 v0, 0x0
|
|
|
|
:goto_0
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public registrySuffix()Lcom/google/common/net/InternetDomainName;
|
|
.locals 1
|
|
.annotation runtime Ljavax/annotation/CheckForNull;
|
|
.end annotation
|
|
|
|
.line 1
|
|
invoke-virtual {p0}, Lcom/google/common/net/InternetDomainName;->hasRegistrySuffix()Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
iget v0, p0, Lcom/google/common/net/InternetDomainName;->registrySuffixIndex:I
|
|
|
|
invoke-direct {p0, v0}, Lcom/google/common/net/InternetDomainName;->ancestor(I)Lcom/google/common/net/InternetDomainName;
|
|
|
|
move-result-object v0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const/4 v0, 0x0
|
|
|
|
:goto_0
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public toString()Ljava/lang/String;
|
|
.locals 1
|
|
|
|
.line 1
|
|
iget-object v0, p0, Lcom/google/common/net/InternetDomainName;->name:Ljava/lang/String;
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public topDomainUnderRegistrySuffix()Lcom/google/common/net/InternetDomainName;
|
|
.locals 3
|
|
|
|
.line 1
|
|
invoke-virtual {p0}, Lcom/google/common/net/InternetDomainName;->isTopDomainUnderRegistrySuffix()Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
return-object p0
|
|
|
|
.line 2
|
|
:cond_0
|
|
invoke-virtual {p0}, Lcom/google/common/net/InternetDomainName;->isUnderRegistrySuffix()Z
|
|
|
|
move-result v0
|
|
|
|
iget-object v1, p0, Lcom/google/common/net/InternetDomainName;->name:Ljava/lang/String;
|
|
|
|
const-string v2, "Not under a registry suffix: %s"
|
|
|
|
invoke-static {v0, v2, v1}, Lcom/google/common/base/Preconditions;->checkState(ZLjava/lang/String;Ljava/lang/Object;)V
|
|
|
|
.line 3
|
|
iget v0, p0, Lcom/google/common/net/InternetDomainName;->registrySuffixIndex:I
|
|
|
|
add-int/lit8 v0, v0, -0x1
|
|
|
|
invoke-direct {p0, v0}, Lcom/google/common/net/InternetDomainName;->ancestor(I)Lcom/google/common/net/InternetDomainName;
|
|
|
|
move-result-object v0
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public topPrivateDomain()Lcom/google/common/net/InternetDomainName;
|
|
.locals 3
|
|
|
|
.line 1
|
|
invoke-virtual {p0}, Lcom/google/common/net/InternetDomainName;->isTopPrivateDomain()Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
return-object p0
|
|
|
|
.line 2
|
|
:cond_0
|
|
invoke-virtual {p0}, Lcom/google/common/net/InternetDomainName;->isUnderPublicSuffix()Z
|
|
|
|
move-result v0
|
|
|
|
iget-object v1, p0, Lcom/google/common/net/InternetDomainName;->name:Ljava/lang/String;
|
|
|
|
const-string v2, "Not under a public suffix: %s"
|
|
|
|
invoke-static {v0, v2, v1}, Lcom/google/common/base/Preconditions;->checkState(ZLjava/lang/String;Ljava/lang/Object;)V
|
|
|
|
.line 3
|
|
iget v0, p0, Lcom/google/common/net/InternetDomainName;->publicSuffixIndex:I
|
|
|
|
add-int/lit8 v0, v0, -0x1
|
|
|
|
invoke-direct {p0, v0}, Lcom/google/common/net/InternetDomainName;->ancestor(I)Lcom/google/common/net/InternetDomainName;
|
|
|
|
move-result-object v0
|
|
|
|
return-object v0
|
|
.end method
|