(Context context, @NonNull String host)
| 151 | } |
| 152 | |
| 153 | static String getTld(Context context, @NonNull String host) { |
| 154 | ensureSuffixList(context); |
| 155 | |
| 156 | String eval = host.toLowerCase(Locale.ROOT); |
| 157 | while (true) { |
| 158 | int d = eval.indexOf('.'); |
| 159 | String w = (d < 0 ? null : '*' + eval.substring(d)); |
| 160 | |
| 161 | synchronized (suffixList) { |
| 162 | if (suffixList.contains(eval)) |
| 163 | return eval; |
| 164 | if (suffixList.contains(w)) |
| 165 | if (suffixList.contains('!' + eval)) |
| 166 | return eval.substring(d + 1); |
| 167 | else |
| 168 | return eval; |
| 169 | } |
| 170 | |
| 171 | int dot = eval.indexOf('.'); |
| 172 | if (dot < 0) |
| 173 | return null; |
| 174 | |
| 175 | eval = eval.substring(dot + 1); |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | static String getEmailUser(String address) { |
| 180 | if (address == null) |
no test coverage detected