MCPcopy Create free account
hub / github.com/M66B/FairEmail / getRootDomain

Method getRootDomain

app/src/main/java/eu/faircode/email/UriHelper.java:123–140  ·  view source on GitHub ↗
(Context context, String host)

Source from the content-addressed store, hash-verified

121 }
122
123 static String getRootDomain(Context context, String host) {
124 if (host == null)
125 return null;
126 String tld = getTld(context, host);
127 if (tld == null)
128 return null;
129 if (tld.equalsIgnoreCase(host))
130 return null;
131 int len = host.length() - tld.length() - 1;
132 if (len < 0) {
133 Log.e("getRootDomain host=" + host + " tld=" + tld);
134 return null;
135 }
136 int dot = host.substring(0, len).lastIndexOf('.');
137 if (dot < 0)
138 return host;
139 return host.substring(dot + 1);
140 }
141
142 static boolean isTld(Context context, String host) {
143 if (host == null)

Callers 12

getMethod · 0.95
onExecuteMethod · 0.95
onExecuteMethod · 0.95
testMethod · 0.95
matchKeywordsMethod · 0.95
callMethod · 0.95
bindAddressesMethod · 0.95
onShowAuthMethod · 0.95
fromEmailMethod · 0.95
isAlignedMethod · 0.95
equalRootDomainMethod · 0.95
onExecuteMethod · 0.95

Calls 3

getTldMethod · 0.95
eMethod · 0.95
lengthMethod · 0.45

Tested by

no test coverage detected