001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.commons.validator.routines;
018
019import java.io.Serializable;
020import java.net.IDN;
021import java.util.Arrays;
022import java.util.Locale;
023
024/**
025 * <p><b>Domain name</b> validation routines.</p>
026 *
027 * <p>
028 * This validator provides methods for validating Internet domain names
029 * and top-level domains.
030 * </p>
031 *
032 * <p>Domain names are evaluated according
033 * to the standards <a href="http://www.ietf.org/rfc/rfc1034.txt">RFC1034</a>,
034 * section 3, and <a href="http://www.ietf.org/rfc/rfc1123.txt">RFC1123</a>,
035 * section 2.1. No accommodation is provided for the specialized needs of
036 * other applications; if the domain name has been URL-encoded, for example,
037 * validation will fail even though the equivalent plaintext version of the
038 * same name would have passed.
039 * </p>
040 *
041 * <p>
042 * Validation is also provided for top-level domains (TLDs) as defined and
043 * maintained by the Internet Assigned Numbers Authority (IANA):
044 * </p>
045 *
046 *   <ul>
047 *     <li>{@link #isValidInfrastructureTld} - validates infrastructure TLDs
048 *         (<code>.arpa</code>, etc.)</li>
049 *     <li>{@link #isValidGenericTld} - validates generic TLDs
050 *         (<code>.com, .org</code>, etc.)</li>
051 *     <li>{@link #isValidCountryCodeTld} - validates country code TLDs
052 *         (<code>.us, .uk, .cn</code>, etc.)</li>
053 *   </ul>
054 *
055 * <p>
056 * (<b>NOTE</b>: This class does not provide IP address lookup for domain names or
057 * methods to ensure that a given domain name matches a specific IP; see
058 * {@link java.net.InetAddress} for that functionality.)
059 * </p>
060 *
061 * @version $Revision: 1713225 $
062 * @since Validator 1.4
063 */
064public class DomainValidator implements Serializable {
065
066    private static final String[] EMPTY_STRING_ARRAY = new String[0];
067
068    private static final long serialVersionUID = -4407125112880174009L;
069
070    // Regular expression strings for hostnames (derived from RFC2396 and RFC 1123)
071
072    // RFC2396: domainlabel   = alphanum | alphanum *( alphanum | "-" ) alphanum
073    // Max 63 characters
074    private static final String DOMAIN_LABEL_REGEX = "\\p{Alnum}(?>[\\p{Alnum}-]{0,61}\\p{Alnum})?";
075
076    // RFC2396 toplabel = alpha | alpha *( alphanum | "-" ) alphanum
077    // Max 63 characters
078    private static final String TOP_LABEL_REGEX = "\\p{Alpha}(?>[\\p{Alnum}-]{0,61}\\p{Alnum})?";
079
080    // RFC2396 hostname = *( domainlabel "." ) toplabel [ "." ]
081    // Note that the regex currently requires both a domain label and a top level label, whereas
082    // the RFC does not. This is because the regex is used to detect if a TLD is present.
083    // If the match fails, input is checked against DOMAIN_LABEL_REGEX (hostnameRegex)
084    // RFC1123 sec 2.1 allows hostnames to start with a digit
085    private static final String DOMAIN_NAME_REGEX =
086            "^(?:" + DOMAIN_LABEL_REGEX + "\\.)+" + "(" + TOP_LABEL_REGEX + ")\\.?$";
087
088    private final boolean allowLocal;
089
090    /**
091     * Singleton instance of this validator, which
092     *  doesn't consider local addresses as valid.
093     */
094    private static final DomainValidator DOMAIN_VALIDATOR = new DomainValidator(false);
095
096    /**
097     * Singleton instance of this validator, which does
098     *  consider local addresses valid.
099     */
100    private static final DomainValidator DOMAIN_VALIDATOR_WITH_LOCAL = new DomainValidator(true);
101
102    /**
103     * RegexValidator for matching domains.
104     */
105    private final RegexValidator domainRegex =
106            new RegexValidator(DOMAIN_NAME_REGEX);
107    /**
108     * RegexValidator for matching a local hostname
109     */
110    // RFC1123 sec 2.1 allows hostnames to start with a digit
111    private final RegexValidator hostnameRegex =
112            new RegexValidator(DOMAIN_LABEL_REGEX);
113
114    /**
115     * Returns the singleton instance of this validator. It
116     *  will not consider local addresses as valid.
117     * @return the singleton instance of this validator
118     */
119    public static synchronized DomainValidator getInstance() {
120        inUse = true;
121        return DOMAIN_VALIDATOR;
122    }
123
124    /**
125     * Returns the singleton instance of this validator,
126     *  with local validation as required.
127     * @param allowLocal Should local addresses be considered valid?
128     * @return the singleton instance of this validator
129     */
130    public static synchronized DomainValidator getInstance(boolean allowLocal) {
131        inUse = true;
132       if(allowLocal) {
133          return DOMAIN_VALIDATOR_WITH_LOCAL;
134       }
135       return DOMAIN_VALIDATOR;
136    }
137
138    /** Private constructor. */
139    private DomainValidator(boolean allowLocal) {
140       this.allowLocal = allowLocal;
141    }
142
143    /**
144     * Returns true if the specified <code>String</code> parses
145     * as a valid domain name with a recognized top-level domain.
146     * The parsing is case-insensitive.
147     * @param domain the parameter to check for domain name syntax
148     * @return true if the parameter is a valid domain name
149     */
150    public boolean isValid(String domain) {
151        if (domain == null) {
152            return false;
153        }
154        domain = unicodeToASCII(domain);
155        // hosts must be equally reachable via punycode and Unicode;
156        // Unicode is never shorter than punycode, so check punycode
157        // if domain did not convert, then it will be caught by ASCII
158        // checks in the regexes below
159        if (domain.length() > 253) {
160            return false;
161        }
162        String[] groups = domainRegex.match(domain);
163        if (groups != null && groups.length > 0) {
164            return isValidTld(groups[0]);
165        }
166        return allowLocal && hostnameRegex.isValid(domain);
167    }
168
169    // package protected for unit test access
170    // must agree with isValid() above
171    final boolean isValidDomainSyntax(String domain) {
172        if (domain == null) {
173            return false;
174        }
175        domain = unicodeToASCII(domain);
176        // hosts must be equally reachable via punycode and Unicode;
177        // Unicode is never shorter than punycode, so check punycode
178        // if domain did not convert, then it will be caught by ASCII
179        // checks in the regexes below
180        if (domain.length() > 253) {
181            return false;
182        }
183        String[] groups = domainRegex.match(domain);
184        return (groups != null && groups.length > 0)
185                || hostnameRegex.isValid(domain);
186    }
187
188    /**
189     * Returns true if the specified <code>String</code> matches any
190     * IANA-defined top-level domain. Leading dots are ignored if present.
191     * The search is case-insensitive.
192     * @param tld the parameter to check for TLD status, not null
193     * @return true if the parameter is a TLD
194     */
195    public boolean isValidTld(String tld) {
196        tld = unicodeToASCII(tld);
197        if(allowLocal && isValidLocalTld(tld)) {
198           return true;
199        }
200        return isValidInfrastructureTld(tld)
201                || isValidGenericTld(tld)
202                || isValidCountryCodeTld(tld);
203    }
204
205    /**
206     * Returns true if the specified <code>String</code> matches any
207     * IANA-defined infrastructure top-level domain. Leading dots are
208     * ignored if present. The search is case-insensitive.
209     * @param iTld the parameter to check for infrastructure TLD status, not null
210     * @return true if the parameter is an infrastructure TLD
211     */
212    public boolean isValidInfrastructureTld(String iTld) {
213        final String key = chompLeadingDot(unicodeToASCII(iTld).toLowerCase(Locale.ENGLISH));
214        return arrayContains(INFRASTRUCTURE_TLDS, key);
215    }
216
217    /**
218     * Returns true if the specified <code>String</code> matches any
219     * IANA-defined generic top-level domain. Leading dots are ignored
220     * if present. The search is case-insensitive.
221     * @param gTld the parameter to check for generic TLD status, not null
222     * @return true if the parameter is a generic TLD
223     */
224    public boolean isValidGenericTld(String gTld) {
225        final String key = chompLeadingDot(unicodeToASCII(gTld).toLowerCase(Locale.ENGLISH));
226        return (arrayContains(GENERIC_TLDS, key) || arrayContains(GENERIC_TLDS_PLUS, key))
227                && !arrayContains(GENERIC_TLDS_MINUS, key);
228    }
229
230    /**
231     * Returns true if the specified <code>String</code> matches any
232     * IANA-defined country code top-level domain. Leading dots are
233     * ignored if present. The search is case-insensitive.
234     * @param ccTld the parameter to check for country code TLD status, not null
235     * @return true if the parameter is a country code TLD
236     */
237    public boolean isValidCountryCodeTld(String ccTld) {
238        final String key = chompLeadingDot(unicodeToASCII(ccTld).toLowerCase(Locale.ENGLISH));
239        return (arrayContains(COUNTRY_CODE_TLDS, key) || arrayContains(COUNTRY_CODE_TLDS_PLUS, key))
240                && !arrayContains(COUNTRY_CODE_TLDS_MINUS, key);
241    }
242
243    /**
244     * Returns true if the specified <code>String</code> matches any
245     * widely used "local" domains (localhost or localdomain). Leading dots are
246     * ignored if present. The search is case-insensitive.
247     * @param lTld the parameter to check for local TLD status, not null
248     * @return true if the parameter is an local TLD
249     */
250    public boolean isValidLocalTld(String lTld) {
251        final String key = chompLeadingDot(unicodeToASCII(lTld).toLowerCase(Locale.ENGLISH));
252        return arrayContains(LOCAL_TLDS, key);
253    }
254
255    private String chompLeadingDot(String str) {
256        if (str.startsWith(".")) {
257            return str.substring(1);
258        }
259        return str;
260    }
261
262    // ---------------------------------------------
263    // ----- TLDs defined by IANA
264    // ----- Authoritative and comprehensive list at:
265    // ----- http://data.iana.org/TLD/tlds-alpha-by-domain.txt
266
267    // Note that the above list is in UPPER case.
268    // The code currently converts strings to lower case (as per the tables below)
269
270    // IANA also provide an HTML list at http://www.iana.org/domains/root/db
271    // Note that this contains several country code entries which are NOT in
272    // the text file. These all have the "Not assigned" in the "Sponsoring Organisation" column
273    // For example (as of 2015-01-02):
274    // .bl  country-code    Not assigned
275    // .um  country-code    Not assigned
276
277    // WARNING: this array MUST be sorted, otherwise it cannot be searched reliably using binary search
278    private static final String[] INFRASTRUCTURE_TLDS = new String[] {
279        "arpa",               // internet infrastructure
280    };
281
282    // WARNING: this array MUST be sorted, otherwise it cannot be searched reliably using binary search
283    private static final String[] GENERIC_TLDS = new String[] {
284        // Taken from Version 2015082801, Last Updated Sat Aug 29 07:07:01 2015 UTC
285        "aaa", // aaa American Automobile Association, Inc.
286        "aarp", // aarp AARP
287        "abb", // abb ABB Ltd
288        "abbott", // abbott Abbott Laboratories, Inc.
289        "abogado", // abogado Top Level Domain Holdings Limited
290        "academy", // academy Half Oaks, LLC
291        "accenture", // accenture Accenture plc
292        "accountant", // accountant dot Accountant Limited
293        "accountants", // accountants Knob Town, LLC
294        "aco", // aco ACO Severin Ahlmann GmbH &amp; Co. KG
295        "active", // active The Active Network, Inc
296        "actor", // actor United TLD Holdco Ltd.
297        "ads", // ads Charleston Road Registry Inc.
298        "adult", // adult ICM Registry AD LLC
299        "aeg", // aeg Aktiebolaget Electrolux
300        "aero", // aero Societe Internationale de Telecommunications Aeronautique (SITA INC USA)
301        "afl", // afl Australian Football League
302        "agency", // agency Steel Falls, LLC
303        "aig", // aig American International Group, Inc.
304        "airforce", // airforce United TLD Holdco Ltd.
305        "airtel", // airtel Bharti Airtel Limited
306        "allfinanz", // allfinanz Allfinanz Deutsche Vermögensberatung Aktiengesellschaft
307        "alsace", // alsace REGION D ALSACE
308        "amica", // amica Amica Mutual Insurance Company
309        "amsterdam", // amsterdam Gemeente Amsterdam
310        "android", // android Charleston Road Registry Inc.
311        "apartments", // apartments June Maple, LLC
312        "app", // app Charleston Road Registry Inc.
313        "apple", // apple Apple Inc.
314        "aquarelle", // aquarelle Aquarelle.com
315        "aramco", // aramco Aramco Services Company
316        "archi", // archi STARTING DOT LIMITED
317        "army", // army United TLD Holdco Ltd.
318        "arte", // arte Association Relative à la Télévision Européenne G.E.I.E.
319        "asia", // asia DotAsia Organisation Ltd.
320        "associates", // associates Baxter Hill, LLC
321        "attorney", // attorney United TLD Holdco, Ltd
322        "auction", // auction United TLD HoldCo, Ltd.
323        "audio", // audio Uniregistry, Corp.
324        "auto", // auto Uniregistry, Corp.
325        "autos", // autos DERAutos, LLC
326        "axa", // axa AXA SA
327        "azure", // azure Microsoft Corporation
328        "band", // band United TLD Holdco, Ltd
329        "bank", // bank fTLD Registry Services, LLC
330        "bar", // bar Punto 2012 Sociedad Anonima Promotora de Inversion de Capital Variable
331        "barcelona", // barcelona Municipi de Barcelona
332        "barclaycard", // barclaycard Barclays Bank PLC
333        "barclays", // barclays Barclays Bank PLC
334        "bargains", // bargains Half Hallow, LLC
335        "bauhaus", // bauhaus Werkhaus GmbH
336        "bayern", // bayern Bayern Connect GmbH
337        "bbc", // bbc British Broadcasting Corporation
338        "bbva", // bbva BANCO BILBAO VIZCAYA ARGENTARIA, S.A.
339        "bcn", // bcn Municipi de Barcelona
340        "beats", // beats Beats Electronics, LLC
341        "beer", // beer Top Level Domain Holdings Limited
342        "bentley", // bentley Bentley Motors Limited
343        "berlin", // berlin dotBERLIN GmbH &amp; Co. KG
344        "best", // best BestTLD Pty Ltd
345        "bet", // bet Afilias plc
346        "bharti", // bharti Bharti Enterprises (Holding) Private Limited
347        "bible", // bible American Bible Society
348        "bid", // bid dot Bid Limited
349        "bike", // bike Grand Hollow, LLC
350        "bing", // bing Microsoft Corporation
351        "bingo", // bingo Sand Cedar, LLC
352        "bio", // bio STARTING DOT LIMITED
353        "biz", // biz Neustar, Inc.
354        "black", // black Afilias Limited
355        "blackfriday", // blackfriday Uniregistry, Corp.
356        "bloomberg", // bloomberg Bloomberg IP Holdings LLC
357        "blue", // blue Afilias Limited
358        "bms", // bms Bristol-Myers Squibb Company
359        "bmw", // bmw Bayerische Motoren Werke Aktiengesellschaft
360        "bnl", // bnl Banca Nazionale del Lavoro
361        "bnpparibas", // bnpparibas BNP Paribas
362        "boats", // boats DERBoats, LLC
363        "bom", // bom Núcleo de Informação e Coordenação do Ponto BR - NIC.br
364        "bond", // bond Bond University Limited
365        "boo", // boo Charleston Road Registry Inc.
366        "boots", // boots THE BOOTS COMPANY PLC
367        "boutique", // boutique Over Galley, LLC
368        "bradesco", // bradesco Banco Bradesco S.A.
369        "bridgestone", // bridgestone Bridgestone Corporation
370        "broker", // broker DOTBROKER REGISTRY LTD
371        "brother", // brother Brother Industries, Ltd.
372        "brussels", // brussels DNS.be vzw
373        "budapest", // budapest Top Level Domain Holdings Limited
374        "build", // build Plan Bee LLC
375        "builders", // builders Atomic Madison, LLC
376        "business", // business Spring Cross, LLC
377        "buzz", // buzz DOTSTRATEGY CO.
378        "bzh", // bzh Association www.bzh
379        "cab", // cab Half Sunset, LLC
380        "cafe", // cafe Pioneer Canyon, LLC
381        "cal", // cal Charleston Road Registry Inc.
382        "camera", // camera Atomic Maple, LLC
383        "camp", // camp Delta Dynamite, LLC
384        "cancerresearch", // cancerresearch Australian Cancer Research Foundation
385        "canon", // canon Canon Inc.
386        "capetown", // capetown ZA Central Registry NPC trading as ZA Central Registry
387        "capital", // capital Delta Mill, LLC
388        "car", // car Cars Registry Limited
389        "caravan", // caravan Caravan International, Inc.
390        "cards", // cards Foggy Hollow, LLC
391        "care", // care Goose Cross, LLC
392        "career", // career dotCareer LLC
393        "careers", // careers Wild Corner, LLC
394        "cars", // cars Uniregistry, Corp.
395        "cartier", // cartier Richemont DNS Inc.
396        "casa", // casa Top Level Domain Holdings Limited
397        "cash", // cash Delta Lake, LLC
398        "casino", // casino Binky Sky, LLC
399        "cat", // cat Fundacio puntCAT
400        "catering", // catering New Falls. LLC
401        "cba", // cba COMMONWEALTH BANK OF AUSTRALIA
402        "cbn", // cbn The Christian Broadcasting Network, Inc.
403        "ceb", // ceb The Corporate Executive Board Company
404        "center", // center Tin Mill, LLC
405        "ceo", // ceo CEOTLD Pty Ltd
406        "cern", // cern European Organization for Nuclear Research (&quot;CERN&quot;)
407        "cfa", // cfa CFA Institute
408        "cfd", // cfd DOTCFD REGISTRY LTD
409        "chanel", // chanel Chanel International B.V.
410        "channel", // channel Charleston Road Registry Inc.
411        "chat", // chat Sand Fields, LLC
412        "cheap", // cheap Sand Cover, LLC
413        "chloe", // chloe Richemont DNS Inc.
414        "christmas", // christmas Uniregistry, Corp.
415        "chrome", // chrome Charleston Road Registry Inc.
416        "church", // church Holly Fileds, LLC
417        "cipriani", // cipriani Hotel Cipriani Srl
418        "cisco", // cisco Cisco Technology, Inc.
419        "citic", // citic CITIC Group Corporation
420        "city", // city Snow Sky, LLC
421        "claims", // claims Black Corner, LLC
422        "cleaning", // cleaning Fox Shadow, LLC
423        "click", // click Uniregistry, Corp.
424        "clinic", // clinic Goose Park, LLC
425        "clothing", // clothing Steel Lake, LLC
426        "cloud", // cloud ARUBA S.p.A.
427        "club", // club .CLUB DOMAINS, LLC
428        "clubmed", // clubmed Club Méditerranée S.A.
429        "coach", // coach Koko Island, LLC
430        "codes", // codes Puff Willow, LLC
431        "coffee", // coffee Trixy Cover, LLC
432        "college", // college XYZ.COM LLC
433        "cologne", // cologne NetCologne Gesellschaft für Telekommunikation mbH
434        "com", // com VeriSign Global Registry Services
435        "commbank", // commbank COMMONWEALTH BANK OF AUSTRALIA
436        "community", // community Fox Orchard, LLC
437        "company", // company Silver Avenue, LLC
438        "computer", // computer Pine Mill, LLC
439        "condos", // condos Pine House, LLC
440        "construction", // construction Fox Dynamite, LLC
441        "consulting", // consulting United TLD Holdco, LTD.
442        "contractors", // contractors Magic Woods, LLC
443        "cooking", // cooking Top Level Domain Holdings Limited
444        "cool", // cool Koko Lake, LLC
445        "coop", // coop DotCooperation LLC
446        "corsica", // corsica Collectivité Territoriale de Corse
447        "country", // country Top Level Domain Holdings Limited
448        "coupons", // coupons Black Island, LLC
449        "courses", // courses OPEN UNIVERSITIES AUSTRALIA PTY LTD
450        "credit", // credit Snow Shadow, LLC
451        "creditcard", // creditcard Binky Frostbite, LLC
452        "cricket", // cricket dot Cricket Limited
453        "crown", // crown Crown Equipment Corporation
454        "crs", // crs Federated Co-operatives Limited
455        "cruises", // cruises Spring Way, LLC
456        "csc", // csc Alliance-One Services, Inc.
457        "cuisinella", // cuisinella SALM S.A.S.
458        "cymru", // cymru Nominet UK
459        "cyou", // cyou Beijing Gamease Age Digital Technology Co., Ltd.
460        "dabur", // dabur Dabur India Limited
461        "dad", // dad Charleston Road Registry Inc.
462        "dance", // dance United TLD Holdco Ltd.
463        "date", // date dot Date Limited
464        "dating", // dating Pine Fest, LLC
465        "datsun", // datsun NISSAN MOTOR CO., LTD.
466        "day", // day Charleston Road Registry Inc.
467        "dclk", // dclk Charleston Road Registry Inc.
468        "deals", // deals Sand Sunset, LLC
469        "degree", // degree United TLD Holdco, Ltd
470        "delivery", // delivery Steel Station, LLC
471        "dell", // dell Dell Inc.
472        "delta", // delta Delta Air Lines, Inc.
473        "democrat", // democrat United TLD Holdco Ltd.
474        "dental", // dental Tin Birch, LLC
475        "dentist", // dentist United TLD Holdco, Ltd
476        "desi", // desi Desi Networks LLC
477        "design", // design Top Level Design, LLC
478        "dev", // dev Charleston Road Registry Inc.
479        "diamonds", // diamonds John Edge, LLC
480        "diet", // diet Uniregistry, Corp.
481        "digital", // digital Dash Park, LLC
482        "direct", // direct Half Trail, LLC
483        "directory", // directory Extra Madison, LLC
484        "discount", // discount Holly Hill, LLC
485        "dnp", // dnp Dai Nippon Printing Co., Ltd.
486        "docs", // docs Charleston Road Registry Inc.
487        "dog", // dog Koko Mill, LLC
488        "doha", // doha Communications Regulatory Authority (CRA)
489        "domains", // domains Sugar Cross, LLC
490        "doosan", // doosan Doosan Corporation
491        "download", // download dot Support Limited
492        "drive", // drive Charleston Road Registry Inc.
493        "durban", // durban ZA Central Registry NPC trading as ZA Central Registry
494        "dvag", // dvag Deutsche Vermögensberatung Aktiengesellschaft DVAG
495        "earth", // earth Interlink Co., Ltd.
496        "eat", // eat Charleston Road Registry Inc.
497        "edu", // edu EDUCAUSE
498        "education", // education Brice Way, LLC
499        "email", // email Spring Madison, LLC
500        "emerck", // emerck Merck KGaA
501        "energy", // energy Binky Birch, LLC
502        "engineer", // engineer United TLD Holdco Ltd.
503        "engineering", // engineering Romeo Canyon
504        "enterprises", // enterprises Snow Oaks, LLC
505        "epson", // epson Seiko Epson Corporation
506        "equipment", // equipment Corn Station, LLC
507        "erni", // erni ERNI Group Holding AG
508        "esq", // esq Charleston Road Registry Inc.
509        "estate", // estate Trixy Park, LLC
510        "eurovision", // eurovision European Broadcasting Union (EBU)
511        "eus", // eus Puntueus Fundazioa
512        "events", // events Pioneer Maple, LLC
513        "everbank", // everbank EverBank
514        "exchange", // exchange Spring Falls, LLC
515        "expert", // expert Magic Pass, LLC
516        "exposed", // exposed Victor Beach, LLC
517        "express", // express Sea Sunset, LLC
518        "fage", // fage Fage International S.A.
519        "fail", // fail Atomic Pipe, LLC
520        "faith", // faith dot Faith Limited
521        "family", // family United TLD Holdco Ltd.
522        "fan", // fan Asiamix Digital Ltd
523        "fans", // fans Asiamix Digital Limited
524        "farm", // farm Just Maple, LLC
525        "fashion", // fashion Top Level Domain Holdings Limited
526        "feedback", // feedback Top Level Spectrum, Inc.
527        "ferrero", // ferrero Ferrero Trading Lux S.A.
528        "film", // film Motion Picture Domain Registry Pty Ltd
529        "final", // final Núcleo de Informação e Coordenação do Ponto BR - NIC.br
530        "finance", // finance Cotton Cypress, LLC
531        "financial", // financial Just Cover, LLC
532        "firmdale", // firmdale Firmdale Holdings Limited
533        "fish", // fish Fox Woods, LLC
534        "fishing", // fishing Top Level Domain Holdings Limited
535        "fit", // fit Minds + Machines Group Limited
536        "fitness", // fitness Brice Orchard, LLC
537        "flights", // flights Fox Station, LLC
538        "florist", // florist Half Cypress, LLC
539        "flowers", // flowers Uniregistry, Corp.
540        "flsmidth", // flsmidth FLSmidth A/S
541        "fly", // fly Charleston Road Registry Inc.
542        "foo", // foo Charleston Road Registry Inc.
543        "football", // football Foggy Farms, LLC
544        "forex", // forex DOTFOREX REGISTRY LTD
545        "forsale", // forsale United TLD Holdco, LLC
546        "forum", // forum Fegistry, LLC
547        "foundation", // foundation John Dale, LLC
548        "frl", // frl FRLregistry B.V.
549        "frogans", // frogans OP3FT
550        "fund", // fund John Castle, LLC
551        "furniture", // furniture Lone Fields, LLC
552        "futbol", // futbol United TLD Holdco, Ltd.
553        "fyi", // fyi Silver Tigers, LLC
554        "gal", // gal Asociación puntoGAL
555        "gallery", // gallery Sugar House, LLC
556        "game", // game Uniregistry, Corp.
557        "garden", // garden Top Level Domain Holdings Limited
558        "gbiz", // gbiz Charleston Road Registry Inc.
559        "gdn", // gdn Joint Stock Company "Navigation-information systems"
560        "gea", // gea GEA Group Aktiengesellschaft
561        "gent", // gent COMBELL GROUP NV/SA
562        "genting", // genting Resorts World Inc. Pte. Ltd.
563        "ggee", // ggee GMO Internet, Inc.
564        "gift", // gift Uniregistry, Corp.
565        "gifts", // gifts Goose Sky, LLC
566        "gives", // gives United TLD Holdco Ltd.
567        "giving", // giving Giving Limited
568        "glass", // glass Black Cover, LLC
569        "gle", // gle Charleston Road Registry Inc.
570        "global", // global Dot Global Domain Registry Limited
571        "globo", // globo Globo Comunicação e Participações S.A
572        "gmail", // gmail Charleston Road Registry Inc.
573        "gmo", // gmo GMO Internet, Inc.
574        "gmx", // gmx 1&amp;1 Mail &amp; Media GmbH
575        "gold", // gold June Edge, LLC
576        "goldpoint", // goldpoint YODOBASHI CAMERA CO.,LTD.
577        "golf", // golf Lone Falls, LLC
578        "goo", // goo NTT Resonant Inc.
579        "goog", // goog Charleston Road Registry Inc.
580        "google", // google Charleston Road Registry Inc.
581        "gop", // gop Republican State Leadership Committee, Inc.
582        "gov", // gov General Services Administration Attn: QTDC, 2E08 (.gov Domain Registration)
583        "graphics", // graphics Over Madison, LLC
584        "gratis", // gratis Pioneer Tigers, LLC
585        "green", // green Afilias Limited
586        "gripe", // gripe Corn Sunset, LLC
587        "group", // group Romeo Town, LLC
588        "gucci", // gucci Guccio Gucci S.p.a.
589        "guge", // guge Charleston Road Registry Inc.
590        "guide", // guide Snow Moon, LLC
591        "guitars", // guitars Uniregistry, Corp.
592        "guru", // guru Pioneer Cypress, LLC
593        "hamburg", // hamburg Hamburg Top-Level-Domain GmbH
594        "hangout", // hangout Charleston Road Registry Inc.
595        "haus", // haus United TLD Holdco, LTD.
596        "healthcare", // healthcare Silver Glen, LLC
597        "help", // help Uniregistry, Corp.
598        "here", // here Charleston Road Registry Inc.
599        "hermes", // hermes Hermes International
600        "hiphop", // hiphop Uniregistry, Corp.
601        "hitachi", // hitachi Hitachi, Ltd.
602        "hiv", // hiv dotHIV gemeinnuetziger e.V.
603        "hockey", // hockey Half Willow, LLC
604        "holdings", // holdings John Madison, LLC
605        "holiday", // holiday Goose Woods, LLC
606        "homedepot", // homedepot Homer TLC, Inc.
607        "homes", // homes DERHomes, LLC
608        "honda", // honda Honda Motor Co., Ltd.
609        "horse", // horse Top Level Domain Holdings Limited
610        "host", // host DotHost Inc.
611        "hosting", // hosting Uniregistry, Corp.
612        "hoteles", // hoteles Travel Reservations SRL
613        "hotmail", // hotmail Microsoft Corporation
614        "house", // house Sugar Park, LLC
615        "how", // how Charleston Road Registry Inc.
616        "hsbc", // hsbc HSBC Holdings PLC
617        "hyundai", // hyundai Hyundai Motor Company
618        "ibm", // ibm International Business Machines Corporation
619        "icbc", // icbc Industrial and Commercial Bank of China Limited
620        "ice", // ice IntercontinentalExchange, Inc.
621        "icu", // icu One.com A/S
622        "ifm", // ifm ifm electronic gmbh
623        "iinet", // iinet Connect West Pty. Ltd.
624        "immo", // immo Auburn Bloom, LLC
625        "immobilien", // immobilien United TLD Holdco Ltd.
626        "industries", // industries Outer House, LLC
627        "infiniti", // infiniti NISSAN MOTOR CO., LTD.
628        "info", // info Afilias Limited
629        "ing", // ing Charleston Road Registry Inc.
630        "ink", // ink Top Level Design, LLC
631        "institute", // institute Outer Maple, LLC
632        "insure", // insure Pioneer Willow, LLC
633        "int", // int Internet Assigned Numbers Authority
634        "international", // international Wild Way, LLC
635        "investments", // investments Holly Glen, LLC
636        "ipiranga", // ipiranga Ipiranga Produtos de Petroleo S.A.
637        "irish", // irish Dot-Irish LLC
638        "ist", // ist Istanbul Metropolitan Municipality
639        "istanbul", // istanbul Istanbul Metropolitan Municipality / Medya A.S.
640        "itau", // itau Itau Unibanco Holding S.A.
641        "iwc", // iwc Richemont DNS Inc.
642        "jaguar", // jaguar Jaguar Land Rover Ltd
643        "java", // java Oracle Corporation
644        "jcb", // jcb JCB Co., Ltd.
645        "jetzt", // jetzt New TLD Company AB
646        "jewelry", // jewelry Wild Bloom, LLC
647        "jlc", // jlc Richemont DNS Inc.
648        "jll", // jll Jones Lang LaSalle Incorporated
649        "jobs", // jobs Employ Media LLC
650        "joburg", // joburg ZA Central Registry NPC trading as ZA Central Registry
651        "jprs", // jprs Japan Registry Services Co., Ltd.
652        "juegos", // juegos Uniregistry, Corp.
653        "kaufen", // kaufen United TLD Holdco Ltd.
654        "kddi", // kddi KDDI CORPORATION
655        "kia", // kia KIA MOTORS CORPORATION
656        "kim", // kim Afilias Limited
657        "kinder", // kinder Ferrero Trading Lux S.A.
658        "kitchen", // kitchen Just Goodbye, LLC
659        "kiwi", // kiwi DOT KIWI LIMITED
660        "koeln", // koeln NetCologne Gesellschaft für Telekommunikation mbH
661        "komatsu", // komatsu Komatsu Ltd.
662        "krd", // krd KRG Department of Information Technology
663        "kred", // kred KredTLD Pty Ltd
664        "kyoto", // kyoto Academic Institution: Kyoto Jyoho Gakuen
665        "lacaixa", // lacaixa CAIXA D&#39;ESTALVIS I PENSIONS DE BARCELONA
666        "lancaster", // lancaster LANCASTER
667        "land", // land Pine Moon, LLC
668        "landrover", // landrover Jaguar Land Rover Ltd
669        "lasalle", // lasalle Jones Lang LaSalle Incorporated
670        "lat", // lat ECOM-LAC Federación de Latinoamérica y el Caribe para Internet y el Comercio Electrónico
671        "latrobe", // latrobe La Trobe University
672        "law", // law Minds + Machines Group Limited
673        "lawyer", // lawyer United TLD Holdco, Ltd
674        "lds", // lds IRI Domain Management, LLC
675        "lease", // lease Victor Trail, LLC
676        "leclerc", // leclerc A.C.D. LEC Association des Centres Distributeurs Edouard Leclerc
677        "legal", // legal Blue Falls, LLC
678        "lexus", // lexus TOYOTA MOTOR CORPORATION
679        "lgbt", // lgbt Afilias Limited
680        "liaison", // liaison Liaison Technologies, Incorporated
681        "lidl", // lidl Schwarz Domains und Services GmbH &amp; Co. KG
682        "life", // life Trixy Oaks, LLC
683        "lighting", // lighting John McCook, LLC
684        "limited", // limited Big Fest, LLC
685        "limo", // limo Hidden Frostbite, LLC
686        "linde", // linde Linde Aktiengesellschaft
687        "link", // link Uniregistry, Corp.
688        "live", // live United TLD Holdco Ltd.
689        "lixil", // lixil LIXIL Group Corporation
690        "loan", // loan dot Loan Limited
691        "loans", // loans June Woods, LLC
692        "lol", // lol Uniregistry, Corp.
693        "london", // london Dot London Domains Limited
694        "lotte", // lotte Lotte Holdings Co., Ltd.
695        "lotto", // lotto Afilias Limited
696        "love", // love Merchant Law Group LLP
697        "ltd", // ltd Over Corner, LLC
698        "ltda", // ltda InterNetX Corp.
699        "lupin", // lupin LUPIN LIMITED
700        "luxe", // luxe Top Level Domain Holdings Limited
701        "luxury", // luxury Luxury Partners LLC
702        "madrid", // madrid Comunidad de Madrid
703        "maif", // maif Mutuelle Assurance Instituteur France (MAIF)
704        "maison", // maison Victor Frostbite, LLC
705        "man", // man MAN SE
706        "management", // management John Goodbye, LLC
707        "mango", // mango PUNTO FA S.L.
708        "market", // market Unitied TLD Holdco, Ltd
709        "marketing", // marketing Fern Pass, LLC
710        "markets", // markets DOTMARKETS REGISTRY LTD
711        "marriott", // marriott Marriott Worldwide Corporation
712        "mba", // mba Lone Hollow, LLC
713        "media", // media Grand Glen, LLC
714        "meet", // meet Afilias Limited
715        "melbourne", // melbourne The Crown in right of the State of Victoria, represented by its Department of State Development, Business and Innovation
716        "meme", // meme Charleston Road Registry Inc.
717        "memorial", // memorial Dog Beach, LLC
718        "men", // men Exclusive Registry Limited
719        "menu", // menu Wedding TLD2, LLC
720        "meo", // meo PT Comunicacoes S.A.
721        "miami", // miami Top Level Domain Holdings Limited
722        "microsoft", // microsoft Microsoft Corporation
723        "mil", // mil DoD Network Information Center
724        "mini", // mini Bayerische Motoren Werke Aktiengesellschaft
725        "mma", // mma MMA IARD
726        "mobi", // mobi Afilias Technologies Limited dba dotMobi
727        "moda", // moda United TLD Holdco Ltd.
728        "moe", // moe Interlink Co., Ltd.
729        "moi", // moi Amazon Registry Services, Inc.
730        "mom", // mom Uniregistry, Corp.
731        "monash", // monash Monash University
732        "money", // money Outer McCook, LLC
733        "montblanc", // montblanc Richemont DNS Inc.
734        "mormon", // mormon IRI Domain Management, LLC (&quot;Applicant&quot;)
735        "mortgage", // mortgage United TLD Holdco, Ltd
736        "moscow", // moscow Foundation for Assistance for Internet Technologies and Infrastructure Development (FAITID)
737        "motorcycles", // motorcycles DERMotorcycles, LLC
738        "mov", // mov Charleston Road Registry Inc.
739        "movie", // movie New Frostbite, LLC
740        "movistar", // movistar Telefónica S.A.
741        "mtn", // mtn MTN Dubai Limited
742        "mtpc", // mtpc Mitsubishi Tanabe Pharma Corporation
743        "mtr", // mtr MTR Corporation Limited
744        "museum", // museum Museum Domain Management Association
745        "mutuelle", // mutuelle Fédération Nationale de la Mutualité Française
746        "nadex", // nadex Nadex Domains, Inc
747        "nagoya", // nagoya GMO Registry, Inc.
748        "name", // name VeriSign Information Services, Inc.
749        "navy", // navy United TLD Holdco Ltd.
750        "nec", // nec NEC Corporation
751        "net", // net VeriSign Global Registry Services
752        "netbank", // netbank COMMONWEALTH BANK OF AUSTRALIA
753        "network", // network Trixy Manor, LLC
754        "neustar", // neustar NeuStar, Inc.
755        "new", // new Charleston Road Registry Inc.
756        "news", // news United TLD Holdco Ltd.
757        "nexus", // nexus Charleston Road Registry Inc.
758        "ngo", // ngo Public Interest Registry
759        "nhk", // nhk Japan Broadcasting Corporation (NHK)
760        "nico", // nico DWANGO Co., Ltd.
761        "ninja", // ninja United TLD Holdco Ltd.
762        "nissan", // nissan NISSAN MOTOR CO., LTD.
763        "nokia", // nokia Nokia Corporation
764        "nra", // nra NRA Holdings Company, INC.
765        "nrw", // nrw Minds + Machines GmbH
766        "ntt", // ntt NIPPON TELEGRAPH AND TELEPHONE CORPORATION
767        "nyc", // nyc The City of New York by and through the New York City Department of Information Technology &amp; Telecommunications
768        "obi", // obi OBI Group Holding SE &amp; Co. KGaA
769        "office", // office Microsoft Corporation
770        "okinawa", // okinawa BusinessRalliart inc.
771        "omega", // omega The Swatch Group Ltd
772        "one", // one One.com A/S
773        "ong", // ong Public Interest Registry
774        "onl", // onl I-REGISTRY Ltd., Niederlassung Deutschland
775        "online", // online DotOnline Inc.
776        "ooo", // ooo INFIBEAM INCORPORATION LIMITED
777        "oracle", // oracle Oracle Corporation
778        "orange", // orange Orange Brand Services Limited
779        "org", // org Public Interest Registry (PIR)
780        "organic", // organic Afilias Limited
781        "osaka", // osaka Interlink Co., Ltd.
782        "otsuka", // otsuka Otsuka Holdings Co., Ltd.
783        "ovh", // ovh OVH SAS
784        "page", // page Charleston Road Registry Inc.
785        "panerai", // panerai Richemont DNS Inc.
786        "paris", // paris City of Paris
787        "partners", // partners Magic Glen, LLC
788        "parts", // parts Sea Goodbye, LLC
789        "party", // party Blue Sky Registry Limited
790        "pet", // pet Afilias plc
791        "pharmacy", // pharmacy National Association of Boards of Pharmacy
792        "philips", // philips Koninklijke Philips N.V.
793        "photo", // photo Uniregistry, Corp.
794        "photography", // photography Sugar Glen, LLC
795        "photos", // photos Sea Corner, LLC
796        "physio", // physio PhysBiz Pty Ltd
797        "piaget", // piaget Richemont DNS Inc.
798        "pics", // pics Uniregistry, Corp.
799        "pictet", // pictet Pictet Europe S.A.
800        "pictures", // pictures Foggy Sky, LLC
801        "ping", // ping Ping Registry Provider, Inc.
802        "pink", // pink Afilias Limited
803        "pizza", // pizza Foggy Moon, LLC
804        "place", // place Snow Galley, LLC
805        "play", // play Charleston Road Registry Inc.
806        "playstation", // playstation Sony Computer Entertainment Inc.
807        "plumbing", // plumbing Spring Tigers, LLC
808        "plus", // plus Sugar Mill, LLC
809        "pohl", // pohl Deutsche Vermögensberatung Aktiengesellschaft DVAG
810        "poker", // poker Afilias Domains No. 5 Limited
811        "porn", // porn ICM Registry PN LLC
812        "post", // post Universal Postal Union
813        "praxi", // praxi Praxi S.p.A.
814        "press", // press DotPress Inc.
815        "pro", // pro Registry Services Corporation dba RegistryPro
816        "prod", // prod Charleston Road Registry Inc.
817        "productions", // productions Magic Birch, LLC
818        "prof", // prof Charleston Road Registry Inc.
819        "properties", // properties Big Pass, LLC
820        "property", // property Uniregistry, Corp.
821        "protection", // protection XYZ.COM LLC
822        "pub", // pub United TLD Holdco Ltd.
823        "qpon", // qpon dotCOOL, Inc.
824        "quebec", // quebec PointQuébec Inc
825        "racing", // racing Premier Registry Limited
826        "realtor", // realtor Real Estate Domains LLC
827        "realty", // realty Fegistry, LLC
828        "recipes", // recipes Grand Island, LLC
829        "red", // red Afilias Limited
830        "redstone", // redstone Redstone Haute Couture Co., Ltd.
831        "rehab", // rehab United TLD Holdco Ltd.
832        "reise", // reise Foggy Way, LLC
833        "reisen", // reisen New Cypress, LLC
834        "reit", // reit National Association of Real Estate Investment Trusts, Inc.
835        "ren", // ren Beijing Qianxiang Wangjing Technology Development Co., Ltd.
836        "rent", // rent XYZ.COM LLC
837        "rentals", // rentals Big Hollow,LLC
838        "repair", // repair Lone Sunset, LLC
839        "report", // report Binky Glen, LLC
840        "republican", // republican United TLD Holdco Ltd.
841        "rest", // rest Punto 2012 Sociedad Anonima Promotora de Inversion de Capital Variable
842        "restaurant", // restaurant Snow Avenue, LLC
843        "review", // review dot Review Limited
844        "reviews", // reviews United TLD Holdco, Ltd.
845        "rich", // rich I-REGISTRY Ltd., Niederlassung Deutschland
846        "ricoh", // ricoh Ricoh Company, Ltd.
847        "rio", // rio Empresa Municipal de Informática SA - IPLANRIO
848        "rip", // rip United TLD Holdco Ltd.
849        "rocher", // rocher Ferrero Trading Lux S.A.
850        "rocks", // rocks United TLD Holdco, LTD.
851        "rodeo", // rodeo Top Level Domain Holdings Limited
852        "rsvp", // rsvp Charleston Road Registry Inc.
853        "ruhr", // ruhr regiodot GmbH &amp; Co. KG
854        "run", // run Snow Park, LLC
855        "rwe", // rwe RWE AG
856        "ryukyu", // ryukyu BusinessRalliart inc.
857        "saarland", // saarland dotSaarland GmbH
858        "sakura", // sakura SAKURA Internet Inc.
859        "sale", // sale United TLD Holdco, Ltd
860        "samsung", // samsung SAMSUNG SDS CO., LTD
861        "sandvik", // sandvik Sandvik AB
862        "sandvikcoromant", // sandvikcoromant Sandvik AB
863        "sanofi", // sanofi Sanofi
864        "sap", // sap SAP AG
865        "sapo", // sapo PT Comunicacoes S.A.
866        "sarl", // sarl Delta Orchard, LLC
867        "saxo", // saxo Saxo Bank A/S
868        "sbs", // sbs SPECIAL BROADCASTING SERVICE CORPORATION
869        "sca", // sca SVENSKA CELLULOSA AKTIEBOLAGET SCA (publ)
870        "scb", // scb The Siam Commercial Bank Public Company Limited (&quot;SCB&quot;)
871        "schmidt", // schmidt SALM S.A.S.
872        "scholarships", // scholarships Scholarships.com, LLC
873        "school", // school Little Galley, LLC
874        "schule", // schule Outer Moon, LLC
875        "schwarz", // schwarz Schwarz Domains und Services GmbH &amp; Co. KG
876        "science", // science dot Science Limited
877        "scor", // scor SCOR SE
878        "scot", // scot Dot Scot Registry Limited
879        "seat", // seat SEAT, S.A. (Sociedad Unipersonal)
880        "security", // security XYZ.COM LLC
881        "seek", // seek Seek Limited
882        "sener", // sener Sener Ingeniería y Sistemas, S.A.
883        "services", // services Fox Castle, LLC
884        "seven", // seven Seven West Media Ltd
885        "sew", // sew SEW-EURODRIVE GmbH &amp; Co KG
886        "sex", // sex ICM Registry SX LLC
887        "sexy", // sexy Uniregistry, Corp.
888        "shiksha", // shiksha Afilias Limited
889        "shoes", // shoes Binky Galley, LLC
890        "show", // show Snow Beach, LLC
891        "shriram", // shriram Shriram Capital Ltd.
892        "singles", // singles Fern Madison, LLC
893        "site", // site DotSite Inc.
894        "ski", // ski STARTING DOT LIMITED
895        "sky", // sky Sky International AG
896        "skype", // skype Microsoft Corporation
897        "sncf", // sncf SNCF (Société Nationale des Chemins de fer Francais)
898        "soccer", // soccer Foggy Shadow, LLC
899        "social", // social United TLD Holdco Ltd.
900        "software", // software United TLD Holdco, Ltd
901        "sohu", // sohu Sohu.com Limited
902        "solar", // solar Ruby Town, LLC
903        "solutions", // solutions Silver Cover, LLC
904        "sony", // sony Sony Corporation
905        "soy", // soy Charleston Road Registry Inc.
906        "space", // space DotSpace Inc.
907        "spiegel", // spiegel SPIEGEL-Verlag Rudolf Augstein GmbH &amp; Co. KG
908        "spreadbetting", // spreadbetting DOTSPREADBETTING REGISTRY LTD
909        "srl", // srl InterNetX Corp.
910        "stada", // stada STADA Arzneimittel AG
911        "starhub", // starhub StarHub Limited
912        "statoil", // statoil Statoil ASA
913        "stc", // stc Saudi Telecom Company
914        "stcgroup", // stcgroup Saudi Telecom Company
915        "stockholm", // stockholm Stockholms kommun
916        "studio", // studio United TLD Holdco Ltd.
917        "study", // study OPEN UNIVERSITIES AUSTRALIA PTY LTD
918        "style", // style Binky Moon, LLC
919        "sucks", // sucks Vox Populi Registry Ltd.
920        "supplies", // supplies Atomic Fields, LLC
921        "supply", // supply Half Falls, LLC
922        "support", // support Grand Orchard, LLC
923        "surf", // surf Top Level Domain Holdings Limited
924        "surgery", // surgery Tin Avenue, LLC
925        "suzuki", // suzuki SUZUKI MOTOR CORPORATION
926        "swatch", // swatch The Swatch Group Ltd
927        "swiss", // swiss Swiss Confederation
928        "sydney", // sydney State of New South Wales, Department of Premier and Cabinet
929        "systems", // systems Dash Cypress, LLC
930        "taipei", // taipei Taipei City Government
931        "tatamotors", // tatamotors Tata Motors Ltd
932        "tatar", // tatar Limited Liability Company &quot;Coordination Center of Regional Domain of Tatarstan Republic&quot;
933        "tattoo", // tattoo Uniregistry, Corp.
934        "tax", // tax Storm Orchard, LLC
935        "taxi", // taxi Pine Falls, LLC
936        "team", // team Atomic Lake, LLC
937        "tech", // tech Dot Tech LLC
938        "technology", // technology Auburn Falls, LLC
939        "tel", // tel Telnic Ltd.
940        "telefonica", // telefonica Telefónica S.A.
941        "temasek", // temasek Temasek Holdings (Private) Limited
942        "tennis", // tennis Cotton Bloom, LLC
943        "thd", // thd Homer TLC, Inc.
944        "theater", // theater Blue Tigers, LLC
945        "theatre", // theatre XYZ.COM LLC
946        "tickets", // tickets Accent Media Limited
947        "tienda", // tienda Victor Manor, LLC
948        "tips", // tips Corn Willow, LLC
949        "tires", // tires Dog Edge, LLC
950        "tirol", // tirol punkt Tirol GmbH
951        "today", // today Pearl Woods, LLC
952        "tokyo", // tokyo GMO Registry, Inc.
953        "tools", // tools Pioneer North, LLC
954        "top", // top Jiangsu Bangning Science &amp; Technology Co.,Ltd.
955        "toray", // toray Toray Industries, Inc.
956        "toshiba", // toshiba TOSHIBA Corporation
957        "tours", // tours Sugar Station, LLC
958        "town", // town Koko Moon, LLC
959        "toyota", // toyota TOYOTA MOTOR CORPORATION
960        "toys", // toys Pioneer Orchard, LLC
961        "trade", // trade Elite Registry Limited
962        "trading", // trading DOTTRADING REGISTRY LTD
963        "training", // training Wild Willow, LLC
964        "travel", // travel Tralliance Registry Management Company, LLC.
965        "trust", // trust Artemis Internet Inc
966        "tui", // tui TUI AG
967        "ubs", // ubs UBS AG
968        "university", // university Little Station, LLC
969        "uno", // uno Dot Latin LLC
970        "uol", // uol UBN INTERNET LTDA.
971        "vacations", // vacations Atomic Tigers, LLC
972        "vegas", // vegas Dot Vegas, Inc.
973        "ventures", // ventures Binky Lake, LLC
974        "versicherung", // versicherung dotversicherung-registry GmbH
975        "vet", // vet United TLD Holdco, Ltd
976        "viajes", // viajes Black Madison, LLC
977        "video", // video United TLD Holdco, Ltd
978        "villas", // villas New Sky, LLC
979        "vin", // vin Holly Shadow, LLC
980        "virgin", // virgin Virgin Enterprises Limited
981        "vision", // vision Koko Station, LLC
982        "vista", // vista Vistaprint Limited
983        "vistaprint", // vistaprint Vistaprint Limited
984        "viva", // viva Saudi Telecom Company
985        "vlaanderen", // vlaanderen DNS.be vzw
986        "vodka", // vodka Top Level Domain Holdings Limited
987        "vote", // vote Monolith Registry LLC
988        "voting", // voting Valuetainment Corp.
989        "voto", // voto Monolith Registry LLC
990        "voyage", // voyage Ruby House, LLC
991        "wales", // wales Nominet UK
992        "walter", // walter Sandvik AB
993        "wang", // wang Zodiac Registry Limited
994        "watch", // watch Sand Shadow, LLC
995        "webcam", // webcam dot Webcam Limited
996        "website", // website DotWebsite Inc.
997        "wed", // wed Atgron, Inc.
998        "wedding", // wedding Top Level Domain Holdings Limited
999        "weir", // weir Weir Group IP Limited
1000        "whoswho", // whoswho Who&#39;s Who Registry
1001        "wien", // wien punkt.wien GmbH
1002        "wiki", // wiki Top Level Design, LLC
1003        "williamhill", // williamhill William Hill Organization Limited
1004        "win", // win First Registry Limited
1005        "windows", // windows Microsoft Corporation
1006        "wine", // wine June Station, LLC
1007        "wme", // wme William Morris Endeavor Entertainment, LLC
1008        "work", // work Top Level Domain Holdings Limited
1009        "works", // works Little Dynamite, LLC
1010        "world", // world Bitter Fields, LLC
1011        "wtc", // wtc World Trade Centers Association, Inc.
1012        "wtf", // wtf Hidden Way, LLC
1013        "xbox", // xbox Microsoft Corporation
1014        "xerox", // xerox Xerox DNHC LLC
1015        "xin", // xin Elegant Leader Limited
1016        "xn--11b4c3d", // कॉम VeriSign Sarl
1017        "xn--1qqw23a", // 佛山 Guangzhou YU Wei Information Technology Co., Ltd.
1018        "xn--30rr7y", // 慈善 Excellent First Limited
1019        "xn--3bst00m", // 集团 Eagle Horizon Limited
1020        "xn--3ds443g", // 在线 TLD REGISTRY LIMITED
1021        "xn--3pxu8k", // 点看 VeriSign Sarl
1022        "xn--42c2d9a", // คอม VeriSign Sarl
1023        "xn--45q11c", // 八卦 Zodiac Scorpio Limited
1024        "xn--4gbrim", // موقع Suhub Electronic Establishment
1025        "xn--55qw42g", // 公益 China Organizational Name Administration Center
1026        "xn--55qx5d", // 公司 Computer Network Information Center of Chinese Academy of Sciences (China Internet Network Information Center)
1027        "xn--6frz82g", // 移动 Afilias Limited
1028        "xn--6qq986b3xl", // 我爱你 Tycoon Treasure Limited
1029        "xn--80adxhks", // москва Foundation for Assistance for Internet Technologies and Infrastructure Development (FAITID)
1030        "xn--80asehdb", // онлайн CORE Association
1031        "xn--80aswg", // сайт CORE Association
1032        "xn--9dbq2a", // קום VeriSign Sarl
1033        "xn--9et52u", // 时尚 RISE VICTORY LIMITED
1034        "xn--b4w605ferd", // 淡马锡 Temasek Holdings (Private) Limited
1035        "xn--c1avg", // орг Public Interest Registry
1036        "xn--c2br7g", // नेट VeriSign Sarl
1037        "xn--cg4bki", // 삼성 SAMSUNG SDS CO., LTD
1038        "xn--czr694b", // 商标 HU YI GLOBAL INFORMATION RESOURCES(HOLDING) COMPANY.HONGKONG LIMITED
1039        "xn--czrs0t", // 商店 Wild Island, LLC
1040        "xn--czru2d", // 商城 Zodiac Aquarius Limited
1041        "xn--d1acj3b", // дети The Foundation for Network Initiatives “The Smart Internet”
1042        "xn--efvy88h", // 新闻 Xinhua News Agency Guangdong Branch 新华通讯社广东分社
1043        "xn--estv75g", // 工行 Industrial and Commercial Bank of China Limited
1044        "xn--fhbei", // كوم VeriSign Sarl
1045        "xn--fiq228c5hs", // 中文网 TLD REGISTRY LIMITED
1046        "xn--fiq64b", // 中信 CITIC Group Corporation
1047        "xn--fjq720a", // 娱乐 Will Bloom, LLC
1048        "xn--flw351e", // 谷歌 Charleston Road Registry Inc.
1049        "xn--hxt814e", // 网店 Zodiac Libra Limited
1050        "xn--i1b6b1a6a2e", // संगठन Public Interest Registry
1051        "xn--imr513n", // 餐厅 HU YI GLOBAL INFORMATION RESOURCES (HOLDING) COMPANY. HONGKONG LIMITED
1052        "xn--io0a7i", // 网络 Computer Network Information Center of Chinese Academy of Sciences (China Internet Network Information Center)
1053        "xn--j1aef", // ком VeriSign Sarl
1054        "xn--kcrx77d1x4a", // 飞利浦 Koninklijke Philips N.V.
1055        "xn--kput3i", // 手机 Beijing RITT-Net Technology Development Co., Ltd
1056        "xn--mgba3a3ejt", // ارامكو Aramco Services Company
1057        "xn--mgbab2bd", // بازار CORE Association
1058        "xn--mk1bu44c", // 닷컴 VeriSign Sarl
1059        "xn--mxtq1m", // 政府 Net-Chinese Co., Ltd.
1060        "xn--ngbc5azd", // شبكة International Domain Registry Pty. Ltd.
1061        "xn--nqv7f", // 机构 Public Interest Registry
1062        "xn--nqv7fs00ema", // 组织机构 Public Interest Registry
1063        "xn--nyqy26a", // 健康 Stable Tone Limited
1064        "xn--p1acf", // рус Rusnames Limited
1065        "xn--pssy2u", // 大拿 VeriSign Sarl
1066        "xn--q9jyb4c", // みんな Charleston Road Registry Inc.
1067        "xn--qcka1pmc", // グーグル Charleston Road Registry Inc.
1068        "xn--rhqv96g", // 世界 Stable Tone Limited
1069        "xn--ses554g", // 网址 KNET Co., Ltd
1070        "xn--t60b56a", // 닷넷 VeriSign Sarl
1071        "xn--tckwe", // コム VeriSign Sarl
1072        "xn--unup4y", // 游戏 Spring Fields, LLC
1073        "xn--vermgensberater-ctb", // VERMöGENSBERATER Deutsche Vermögensberatung Aktiengesellschaft DVAG
1074        "xn--vermgensberatung-pwb", // VERMöGENSBERATUNG Deutsche Vermögensberatung Aktiengesellschaft DVAG
1075        "xn--vhquv", // 企业 Dash McCook, LLC
1076        "xn--vuq861b", // 信息 Beijing Tele-info Network Technology Co., Ltd.
1077        "xn--xhq521b", // 广东 Guangzhou YU Wei Information Technology Co., Ltd.
1078        "xn--zfr164b", // 政务 China Organizational Name Administration Center
1079        "xperia", // xperia Sony Mobile Communications AB
1080        "xxx", // xxx ICM Registry LLC
1081        "xyz", // xyz XYZ.COM LLC
1082        "yachts", // yachts DERYachts, LLC
1083        "yamaxun", // yamaxun Amazon Registry Services, Inc.
1084        "yandex", // yandex YANDEX, LLC
1085        "yodobashi", // yodobashi YODOBASHI CAMERA CO.,LTD.
1086        "yoga", // yoga Top Level Domain Holdings Limited
1087        "yokohama", // yokohama GMO Registry, Inc.
1088        "youtube", // youtube Charleston Road Registry Inc.
1089        "zara", // zara Industria de Diseño Textil, S.A. (INDITEX, S.A.)
1090        "zip", // zip Charleston Road Registry Inc.
1091        "zone", // zone Outer Falls, LLC
1092        "zuerich", // zuerich Kanton Zürich (Canton of Zurich)
1093    };
1094
1095    // WARNING: this array MUST be sorted, otherwise it cannot be searched reliably using binary search
1096    private static final String[] COUNTRY_CODE_TLDS = new String[] {
1097        "ac",                 // Ascension Island
1098        "ad",                 // Andorra
1099        "ae",                 // United Arab Emirates
1100        "af",                 // Afghanistan
1101        "ag",                 // Antigua and Barbuda
1102        "ai",                 // Anguilla
1103        "al",                 // Albania
1104        "am",                 // Armenia
1105//        "an",                 // Netherlands Antilles (retired)
1106        "ao",                 // Angola
1107        "aq",                 // Antarctica
1108        "ar",                 // Argentina
1109        "as",                 // American Samoa
1110        "at",                 // Austria
1111        "au",                 // Australia (includes Ashmore and Cartier Islands and Coral Sea Islands)
1112        "aw",                 // Aruba
1113        "ax",                 // Åland
1114        "az",                 // Azerbaijan
1115        "ba",                 // Bosnia and Herzegovina
1116        "bb",                 // Barbados
1117        "bd",                 // Bangladesh
1118        "be",                 // Belgium
1119        "bf",                 // Burkina Faso
1120        "bg",                 // Bulgaria
1121        "bh",                 // Bahrain
1122        "bi",                 // Burundi
1123        "bj",                 // Benin
1124        "bm",                 // Bermuda
1125        "bn",                 // Brunei Darussalam
1126        "bo",                 // Bolivia
1127        "br",                 // Brazil
1128        "bs",                 // Bahamas
1129        "bt",                 // Bhutan
1130        "bv",                 // Bouvet Island
1131        "bw",                 // Botswana
1132        "by",                 // Belarus
1133        "bz",                 // Belize
1134        "ca",                 // Canada
1135        "cc",                 // Cocos (Keeling) Islands
1136        "cd",                 // Democratic Republic of the Congo (formerly Zaire)
1137        "cf",                 // Central African Republic
1138        "cg",                 // Republic of the Congo
1139        "ch",                 // Switzerland
1140        "ci",                 // Côte d'Ivoire
1141        "ck",                 // Cook Islands
1142        "cl",                 // Chile
1143        "cm",                 // Cameroon
1144        "cn",                 // China, mainland
1145        "co",                 // Colombia
1146        "cr",                 // Costa Rica
1147        "cu",                 // Cuba
1148        "cv",                 // Cape Verde
1149        "cw",                 // Curaçao
1150        "cx",                 // Christmas Island
1151        "cy",                 // Cyprus
1152        "cz",                 // Czech Republic
1153        "de",                 // Germany
1154        "dj",                 // Djibouti
1155        "dk",                 // Denmark
1156        "dm",                 // Dominica
1157        "do",                 // Dominican Republic
1158        "dz",                 // Algeria
1159        "ec",                 // Ecuador
1160        "ee",                 // Estonia
1161        "eg",                 // Egypt
1162        "er",                 // Eritrea
1163        "es",                 // Spain
1164        "et",                 // Ethiopia
1165        "eu",                 // European Union
1166        "fi",                 // Finland
1167        "fj",                 // Fiji
1168        "fk",                 // Falkland Islands
1169        "fm",                 // Federated States of Micronesia
1170        "fo",                 // Faroe Islands
1171        "fr",                 // France
1172        "ga",                 // Gabon
1173        "gb",                 // Great Britain (United Kingdom)
1174        "gd",                 // Grenada
1175        "ge",                 // Georgia
1176        "gf",                 // French Guiana
1177        "gg",                 // Guernsey
1178        "gh",                 // Ghana
1179        "gi",                 // Gibraltar
1180        "gl",                 // Greenland
1181        "gm",                 // The Gambia
1182        "gn",                 // Guinea
1183        "gp",                 // Guadeloupe
1184        "gq",                 // Equatorial Guinea
1185        "gr",                 // Greece
1186        "gs",                 // South Georgia and the South Sandwich Islands
1187        "gt",                 // Guatemala
1188        "gu",                 // Guam
1189        "gw",                 // Guinea-Bissau
1190        "gy",                 // Guyana
1191        "hk",                 // Hong Kong
1192        "hm",                 // Heard Island and McDonald Islands
1193        "hn",                 // Honduras
1194        "hr",                 // Croatia (Hrvatska)
1195        "ht",                 // Haiti
1196        "hu",                 // Hungary
1197        "id",                 // Indonesia
1198        "ie",                 // Ireland (Éire)
1199        "il",                 // Israel
1200        "im",                 // Isle of Man
1201        "in",                 // India
1202        "io",                 // British Indian Ocean Territory
1203        "iq",                 // Iraq
1204        "ir",                 // Iran
1205        "is",                 // Iceland
1206        "it",                 // Italy
1207        "je",                 // Jersey
1208        "jm",                 // Jamaica
1209        "jo",                 // Jordan
1210        "jp",                 // Japan
1211        "ke",                 // Kenya
1212        "kg",                 // Kyrgyzstan
1213        "kh",                 // Cambodia (Khmer)
1214        "ki",                 // Kiribati
1215        "km",                 // Comoros
1216        "kn",                 // Saint Kitts and Nevis
1217        "kp",                 // North Korea
1218        "kr",                 // South Korea
1219        "kw",                 // Kuwait
1220        "ky",                 // Cayman Islands
1221        "kz",                 // Kazakhstan
1222        "la",                 // Laos (currently being marketed as the official domain for Los Angeles)
1223        "lb",                 // Lebanon
1224        "lc",                 // Saint Lucia
1225        "li",                 // Liechtenstein
1226        "lk",                 // Sri Lanka
1227        "lr",                 // Liberia
1228        "ls",                 // Lesotho
1229        "lt",                 // Lithuania
1230        "lu",                 // Luxembourg
1231        "lv",                 // Latvia
1232        "ly",                 // Libya
1233        "ma",                 // Morocco
1234        "mc",                 // Monaco
1235        "md",                 // Moldova
1236        "me",                 // Montenegro
1237        "mg",                 // Madagascar
1238        "mh",                 // Marshall Islands
1239        "mk",                 // Republic of Macedonia
1240        "ml",                 // Mali
1241        "mm",                 // Myanmar
1242        "mn",                 // Mongolia
1243        "mo",                 // Macau
1244        "mp",                 // Northern Mariana Islands
1245        "mq",                 // Martinique
1246        "mr",                 // Mauritania
1247        "ms",                 // Montserrat
1248        "mt",                 // Malta
1249        "mu",                 // Mauritius
1250        "mv",                 // Maldives
1251        "mw",                 // Malawi
1252        "mx",                 // Mexico
1253        "my",                 // Malaysia
1254        "mz",                 // Mozambique
1255        "na",                 // Namibia
1256        "nc",                 // New Caledonia
1257        "ne",                 // Niger
1258        "nf",                 // Norfolk Island
1259        "ng",                 // Nigeria
1260        "ni",                 // Nicaragua
1261        "nl",                 // Netherlands
1262        "no",                 // Norway
1263        "np",                 // Nepal
1264        "nr",                 // Nauru
1265        "nu",                 // Niue
1266        "nz",                 // New Zealand
1267        "om",                 // Oman
1268        "pa",                 // Panama
1269        "pe",                 // Peru
1270        "pf",                 // French Polynesia With Clipperton Island
1271        "pg",                 // Papua New Guinea
1272        "ph",                 // Philippines
1273        "pk",                 // Pakistan
1274        "pl",                 // Poland
1275        "pm",                 // Saint-Pierre and Miquelon
1276        "pn",                 // Pitcairn Islands
1277        "pr",                 // Puerto Rico
1278        "ps",                 // Palestinian territories (PA-controlled West Bank and Gaza Strip)
1279        "pt",                 // Portugal
1280        "pw",                 // Palau
1281        "py",                 // Paraguay
1282        "qa",                 // Qatar
1283        "re",                 // Réunion
1284        "ro",                 // Romania
1285        "rs",                 // Serbia
1286        "ru",                 // Russia
1287        "rw",                 // Rwanda
1288        "sa",                 // Saudi Arabia
1289        "sb",                 // Solomon Islands
1290        "sc",                 // Seychelles
1291        "sd",                 // Sudan
1292        "se",                 // Sweden
1293        "sg",                 // Singapore
1294        "sh",                 // Saint Helena
1295        "si",                 // Slovenia
1296        "sj",                 // Svalbard and Jan Mayen Islands Not in use (Norwegian dependencies; see .no)
1297        "sk",                 // Slovakia
1298        "sl",                 // Sierra Leone
1299        "sm",                 // San Marino
1300        "sn",                 // Senegal
1301        "so",                 // Somalia
1302        "sr",                 // Suriname
1303        "st",                 // São Tomé and Príncipe
1304        "su",                 // Soviet Union (deprecated)
1305        "sv",                 // El Salvador
1306        "sx",                 // Sint Maarten
1307        "sy",                 // Syria
1308        "sz",                 // Swaziland
1309        "tc",                 // Turks and Caicos Islands
1310        "td",                 // Chad
1311        "tf",                 // French Southern and Antarctic Lands
1312        "tg",                 // Togo
1313        "th",                 // Thailand
1314        "tj",                 // Tajikistan
1315        "tk",                 // Tokelau
1316        "tl",                 // East Timor (deprecated old code)
1317        "tm",                 // Turkmenistan
1318        "tn",                 // Tunisia
1319        "to",                 // Tonga
1320//        "tp",                 // East Timor (Retired)
1321        "tr",                 // Turkey
1322        "tt",                 // Trinidad and Tobago
1323        "tv",                 // Tuvalu
1324        "tw",                 // Taiwan, Republic of China
1325        "tz",                 // Tanzania
1326        "ua",                 // Ukraine
1327        "ug",                 // Uganda
1328        "uk",                 // United Kingdom
1329        "us",                 // United States of America
1330        "uy",                 // Uruguay
1331        "uz",                 // Uzbekistan
1332        "va",                 // Vatican City State
1333        "vc",                 // Saint Vincent and the Grenadines
1334        "ve",                 // Venezuela
1335        "vg",                 // British Virgin Islands
1336        "vi",                 // U.S. Virgin Islands
1337        "vn",                 // Vietnam
1338        "vu",                 // Vanuatu
1339        "wf",                 // Wallis and Futuna
1340        "ws",                 // Samoa (formerly Western Samoa)
1341        "xn--3e0b707e", // 한국 KISA (Korea Internet &amp; Security Agency)
1342        "xn--45brj9c", // ভারত National Internet Exchange of India
1343        "xn--80ao21a", // қаз Association of IT Companies of Kazakhstan
1344        "xn--90a3ac", // срб Serbian National Internet Domain Registry (RNIDS)
1345        "xn--90ais", // ??? Reliable Software Inc.
1346        "xn--clchc0ea0b2g2a9gcd", // சிங்கப்பூர் Singapore Network Information Centre (SGNIC) Pte Ltd
1347        "xn--d1alf", // мкд Macedonian Academic Research Network Skopje
1348        "xn--fiqs8s", // 中国 China Internet Network Information Center
1349        "xn--fiqz9s", // 中國 China Internet Network Information Center
1350        "xn--fpcrj9c3d", // భారత్ National Internet Exchange of India
1351        "xn--fzc2c9e2c", // ලංකා LK Domain Registry
1352        "xn--gecrj9c", // ભારત National Internet Exchange of India
1353        "xn--h2brj9c", // भारत National Internet Exchange of India
1354        "xn--j1amh", // укр Ukrainian Network Information Centre (UANIC), Inc.
1355        "xn--j6w193g", // 香港 Hong Kong Internet Registration Corporation Ltd.
1356        "xn--kprw13d", // 台湾 Taiwan Network Information Center (TWNIC)
1357        "xn--kpry57d", // 台灣 Taiwan Network Information Center (TWNIC)
1358        "xn--l1acc", // мон Datacom Co.,Ltd
1359        "xn--lgbbat1ad8j", // الجزائر CERIST
1360        "xn--mgb9awbf", // عمان Telecommunications Regulatory Authority (TRA)
1361        "xn--mgba3a4f16a", // ایران Institute for Research in Fundamental Sciences (IPM)
1362        "xn--mgbaam7a8h", // امارات Telecommunications Regulatory Authority (TRA)
1363        "xn--mgbayh7gpa", // الاردن National Information Technology Center (NITC)
1364        "xn--mgbbh1a71e", // بھارت National Internet Exchange of India
1365        "xn--mgbc0a9azcg", // المغرب Agence Nationale de Réglementation des Télécommunications (ANRT)
1366        "xn--mgberp4a5d4ar", // السعودية Communications and Information Technology Commission
1367        "xn--mgbpl2fh", // ????? Sudan Internet Society
1368        "xn--mgbtx2b", // عراق Communications and Media Commission (CMC)
1369        "xn--mgbx4cd0ab", // مليسيا MYNIC Berhad
1370        "xn--node", // გე Information Technologies Development Center (ITDC)
1371        "xn--o3cw4h", // ไทย Thai Network Information Center Foundation
1372        "xn--ogbpf8fl", // سورية National Agency for Network Services (NANS)
1373        "xn--p1ai", // рф Coordination Center for TLD RU
1374        "xn--pgbs0dh", // تونس Agence Tunisienne d&#39;Internet
1375        "xn--qxam", // ελ ICS-FORTH GR
1376        "xn--s9brj9c", // ਭਾਰਤ National Internet Exchange of India
1377        "xn--wgbh1c", // مصر National Telecommunication Regulatory Authority - NTRA
1378        "xn--wgbl6a", // قطر Communications Regulatory Authority
1379        "xn--xkc2al3hye2a", // இலங்கை LK Domain Registry
1380        "xn--xkc2dl3a5ee0h", // இந்தியா National Internet Exchange of India
1381        "xn--y9a3aq", // ??? Internet Society
1382        "xn--yfro4i67o", // 新加坡 Singapore Network Information Centre (SGNIC) Pte Ltd
1383        "xn--ygbi2ammx", // فلسطين Ministry of Telecom &amp; Information Technology (MTIT)
1384        "ye",                 // Yemen
1385        "yt",                 // Mayotte
1386        "za",                 // South Africa
1387        "zm",                 // Zambia
1388        "zw",                 // Zimbabwe
1389    };
1390
1391    // WARNING: this array MUST be sorted, otherwise it cannot be searched reliably using binary search
1392    private static final String[] LOCAL_TLDS = new String[] {
1393       "localdomain",         // Also widely used as localhost.localdomain
1394       "localhost",           // RFC2606 defined
1395    };
1396
1397    // Additional arrays to supplement or override the built in ones.
1398    // The PLUS arrays are valid keys, the MINUS arrays are invalid keys
1399
1400    /*
1401     * This field is used to detect whether the getInstance has been called.
1402     * After this, the method updateTLDOverride is not allowed to be called.
1403     * This field does not need to be volatile since it is only accessed from
1404     * synchronized methods. 
1405     */
1406    private static boolean inUse = false;
1407
1408    /*
1409     * These arrays are mutable, but they don't need to be volatile.
1410     * They can only be updated by the updateTLDOverride method, and any readers must get an instance
1411     * using the getInstance methods which are all (now) synchronised.
1412     */
1413    // WARNING: this array MUST be sorted, otherwise it cannot be searched reliably using binary search
1414    private static volatile String[] COUNTRY_CODE_TLDS_PLUS = EMPTY_STRING_ARRAY;
1415
1416    // WARNING: this array MUST be sorted, otherwise it cannot be searched reliably using binary search
1417    private static volatile String[] GENERIC_TLDS_PLUS = EMPTY_STRING_ARRAY;
1418
1419    // WARNING: this array MUST be sorted, otherwise it cannot be searched reliably using binary search
1420    private static volatile String[] COUNTRY_CODE_TLDS_MINUS = EMPTY_STRING_ARRAY;
1421
1422    // WARNING: this array MUST be sorted, otherwise it cannot be searched reliably using binary search
1423    private static volatile String[] GENERIC_TLDS_MINUS = EMPTY_STRING_ARRAY;
1424
1425    /**
1426     * enum used by {@link DomainValidator#updateTLDOverride(ArrayType, String[])}
1427     * to determine which override array to update.
1428     * @since 1.5.0
1429     */
1430    enum ArrayType {
1431        /** Update the GENERIC_TLDS_PLUS table containing additonal generic TLDs */
1432        GENERIC_PLUS,
1433        /** Update the GENERIC_TLDS_MINUS table containing deleted generic TLDs */
1434        GENERIC_MINUS,
1435        /** Update the COUNTRY_CODE_TLDS_PLUS table containing additonal country code TLDs */
1436        COUNTRY_CODE_PLUS,
1437        /** Update the COUNTRY_CODE_TLDS_MINUS table containing deleted country code TLDs */
1438        COUNTRY_CODE_MINUS;
1439    };
1440
1441    // For use by unit test code only
1442    static synchronized void clearTLDOverrides() {
1443        inUse = false;
1444        COUNTRY_CODE_TLDS_PLUS = EMPTY_STRING_ARRAY;
1445        COUNTRY_CODE_TLDS_MINUS = EMPTY_STRING_ARRAY;
1446        GENERIC_TLDS_PLUS = EMPTY_STRING_ARRAY;
1447        GENERIC_TLDS_MINUS = EMPTY_STRING_ARRAY;
1448    }
1449    /**
1450     * Update one of the TLD override arrays.
1451     * This must only be done at program startup, before any instances are accessed using getInstance.
1452     * <p>
1453     * For example:
1454     * <p>
1455     * {@code DomainValidator.updateTLDOverride(ArrayType.GENERIC_PLUS, new String[]{"apache"})}
1456     * <p>
1457     * To clear an override array, provide an empty array.
1458     *
1459     * @param table the table to update, see {@link DomainValidator#ArrayType}
1460     * @param tlds the array of TLDs, must not be null
1461     * @throws IllegalStateException if the method is called after getInstance
1462     * @since 1.5.0
1463     */
1464    public static synchronized void updateTLDOverride(ArrayType table, String [] tlds) {
1465        if (inUse) {
1466            throw new IllegalStateException("Can only invoke this method before calling getInstance");
1467        }
1468        String [] copy = new String[tlds.length];
1469        // Comparisons are always done with lower-case entries
1470        for (int i = 0; i < tlds.length; i++) {
1471            copy[i] = tlds[i].toLowerCase(Locale.ENGLISH);
1472        }
1473        Arrays.sort(copy);
1474        switch(table) {
1475        case COUNTRY_CODE_MINUS:
1476            COUNTRY_CODE_TLDS_MINUS = copy;
1477            break;
1478        case COUNTRY_CODE_PLUS:
1479            COUNTRY_CODE_TLDS_PLUS = copy;
1480            break;
1481        case GENERIC_MINUS:
1482            GENERIC_TLDS_MINUS = copy;
1483            break;
1484        case GENERIC_PLUS:
1485            GENERIC_TLDS_PLUS = copy;
1486            break;
1487        }
1488    }
1489
1490    /**
1491     * Converts potentially Unicode input to punycode.
1492     * If conversion fails, returns the original input.
1493     * 
1494     * @param input the string to convert, not null
1495     * @return converted input, or original input if conversion fails
1496     */
1497    // Needed by UrlValidator
1498    static String unicodeToASCII(String input) {
1499        if (isOnlyASCII(input)) { // skip possibly expensive processing
1500            return input;
1501        }
1502        try {
1503            final String ascii = IDN.toASCII(input);
1504            if (IDNBUGHOLDER.IDN_TOASCII_PRESERVES_TRAILING_DOTS) {
1505                return ascii;
1506            }
1507            final int length = input.length();
1508            if (length == 0) {// check there is a last character
1509                return input;
1510            }
1511// RFC3490 3.1. 1)
1512//            Whenever dots are used as label separators, the following
1513//            characters MUST be recognized as dots: U+002E (full stop), U+3002
1514//            (ideographic full stop), U+FF0E (fullwidth full stop), U+FF61
1515//            (halfwidth ideographic full stop).
1516            char lastChar = input.charAt(length-1);// fetch original last char
1517            switch(lastChar) {
1518                case '\u002E': // "." full stop
1519                case '\u3002': // ideographic full stop
1520                case '\uFF0E': // fullwidth full stop
1521                case '\uFF61': // halfwidth ideographic full stop
1522                    return ascii + "."; // restore the missing stop
1523                default:
1524                    return ascii;
1525            }
1526        } catch (IllegalArgumentException e) { // input is not valid
1527            return input;
1528        }
1529    }
1530
1531    private static class IDNBUGHOLDER {
1532        private static boolean keepsTrailingDot() {
1533            final String input = "a."; // must be a valid name
1534            return input.equals(IDN.toASCII(input));
1535        }
1536        private static final boolean IDN_TOASCII_PRESERVES_TRAILING_DOTS = keepsTrailingDot();
1537    }
1538
1539    /*
1540     * Check if input contains only ASCII
1541     * Treats null as all ASCII
1542     */
1543    private static boolean isOnlyASCII(String input) {
1544        if (input == null) {
1545            return true;
1546        }
1547        for(int i=0; i < input.length(); i++) {
1548            if (input.charAt(i) > 0x7F) {
1549                return false;
1550            }
1551        }
1552        return true;
1553    }
1554
1555    /**
1556     * Check if a sorted array contains the specified key
1557     *
1558     * @param sortedArray the array to search
1559     * @param key the key to find
1560     * @return {@code true} if the array contains the key
1561     */
1562    private static boolean arrayContains(String[] sortedArray, String key) {
1563        return Arrays.binarySearch(sortedArray, key) >= 0;
1564    }
1565}