Changeset 9853 in josm
- Timestamp:
- 2016-02-23T01:09:36+01:00 (9 years ago)
- Location:
- trunk
- Files:
-
- 8 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/routines/DomainValidator.java
r9239 r9853 17 17 package org.openstreetmap.josm.data.validation.routines; 18 18 19 import java.net.IDN; 19 20 import java.util.Arrays; 20 21 import java.util.Locale; … … 31 32 * to the standards <a href="http://www.ietf.org/rfc/rfc1034.txt">RFC1034</a>, 32 33 * section 3, and <a href="http://www.ietf.org/rfc/rfc1123.txt">RFC1123</a>, 33 * section 2.1. No accom odation is provided for the specialized needs of34 * section 2.1. No accommodation is provided for the specialized needs of 34 35 * other applications; if the domain name has been URL-encoded, for example, 35 36 * validation will fail even though the equivalent plaintext version of the … … 47 48 * <li>{@link #isValidGenericTld} - validates generic TLDs 48 49 * (<code>.com, .org</code>, etc.)</li> 49 * <li>{@link #isValidIdnTld} - validates IDN TLDs50 * (<code>.xn--*</code>, etc.)</li>51 50 * <li>{@link #isValidCountryCodeTld} - validates country code TLDs 52 51 * (<code>.us, .uk, .cn</code>, etc.)</li> … … 59 58 * </p> 60 59 * 61 * @version $Revision: 1 640271 $ $Date: 2014-11-18 02:32:15 2014 UTC (Tue, 18 Nov 2014)$60 * @version $Revision: 1725571 $ 62 61 * @since Validator 1.4 63 62 */ 64 63 public final class DomainValidator extends AbstractValidator { 65 64 65 private static final int MAX_DOMAIN_LENGTH = 253; 66 67 private static final String[] EMPTY_STRING_ARRAY = new String[0]; 68 66 69 // Regular expression strings for hostnames (derived from RFC2396 and RFC 1123) 67 private static final String DOMAIN_LABEL_REGEX = "\\p{Alnum}(?>[\\p{Alnum}-]*\\p{Alnum})*"; 68 private static final String TOP_LABEL_REGEX = "\\p{Alpha}{2,}"; 69 // JOSM PATCH BEGIN 70 // See #10862 - IDN TLDs in ASCII form 71 private static final String TOP_LABEL_IDN_REGEX = "(?:xn|XN)--\\p{Alnum}{2,}(?:-\\p{Alpha}{2,})?"; 70 71 // RFC2396: domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum 72 // Max 63 characters 73 private static final String DOMAIN_LABEL_REGEX = "\\p{Alnum}(?>[\\p{Alnum}-]{0,61}\\p{Alnum})?"; 74 75 // RFC2396 toplabel = alpha | alpha *( alphanum | "-" ) alphanum 76 // Max 63 characters 77 private static final String TOP_LABEL_REGEX = "\\p{Alpha}(?>[\\p{Alnum}-]{0,61}\\p{Alnum})?"; 78 79 // RFC2396 hostname = *( domainlabel "." ) toplabel [ "." ] 80 // Note that the regex currently requires both a domain label and a top level label, whereas 81 // the RFC does not. This is because the regex is used to detect if a TLD is present. 82 // If the match fails, input is checked against DOMAIN_LABEL_REGEX (hostnameRegex) 83 // RFC1123 sec 2.1 allows hostnames to start with a digit 72 84 private static final String DOMAIN_NAME_REGEX = 73 "^(?:" + DOMAIN_LABEL_REGEX + "\\.)+" + "(" + TOP_LABEL_REGEX + "|" + TOP_LABEL_IDN_REGEX + ")$"; 74 // JOSM PATCH END 85 "^(?:" + DOMAIN_LABEL_REGEX + "\\.)+" + "(" + TOP_LABEL_REGEX + ")\\.?$"; 75 86 76 87 private final boolean allowLocal; … … 94 105 new RegexValidator(DOMAIN_NAME_REGEX); 95 106 /** 96 * RegexValidator for matching the a local hostname 97 */ 107 * RegexValidator for matching a local hostname 108 */ 109 // RFC1123 sec 2.1 allows hostnames to start with a digit 98 110 private final RegexValidator hostnameRegex = 99 111 new RegexValidator(DOMAIN_LABEL_REGEX); … … 104 116 * @return the singleton instance of this validator 105 117 */ 106 public static DomainValidator getInstance() { 118 public static synchronized DomainValidator getInstance() { 119 inUse = true; 107 120 return DOMAIN_VALIDATOR; 108 121 } … … 114 127 * @return the singleton instance of this validator 115 128 */ 116 public static DomainValidator getInstance(boolean allowLocal) { 117 if (allowLocal) { 118 return DOMAIN_VALIDATOR_WITH_LOCAL; 119 } 120 return DOMAIN_VALIDATOR; 129 public static synchronized DomainValidator getInstance(boolean allowLocal) { 130 inUse = true; 131 if (allowLocal) { 132 return DOMAIN_VALIDATOR_WITH_LOCAL; 133 } 134 return DOMAIN_VALIDATOR; 121 135 } 122 136 … … 126 140 */ 127 141 private DomainValidator(boolean allowLocal) { 128 this.allowLocal = allowLocal;142 this.allowLocal = allowLocal; 129 143 } 130 144 … … 132 146 * Returns true if the specified <code>String</code> parses 133 147 * as a valid domain name with a recognized top-level domain. 134 * The parsing is case- sensitive.148 * The parsing is case-insensitive. 135 149 * @param domain the parameter to check for domain name syntax 136 150 * @return true if the parameter is a valid domain name … … 138 152 @Override 139 153 public boolean isValid(String domain) { 154 if (domain == null) { 155 return false; 156 } 157 domain = unicodeToASCII(domain); 158 // hosts must be equally reachable via punycode and Unicode 159 // Unicode is never shorter than punycode, so check punycode 160 // if domain did not convert, then it will be caught by ASCII 161 // checks in the regexes below 162 if (domain.length() > MAX_DOMAIN_LENGTH) { 163 return false; 164 } 140 165 String[] groups = domainRegex.match(domain); 141 166 if (groups != null && groups.length > 0) { 142 167 return isValidTld(groups[0]); 143 } else if (allowLocal) {144 if (hostnameRegex.isValid(domain)) {145 return true;146 }147 168 } 148 return false; 169 return allowLocal && hostnameRegex.isValid(domain); 170 } 171 172 // package protected for unit test access 173 // must agree with isValid() above 174 boolean isValidDomainSyntax(String domain) { 175 if (domain == null) { 176 return false; 177 } 178 domain = unicodeToASCII(domain); 179 // hosts must be equally reachable via punycode and Unicode 180 // Unicode is never shorter than punycode, so check punycode 181 // if domain did not convert, then it will be caught by ASCII 182 // checks in the regexes below 183 if (domain.length() > MAX_DOMAIN_LENGTH) { 184 return false; 185 } 186 String[] groups = domainRegex.match(domain); 187 return (groups != null && groups.length > 0) 188 || hostnameRegex.isValid(domain); 149 189 } 150 190 … … 152 192 * Returns true if the specified <code>String</code> matches any 153 193 * IANA-defined top-level domain. Leading dots are ignored if present. 154 * The search is case- sensitive.155 * @param tld the parameter to check for TLD status 194 * The search is case-insensitive. 195 * @param tld the parameter to check for TLD status, not null 156 196 * @return true if the parameter is a TLD 157 197 */ 158 198 public boolean isValidTld(String tld) { 199 tld = unicodeToASCII(tld); 159 200 if (allowLocal && isValidLocalTld(tld)) { 160 return true;201 return true; 161 202 } 162 203 return isValidInfrastructureTld(tld) 163 204 || isValidGenericTld(tld) 164 || isValidIdnTld(tld)165 205 || isValidCountryCodeTld(tld); 166 206 } … … 169 209 * Returns true if the specified <code>String</code> matches any 170 210 * IANA-defined infrastructure top-level domain. Leading dots are 171 * ignored if present. The search is case- sensitive.172 * @param iTld the parameter to check for infrastructure TLD status 211 * ignored if present. The search is case-insensitive. 212 * @param iTld the parameter to check for infrastructure TLD status, not null 173 213 * @return true if the parameter is an infrastructure TLD 174 214 */ 175 215 public boolean isValidInfrastructureTld(String iTld) { 176 return Arrays.binarySearch(INFRASTRUCTURE_TLDS, chompLeadingDot(iTld.toLowerCase(Locale.ENGLISH))) >= 0; 216 final String key = chompLeadingDot(unicodeToASCII(iTld).toLowerCase(Locale.ENGLISH)); 217 return arrayContains(INFRASTRUCTURE_TLDS, key); 177 218 } 178 219 … … 180 221 * Returns true if the specified <code>String</code> matches any 181 222 * IANA-defined generic top-level domain. Leading dots are ignored 182 * if present. The search is case- sensitive.183 * @param gTld the parameter to check for generic TLD status 223 * if present. The search is case-insensitive. 224 * @param gTld the parameter to check for generic TLD status, not null 184 225 * @return true if the parameter is a generic TLD 185 226 */ 186 227 public boolean isValidGenericTld(String gTld) { 187 return Arrays.binarySearch(GENERIC_TLDS, chompLeadingDot(gTld.toLowerCase(Locale.ENGLISH))) >= 0; 188 } 189 190 /** 191 * Returns true if the specified <code>String</code> matches any 192 * IANA-defined IDN top-level domain. Leading dots are ignored 193 * if present. The search is case-sensitive. 194 * @param iTld the parameter to check for IDN TLD status 195 * @return true if the parameter is an IDN TLD 196 */ 197 public boolean isValidIdnTld(String iTld) { 198 return Arrays.binarySearch(IDN_TLDS, chompLeadingDot(iTld.toUpperCase(Locale.ENGLISH))) >= 0; 228 final String key = chompLeadingDot(unicodeToASCII(gTld).toLowerCase(Locale.ENGLISH)); 229 return (arrayContains(GENERIC_TLDS, key) || arrayContains(genericTLDsPlus, key)) 230 && !arrayContains(genericTLDsMinus, key); 199 231 } 200 232 … … 202 234 * Returns true if the specified <code>String</code> matches any 203 235 * IANA-defined country code top-level domain. Leading dots are 204 * ignored if present. The search is case- sensitive.205 * @param ccTld the parameter to check for country code TLD status 236 * ignored if present. The search is case-insensitive. 237 * @param ccTld the parameter to check for country code TLD status, not null 206 238 * @return true if the parameter is a country code TLD 207 239 */ 208 240 public boolean isValidCountryCodeTld(String ccTld) { 209 return Arrays.binarySearch(COUNTRY_CODE_TLDS, chompLeadingDot(ccTld.toLowerCase(Locale.ENGLISH))) >= 0; 241 final String key = chompLeadingDot(unicodeToASCII(ccTld).toLowerCase(Locale.ENGLISH)); 242 return (arrayContains(COUNTRY_CODE_TLDS, key) || arrayContains(countryCodeTLDsPlus, key)) 243 && !arrayContains(countryCodeTLDsMinus, key); 210 244 } 211 245 … … 213 247 * Returns true if the specified <code>String</code> matches any 214 248 * widely used "local" domains (localhost or localdomain). Leading dots are 215 * ignored if present. The search is case-sensitive.216 * @param iTld the parameter to check for local TLD status249 * ignored if present. The search is case-insensitive. 250 * @param lTld the parameter to check for local TLD status, not null 217 251 * @return true if the parameter is an local TLD 218 252 */ 219 public boolean isValidLocalTld(String iTld) { 220 return Arrays.binarySearch(LOCAL_TLDS, chompLeadingDot(iTld.toLowerCase(Locale.ENGLISH))) >= 0; 253 public boolean isValidLocalTld(String lTld) { 254 final String key = chompLeadingDot(unicodeToASCII(lTld).toLowerCase(Locale.ENGLISH)); 255 return arrayContains(LOCAL_TLDS, key); 221 256 } 222 257 … … 224 259 if (str.startsWith(".")) { 225 260 return str.substring(1); 226 } else {227 return str;228 261 } 262 return str; 229 263 } 230 264 … … 234 268 // ----- http://data.iana.org/TLD/tlds-alpha-by-domain.txt 235 269 270 // Note that the above list is in UPPER case. 271 // The code currently converts strings to lower case (as per the tables below) 272 273 // IANA also provide an HTML list at http://www.iana.org/domains/root/db 274 // Note that this contains several country code entries which are NOT in 275 // the text file. These all have the "Not assigned" in the "Sponsoring Organisation" column 276 // For example (as of 2015-01-02): 277 // .bl country-code Not assigned 278 // .um country-code Not assigned 279 280 // WARNING: this array MUST be sorted, otherwise it cannot be searched reliably using binary search 236 281 private static final String[] INFRASTRUCTURE_TLDS = new String[] { 237 282 "arpa", // internet infrastructure 238 "root" // diagnostic marker for non-truncated root zone239 283 }; 240 284 285 // WARNING: this array MUST be sorted, otherwise it cannot be searched reliably using binary search 241 286 private static final String[] GENERIC_TLDS = new String[] { 242 "abogado", 243 "academy", 244 "accountants", 245 "active", 246 "actor", 247 "aero", 248 "agency", 249 "airforce", 250 "allfinanz", 251 "alsace", 252 "archi", 253 "army", 254 "arpa", 255 "asia", 256 "associates", 257 "attorney", 258 "auction", 259 "audio", 260 "autos", 261 "axa", 262 "band", 263 "bar", 264 "bargains", 265 "bayern", 266 "beer", 267 "berlin", 268 "best", 269 "bid", 270 "bike", 271 "bio", 272 "biz", 273 "black", 274 "blackfriday", 275 "blue", 276 "bmw", 277 "bnpparibas", 278 "boo", 279 "boutique", 280 "brussels", 281 "budapest", 282 "build", 283 "builders", 284 "business", 285 "buzz", 286 "bzh", 287 "cab", 288 "cal", 289 "camera", 290 "camp", 291 "cancerresearch", 292 "capetown", 293 "capital", 294 "caravan", 295 "cards", 296 "care", 297 "career", 298 "careers", 299 "casa", 300 "cash", 301 "cat", 302 "catering", 303 "center", 304 "ceo", 305 "cern", 306 "channel", 307 "cheap", 308 "christmas", 309 "chrome", 310 "church", 311 "citic", 312 "city", 313 "claims", 314 "cleaning", 315 "click", 316 "clinic", 317 "clothing", 318 "club", 319 "codes", 320 "coffee", 321 "college", 322 "cologne", 323 "com", 324 "community", 325 "company", 326 "computer", 327 "condos", 328 "construction", 329 "consulting", 330 "contractors", 331 "cooking", 332 "cool", 333 "coop", 334 "country", 335 "credit", 336 "creditcard", 337 "crs", 338 "cruises", 339 "cuisinella", 340 "cymru", 341 "dad", 342 "dance", 343 "dating", 344 "day", 345 "deals", 346 "degree", 347 "democrat", 348 "dental", 349 "dentist", 350 "desi", 351 "diamonds", 352 "diet", 353 "digital", 354 "direct", 355 "directory", 356 "discount", 357 "dnp", 358 "domains", 359 "durban", 360 "dvag", 361 "eat", 362 "edu", 363 "education", 364 "email", 365 "engineer", 366 "engineering", 367 "enterprises", 368 "equipment", 369 "esq", 370 "estate", 371 "eus", 372 "events", 373 "exchange", 374 "expert", 375 "exposed", 376 "fail", 377 "farm", 378 "feedback", 379 "finance", 380 "financial", 381 "fish", 382 "fishing", 383 "fitness", 384 "flights", 385 "florist", 386 "flsmidth", 387 "fly", 388 "foo", 389 "forsale", 390 "foundation", 391 "frl", 392 "frogans", 393 "fund", 394 "furniture", 395 "futbol", 396 "gal", 397 "gallery", 398 "gbiz", 399 "gent", 400 "gift", 401 "gifts", 402 "gives", 403 "glass", 404 "gle", 405 "global", 406 "globo", 407 "gmail", 408 "gmo", 409 "gmx", 410 "google", 411 "gop", 412 "gov", 413 "graphics", 414 "gratis", 415 "green", 416 "gripe", 417 "guide", 418 "guitars", 419 "guru", 420 "hamburg", 421 "haus", 422 "healthcare", 423 "help", 424 "here", 425 "hiphop", 426 "hiv", 427 "holdings", 428 "holiday", 429 "homes", 430 "horse", 431 "host", 432 "hosting", 433 "house", 434 "how", 435 "ibm", 436 "immo", 437 "immobilien", 438 "industries", 439 "info", 440 "ing", 441 "ink", 442 "institute", 443 "insure", 444 "int", 445 "international", 446 "investments", 447 "jetzt", 448 "jobs", 449 "joburg", 450 "juegos", 451 "kaufen", 452 "kim", 453 "kitchen", 454 "kiwi", 455 "koeln", 456 "krd", 457 "kred", 458 "lacaixa", 459 "land", 460 "lawyer", 461 "lease", 462 "lgbt", 463 "life", 464 "lighting", 465 "limited", 466 "limo", 467 "link", 468 "loans", 469 "london", 470 "lotto", 471 "ltda", 472 "luxe", 473 "luxury", 474 "maison", 475 "management", 476 "mango", 477 "market", 478 "marketing", 479 "media", 480 "meet", 481 "melbourne", 482 "meme", 483 "menu", 484 "miami", 485 "mil", 486 "mini", 487 "mobi", 488 "moda", 489 "moe", 490 "monash", 491 "mortgage", 492 "moscow", 493 "motorcycles", 494 "mov", 495 "museum", 496 "nagoya", 497 "name", 498 "navy", 499 "net", 500 "network", 501 "neustar", 502 "new", 503 "nexus", 504 "ngo", 505 "nhk", 506 "ninja", 507 "nra", 508 "nrw", 509 "nyc", 510 "okinawa", 511 "ong", 512 "onl", 513 "ooo", 514 "org", 515 "organic", 516 "otsuka", 517 "ovh", 518 "paris", 519 "partners", 520 "parts", 521 "pharmacy", 522 "photo", 523 "photography", 524 "photos", 525 "physio", 526 "pics", 527 "pictures", 528 "pink", 529 "pizza", 530 "place", 531 "plumbing", 532 "pohl", 533 "poker", 534 "post", 535 "praxi", 536 "press", 537 "pro", 538 "prod", 539 "productions", 540 "prof", 541 "properties", 542 "property", 543 "pub", 544 "qpon", 545 "quebec", 546 "realtor", 547 "recipes", 548 "red", 549 "rehab", 550 "reise", 551 "reisen", 552 "ren", 553 "rentals", 554 "repair", 555 "report", 556 "republican", 557 "rest", 558 "restaurant", 559 "reviews", 560 "rich", 561 "rio", 562 "rip", 563 "rocks", 564 "rodeo", 565 "rsvp", 566 "ruhr", 567 "ryukyu", 568 "saarland", 569 "sarl", 570 "sca", 571 "scb", 572 "schmidt", 573 "schule", 574 "scot", 575 "services", 576 "sexy", 577 "shiksha", 578 "shoes", 579 "singles", 580 "social", 581 "software", 582 "sohu", 583 "solar", 584 "solutions", 585 "soy", 586 "space", 587 "spiegel", 588 "supplies", 589 "supply", 590 "support", 591 "surf", 592 "surgery", 593 "suzuki", 594 "systems", 595 "tatar", 596 "tattoo", 597 "tax", 598 "technology", 599 "tel", 600 "tienda", 601 "tips", 602 "tirol", 603 "today", 604 "tokyo", 605 "tools", 606 "top", 607 "town", 608 "toys", 609 "trade", 610 "training", 611 "travel", 612 "tui", 613 "university", 614 "uno", 615 "uol", 616 "vacations", 617 "vegas", 618 "ventures", 619 "versicherung", 620 "vet", 621 "viajes", 622 "villas", 623 "vision", 624 "vlaanderen", 625 "vodka", 626 "vote", 627 "voting", 628 "voto", 629 "voyage", 630 "wales", 631 "wang", 632 "watch", 633 "webcam", 634 "website", 635 "wed", 636 "wedding", 637 "whoswho", 638 "wien", 639 "wiki", 640 "williamhill", 641 "wme", 642 "work", 643 "works", 644 "world", 645 "wtc", 646 "wtf", 647 "xxx", 648 "xyz", 649 "yachts", 650 "yandex", 651 "yoga", 652 "yokohama", 653 "youtube", 654 "zip", 655 "zone", 287 // Taken from Version 2016011900, Last Updated Tue Jan 19 07:07:02 2016 UTC 288 "aaa", // aaa American Automobile Association, Inc. 289 "aarp", // aarp AARP 290 "abb", // abb ABB Ltd 291 "abbott", // abbott Abbott Laboratories, Inc. 292 "abogado", // abogado Top Level Domain Holdings Limited 293 "academy", // academy Half Oaks, LLC 294 "accenture", // accenture Accenture plc 295 "accountant", // accountant dot Accountant Limited 296 "accountants", // accountants Knob Town, LLC 297 "aco", // aco ACO Severin Ahlmann GmbH & Co. KG 298 "active", // active The Active Network, Inc 299 "actor", // actor United TLD Holdco Ltd. 300 "adac", // adac Allgemeiner Deutscher Automobil-Club e.V. (ADAC) 301 "ads", // ads Charleston Road Registry Inc. 302 "adult", // adult ICM Registry AD LLC 303 "aeg", // aeg Aktiebolaget Electrolux 304 "aero", // aero Societe Internationale de Telecommunications Aeronautique (SITA INC USA) 305 "afl", // afl Australian Football League 306 "agency", // agency Steel Falls, LLC 307 "aig", // aig American International Group, Inc. 308 "airforce", // airforce United TLD Holdco Ltd. 309 "airtel", // airtel Bharti Airtel Limited 310 "alibaba", // alibaba Alibaba Group Holding Limited 311 "alipay", // alipay Alibaba Group Holding Limited 312 "allfinanz", // allfinanz Allfinanz Deutsche Vermögensberatung Aktiengesellschaft 313 "alsace", // alsace REGION D ALSACE 314 "amica", // amica Amica Mutual Insurance Company 315 "amsterdam", // amsterdam Gemeente Amsterdam 316 "analytics", // analytics Campus IP LLC 317 "android", // android Charleston Road Registry Inc. 318 "apartments", // apartments June Maple, LLC 319 "app", // app Charleston Road Registry Inc. 320 "apple", // apple Apple Inc. 321 "aquarelle", // aquarelle Aquarelle.com 322 "aramco", // aramco Aramco Services Company 323 "archi", // archi STARTING DOT LIMITED 324 "army", // army United TLD Holdco Ltd. 325 "arte", // arte Association Relative à la Télévision Européenne G.E.I.E. 326 "asia", // asia DotAsia Organisation Ltd. 327 "associates", // associates Baxter Hill, LLC 328 "attorney", // attorney United TLD Holdco, Ltd 329 "auction", // auction United TLD HoldCo, Ltd. 330 "audi", // audi AUDI Aktiengesellschaft 331 "audio", // audio Uniregistry, Corp. 332 "author", // author Amazon Registry Services, Inc. 333 "auto", // auto Uniregistry, Corp. 334 "autos", // autos DERAutos, LLC 335 "axa", // axa AXA SA 336 "azure", // azure Microsoft Corporation 337 "baidu", // baidu Baidu, Inc. 338 "band", // band United TLD Holdco, Ltd 339 "bank", // bank fTLD Registry Services, LLC 340 "bar", // bar Punto 2012 Sociedad Anonima Promotora de Inversion de Capital Variable 341 "barcelona", // barcelona Municipi de Barcelona 342 "barclaycard", // barclaycard Barclays Bank PLC 343 "barclays", // barclays Barclays Bank PLC 344 "bargains", // bargains Half Hallow, LLC 345 "bauhaus", // bauhaus Werkhaus GmbH 346 "bayern", // bayern Bayern Connect GmbH 347 "bbc", // bbc British Broadcasting Corporation 348 "bbva", // bbva BANCO BILBAO VIZCAYA ARGENTARIA, S.A. 349 "bcn", // bcn Municipi de Barcelona 350 "beats", // beats Beats Electronics, LLC 351 "beer", // beer Top Level Domain Holdings Limited 352 "bentley", // bentley Bentley Motors Limited 353 "berlin", // berlin dotBERLIN GmbH & Co. KG 354 "best", // best BestTLD Pty Ltd 355 "bet", // bet Afilias plc 356 "bharti", // bharti Bharti Enterprises (Holding) Private Limited 357 "bible", // bible American Bible Society 358 "bid", // bid dot Bid Limited 359 "bike", // bike Grand Hollow, LLC 360 "bing", // bing Microsoft Corporation 361 "bingo", // bingo Sand Cedar, LLC 362 "bio", // bio STARTING DOT LIMITED 363 "biz", // biz Neustar, Inc. 364 "black", // black Afilias Limited 365 "blackfriday", // blackfriday Uniregistry, Corp. 366 "bloomberg", // bloomberg Bloomberg IP Holdings LLC 367 "blue", // blue Afilias Limited 368 "bms", // bms Bristol-Myers Squibb Company 369 "bmw", // bmw Bayerische Motoren Werke Aktiengesellschaft 370 "bnl", // bnl Banca Nazionale del Lavoro 371 "bnpparibas", // bnpparibas BNP Paribas 372 "boats", // boats DERBoats, LLC 373 "boehringer", // boehringer Boehringer Ingelheim International GmbH 374 "bom", // bom Núcleo de Informação e Coordenação do Ponto BR - NIC.br 375 "bond", // bond Bond University Limited 376 "boo", // boo Charleston Road Registry Inc. 377 "book", // book Amazon Registry Services, Inc. 378 "boots", // boots THE BOOTS COMPANY PLC 379 "bosch", // bosch Robert Bosch GMBH 380 "bostik", // bostik Bostik SA 381 "bot", // bot Amazon Registry Services, Inc. 382 "boutique", // boutique Over Galley, LLC 383 "bradesco", // bradesco Banco Bradesco S.A. 384 "bridgestone", // bridgestone Bridgestone Corporation 385 "broadway", // broadway Celebrate Broadway, Inc. 386 "broker", // broker DOTBROKER REGISTRY LTD 387 "brother", // brother Brother Industries, Ltd. 388 "brussels", // brussels DNS.be vzw 389 "budapest", // budapest Top Level Domain Holdings Limited 390 "bugatti", // bugatti Bugatti International SA 391 "build", // build Plan Bee LLC 392 "builders", // builders Atomic Madison, LLC 393 "business", // business Spring Cross, LLC 394 "buy", // buy Amazon Registry Services, INC 395 "buzz", // buzz DOTSTRATEGY CO. 396 "bzh", // bzh Association www.bzh 397 "cab", // cab Half Sunset, LLC 398 "cafe", // cafe Pioneer Canyon, LLC 399 "cal", // cal Charleston Road Registry Inc. 400 "call", // call Amazon Registry Services, Inc. 401 "camera", // camera Atomic Maple, LLC 402 "camp", // camp Delta Dynamite, LLC 403 "cancerresearch", // cancerresearch Australian Cancer Research Foundation 404 "canon", // canon Canon Inc. 405 "capetown", // capetown ZA Central Registry NPC trading as ZA Central Registry 406 "capital", // capital Delta Mill, LLC 407 "car", // car Cars Registry Limited 408 "caravan", // caravan Caravan International, Inc. 409 "cards", // cards Foggy Hollow, LLC 410 "care", // care Goose Cross, LLC 411 "career", // career dotCareer LLC 412 "careers", // careers Wild Corner, LLC 413 "cars", // cars Uniregistry, Corp. 414 "cartier", // cartier Richemont DNS Inc. 415 "casa", // casa Top Level Domain Holdings Limited 416 "cash", // cash Delta Lake, LLC 417 "casino", // casino Binky Sky, LLC 418 "cat", // cat Fundacio puntCAT 419 "catering", // catering New Falls. LLC 420 "cba", // cba COMMONWEALTH BANK OF AUSTRALIA 421 "cbn", // cbn The Christian Broadcasting Network, Inc. 422 "ceb", // ceb The Corporate Executive Board Company 423 "center", // center Tin Mill, LLC 424 "ceo", // ceo CEOTLD Pty Ltd 425 "cern", // cern European Organization for Nuclear Research ("CERN") 426 "cfa", // cfa CFA Institute 427 "cfd", // cfd DOTCFD REGISTRY LTD 428 "chanel", // chanel Chanel International B.V. 429 "channel", // channel Charleston Road Registry Inc. 430 "chat", // chat Sand Fields, LLC 431 "cheap", // cheap Sand Cover, LLC 432 "chloe", // chloe Richemont DNS Inc. 433 "christmas", // christmas Uniregistry, Corp. 434 "chrome", // chrome Charleston Road Registry Inc. 435 "church", // church Holly Fileds, LLC 436 "cipriani", // cipriani Hotel Cipriani Srl 437 "circle", // circle Amazon Registry Services, Inc. 438 "cisco", // cisco Cisco Technology, Inc. 439 "citic", // citic CITIC Group Corporation 440 "city", // city Snow Sky, LLC 441 "cityeats", // cityeats Lifestyle Domain Holdings, Inc. 442 "claims", // claims Black Corner, LLC 443 "cleaning", // cleaning Fox Shadow, LLC 444 "click", // click Uniregistry, Corp. 445 "clinic", // clinic Goose Park, LLC 446 "clinique", // clinique The Estée Lauder Companies Inc. 447 "clothing", // clothing Steel Lake, LLC 448 "cloud", // cloud ARUBA S.p.A. 449 "club", // club .CLUB DOMAINS, LLC 450 "clubmed", // clubmed Club Méditerranée S.A. 451 "coach", // coach Koko Island, LLC 452 "codes", // codes Puff Willow, LLC 453 "coffee", // coffee Trixy Cover, LLC 454 "college", // college XYZ.COM LLC 455 "cologne", // cologne NetCologne Gesellschaft für Telekommunikation mbH 456 "com", // com VeriSign Global Registry Services 457 "commbank", // commbank COMMONWEALTH BANK OF AUSTRALIA 458 "community", // community Fox Orchard, LLC 459 "company", // company Silver Avenue, LLC 460 "compare", // compare iSelect Ltd 461 "computer", // computer Pine Mill, LLC 462 "comsec", // comsec VeriSign, Inc. 463 "condos", // condos Pine House, LLC 464 "construction", // construction Fox Dynamite, LLC 465 "consulting", // consulting United TLD Holdco, LTD. 466 "contact", // contact Top Level Spectrum, Inc. 467 "contractors", // contractors Magic Woods, LLC 468 "cooking", // cooking Top Level Domain Holdings Limited 469 "cool", // cool Koko Lake, LLC 470 "coop", // coop DotCooperation LLC 471 "corsica", // corsica Collectivité Territoriale de Corse 472 "country", // country Top Level Domain Holdings Limited 473 "coupon", // coupon Amazon Registry Services, Inc. 474 "coupons", // coupons Black Island, LLC 475 "courses", // courses OPEN UNIVERSITIES AUSTRALIA PTY LTD 476 "credit", // credit Snow Shadow, LLC 477 "creditcard", // creditcard Binky Frostbite, LLC 478 "creditunion", // creditunion CUNA Performance Resources, LLC 479 "cricket", // cricket dot Cricket Limited 480 "crown", // crown Crown Equipment Corporation 481 "crs", // crs Federated Co-operatives Limited 482 "cruises", // cruises Spring Way, LLC 483 "csc", // csc Alliance-One Services, Inc. 484 "cuisinella", // cuisinella SALM S.A.S. 485 "cymru", // cymru Nominet UK 486 "cyou", // cyou Beijing Gamease Age Digital Technology Co., Ltd. 487 "dabur", // dabur Dabur India Limited 488 "dad", // dad Charleston Road Registry Inc. 489 "dance", // dance United TLD Holdco Ltd. 490 "date", // date dot Date Limited 491 "dating", // dating Pine Fest, LLC 492 "datsun", // datsun NISSAN MOTOR CO., LTD. 493 "day", // day Charleston Road Registry Inc. 494 "dclk", // dclk Charleston Road Registry Inc. 495 "dealer", // dealer Dealer Dot Com, Inc. 496 "deals", // deals Sand Sunset, LLC 497 "degree", // degree United TLD Holdco, Ltd 498 "delivery", // delivery Steel Station, LLC 499 "dell", // dell Dell Inc. 500 "deloitte", // deloitte Deloitte Touche Tohmatsu 501 "delta", // delta Delta Air Lines, Inc. 502 "democrat", // democrat United TLD Holdco Ltd. 503 "dental", // dental Tin Birch, LLC 504 "dentist", // dentist United TLD Holdco, Ltd 505 "desi", // desi Desi Networks LLC 506 "design", // design Top Level Design, LLC 507 "dev", // dev Charleston Road Registry Inc. 508 "diamonds", // diamonds John Edge, LLC 509 "diet", // diet Uniregistry, Corp. 510 "digital", // digital Dash Park, LLC 511 "direct", // direct Half Trail, LLC 512 "directory", // directory Extra Madison, LLC 513 "discount", // discount Holly Hill, LLC 514 "dnp", // dnp Dai Nippon Printing Co., Ltd. 515 "docs", // docs Charleston Road Registry Inc. 516 "dog", // dog Koko Mill, LLC 517 "doha", // doha Communications Regulatory Authority (CRA) 518 "domains", // domains Sugar Cross, LLC 519 "doosan", // doosan Doosan Corporation 520 "download", // download dot Support Limited 521 "drive", // drive Charleston Road Registry Inc. 522 "dubai", // dubai Dubai Smart Government Department 523 "durban", // durban ZA Central Registry NPC trading as ZA Central Registry 524 "dvag", // dvag Deutsche Vermögensberatung Aktiengesellschaft DVAG 525 "earth", // earth Interlink Co., Ltd. 526 "eat", // eat Charleston Road Registry Inc. 527 "edeka", // edeka EDEKA Verband kaufmännischer Genossenschaften e.V. 528 "edu", // edu EDUCAUSE 529 "education", // education Brice Way, LLC 530 "email", // email Spring Madison, LLC 531 "emerck", // emerck Merck KGaA 532 "energy", // energy Binky Birch, LLC 533 "engineer", // engineer United TLD Holdco Ltd. 534 "engineering", // engineering Romeo Canyon 535 "enterprises", // enterprises Snow Oaks, LLC 536 "epson", // epson Seiko Epson Corporation 537 "equipment", // equipment Corn Station, LLC 538 "erni", // erni ERNI Group Holding AG 539 "esq", // esq Charleston Road Registry Inc. 540 "estate", // estate Trixy Park, LLC 541 "eurovision", // eurovision European Broadcasting Union (EBU) 542 "eus", // eus Puntueus Fundazioa 543 "events", // events Pioneer Maple, LLC 544 "everbank", // everbank EverBank 545 "exchange", // exchange Spring Falls, LLC 546 "expert", // expert Magic Pass, LLC 547 "exposed", // exposed Victor Beach, LLC 548 "express", // express Sea Sunset, LLC 549 "fage", // fage Fage International S.A. 550 "fail", // fail Atomic Pipe, LLC 551 "fairwinds", // fairwinds FairWinds Partners, LLC 552 "faith", // faith dot Faith Limited 553 "family", // family United TLD Holdco Ltd. 554 "fan", // fan Asiamix Digital Ltd 555 "fans", // fans Asiamix Digital Limited 556 "farm", // farm Just Maple, LLC 557 "fashion", // fashion Top Level Domain Holdings Limited 558 "fast", // fast Amazon Registry Services, Inc. 559 "feedback", // feedback Top Level Spectrum, Inc. 560 "ferrero", // ferrero Ferrero Trading Lux S.A. 561 "film", // film Motion Picture Domain Registry Pty Ltd 562 "final", // final Núcleo de Informação e Coordenação do Ponto BR - NIC.br 563 "finance", // finance Cotton Cypress, LLC 564 "financial", // financial Just Cover, LLC 565 "firestone", // firestone Bridgestone Corporation 566 "firmdale", // firmdale Firmdale Holdings Limited 567 "fish", // fish Fox Woods, LLC 568 "fishing", // fishing Top Level Domain Holdings Limited 569 "fit", // fit Minds + Machines Group Limited 570 "fitness", // fitness Brice Orchard, LLC 571 "flickr", // flickr Yahoo! Domain Services Inc. 572 "flights", // flights Fox Station, LLC 573 "florist", // florist Half Cypress, LLC 574 "flowers", // flowers Uniregistry, Corp. 575 "flsmidth", // flsmidth FLSmidth A/S 576 "fly", // fly Charleston Road Registry Inc. 577 "foo", // foo Charleston Road Registry Inc. 578 "football", // football Foggy Farms, LLC 579 "ford", // ford Ford Motor Company 580 "forex", // forex DOTFOREX REGISTRY LTD 581 "forsale", // forsale United TLD Holdco, LLC 582 "forum", // forum Fegistry, LLC 583 "foundation", // foundation John Dale, LLC 584 "fox", // fox FOX Registry, LLC 585 "fresenius", // fresenius Fresenius Immobilien-Verwaltungs-GmbH 586 "frl", // frl FRLregistry B.V. 587 "frogans", // frogans OP3FT 588 "frontier", // frontier Frontier Communications Corporation 589 "fund", // fund John Castle, LLC 590 "furniture", // furniture Lone Fields, LLC 591 "futbol", // futbol United TLD Holdco, Ltd. 592 "fyi", // fyi Silver Tigers, LLC 593 "gal", // gal Asociación puntoGAL 594 "gallery", // gallery Sugar House, LLC 595 "gallup", // gallup Gallup, Inc. 596 "game", // game Uniregistry, Corp. 597 "garden", // garden Top Level Domain Holdings Limited 598 "gbiz", // gbiz Charleston Road Registry Inc. 599 "gdn", // gdn Joint Stock Company "Navigation-information systems" 600 "gea", // gea GEA Group Aktiengesellschaft 601 "gent", // gent COMBELL GROUP NV/SA 602 "genting", // genting Resorts World Inc. Pte. Ltd. 603 "ggee", // ggee GMO Internet, Inc. 604 "gift", // gift Uniregistry, Corp. 605 "gifts", // gifts Goose Sky, LLC 606 "gives", // gives United TLD Holdco Ltd. 607 "giving", // giving Giving Limited 608 "glass", // glass Black Cover, LLC 609 "gle", // gle Charleston Road Registry Inc. 610 "global", // global Dot Global Domain Registry Limited 611 "globo", // globo Globo Comunicação e Participações S.A 612 "gmail", // gmail Charleston Road Registry Inc. 613 "gmo", // gmo GMO Internet, Inc. 614 "gmx", // gmx 1&1 Mail & Media GmbH 615 "gold", // gold June Edge, LLC 616 "goldpoint", // goldpoint YODOBASHI CAMERA CO.,LTD. 617 "golf", // golf Lone Falls, LLC 618 "goo", // goo NTT Resonant Inc. 619 "goog", // goog Charleston Road Registry Inc. 620 "google", // google Charleston Road Registry Inc. 621 "gop", // gop Republican State Leadership Committee, Inc. 622 "got", // got Amazon Registry Services, Inc. 623 "gov", // gov General Services Administration Attn: QTDC, 2E08 (.gov Domain Registration) 624 "grainger", // grainger Grainger Registry Services, LLC 625 "graphics", // graphics Over Madison, LLC 626 "gratis", // gratis Pioneer Tigers, LLC 627 "green", // green Afilias Limited 628 "gripe", // gripe Corn Sunset, LLC 629 "group", // group Romeo Town, LLC 630 "gucci", // gucci Guccio Gucci S.p.a. 631 "guge", // guge Charleston Road Registry Inc. 632 "guide", // guide Snow Moon, LLC 633 "guitars", // guitars Uniregistry, Corp. 634 "guru", // guru Pioneer Cypress, LLC 635 "hamburg", // hamburg Hamburg Top-Level-Domain GmbH 636 "hangout", // hangout Charleston Road Registry Inc. 637 "haus", // haus United TLD Holdco, LTD. 638 "hdfcbank", // hdfcbank HDFC Bank Limited 639 "health", // health DotHealth, LLC 640 "healthcare", // healthcare Silver Glen, LLC 641 "help", // help Uniregistry, Corp. 642 "helsinki", // helsinki City of Helsinki 643 "here", // here Charleston Road Registry Inc. 644 "hermes", // hermes Hermes International 645 "hiphop", // hiphop Uniregistry, Corp. 646 "hitachi", // hitachi Hitachi, Ltd. 647 "hiv", // hiv dotHIV gemeinnuetziger e.V. 648 "hockey", // hockey Half Willow, LLC 649 "holdings", // holdings John Madison, LLC 650 "holiday", // holiday Goose Woods, LLC 651 "homedepot", // homedepot Homer TLC, Inc. 652 "homes", // homes DERHomes, LLC 653 "honda", // honda Honda Motor Co., Ltd. 654 "horse", // horse Top Level Domain Holdings Limited 655 "host", // host DotHost Inc. 656 "hosting", // hosting Uniregistry, Corp. 657 "hoteles", // hoteles Travel Reservations SRL 658 "hotmail", // hotmail Microsoft Corporation 659 "house", // house Sugar Park, LLC 660 "how", // how Charleston Road Registry Inc. 661 "hsbc", // hsbc HSBC Holdings PLC 662 "hyundai", // hyundai Hyundai Motor Company 663 "ibm", // ibm International Business Machines Corporation 664 "icbc", // icbc Industrial and Commercial Bank of China Limited 665 "ice", // ice IntercontinentalExchange, Inc. 666 "icu", // icu One.com A/S 667 "ifm", // ifm ifm electronic gmbh 668 "iinet", // iinet Connect West Pty. Ltd. 669 "immo", // immo Auburn Bloom, LLC 670 "immobilien", // immobilien United TLD Holdco Ltd. 671 "industries", // industries Outer House, LLC 672 "infiniti", // infiniti NISSAN MOTOR CO., LTD. 673 "info", // info Afilias Limited 674 "ing", // ing Charleston Road Registry Inc. 675 "ink", // ink Top Level Design, LLC 676 "institute", // institute Outer Maple, LLC 677 "insurance", // insurance fTLD Registry Services LLC 678 "insure", // insure Pioneer Willow, LLC 679 "int", // int Internet Assigned Numbers Authority 680 "international", // international Wild Way, LLC 681 "investments", // investments Holly Glen, LLC 682 "ipiranga", // ipiranga Ipiranga Produtos de Petroleo S.A. 683 "irish", // irish Dot-Irish LLC 684 "iselect", // iselect iSelect Ltd 685 "ist", // ist Istanbul Metropolitan Municipality 686 "istanbul", // istanbul Istanbul Metropolitan Municipality / Medya A.S. 687 "itau", // itau Itau Unibanco Holding S.A. 688 "iwc", // iwc Richemont DNS Inc. 689 "jaguar", // jaguar Jaguar Land Rover Ltd 690 "java", // java Oracle Corporation 691 "jcb", // jcb JCB Co., Ltd. 692 "jetzt", // jetzt New TLD Company AB 693 "jewelry", // jewelry Wild Bloom, LLC 694 "jlc", // jlc Richemont DNS Inc. 695 "jll", // jll Jones Lang LaSalle Incorporated 696 "jmp", // jmp Matrix IP LLC 697 "jobs", // jobs Employ Media LLC 698 "joburg", // joburg ZA Central Registry NPC trading as ZA Central Registry 699 "jot", // jot Amazon Registry Services, Inc. 700 "joy", // joy Amazon Registry Services, Inc. 701 "jprs", // jprs Japan Registry Services Co., Ltd. 702 "juegos", // juegos Uniregistry, Corp. 703 "kaufen", // kaufen United TLD Holdco Ltd. 704 "kddi", // kddi KDDI CORPORATION 705 "kfh", // kfh Kuwait Finance House 706 "kia", // kia KIA MOTORS CORPORATION 707 "kim", // kim Afilias Limited 708 "kinder", // kinder Ferrero Trading Lux S.A. 709 "kitchen", // kitchen Just Goodbye, LLC 710 "kiwi", // kiwi DOT KIWI LIMITED 711 "koeln", // koeln NetCologne Gesellschaft für Telekommunikation mbH 712 "komatsu", // komatsu Komatsu Ltd. 713 "kpn", // kpn Koninklijke KPN N.V. 714 "krd", // krd KRG Department of Information Technology 715 "kred", // kred KredTLD Pty Ltd 716 "kyoto", // kyoto Academic Institution: Kyoto Jyoho Gakuen 717 "lacaixa", // lacaixa CAIXA D'ESTALVIS I PENSIONS DE BARCELONA 718 "lamborghini", // lamborghini Automobili Lamborghini S.p.A. 719 "lamer", // lamer The Estée Lauder Companies Inc. 720 "lancaster", // lancaster LANCASTER 721 "land", // land Pine Moon, LLC 722 "landrover", // landrover Jaguar Land Rover Ltd 723 "lanxess", // lanxess LANXESS Corporation 724 "lasalle", // lasalle Jones Lang LaSalle Incorporated 725 "lat", // lat ECOM-LAC Federación de Latinoamérica y el Caribe para Internet y el Comercio Electrónico 726 "latrobe", // latrobe La Trobe University 727 "law", // law Minds + Machines Group Limited 728 "lawyer", // lawyer United TLD Holdco, Ltd 729 "lds", // lds IRI Domain Management, LLC 730 "lease", // lease Victor Trail, LLC 731 "leclerc", // leclerc A.C.D. LEC Association des Centres Distributeurs Edouard Leclerc 732 "legal", // legal Blue Falls, LLC 733 "lexus", // lexus TOYOTA MOTOR CORPORATION 734 "lgbt", // lgbt Afilias Limited 735 "liaison", // liaison Liaison Technologies, Incorporated 736 "lidl", // lidl Schwarz Domains und Services GmbH & Co. KG 737 "life", // life Trixy Oaks, LLC 738 "lifeinsurance", // lifeinsurance American Council of Life Insurers 739 "lifestyle", // lifestyle Lifestyle Domain Holdings, Inc. 740 "lighting", // lighting John McCook, LLC 741 "like", // like Amazon Registry Services, Inc. 742 "limited", // limited Big Fest, LLC 743 "limo", // limo Hidden Frostbite, LLC 744 "lincoln", // lincoln Ford Motor Company 745 "linde", // linde Linde Aktiengesellschaft 746 "link", // link Uniregistry, Corp. 747 "live", // live United TLD Holdco Ltd. 748 "living", // living Lifestyle Domain Holdings, Inc. 749 "lixil", // lixil LIXIL Group Corporation 750 "loan", // loan dot Loan Limited 751 "loans", // loans June Woods, LLC 752 "lol", // lol Uniregistry, Corp. 753 "london", // london Dot London Domains Limited 754 "lotte", // lotte Lotte Holdings Co., Ltd. 755 "lotto", // lotto Afilias Limited 756 "love", // love Merchant Law Group LLP 757 "ltd", // ltd Over Corner, LLC 758 "ltda", // ltda InterNetX Corp. 759 "lupin", // lupin LUPIN LIMITED 760 "luxe", // luxe Top Level Domain Holdings Limited 761 "luxury", // luxury Luxury Partners LLC 762 "madrid", // madrid Comunidad de Madrid 763 "maif", // maif Mutuelle Assurance Instituteur France (MAIF) 764 "maison", // maison Victor Frostbite, LLC 765 "makeup", // makeup L'Oréal 766 "man", // man MAN SE 767 "management", // management John Goodbye, LLC 768 "mango", // mango PUNTO FA S.L. 769 "market", // market Unitied TLD Holdco, Ltd 770 "marketing", // marketing Fern Pass, LLC 771 "markets", // markets DOTMARKETS REGISTRY LTD 772 "marriott", // marriott Marriott Worldwide Corporation 773 "mba", // mba Lone Hollow, LLC 774 "med", // med Medistry LLC 775 "media", // media Grand Glen, LLC 776 "meet", // meet Afilias Limited 777 "melbourne", // melbourne The Crown in right of the State of Victoria 778 "meme", // meme Charleston Road Registry Inc. 779 "memorial", // memorial Dog Beach, LLC 780 "men", // men Exclusive Registry Limited 781 "menu", // menu Wedding TLD2, LLC 782 "meo", // meo PT Comunicacoes S.A. 783 "miami", // miami Top Level Domain Holdings Limited 784 "microsoft", // microsoft Microsoft Corporation 785 "mil", // mil DoD Network Information Center 786 "mini", // mini Bayerische Motoren Werke Aktiengesellschaft 787 "mma", // mma MMA IARD 788 "mobi", // mobi Afilias Technologies Limited dba dotMobi 789 "mobily", // mobily GreenTech Consultancy Company W.L.L. 790 "moda", // moda United TLD Holdco Ltd. 791 "moe", // moe Interlink Co., Ltd. 792 "moi", // moi Amazon Registry Services, Inc. 793 "mom", // mom Uniregistry, Corp. 794 "monash", // monash Monash University 795 "money", // money Outer McCook, LLC 796 "montblanc", // montblanc Richemont DNS Inc. 797 "mormon", // mormon IRI Domain Management, LLC ("Applicant") 798 "mortgage", // mortgage United TLD Holdco, Ltd 799 "moscow", // moscow Foundation for Assistance for Internet Technologies and Infrastructure Development (FAITID) 800 "motorcycles", // motorcycles DERMotorcycles, LLC 801 "mov", // mov Charleston Road Registry Inc. 802 "movie", // movie New Frostbite, LLC 803 "movistar", // movistar Telefónica S.A. 804 "mtn", // mtn MTN Dubai Limited 805 "mtpc", // mtpc Mitsubishi Tanabe Pharma Corporation 806 "mtr", // mtr MTR Corporation Limited 807 "museum", // museum Museum Domain Management Association 808 "mutuelle", // mutuelle Fédération Nationale de la Mutualité Française 809 "nadex", // nadex Nadex Domains, Inc 810 "nagoya", // nagoya GMO Registry, Inc. 811 "name", // name VeriSign Information Services, Inc. 812 "natura", // natura NATURA COSMÉTICOS S.A. 813 "navy", // navy United TLD Holdco Ltd. 814 "nec", // nec NEC Corporation 815 "net", // net VeriSign Global Registry Services 816 "netbank", // netbank COMMONWEALTH BANK OF AUSTRALIA 817 "network", // network Trixy Manor, LLC 818 "neustar", // neustar NeuStar, Inc. 819 "new", // new Charleston Road Registry Inc. 820 "news", // news United TLD Holdco Ltd. 821 "nexus", // nexus Charleston Road Registry Inc. 822 "ngo", // ngo Public Interest Registry 823 "nhk", // nhk Japan Broadcasting Corporation (NHK) 824 "nico", // nico DWANGO Co., Ltd. 825 "nikon", // nikon NIKON CORPORATION 826 "ninja", // ninja United TLD Holdco Ltd. 827 "nissan", // nissan NISSAN MOTOR CO., LTD. 828 "nokia", // nokia Nokia Corporation 829 "norton", // norton Symantec Corporation 830 "nowruz", // nowruz Asia Green IT System Bilgisayar San. ve Tic. Ltd. Sti. 831 "nra", // nra NRA Holdings Company, INC. 832 "nrw", // nrw Minds + Machines GmbH 833 "ntt", // ntt NIPPON TELEGRAPH AND TELEPHONE CORPORATION 834 "nyc", // nyc The City of New York by and through the New York City Department of Information Technology & Telecommunications 835 "obi", // obi OBI Group Holding SE & Co. KGaA 836 "office", // office Microsoft Corporation 837 "okinawa", // okinawa BusinessRalliart inc. 838 "omega", // omega The Swatch Group Ltd 839 "one", // one One.com A/S 840 "ong", // ong Public Interest Registry 841 "onl", // onl I-REGISTRY Ltd., Niederlassung Deutschland 842 "online", // online DotOnline Inc. 843 "ooo", // ooo INFIBEAM INCORPORATION LIMITED 844 "oracle", // oracle Oracle Corporation 845 "orange", // orange Orange Brand Services Limited 846 "org", // org Public Interest Registry (PIR) 847 "organic", // organic Afilias Limited 848 "origins", // origins The Estée Lauder Companies Inc. 849 "osaka", // osaka Interlink Co., Ltd. 850 "otsuka", // otsuka Otsuka Holdings Co., Ltd. 851 "ovh", // ovh OVH SAS 852 "page", // page Charleston Road Registry Inc. 853 "pamperedchef", // pamperedchef The Pampered Chef, Ltd. 854 "panerai", // panerai Richemont DNS Inc. 855 "paris", // paris City of Paris 856 "pars", // pars Asia Green IT System Bilgisayar San. ve Tic. Ltd. Sti. 857 "partners", // partners Magic Glen, LLC 858 "parts", // parts Sea Goodbye, LLC 859 "party", // party Blue Sky Registry Limited 860 "pet", // pet Afilias plc 861 "pharmacy", // pharmacy National Association of Boards of Pharmacy 862 "philips", // philips Koninklijke Philips N.V. 863 "photo", // photo Uniregistry, Corp. 864 "photography", // photography Sugar Glen, LLC 865 "photos", // photos Sea Corner, LLC 866 "physio", // physio PhysBiz Pty Ltd 867 "piaget", // piaget Richemont DNS Inc. 868 "pics", // pics Uniregistry, Corp. 869 "pictet", // pictet Pictet Europe S.A. 870 "pictures", // pictures Foggy Sky, LLC 871 "pid", // pid Top Level Spectrum, Inc. 872 "pin", // pin Amazon Registry Services, Inc. 873 "ping", // ping Ping Registry Provider, Inc. 874 "pink", // pink Afilias Limited 875 "pizza", // pizza Foggy Moon, LLC 876 "place", // place Snow Galley, LLC 877 "play", // play Charleston Road Registry Inc. 878 "playstation", // playstation Sony Computer Entertainment Inc. 879 "plumbing", // plumbing Spring Tigers, LLC 880 "plus", // plus Sugar Mill, LLC 881 "pohl", // pohl Deutsche Vermögensberatung Aktiengesellschaft DVAG 882 "poker", // poker Afilias Domains No. 5 Limited 883 "porn", // porn ICM Registry PN LLC 884 "post", // post Universal Postal Union 885 "praxi", // praxi Praxi S.p.A. 886 "press", // press DotPress Inc. 887 "pro", // pro Registry Services Corporation dba RegistryPro 888 "prod", // prod Charleston Road Registry Inc. 889 "productions", // productions Magic Birch, LLC 890 "prof", // prof Charleston Road Registry Inc. 891 "promo", // promo Afilias plc 892 "properties", // properties Big Pass, LLC 893 "property", // property Uniregistry, Corp. 894 "protection", // protection XYZ.COM LLC 895 "pub", // pub United TLD Holdco Ltd. 896 "pwc", // pwc PricewaterhouseCoopers LLP 897 "qpon", // qpon dotCOOL, Inc. 898 "quebec", // quebec PointQuébec Inc 899 "quest", // quest Quest ION Limited 900 "racing", // racing Premier Registry Limited 901 "read", // read Amazon Registry Services, Inc. 902 "realtor", // realtor Real Estate Domains LLC 903 "realty", // realty Fegistry, LLC 904 "recipes", // recipes Grand Island, LLC 905 "red", // red Afilias Limited 906 "redstone", // redstone Redstone Haute Couture Co., Ltd. 907 "redumbrella", // redumbrella Travelers TLD, LLC 908 "rehab", // rehab United TLD Holdco Ltd. 909 "reise", // reise Foggy Way, LLC 910 "reisen", // reisen New Cypress, LLC 911 "reit", // reit National Association of Real Estate Investment Trusts, Inc. 912 "ren", // ren Beijing Qianxiang Wangjing Technology Development Co., Ltd. 913 "rent", // rent XYZ.COM LLC 914 "rentals", // rentals Big Hollow,LLC 915 "repair", // repair Lone Sunset, LLC 916 "report", // report Binky Glen, LLC 917 "republican", // republican United TLD Holdco Ltd. 918 "rest", // rest Punto 2012 Sociedad Anonima Promotora de Inversion de Capital Variable 919 "restaurant", // restaurant Snow Avenue, LLC 920 "review", // review dot Review Limited 921 "reviews", // reviews United TLD Holdco, Ltd. 922 "rexroth", // rexroth Robert Bosch GMBH 923 "rich", // rich I-REGISTRY Ltd., Niederlassung Deutschland 924 "ricoh", // ricoh Ricoh Company, Ltd. 925 "rio", // rio Empresa Municipal de Informática SA - IPLANRIO 926 "rip", // rip United TLD Holdco Ltd. 927 "rocher", // rocher Ferrero Trading Lux S.A. 928 "rocks", // rocks United TLD Holdco, LTD. 929 "rodeo", // rodeo Top Level Domain Holdings Limited 930 "room", // room Amazon Registry Services, Inc. 931 "rsvp", // rsvp Charleston Road Registry Inc. 932 "ruhr", // ruhr regiodot GmbH & Co. KG 933 "run", // run Snow Park, LLC 934 "rwe", // rwe RWE AG 935 "ryukyu", // ryukyu BusinessRalliart inc. 936 "saarland", // saarland dotSaarland GmbH 937 "safe", // safe Amazon Registry Services, Inc. 938 "safety", // safety Safety Registry Services, LLC. 939 "sakura", // sakura SAKURA Internet Inc. 940 "sale", // sale United TLD Holdco, Ltd 941 "salon", // salon Outer Orchard, LLC 942 "samsung", // samsung SAMSUNG SDS CO., LTD 943 "sandvik", // sandvik Sandvik AB 944 "sandvikcoromant", // sandvikcoromant Sandvik AB 945 "sanofi", // sanofi Sanofi 946 "sap", // sap SAP AG 947 "sapo", // sapo PT Comunicacoes S.A. 948 "sarl", // sarl Delta Orchard, LLC 949 "sas", // sas Research IP LLC 950 "saxo", // saxo Saxo Bank A/S 951 "sbs", // sbs SPECIAL BROADCASTING SERVICE CORPORATION 952 "sca", // sca SVENSKA CELLULOSA AKTIEBOLAGET SCA (publ) 953 "scb", // scb The Siam Commercial Bank Public Company Limited ("SCB") 954 "schaeffler", // schaeffler Schaeffler Technologies AG & Co. KG 955 "schmidt", // schmidt SALM S.A.S. 956 "scholarships", // scholarships Scholarships.com, LLC 957 "school", // school Little Galley, LLC 958 "schule", // schule Outer Moon, LLC 959 "schwarz", // schwarz Schwarz Domains und Services GmbH & Co. KG 960 "science", // science dot Science Limited 961 "scor", // scor SCOR SE 962 "scot", // scot Dot Scot Registry Limited 963 "seat", // seat SEAT, S.A. (Sociedad Unipersonal) 964 "security", // security XYZ.COM LLC 965 "seek", // seek Seek Limited 966 "select", // select iSelect Ltd 967 "sener", // sener Sener Ingeniería y Sistemas, S.A. 968 "services", // services Fox Castle, LLC 969 "seven", // seven Seven West Media Ltd 970 "sew", // sew SEW-EURODRIVE GmbH & Co KG 971 "sex", // sex ICM Registry SX LLC 972 "sexy", // sexy Uniregistry, Corp. 973 "sfr", // sfr Societe Francaise du Radiotelephone - SFR 974 "sharp", // sharp Sharp Corporation 975 "shell", // shell Shell Information Technology International Inc 976 "shia", // shia Asia Green IT System Bilgisayar San. ve Tic. Ltd. Sti. 977 "shiksha", // shiksha Afilias Limited 978 "shoes", // shoes Binky Galley, LLC 979 "show", // show Snow Beach, LLC 980 "shriram", // shriram Shriram Capital Ltd. 981 "singles", // singles Fern Madison, LLC 982 "site", // site DotSite Inc. 983 "ski", // ski STARTING DOT LIMITED 984 "skin", // skin L'Oréal 985 "sky", // sky Sky International AG 986 "skype", // skype Microsoft Corporation 987 "smile", // smile Amazon Registry Services, Inc. 988 "sncf", // sncf SNCF (Société Nationale des Chemins de fer Francais) 989 "soccer", // soccer Foggy Shadow, LLC 990 "social", // social United TLD Holdco Ltd. 991 "softbank", // softbank SoftBank Group Corp. 992 "software", // software United TLD Holdco, Ltd 993 "sohu", // sohu Sohu.com Limited 994 "solar", // solar Ruby Town, LLC 995 "solutions", // solutions Silver Cover, LLC 996 "sony", // sony Sony Corporation 997 "soy", // soy Charleston Road Registry Inc. 998 "space", // space DotSpace Inc. 999 "spiegel", // spiegel SPIEGEL-Verlag Rudolf Augstein GmbH & Co. KG 1000 "spot", // spot Amazon Registry Services, Inc. 1001 "spreadbetting", // spreadbetting DOTSPREADBETTING REGISTRY LTD 1002 "srl", // srl InterNetX Corp. 1003 "stada", // stada STADA Arzneimittel AG 1004 "star", // star Star India Private Limited 1005 "starhub", // starhub StarHub Limited 1006 "statefarm", // statefarm State Farm Mutual Automobile Insurance Company 1007 "statoil", // statoil Statoil ASA 1008 "stc", // stc Saudi Telecom Company 1009 "stcgroup", // stcgroup Saudi Telecom Company 1010 "stockholm", // stockholm Stockholms kommun 1011 "storage", // storage Self Storage Company LLC 1012 "studio", // studio United TLD Holdco Ltd. 1013 "study", // study OPEN UNIVERSITIES AUSTRALIA PTY LTD 1014 "style", // style Binky Moon, LLC 1015 "sucks", // sucks Vox Populi Registry Ltd. 1016 "supplies", // supplies Atomic Fields, LLC 1017 "supply", // supply Half Falls, LLC 1018 "support", // support Grand Orchard, LLC 1019 "surf", // surf Top Level Domain Holdings Limited 1020 "surgery", // surgery Tin Avenue, LLC 1021 "suzuki", // suzuki SUZUKI MOTOR CORPORATION 1022 "swatch", // swatch The Swatch Group Ltd 1023 "swiss", // swiss Swiss Confederation 1024 "sydney", // sydney State of New South Wales, Department of Premier and Cabinet 1025 "symantec", // symantec Symantec Corporation 1026 "systems", // systems Dash Cypress, LLC 1027 "tab", // tab Tabcorp Holdings Limited 1028 "taipei", // taipei Taipei City Government 1029 "taobao", // taobao Alibaba Group Holding Limited 1030 "tatamotors", // tatamotors Tata Motors Ltd 1031 "tatar", // tatar Limited Liability Company "Coordination Center of Regional Domain of Tatarstan Republic" 1032 "tattoo", // tattoo Uniregistry, Corp. 1033 "tax", // tax Storm Orchard, LLC 1034 "taxi", // taxi Pine Falls, LLC 1035 "tci", // tci Asia Green IT System Bilgisayar San. ve Tic. Ltd. Sti. 1036 "team", // team Atomic Lake, LLC 1037 "tech", // tech Dot Tech LLC 1038 "technology", // technology Auburn Falls, LLC 1039 "tel", // tel Telnic Ltd. 1040 "telefonica", // telefonica Telefónica S.A. 1041 "temasek", // temasek Temasek Holdings (Private) Limited 1042 "tennis", // tennis Cotton Bloom, LLC 1043 "thd", // thd Homer TLC, Inc. 1044 "theater", // theater Blue Tigers, LLC 1045 "theatre", // theatre XYZ.COM LLC 1046 "tickets", // tickets Accent Media Limited 1047 "tienda", // tienda Victor Manor, LLC 1048 "tiffany", // tiffany Tiffany and Company 1049 "tips", // tips Corn Willow, LLC 1050 "tires", // tires Dog Edge, LLC 1051 "tirol", // tirol punkt Tirol GmbH 1052 "tmall", // tmall Alibaba Group Holding Limited 1053 "today", // today Pearl Woods, LLC 1054 "tokyo", // tokyo GMO Registry, Inc. 1055 "tools", // tools Pioneer North, LLC 1056 "top", // top Jiangsu Bangning Science & Technology Co.,Ltd. 1057 "toray", // toray Toray Industries, Inc. 1058 "toshiba", // toshiba TOSHIBA Corporation 1059 "tours", // tours Sugar Station, LLC 1060 "town", // town Koko Moon, LLC 1061 "toyota", // toyota TOYOTA MOTOR CORPORATION 1062 "toys", // toys Pioneer Orchard, LLC 1063 "trade", // trade Elite Registry Limited 1064 "trading", // trading DOTTRADING REGISTRY LTD 1065 "training", // training Wild Willow, LLC 1066 "travel", // travel Tralliance Registry Management Company, LLC. 1067 "travelers", // travelers Travelers TLD, LLC 1068 "travelersinsurance", // travelersinsurance Travelers TLD, LLC 1069 "trust", // trust Artemis Internet Inc 1070 "trv", // trv Travelers TLD, LLC 1071 "tube", // tube Latin American Telecom LLC 1072 "tui", // tui TUI AG 1073 "tushu", // tushu Amazon Registry Services, Inc. 1074 "tvs", // tvs T V SUNDRAM IYENGAR & SONS PRIVATE LIMITED 1075 "ubs", // ubs UBS AG 1076 "unicom", // unicom China United Network Communications Corporation Limited 1077 "university", // university Little Station, LLC 1078 "uno", // uno Dot Latin LLC 1079 "uol", // uol UBN INTERNET LTDA. 1080 "vacations", // vacations Atomic Tigers, LLC 1081 "vana", // vana Lifestyle Domain Holdings, Inc. 1082 "vegas", // vegas Dot Vegas, Inc. 1083 "ventures", // ventures Binky Lake, LLC 1084 "verisign", // verisign VeriSign, Inc. 1085 "versicherung", // versicherung dotversicherung-registry GmbH 1086 "vet", // vet United TLD Holdco, Ltd 1087 "viajes", // viajes Black Madison, LLC 1088 "video", // video United TLD Holdco, Ltd 1089 "villas", // villas New Sky, LLC 1090 "vin", // vin Holly Shadow, LLC 1091 "vip", // vip Minds + Machines Group Limited 1092 "virgin", // virgin Virgin Enterprises Limited 1093 "vision", // vision Koko Station, LLC 1094 "vista", // vista Vistaprint Limited 1095 "vistaprint", // vistaprint Vistaprint Limited 1096 "viva", // viva Saudi Telecom Company 1097 "vlaanderen", // vlaanderen DNS.be vzw 1098 "vodka", // vodka Top Level Domain Holdings Limited 1099 "volkswagen", // volkswagen Volkswagen Group of America Inc. 1100 "vote", // vote Monolith Registry LLC 1101 "voting", // voting Valuetainment Corp. 1102 "voto", // voto Monolith Registry LLC 1103 "voyage", // voyage Ruby House, LLC 1104 "wales", // wales Nominet UK 1105 "walter", // walter Sandvik AB 1106 "wang", // wang Zodiac Registry Limited 1107 "wanggou", // wanggou Amazon Registry Services, Inc. 1108 "watch", // watch Sand Shadow, LLC 1109 "watches", // watches Richemont DNS Inc. 1110 "weather", // weather The Weather Channel, LLC 1111 "weatherchannel", // weatherchannel The Weather Channel, LLC 1112 "webcam", // webcam dot Webcam Limited 1113 "weber", // weber Saint-Gobain Weber SA 1114 "website", // website DotWebsite Inc. 1115 "wed", // wed Atgron, Inc. 1116 "wedding", // wedding Top Level Domain Holdings Limited 1117 "weir", // weir Weir Group IP Limited 1118 "whoswho", // whoswho Who's Who Registry 1119 "wien", // wien punkt.wien GmbH 1120 "wiki", // wiki Top Level Design, LLC 1121 "williamhill", // williamhill William Hill Organization Limited 1122 "win", // win First Registry Limited 1123 "windows", // windows Microsoft Corporation 1124 "wine", // wine June Station, LLC 1125 "wme", // wme William Morris Endeavor Entertainment, LLC 1126 "wolterskluwer", // wolterskluwer Wolters Kluwer N.V. 1127 "work", // work Top Level Domain Holdings Limited 1128 "works", // works Little Dynamite, LLC 1129 "world", // world Bitter Fields, LLC 1130 "wtc", // wtc World Trade Centers Association, Inc. 1131 "wtf", // wtf Hidden Way, LLC 1132 "xbox", // xbox Microsoft Corporation 1133 "xerox", // xerox Xerox DNHC LLC 1134 "xin", // xin Elegant Leader Limited 1135 "xn--11b4c3d", // कॉम VeriSign Sarl 1136 "xn--1ck2e1b", // セール Amazon Registry Services, Inc. 1137 "xn--1qqw23a", // 佛山 Guangzhou YU Wei Information Technology Co., Ltd. 1138 "xn--30rr7y", // 慈善 Excellent First Limited 1139 "xn--3bst00m", // 集团 Eagle Horizon Limited 1140 "xn--3ds443g", // 在线 TLD REGISTRY LIMITED 1141 "xn--3pxu8k", // 点看 VeriSign Sarl 1142 "xn--42c2d9a", // คอม VeriSign Sarl 1143 "xn--45q11c", // 八卦 Zodiac Scorpio Limited 1144 "xn--4gbrim", // موقع Suhub Electronic Establishment 1145 "xn--55qw42g", // 公益 China Organizational Name Administration Center 1146 "xn--55qx5d", // 公司 Computer Network Information Center of Chinese Academy of Sciences (China Internet Network Information Center) 1147 "xn--6frz82g", // 移动 Afilias Limited 1148 "xn--6qq986b3xl", // 我爱你 Tycoon Treasure Limited 1149 "xn--80adxhks", // москва Foundation for Assistance for Internet Technologies and Infrastructure Development (FAITID) 1150 "xn--80asehdb", // онлайн CORE Association 1151 "xn--80aswg", // сайт CORE Association 1152 "xn--8y0a063a", // 联通 China United Network Communications Corporation Limited 1153 "xn--9dbq2a", // קום VeriSign Sarl 1154 "xn--9et52u", // 时尚 RISE VICTORY LIMITED 1155 "xn--b4w605ferd", // 淡马锡 Temasek Holdings (Private) Limited 1156 "xn--bck1b9a5dre4c", // ファッション Amazon Registry Services, Inc. 1157 "xn--c1avg", // орг Public Interest Registry 1158 "xn--c2br7g", // नेट VeriSign Sarl 1159 "xn--cck2b3b", // ストア Amazon Registry Services, Inc. 1160 "xn--cg4bki", // 삼성 SAMSUNG SDS CO., LTD 1161 "xn--czr694b", // 商标 HU YI GLOBAL INFORMATION RESOURCES(HOLDING) COMPANY.HONGKONG LIMITED 1162 "xn--czrs0t", // 商店 Wild Island, LLC 1163 "xn--czru2d", // 商城 Zodiac Aquarius Limited 1164 "xn--d1acj3b", // дети The Foundation for Network Initiatives “The Smart Internet” 1165 "xn--eckvdtc9d", // ポイント Amazon Registry Services, Inc. 1166 "xn--efvy88h", // 新闻 Xinhua News Agency Guangdong Branch 新华通讯社广东分社 1167 "xn--estv75g", // 工行 Industrial and Commercial Bank of China Limited 1168 "xn--fhbei", // كوم VeriSign Sarl 1169 "xn--fiq228c5hs", // 中文网 TLD REGISTRY LIMITED 1170 "xn--fiq64b", // 中信 CITIC Group Corporation 1171 "xn--fjq720a", // 娱乐 Will Bloom, LLC 1172 "xn--flw351e", // 谷歌 Charleston Road Registry Inc. 1173 "xn--g2xx48c", // 购物 Minds + Machines Group Limited 1174 "xn--gckr3f0f", // クラウド Amazon Registry Services, Inc. 1175 "xn--hxt814e", // 网店 Zodiac Libra Limited 1176 "xn--i1b6b1a6a2e", // संगठन Public Interest Registry 1177 "xn--imr513n", // 餐厅 HU YI GLOBAL INFORMATION RESOURCES (HOLDING) COMPANY. HONGKONG LIMITED 1178 "xn--io0a7i", // 网络 Computer Network Information Center of Chinese Academy of Sciences (China Internet Network Information Center) 1179 "xn--j1aef", // ком VeriSign Sarl 1180 "xn--jlq61u9w7b", // 诺基亚 Nokia Corporation 1181 "xn--kcrx77d1x4a", // 飞利浦 Koninklijke Philips N.V. 1182 "xn--kpu716f", // 手表 Richemont DNS Inc. 1183 "xn--kput3i", // 手机 Beijing RITT-Net Technology Development Co., Ltd 1184 "xn--mgba3a3ejt", // ارامكو Aramco Services Company 1185 "xn--mgbab2bd", // بازار CORE Association 1186 "xn--mgbb9fbpob", // موبايلي GreenTech Consultancy Company W.L.L. 1187 "xn--mgbt3dhd", // همراه Asia Green IT System Bilgisayar San. ve Tic. Ltd. Sti. 1188 "xn--mk1bu44c", // 닷컴 VeriSign Sarl 1189 "xn--mxtq1m", // 政府 Net-Chinese Co., Ltd. 1190 "xn--ngbc5azd", // شبكة International Domain Registry Pty. Ltd. 1191 "xn--ngbe9e0a", // بيتك Kuwait Finance House 1192 "xn--nqv7f", // 机构 Public Interest Registry 1193 "xn--nqv7fs00ema", // 组织机构 Public Interest Registry 1194 "xn--nyqy26a", // 健康 Stable Tone Limited 1195 "xn--p1acf", // рус Rusnames Limited 1196 "xn--pbt977c", // 珠宝 Richemont DNS Inc. 1197 "xn--pssy2u", // 大拿 VeriSign Sarl 1198 "xn--q9jyb4c", // みんな Charleston Road Registry Inc. 1199 "xn--qcka1pmc", // グーグル Charleston Road Registry Inc. 1200 "xn--rhqv96g", // 世界 Stable Tone Limited 1201 "xn--rovu88b", // 書籍 Amazon EU S.à r.l. 1202 "xn--ses554g", // 网址 KNET Co., Ltd 1203 "xn--t60b56a", // 닷넷 VeriSign Sarl 1204 "xn--tckwe", // コム VeriSign Sarl 1205 "xn--unup4y", // 游戏 Spring Fields, LLC 1206 "xn--vermgensberater-ctb", // VERMöGENSBERATER Deutsche Vermögensberatung Aktiengesellschaft DVAG 1207 "xn--vermgensberatung-pwb", // VERMöGENSBERATUNG Deutsche Vermögensberatung Aktiengesellschaft DVAG 1208 "xn--vhquv", // 企业 Dash McCook, LLC 1209 "xn--vuq861b", // 信息 Beijing Tele-info Network Technology Co., Ltd. 1210 "xn--xhq521b", // 广东 Guangzhou YU Wei Information Technology Co., Ltd. 1211 "xn--zfr164b", // 政务 China Organizational Name Administration Center 1212 "xperia", // xperia Sony Mobile Communications AB 1213 "xxx", // xxx ICM Registry LLC 1214 "xyz", // xyz XYZ.COM LLC 1215 "yachts", // yachts DERYachts, LLC 1216 "yahoo", // yahoo Yahoo! Domain Services Inc. 1217 "yamaxun", // yamaxun Amazon Registry Services, Inc. 1218 "yandex", // yandex YANDEX, LLC 1219 "yodobashi", // yodobashi YODOBASHI CAMERA CO.,LTD. 1220 "yoga", // yoga Top Level Domain Holdings Limited 1221 "yokohama", // yokohama GMO Registry, Inc. 1222 "youtube", // youtube Charleston Road Registry Inc. 1223 "zara", // zara Industria de Diseño Textil, S.A. (INDITEX, S.A.) 1224 "zero", // zero Amazon Registry Services, Inc. 1225 "zip", // zip Charleston Road Registry Inc. 1226 "zone", // zone Outer Falls, LLC 1227 "zuerich", // zuerich Kanton Zürich (Canton of Zurich) 656 1228 }; 657 1229 658 // JOSM PATCH BEGIN 659 // see #10862 - list of IDN TLDs taken from IANA on 2014-12-18 660 private static final String[] IDN_TLDS = new String[] { 661 "XN--1QQW23A", 662 "XN--3BST00M", 663 "XN--3DS443G", 664 "XN--3E0B707E", 665 "XN--45BRJ9C", 666 "XN--45Q11C", 667 "XN--4GBRIM", 668 "XN--55QW42G", 669 "XN--55QX5D", 670 "XN--6FRZ82G", 671 "XN--6QQ986B3XL", 672 "XN--80ADXHKS", 673 "XN--80AO21A", 674 "XN--80ASEHDB", 675 "XN--80ASWG", 676 "XN--90A3AC", 677 "XN--C1AVG", 678 "XN--CG4BKI", 679 "XN--CLCHC0EA0B2G2A9GCD", 680 "XN--CZR694B", 681 "XN--CZRS0T", 682 "XN--CZRU2D", 683 "XN--D1ACJ3B", 684 "XN--D1ALF", 685 "XN--FIQ228C5HS", 686 "XN--FIQ64B", 687 "XN--FIQS8S", 688 "XN--FIQZ9S", 689 "XN--FLW351E", 690 "XN--FPCRJ9C3D", 691 "XN--FZC2C9E2C", 692 "XN--GECRJ9C", 693 "XN--H2BRJ9C", 694 "XN--HXT814E", 695 "XN--I1B6B1A6A2E", 696 "XN--IO0A7I", 697 "XN--J1AMH", 698 "XN--J6W193G", 699 "XN--KPRW13D", 700 "XN--KPRY57D", 701 "XN--KPUT3I", 702 "XN--L1ACC", 703 "XN--LGBBAT1AD8J", 704 "XN--MGB9AWBF", 705 "XN--MGBA3A4F16A", 706 "XN--MGBAAM7A8H", 707 "XN--MGBAB2BD", 708 "XN--MGBAYH7GPA", 709 "XN--MGBBH1A71E", 710 "XN--MGBC0A9AZCG", 711 "XN--MGBERP4A5D4AR", 712 "XN--MGBX4CD0AB", 713 "XN--NGBC5AZD", 714 "XN--NODE", 715 "XN--NQV7F", 716 "XN--NQV7FS00EMA", 717 "XN--O3CW4H", 718 "XN--OGBPF8FL", 719 "XN--P1ACF", 720 "XN--P1AI", 721 "XN--PGBS0DH", 722 "XN--Q9JYB4C", 723 "XN--QCKA1PMC", 724 "XN--RHQV96G", 725 "XN--S9BRJ9C", 726 "XN--SES554G", 727 "XN--UNUP4Y", 728 "XN--VERMGENSBERATER-CTB", 729 "XN--VERMGENSBERATUNG-PWB", 730 "XN--VHQUV", 731 "XN--WGBH1C", 732 "XN--WGBL6A", 733 "XN--XHQ521B", 734 "XN--XKC2AL3HYE2A", 735 "XN--XKC2DL3A5EE0H", 736 "XN--YFRO4I67O", 737 "XN--YGBI2AMMX", 738 "XN--ZFR164B", 739 }; 740 // END JOSM PATCH 741 1230 // WARNING: this array MUST be sorted, otherwise it cannot be searched reliably using binary search 742 1231 private static final String[] COUNTRY_CODE_TLDS = new String[] { 743 1232 "ac", // Ascension Island … … 749 1238 "al", // Albania 750 1239 "am", // Armenia 751 "an", // Netherlands Antilles 1240 // "an", // Netherlands Antilles (retired) 752 1241 "ao", // Angola 753 1242 "aq", // Antarctica … … 964 1453 "tn", // Tunisia 965 1454 "to", // Tonga 966 "tp", // East Timor 1455 // "tp", // East Timor (Retired) 967 1456 "tr", // Turkey 968 1457 "tt", // Trinidad and Tobago … … 973 1462 "ug", // Uganda 974 1463 "uk", // United Kingdom 975 "um", // United States Minor Outlying Islands976 1464 "us", // United States of America 977 1465 "uy", // Uruguay … … 986 1474 "wf", // Wallis and Futuna 987 1475 "ws", // Samoa (formerly Western Samoa) 1476 "xn--3e0b707e", // 한국 KISA (Korea Internet & Security Agency) 1477 "xn--45brj9c", // ভারত National Internet Exchange of India 1478 "xn--80ao21a", // қаз Association of IT Companies of Kazakhstan 1479 "xn--90a3ac", // срб Serbian National Internet Domain Registry (RNIDS) 1480 "xn--90ais", // ??? Reliable Software Inc. 1481 "xn--clchc0ea0b2g2a9gcd", // சிங்கப்பூர் Singapore Network Information Centre (SGNIC) Pte Ltd 1482 "xn--d1alf", // мкд Macedonian Academic Research Network Skopje 1483 "xn--e1a4c", // ею EURid vzw/asbl 1484 "xn--fiqs8s", // 中国 China Internet Network Information Center 1485 "xn--fiqz9s", // 中國 China Internet Network Information Center 1486 "xn--fpcrj9c3d", // భారత్ National Internet Exchange of India 1487 "xn--fzc2c9e2c", // ලංකා LK Domain Registry 1488 "xn--gecrj9c", // ભારત National Internet Exchange of India 1489 "xn--h2brj9c", // भारत National Internet Exchange of India 1490 "xn--j1amh", // укр Ukrainian Network Information Centre (UANIC), Inc. 1491 "xn--j6w193g", // 香港 Hong Kong Internet Registration Corporation Ltd. 1492 "xn--kprw13d", // 台湾 Taiwan Network Information Center (TWNIC) 1493 "xn--kpry57d", // 台灣 Taiwan Network Information Center (TWNIC) 1494 "xn--l1acc", // мон Datacom Co.,Ltd 1495 "xn--lgbbat1ad8j", // الجزائر CERIST 1496 "xn--mgb9awbf", // عمان Telecommunications Regulatory Authority (TRA) 1497 "xn--mgba3a4f16a", // ایران Institute for Research in Fundamental Sciences (IPM) 1498 "xn--mgbaam7a8h", // امارات Telecommunications Regulatory Authority (TRA) 1499 "xn--mgbayh7gpa", // الاردن National Information Technology Center (NITC) 1500 "xn--mgbbh1a71e", // بھارت National Internet Exchange of India 1501 "xn--mgbc0a9azcg", // المغرب Agence Nationale de Réglementation des Télécommunications (ANRT) 1502 "xn--mgberp4a5d4ar", // السعودية Communications and Information Technology Commission 1503 "xn--mgbpl2fh", // ????? Sudan Internet Society 1504 "xn--mgbtx2b", // عراق Communications and Media Commission (CMC) 1505 "xn--mgbx4cd0ab", // مليسيا MYNIC Berhad 1506 "xn--mix891f", // 澳門 Bureau of Telecommunications Regulation (DSRT) 1507 "xn--node", // გე Information Technologies Development Center (ITDC) 1508 "xn--o3cw4h", // ไทย Thai Network Information Center Foundation 1509 "xn--ogbpf8fl", // سورية National Agency for Network Services (NANS) 1510 "xn--p1ai", // рф Coordination Center for TLD RU 1511 "xn--pgbs0dh", // تونس Agence Tunisienne d'Internet 1512 "xn--qxam", // ελ ICS-FORTH GR 1513 "xn--s9brj9c", // ਭਾਰਤ National Internet Exchange of India 1514 "xn--wgbh1c", // مصر National Telecommunication Regulatory Authority - NTRA 1515 "xn--wgbl6a", // قطر Communications Regulatory Authority 1516 "xn--xkc2al3hye2a", // இலங்கை LK Domain Registry 1517 "xn--xkc2dl3a5ee0h", // இந்தியா National Internet Exchange of India 1518 "xn--y9a3aq", // ??? Internet Society 1519 "xn--yfro4i67o", // 新加坡 Singapore Network Information Centre (SGNIC) Pte Ltd 1520 "xn--ygbi2ammx", // فلسطين Ministry of Telecom & Information Technology (MTIT) 988 1521 "ye", // Yemen 989 1522 "yt", // Mayotte 990 "yu", // Serbia and Montenegro (originally Yugoslavia)991 1523 "za", // South Africa 992 1524 "zm", // Zambia … … 994 1526 }; 995 1527 1528 // WARNING: this array MUST be sorted, otherwise it cannot be searched reliably using binary search 996 1529 private static final String[] LOCAL_TLDS = new String[] { 1530 "localdomain", // Also widely used as localhost.localdomain 997 1531 "localhost", // RFC2606 defined 998 "localdomain" // Also widely used as localhost.localdomain 999 }; 1000 1001 static { 1002 Arrays.sort(INFRASTRUCTURE_TLDS); 1003 Arrays.sort(COUNTRY_CODE_TLDS); 1004 Arrays.sort(GENERIC_TLDS); 1005 Arrays.sort(IDN_TLDS); 1006 Arrays.sort(LOCAL_TLDS); 1532 }; 1533 1534 // Additional arrays to supplement or override the built in ones. 1535 // The PLUS arrays are valid keys, the MINUS arrays are invalid keys 1536 1537 /* 1538 * This field is used to detect whether the getInstance has been called. 1539 * After this, the method updateTLDOverride is not allowed to be called. 1540 * This field does not need to be volatile since it is only accessed from 1541 * synchronized methods. 1542 */ 1543 private static boolean inUse = false; 1544 1545 /* 1546 * These arrays are mutable, but they don't need to be volatile. 1547 * They can only be updated by the updateTLDOverride method, and any readers must get an instance 1548 * using the getInstance methods which are all (now) synchronised. 1549 */ 1550 // WARNING: this array MUST be sorted, otherwise it cannot be searched reliably using binary search 1551 private static volatile String[] countryCodeTLDsPlus = EMPTY_STRING_ARRAY; 1552 1553 // WARNING: this array MUST be sorted, otherwise it cannot be searched reliably using binary search 1554 private static volatile String[] genericTLDsPlus = EMPTY_STRING_ARRAY; 1555 1556 // WARNING: this array MUST be sorted, otherwise it cannot be searched reliably using binary search 1557 private static volatile String[] countryCodeTLDsMinus = EMPTY_STRING_ARRAY; 1558 1559 // WARNING: this array MUST be sorted, otherwise it cannot be searched reliably using binary search 1560 private static volatile String[] genericTLDsMinus = EMPTY_STRING_ARRAY; 1561 1562 /** 1563 * enum used by {@link DomainValidator#updateTLDOverride(ArrayType, String[])} 1564 * to determine which override array to update / fetch 1565 * @since 1.5.0 1566 * @since 1.5.1 made public and added read-only array references 1567 */ 1568 public enum ArrayType { 1569 /** Update (or get a copy of) the GENERIC_TLDS_PLUS table containing additonal generic TLDs */ 1570 GENERIC_PLUS, 1571 /** Update (or get a copy of) the GENERIC_TLDS_MINUS table containing deleted generic TLDs */ 1572 GENERIC_MINUS, 1573 /** Update (or get a copy of) the COUNTRY_CODE_TLDS_PLUS table containing additonal country code TLDs */ 1574 COUNTRY_CODE_PLUS, 1575 /** Update (or get a copy of) the COUNTRY_CODE_TLDS_MINUS table containing deleted country code TLDs */ 1576 COUNTRY_CODE_MINUS, 1577 /** Get a copy of the generic TLDS table */ 1578 GENERIC_RO, 1579 /** Get a copy of the country code table */ 1580 COUNTRY_CODE_RO, 1581 /** Get a copy of the infrastructure table */ 1582 INFRASTRUCTURE_RO, 1583 /** Get a copy of the local table */ 1584 LOCAL_RO 1585 } 1586 1587 // For use by unit test code only 1588 static synchronized void clearTLDOverrides() { 1589 inUse = false; 1590 countryCodeTLDsPlus = EMPTY_STRING_ARRAY; 1591 countryCodeTLDsMinus = EMPTY_STRING_ARRAY; 1592 genericTLDsPlus = EMPTY_STRING_ARRAY; 1593 genericTLDsMinus = EMPTY_STRING_ARRAY; 1594 } 1595 1596 /** 1597 * Update one of the TLD override arrays. 1598 * This must only be done at program startup, before any instances are accessed using getInstance. 1599 * <p> 1600 * For example: 1601 * <p> 1602 * <code>DomainValidator.updateTLDOverride(ArrayType.GENERIC_PLUS, new String[]{"apache"})}</code> 1603 * <p> 1604 * To clear an override array, provide an empty array. 1605 * 1606 * @param table the table to update, see {@link DomainValidator.ArrayType} 1607 * Must be one of the following 1608 * <ul> 1609 * <li>COUNTRY_CODE_MINUS</li> 1610 * <li>COUNTRY_CODE_PLUS</li> 1611 * <li>GENERIC_MINUS</li> 1612 * <li>GENERIC_PLUS</li> 1613 * </ul> 1614 * @param tlds the array of TLDs, must not be null 1615 * @throws IllegalStateException if the method is called after getInstance 1616 * @throws IllegalArgumentException if one of the read-only tables is requested 1617 * @since 1.5.0 1618 */ 1619 public static synchronized void updateTLDOverride(ArrayType table, String[] tlds) { 1620 if (inUse) { 1621 throw new IllegalStateException("Can only invoke this method before calling getInstance"); 1622 } 1623 String[] copy = new String[tlds.length]; 1624 // Comparisons are always done with lower-case entries 1625 for (int i = 0; i < tlds.length; i++) { 1626 copy[i] = tlds[i].toLowerCase(Locale.ENGLISH); 1627 } 1628 Arrays.sort(copy); 1629 switch(table) { 1630 case COUNTRY_CODE_MINUS: 1631 countryCodeTLDsMinus = copy; 1632 break; 1633 case COUNTRY_CODE_PLUS: 1634 countryCodeTLDsPlus = copy; 1635 break; 1636 case GENERIC_MINUS: 1637 genericTLDsMinus = copy; 1638 break; 1639 case GENERIC_PLUS: 1640 genericTLDsPlus = copy; 1641 break; 1642 case COUNTRY_CODE_RO: 1643 case GENERIC_RO: 1644 case INFRASTRUCTURE_RO: 1645 case LOCAL_RO: 1646 throw new IllegalArgumentException("Cannot update the table: " + table); 1647 default: 1648 throw new IllegalArgumentException("Unexpected enum value: " + table); 1649 } 1650 } 1651 1652 /** 1653 * Get a copy of the internal array. 1654 * @param table the array type (any of the enum values) 1655 * @return a copy of the array 1656 * @throws IllegalArgumentException if the table type is unexpected (should not happen) 1657 * @since 1.5.1 1658 */ 1659 public static String[] getTLDEntries(ArrayType table) { 1660 final String[] array; 1661 switch(table) { 1662 case COUNTRY_CODE_MINUS: 1663 array = countryCodeTLDsMinus; 1664 break; 1665 case COUNTRY_CODE_PLUS: 1666 array = countryCodeTLDsPlus; 1667 break; 1668 case GENERIC_MINUS: 1669 array = genericTLDsMinus; 1670 break; 1671 case GENERIC_PLUS: 1672 array = genericTLDsPlus; 1673 break; 1674 case GENERIC_RO: 1675 array = GENERIC_TLDS; 1676 break; 1677 case COUNTRY_CODE_RO: 1678 array = COUNTRY_CODE_TLDS; 1679 break; 1680 case INFRASTRUCTURE_RO: 1681 array = INFRASTRUCTURE_TLDS; 1682 break; 1683 case LOCAL_RO: 1684 array = LOCAL_TLDS; 1685 break; 1686 default: 1687 throw new IllegalArgumentException("Unexpected enum value: " + table); 1688 } 1689 return Arrays.copyOf(array, array.length); // clone the array 1690 } 1691 1692 /** 1693 * Converts potentially Unicode input to punycode. 1694 * If conversion fails, returns the original input. 1695 * 1696 * @param input the string to convert, not null 1697 * @return converted input, or original input if conversion fails 1698 */ 1699 // Needed by UrlValidator 1700 static String unicodeToASCII(String input) { 1701 if (isOnlyASCII(input)) { // skip possibly expensive processing 1702 return input; 1703 } 1704 try { 1705 final String ascii = IDN.toASCII(input); 1706 if (IDNBUGHOLDER.IDN_TOASCII_PRESERVES_TRAILING_DOTS) { 1707 return ascii; 1708 } 1709 final int length = input.length(); 1710 if (length == 0) { // check there is a last character 1711 return input; 1712 } 1713 // RFC3490 3.1. 1) 1714 // Whenever dots are used as label separators, the following 1715 // characters MUST be recognized as dots: U+002E (full stop), U+3002 1716 // (ideographic full stop), U+FF0E (fullwidth full stop), U+FF61 1717 // (halfwidth ideographic full stop). 1718 char lastChar = input.charAt(length-1); // fetch original last char 1719 switch(lastChar) { 1720 case '\u002E': // "." full stop 1721 case '\u3002': // ideographic full stop 1722 case '\uFF0E': // fullwidth full stop 1723 case '\uFF61': // halfwidth ideographic full stop 1724 return ascii + "."; // restore the missing stop 1725 default: 1726 return ascii; 1727 } 1728 } catch (IllegalArgumentException e) { // input is not valid 1729 return input; 1730 } 1731 } 1732 1733 private static class IDNBUGHOLDER { 1734 private static boolean keepsTrailingDot() { 1735 final String input = "a."; // must be a valid name 1736 return input.equals(IDN.toASCII(input)); 1737 } 1738 1739 private static final boolean IDN_TOASCII_PRESERVES_TRAILING_DOTS = keepsTrailingDot(); 1740 } 1741 1742 /* 1743 * Check if input contains only ASCII 1744 * Treats null as all ASCII 1745 */ 1746 private static boolean isOnlyASCII(String input) { 1747 if (input == null) { 1748 return true; 1749 } 1750 for (int i = 0; i < input.length(); i++) { 1751 if (input.charAt(i) > 0x7F) { // CHECKSTYLE IGNORE MagicNumber 1752 return false; 1753 } 1754 } 1755 return true; 1756 } 1757 1758 /** 1759 * Check if a sorted array contains the specified key 1760 * 1761 * @param sortedArray the array to search 1762 * @param key the key to find 1763 * @return {@code true} if the array contains the key 1764 */ 1765 private static boolean arrayContains(String[] sortedArray, String key) { 1766 return Arrays.binarySearch(sortedArray, key) >= 0; 1007 1767 } 1008 1768 } -
trunk/src/org/openstreetmap/josm/data/validation/routines/EmailValidator.java
r8510 r9853 25 25 * <p>Perform email validations.</p> 26 26 * <p> 27 * This class is a Singleton; you can retrieve the instance via the getInstance() method.28 * </p>29 * <p>30 27 * Based on a script by <a href="mailto:stamhankar@hotmail.com">Sandeep V. Tamhankar</a> 31 28 * http://javascript.internet.com … … 33 30 * <p> 34 31 * This implementation is not guaranteed to catch all possible errors in an email address. 35 * For example, an address like nobody@noplace.somedog will pass validator, even though there36 * is no TLD "somedog"37 32 * </p>. 38 33 * 39 * @version $Revision: 1 608584 $ $Date: 2014-07-07 19:54:07 UTC (Mon, 07 Jul 2014)$34 * @version $Revision: 1723573 $ 40 35 * @since Validator 1.4 41 36 */ … … 43 38 44 39 private static final String SPECIAL_CHARS = "\\p{Cntrl}\\(\\)<>@,;:'\\\\\\\"\\.\\[\\]"; 45 private static final String VALID_CHARS = " [^\\s" + SPECIAL_CHARS + "]";46 private static final String QUOTED_USER = "(\" [^\"]*\")";40 private static final String VALID_CHARS = "(\\\\.)|[^\\s" + SPECIAL_CHARS + "]"; 41 private static final String QUOTED_USER = "(\"(\\\\\"|[^\"])*\")"; 47 42 private static final String WORD = "((" + VALID_CHARS + "|')+|" + QUOTED_USER + ")"; 48 43 49 private static final String LEGAL_ASCII_REGEX = "^\\p{ASCII}+$";50 44 private static final String EMAIL_REGEX = "^\\s*?(.+)@(.+?)\\s*$"; 51 45 private static final String IP_DOMAIN_REGEX = "^\\[(.*)\\]$"; 52 46 private static final String USER_REGEX = "^\\s*" + WORD + "(\\." + WORD + ")*$"; 53 47 54 private static final Pattern MATCH_ASCII_PATTERN = Pattern.compile(LEGAL_ASCII_REGEX);55 48 private static final Pattern EMAIL_PATTERN = Pattern.compile(EMAIL_REGEX); 56 49 private static final Pattern IP_DOMAIN_PATTERN = Pattern.compile(IP_DOMAIN_REGEX); 57 50 private static final Pattern USER_PATTERN = Pattern.compile(USER_REGEX); 58 51 52 private static final int MAX_USERNAME_LEN = 64; 53 59 54 private final boolean allowLocal; 55 private final boolean allowTld; 60 56 61 57 /** … … 63 59 * doesn't consider local addresses as valid. 64 60 */ 65 private static final EmailValidator EMAIL_VALIDATOR = new EmailValidator(false); 61 private static final EmailValidator EMAIL_VALIDATOR = new EmailValidator(false, false); 62 63 /** 64 * Singleton instance of this class, which 65 * doesn't consider local addresses as valid. 66 */ 67 private static final EmailValidator EMAIL_VALIDATOR_WITH_TLD = new EmailValidator(false, true); 66 68 67 69 /** … … 69 71 * consider local addresses valid. 70 72 */ 71 private static final EmailValidator EMAIL_VALIDATOR_WITH_LOCAL = new EmailValidator(true); 73 private static final EmailValidator EMAIL_VALIDATOR_WITH_LOCAL = new EmailValidator(true, false); 74 75 76 /** 77 * Singleton instance of this class, which does 78 * consider local addresses valid. 79 */ 80 private static final EmailValidator EMAIL_VALIDATOR_WITH_LOCAL_WITH_TLD = new EmailValidator(true, true); 72 81 73 82 /** … … 85 94 * 86 95 * @param allowLocal Should local addresses be considered valid? 96 * @param allowTld Should TLDs be allowed? 87 97 * @return singleton instance of this validator 88 98 */ 99 public static EmailValidator getInstance(boolean allowLocal, boolean allowTld) { 100 if (allowLocal) { 101 if (allowTld) { 102 return EMAIL_VALIDATOR_WITH_LOCAL_WITH_TLD; 103 } else { 104 return EMAIL_VALIDATOR_WITH_LOCAL; 105 } 106 } else { 107 if (allowTld) { 108 return EMAIL_VALIDATOR_WITH_TLD; 109 } else { 110 return EMAIL_VALIDATOR; 111 } 112 } 113 } 114 115 /** 116 * Returns the Singleton instance of this validator, 117 * with local validation as required. 118 * 119 * @param allowLocal Should local addresses be considered valid? 120 * @return singleton instance of this validator 121 */ 89 122 public static EmailValidator getInstance(boolean allowLocal) { 90 if (allowLocal) { 91 return EMAIL_VALIDATOR_WITH_LOCAL; 92 } 93 return EMAIL_VALIDATOR; 123 return getInstance(allowLocal, false); 124 } 125 126 /** 127 * Protected constructor for subclasses to use. 128 * 129 * @param allowLocal Should local addresses be considered valid? 130 * @param allowTld Should TLDs be allowed? 131 */ 132 protected EmailValidator(boolean allowLocal, boolean allowTld) { 133 super(); 134 this.allowLocal = allowLocal; 135 this.allowTld = allowTld; 94 136 } 95 137 … … 102 144 super(); 103 145 this.allowLocal = allowLocal; 146 this.allowTld = false; 104 147 } 105 148 … … 117 160 } 118 161 119 Matcher asciiMatcher = MATCH_ASCII_PATTERN.matcher(email); 120 if (!asciiMatcher.matches()) { 121 setErrorMessage(tr("E-mail address contains non-ascii characters")); 122 setFix(email.replaceAll("[^\\p{ASCII}]+", "")); 162 if (email.endsWith(".")) { // check this first - it's cheap! 163 setErrorMessage(tr("E-mail address is invalid")); 123 164 return false; 124 165 } … … 131 172 } 132 173 133 if (email.endsWith(".")) {134 setErrorMessage(tr("E-mail address is invalid"));135 return false;136 }137 138 174 String username = emailMatcher.group(1); 139 175 if (!isValidUser(username)) { … … 154 190 * Returns true if the domain component of an email address is valid. 155 191 * 156 * @param domain being validated .192 * @param domain being validated, may be in IDN format 157 193 * @return true if the email address's domain is valid. 158 194 */ … … 165 201 InetAddressValidator.getInstance(); 166 202 return inetAddressValidator.isValid(ipDomainMatcher.group(1)); 203 } 204 // Domain is symbolic name 205 DomainValidator domainValidator = 206 DomainValidator.getInstance(allowLocal); 207 if (allowTld) { 208 return domainValidator.isValid(domain) || (!domain.startsWith(".") && domainValidator.isValidTld(domain)); 167 209 } else { 168 // Domain is symbolic name 169 DomainValidator domainValidator = 170 DomainValidator.getInstance(allowLocal); 171 return domainValidator.isValid(domain) || 172 domainValidator.isValidTld(domain); 210 return domainValidator.isValid(domain); 173 211 } 174 212 } … … 181 219 */ 182 220 protected boolean isValidUser(String user) { 221 222 if (user == null || user.length() > MAX_USERNAME_LEN) { 223 return false; 224 } 225 183 226 return USER_PATTERN.matcher(user).matches(); 184 227 } -
trunk/src/org/openstreetmap/josm/data/validation/routines/InetAddressValidator.java
r8510 r9853 17 17 package org.openstreetmap.josm.data.validation.routines; 18 18 19 import java.util.ArrayList; 20 import java.util.Arrays; 21 import java.util.List; 22 19 23 /** 20 24 * <p><b>InetAddress</b> validation and conversion routines (<code>java.net.InetAddress</code>).</p> … … 26 30 * </p> 27 31 * 28 * @version $Revision: 1 227719 $32 * @version $Revision: 1715439 $ 29 33 * @since Validator 1.4 30 34 */ 31 35 public class InetAddressValidator extends AbstractValidator { 32 36 37 private static final int IPV4_MAX_OCTET_VALUE = 255; 38 39 private static final int MAX_UNSIGNED_SHORT = 0xffff; 40 41 private static final int BASE_16 = 16; 42 33 43 private static final String IPV4_REGEX = 34 44 "^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$"; 45 46 // Max number of hex groups (separated by :) in an IPV6 address 47 private static final int IPV6_MAX_HEX_GROUPS = 8; 48 49 // Max hex digits in each IPv6 group 50 private static final int IPV6_MAX_HEX_DIGITS_PER_GROUP = 4; 35 51 36 52 /** … … 57 73 @Override 58 74 public boolean isValid(String inetAddress) { 59 return isValidInet4Address(inetAddress) ;75 return isValidInet4Address(inetAddress) || isValidInet6Address(inetAddress); 60 76 } 61 77 … … 69 85 String[] groups = ipv4Validator.match(inet4Address); 70 86 71 if (groups == null) return false; 87 if (groups == null) { 88 return false; 89 } 72 90 73 91 // verify that address subgroups are legal 74 for (int i = 0; i <= 3; i++) { 75 String ipSegment = groups[i]; 92 for (String ipSegment : groups) { 76 93 if (ipSegment == null || ipSegment.isEmpty()) { 77 94 return false; … … 86 103 } 87 104 88 if (iIpSegment > 255) { 105 if (iIpSegment > IPV4_MAX_OCTET_VALUE) { 106 return false; 107 } 108 109 if (ipSegment.length() > 1 && ipSegment.startsWith("0")) { 89 110 return false; 90 111 } … … 94 115 return true; 95 116 } 117 118 /** 119 * Validates an IPv6 address. Returns true if valid. 120 * @param inet6Address the IPv6 address to validate 121 * @return true if the argument contains a valid IPv6 address 122 * 123 * @since 1.4.1 124 */ 125 public boolean isValidInet6Address(String inet6Address) { 126 boolean containsCompressedZeroes = inet6Address.contains("::"); 127 if (containsCompressedZeroes && (inet6Address.indexOf("::") != inet6Address.lastIndexOf("::"))) { 128 return false; 129 } 130 if ((inet6Address.startsWith(":") && !inet6Address.startsWith("::")) 131 || (inet6Address.endsWith(":") && !inet6Address.endsWith("::"))) { 132 return false; 133 } 134 String[] octets = inet6Address.split(":"); 135 if (containsCompressedZeroes) { 136 List<String> octetList = new ArrayList<>(Arrays.asList(octets)); 137 if (inet6Address.endsWith("::")) { 138 // String.split() drops ending empty segments 139 octetList.add(""); 140 } else if (inet6Address.startsWith("::") && !octetList.isEmpty()) { 141 octetList.remove(0); 142 } 143 octets = octetList.toArray(new String[octetList.size()]); 144 } 145 if (octets.length > IPV6_MAX_HEX_GROUPS) { 146 return false; 147 } 148 int validOctets = 0; 149 int emptyOctets = 0; 150 for (int index = 0; index < octets.length; index++) { 151 String octet = octets[index]; 152 if (octet.length() == 0) { 153 emptyOctets++; 154 if (emptyOctets > 1) { 155 return false; 156 } 157 } else { 158 emptyOctets = 0; 159 if (octet.contains(".")) { // contains is Java 1.5+ 160 if (!inet6Address.endsWith(octet)) { 161 return false; 162 } 163 if (index > octets.length - 1 || index > 6) { // TODO magic number (sort of) 164 // IPV4 occupies last two octets 165 return false; 166 } 167 if (!isValidInet4Address(octet)) { 168 return false; 169 } 170 validOctets += 2; 171 continue; 172 } 173 if (octet.length() > IPV6_MAX_HEX_DIGITS_PER_GROUP) { 174 return false; 175 } 176 int octetInt = 0; 177 try { 178 octetInt = Integer.valueOf(octet, BASE_16).intValue(); 179 } catch (NumberFormatException e) { 180 return false; 181 } 182 if (octetInt < 0 || octetInt > MAX_UNSIGNED_SHORT) { 183 return false; 184 } 185 } 186 validOctets++; 187 } 188 if (validOctets < IPV6_MAX_HEX_GROUPS && !containsCompressedZeroes) { 189 return false; 190 } 191 return true; 192 } 96 193 } -
trunk/src/org/openstreetmap/josm/data/validation/routines/RegexValidator.java
r9249 r9853 28 28 * a validator which does <i>case in-sensitive</i> validation for a set of regular 29 29 * expressions: 30 * </p> 30 31 * <pre> 31 * String[] regexs = new String[] {...}; 32 * RegexValidator validator = new RegexValidator(regexs, false); 32 * <code> 33 * String[] regexs = new String[] {...}; 34 * RegexValidator validator = new RegexValidator(regexs, false); 35 * </code> 33 36 * </pre> 37 * 34 38 * <ul> 35 * <li>Validate <code>true</code> or <code>false</code>: 36 * <ul> 37 * <li><code>boolean valid = validator.isValid(value);</code></li> 38 * </ul></li> 39 * <li>Validate returning an aggregated String of the matched groups: 40 * <ul> 41 * <li><code>String result = validator.validate(value);</code></li> 42 * </ul></li> 43 * <li>Validate returning the matched groups: 44 * <ul> 45 * <li><code>String[] result = validator.match(value);</code></li> 46 * </ul></li> 39 * <li>Validate <code>true</code> or <code>false</code>:</li> 40 * <li> 41 * <ul> 42 * <li><code>boolean valid = validator.isValid(value);</code></li> 43 * </ul> 44 * </li> 45 * <li>Validate returning an aggregated String of the matched groups:</li> 46 * <li> 47 * <ul> 48 * <li><code>String result = validator.validate(value);</code></li> 49 * </ul> 50 * </li> 51 * <li>Validate returning the matched groups:</li> 52 * <li> 53 * <ul> 54 * <li><code>String[] result = validator.match(value);</code></li> 55 * </ul> 56 * </li> 47 57 * </ul> 58 * 59 * <b>Note that patterns are matched against the entire input.</b> 60 * 48 61 * <p> 49 62 * Cached instances pre-compile and re-use {@link Pattern}(s) - which according 50 63 * to the {@link Pattern} API are safe to use in a multi-threaded environment. 51 * 52 * @version $Revision: 1227719 $ $Date: 2012-01-05 18:45:51 +0100 (Thu, 05 Jan 2012) $ 64 * </p> 65 * 66 * @version $Revision: 1713331 $ 53 67 * @since Validator 1.4 54 68 */ -
trunk/src/org/openstreetmap/josm/data/validation/routines/UrlValidator.java
r8795 r9853 19 19 import static org.openstreetmap.josm.tools.I18n.tr; 20 20 21 import java.util.Arrays; 21 import java.net.URI; 22 import java.net.URISyntaxException; 22 23 import java.util.Collections; 23 24 import java.util.HashSet; 25 import java.util.Locale; 24 26 import java.util.Set; 25 27 import java.util.regex.Matcher; … … 28 30 /** 29 31 * <p><b>URL Validation</b> routines.</p> 30 * Behavior of validation is modified by passing in options:<ul> 32 * Behavior of validation is modified by passing in options: 33 * <ul> 31 34 * <li>ALLOW_2_SLASHES - [FALSE] Allows double '/' characters in the path 32 35 * component.</li> … … 36 39 * considered valid schemes. Enabling this option will let any scheme pass validation.</li> 37 40 * </ul> 41 * 38 42 * <p>Originally based in on php script by Debbie Dyer, validation.php v1.2b, Date: 03/07/02, 39 43 * http://javascript.internet.com. However, this validation now bears little resemblance … … 64 68 * </pre> 65 69 * 66 * @version $Revision: 1 640269 $ $Date: 2014-11-18 02:28:56 UTC (Tue, 18 Nov 2014)$70 * @version $Revision: 1715435 $ 67 71 * @see 68 72 * <a href="http://www.ietf.org/rfc/rfc2396.txt"> … … 96 100 * a {@link RegexValidator} instead ({@link #UrlValidator(RegexValidator, long)}) 97 101 */ 98 public static final long ALLOW_LOCAL_URLS = 1 << 3; 99 100 // Drop numeric, and "+-." for now 101 private static final String AUTHORITY_CHARS_REGEX = "\\p{Alnum}\\-\\."; 102 public static final long ALLOW_LOCAL_URLS = 1 << 3; // CHECKSTYLE IGNORE MagicNumber 102 103 103 104 /** … … 106 107 private static final String URL_REGEX = 107 108 "^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"; 108 109 // 12 3 4 5 6 7 8 9 109 110 private static final Pattern URL_PATTERN = Pattern.compile(URL_REGEX); 110 111 … … 126 127 127 128 /** 128 * Protocol (ie. http:, ftp:,https:).129 * Protocol scheme (e.g. http, ftp, https). 129 130 */ 130 131 private static final String SCHEME_REGEX = "^\\p{Alpha}[\\p{Alnum}\\+\\-\\.]*"; 131 132 private static final Pattern SCHEME_PATTERN = Pattern.compile(SCHEME_REGEX); 132 133 134 // Drop numeric, and "+-." for now 135 // TODO does not allow for optional userinfo. 136 // Validation of character set is done by isValidAuthority 137 private static final String AUTHORITY_CHARS_REGEX = "\\p{Alnum}\\-\\."; // allows for IPV4 but not IPV6 138 private static final String IPV6_REGEX = "[0-9a-fA-F:]+"; // do this as separate match because : could cause ambiguity with port prefix 139 140 // userinfo = *( unreserved / pct-encoded / sub-delims / ":" ) 141 // unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" 142 // sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "=" 143 // We assume that password has the same valid chars as user info 144 private static final String USERINFO_CHARS_REGEX = "[a-zA-Z0-9%-._~!$&'()*+,;=]"; 145 // since neither ':' nor '@' are allowed chars, we don't need to use non-greedy matching 146 private static final String USERINFO_FIELD_REGEX = 147 USERINFO_CHARS_REGEX + "+:" + // At least one character for the name 148 USERINFO_CHARS_REGEX + "*@"; // password may be absent 133 149 private static final String AUTHORITY_REGEX = 134 " ^([" + AUTHORITY_CHARS_REGEX + "]*)(:\\d*)?(.*)?";135 150 "(?:\\[("+IPV6_REGEX+")\\]|(?:(?:"+USERINFO_FIELD_REGEX+")?([" + AUTHORITY_CHARS_REGEX + "]*)))(:\\d*)?(.*)?"; 151 // 1 e.g. user:pass@ 2 3 4 136 152 private static final Pattern AUTHORITY_PATTERN = Pattern.compile(AUTHORITY_REGEX); 137 153 138 private static final int PARSE_AUTHORITY_HOST_IP = 1; 139 140 private static final int PARSE_AUTHORITY_PORT = 2; 141 142 /** 143 * Should always be empty. 144 */ 145 private static final int PARSE_AUTHORITY_EXTRA = 3; 154 private static final int PARSE_AUTHORITY_IPV6 = 1; 155 156 private static final int PARSE_AUTHORITY_HOST_IP = 2; // excludes userinfo, if present 157 158 // Not needed, because it is validated by AUTHORITY_REGEX 159 // private static final int PARSE_AUTHORITY_PORT = 3; 160 161 /** 162 * Should always be empty. The code currently allows spaces. 163 */ 164 private static final int PARSE_AUTHORITY_EXTRA = 4; 146 165 147 166 private static final String PATH_REGEX = "^(/[-\\w:@&?=+,.!/~*'%$_;\\(\\)]*)?$"; … … 151 170 private static final Pattern QUERY_PATTERN = Pattern.compile(QUERY_REGEX); 152 171 153 private static final String LEGAL_ASCII_REGEX = "^\\p{ASCII}+$";154 private static final Pattern ASCII_PATTERN = Pattern.compile(LEGAL_ASCII_REGEX);155 156 private static final String PORT_REGEX = "^:(\\d{1,5})$";157 private static final Pattern PORT_PATTERN = Pattern.compile(PORT_REGEX);158 159 172 /** 160 173 * Holds the set of current validation options. … … 165 178 * The set of schemes that are allowed to be in a URL. 166 179 */ 167 private final Set<String> allowedSchemes; 180 private final Set<String> allowedSchemes; // Must be lower-case 168 181 169 182 /** … … 176 189 * If no schemes are provided, default to this set. 177 190 */ 178 private static final String[] DEFAULT_SCHEMES = {"http", "https", "ftp"}; 191 private static final String[] DEFAULT_SCHEMES = {"http", "https", "ftp"}; // Must be lower-case 179 192 180 193 /** … … 222 235 /** 223 236 * Behavior of validation is modified by passing in options: 224 * @param schemes The set of valid schemes. 237 * @param schemes The set of valid schemes. Ignored if the ALLOW_ALL_SCHEMES option is set. 225 238 * @param options The options should be set using the public constants declared in 226 239 * this class. To set multiple options you simply add them together. For example, … … 233 246 /** 234 247 * Initialize a UrlValidator with the given validation options. 248 * @param authorityValidator Regular expression validator used to validate the authority part 249 * This allows the user to override the standard set of domains. 250 * @param options Validation options. Set using the public constants of this class. 251 * To set multiple options, simply add them together: 252 * <p><code>ALLOW_2_SLASHES + NO_FRAGMENTS</code></p> 253 * enables both of those options. 254 */ 255 public UrlValidator(RegexValidator authorityValidator, long options) { 256 this(null, authorityValidator, options); 257 } 258 259 /** 260 * Customizable constructor. Validation behavior is modifed by passing in options. 261 * @param schemes the set of valid schemes. Ignored if the ALLOW_ALL_SCHEMES option is set. 235 262 * @param authorityValidator Regular expression validator used to validate the authority part 236 263 * @param options Validation options. Set using the public constants of this class. … … 239 266 * enables both of those options. 240 267 */ 241 public UrlValidator(RegexValidator authorityValidator, long options) {242 this(null, authorityValidator, options);243 }244 245 /**246 * Customizable constructor. Validation behavior is modifed by passing in options.247 * @param schemes the set of valid schemes248 * @param authorityValidator Regular expression validator used to validate the authority part249 * @param options Validation options. Set using the public constants of this class.250 * To set multiple options, simply add them together:251 * <p><code>ALLOW_2_SLASHES + NO_FRAGMENTS</code></p>252 * enables both of those options.253 */254 268 public UrlValidator(String[] schemes, RegexValidator authorityValidator, long options) { 255 269 this.options = options; 256 270 257 271 if (isOn(ALLOW_ALL_SCHEMES)) { 258 this.allowedSchemes = Collections.emptySet();272 allowedSchemes = Collections.emptySet(); 259 273 } else { 260 274 if (schemes == null) { 261 275 schemes = DEFAULT_SCHEMES; 262 276 } 263 this.allowedSchemes = new HashSet<>(); 264 this.allowedSchemes.addAll(Arrays.asList(schemes)); 277 allowedSchemes = new HashSet<>(schemes.length); 278 for (int i = 0; i < schemes.length; i++) { 279 allowedSchemes.add(schemes[i].toLowerCase(Locale.ENGLISH)); 280 } 265 281 } 266 282 267 283 this.authorityValidator = authorityValidator; 268 269 284 } 270 285 271 286 /** 272 287 * <p>Checks if a field has a valid url address.</p> 288 * 289 * Note that the method calls #isValidAuthority() 290 * which checks that the domain is valid. 273 291 * 274 292 * @param value The value validation is being performed on. A <code>null</code> … … 282 300 } 283 301 284 if (!ASCII_PATTERN.matcher(value).matches()) {285 setErrorMessage(tr("URL contains non-ascii characters"));286 setFix(value.replaceAll("[^\\p{ASCII}]+", ""));287 return false;288 }289 290 302 // Check the whole url address structure 291 303 Matcher urlMatcher = URL_PATTERN.matcher(value); … … 302 314 303 315 String authority = urlMatcher.group(PARSE_URL_AUTHORITY); 304 if ("file".equals(scheme) && "".equals(authority)) { 305 // Special case - file: allows an empty authority 306 } else { 307 // Validate the authority 308 if (!isValidAuthority(authority)) { 309 setErrorMessage(tr("URL contains an invalid authority: {0}", authority)); 310 return false; 316 if ("file".equals(scheme)) { // Special case - file: allows an empty authority 317 if (!"".equals(authority)) { 318 if (authority.contains(":")) { // but cannot allow trailing : 319 setErrorMessage(tr("URL contains an invalid authority: {0}", authority)); 320 return false; 321 } 322 } 323 // drop through to continue validation 324 } else { // not file: 325 // Validate the authority 326 if (!isValidAuthority(authority)) { 327 setErrorMessage(tr("URL contains an invalid authority: {0}", authority)); 328 return false; 311 329 } 312 330 } … … 335 353 /** 336 354 * Validate scheme. If schemes[] was initialized to a non null, 337 * then only those scheme's are allowed. Note this is slightly different 338 * than for the constructor. 355 * then only those schemes are allowed. 356 * Otherwise the default schemes are "http", "https", "ftp". 357 * Matching is case-blind. 339 358 * @param scheme The scheme to validate. A <code>null</code> value is considered 340 359 * invalid. … … 346 365 } 347 366 367 // TODO could be removed if external schemes were checked in the ctor before being stored 348 368 if (!SCHEME_PATTERN.matcher(scheme).matches()) { 349 369 return false; 350 370 } 351 371 352 if (isOff(ALLOW_ALL_SCHEMES)) { 353 354 if (!this.allowedSchemes.contains(scheme)) { 355 return false; 356 } 372 if (isOff(ALLOW_ALL_SCHEMES) && !allowedSchemes.contains(scheme.toLowerCase(Locale.ENGLISH))) { 373 return false; 357 374 } 358 375 … … 363 380 * Returns true if the authority is properly formatted. An authority is the combination 364 381 * of hostname and port. A <code>null</code> authority value is considered invalid. 365 * @param authority Authority value to validate. 382 * Note: this implementation validates the domain unless a RegexValidator was provided. 383 * If a RegexValidator was supplied and it matches, then the authority is regarded 384 * as valid with no further checks, otherwise the method checks against the 385 * AUTHORITY_PATTERN and the DomainValidator (ALLOW_LOCAL_URLS) 386 * @param authority Authority value to validate, alllows IDN 366 387 * @return true if authority (hostname and port) is valid. 367 388 */ … … 372 393 373 394 // check manual authority validation if specified 374 if (authorityValidator != null ) {375 if (authorityValidator.isValid(authority)) {376 return true;377 }378 }379 380 Matcher authorityMatcher = AUTHORITY_PATTERN.matcher(authority );395 if (authorityValidator != null && authorityValidator.isValid(authority)) { 396 return true; 397 } 398 // convert to ASCII if possible 399 final String authorityASCII = DomainValidator.unicodeToASCII(authority); 400 401 Matcher authorityMatcher = AUTHORITY_PATTERN.matcher(authorityASCII); 381 402 if (!authorityMatcher.matches()) { 382 403 return false; 383 404 } 384 405 385 String hostLocation = authorityMatcher.group(PARSE_AUTHORITY_HOST_IP); 386 // check if authority is hostname or IP address: 387 // try a hostname first since that's much more likely 388 DomainValidator domainValidator = DomainValidator.getInstance(isOn(ALLOW_LOCAL_URLS)); 389 if (!domainValidator.isValid(hostLocation)) { 390 // try an IP address 391 InetAddressValidator inetAddressValidator = 392 InetAddressValidator.getInstance(); 393 if (!inetAddressValidator.isValid(hostLocation)) { 394 // isn't either one, so the URL is invalid 395 return false; 396 } 397 } 398 399 String port = authorityMatcher.group(PARSE_AUTHORITY_PORT); 400 if (port != null) { 401 if (!PORT_PATTERN.matcher(port).matches()) { 402 return false; 406 // We have to process IPV6 separately because that is parsed in a different group 407 String ipv6 = authorityMatcher.group(PARSE_AUTHORITY_IPV6); 408 if (ipv6 != null) { 409 InetAddressValidator inetAddressValidator = InetAddressValidator.getInstance(); 410 if (!inetAddressValidator.isValidInet6Address(ipv6)) { 411 return false; 412 } 413 } else { 414 String hostLocation = authorityMatcher.group(PARSE_AUTHORITY_HOST_IP); 415 // check if authority is hostname or IP address: 416 // try a hostname first since that's much more likely 417 DomainValidator domainValidator = DomainValidator.getInstance(isOn(ALLOW_LOCAL_URLS)); 418 if (!domainValidator.isValid(hostLocation)) { 419 // try an IPv4 address 420 InetAddressValidator inetAddressValidator = InetAddressValidator.getInstance(); 421 if (!inetAddressValidator.isValidInet4Address(hostLocation)) { 422 // isn't IPv4, so the URL is invalid 423 return false; 424 } 403 425 } 404 426 } … … 426 448 } 427 449 450 try { 451 URI uri = new URI(null, null, path, null); 452 String norm = uri.normalize().getPath(); 453 if (norm.startsWith("/../") // Trying to go via the parent dir 454 || norm.equals("/..")) { // Trying to go to the parent dir 455 return false; 456 } 457 } catch (URISyntaxException e) { 458 return false; 459 } 460 428 461 int slash2Count = countToken("//", path); 429 462 if (isOff(ALLOW_2_SLASHES) && (slash2Count > 0)) { 430 463 return false; 431 }432 433 int slashCount = countToken("/", path);434 int dot2Count = countToken("..", path);435 if (dot2Count > 0) {436 if ((slashCount - slash2Count - 1) <= dot2Count) {437 return false;438 }439 464 } 440 465 … … 496 521 */ 497 522 private boolean isOn(long flag) { 498 return ( this.options & flag) > 0;523 return (options & flag) > 0; 499 524 } 500 525 … … 508 533 */ 509 534 private boolean isOff(long flag) { 510 return (this.options & flag) == 0; 535 return (options & flag) == 0; 536 } 537 538 // Unit test access to pattern matcher 539 Matcher matchURL(String value) { 540 return URL_PATTERN.matcher(value); 511 541 } 512 542 } -
trunk/src/org/openstreetmap/josm/data/validation/routines/package.html
r7489 r9853 20 20 </head> 21 21 <body bgcolor="white"> 22 <p>This package contains <i>independant</i> validation routines adapted from Apache Commons Validator 1. 4.0.</p>22 <p>This package contains <i>independant</i> validation routines adapted from Apache Commons Validator 1.5.0.</p> 23 23 <h1>Table of Contents</h1> 24 24 … … 36 36 </ul> 37 37 38 <a id="overview"></a>38 <a name="overview"></a> 39 39 <h1>1. Overview</h1> 40 40 <p> … … 42 42 </p> 43 43 <ul> 44 <li>To provide standard, independ ant validation routines/functions.</li>44 <li>To provide standard, independent validation routines/functions.</li> 45 45 <li>To provide a <i>mini</i> framework for Validation.</li> 46 46 </ul> 47 47 <p> 48 48 This package has been created, since version 1.3.0, in an attempt to clearly 49 separate these two concerns and is the location for the standard, independ ant49 separate these two concerns and is the location for the standard, independent 50 50 validation routines/functions in <em>Commons Validator</em>. 51 51 </p> … … 56 56 </p> 57 57 58 <a id="other"></a>58 <a name="other"></a> 59 59 <h1>2. Validators</h1> 60 60 61 <a id="other.overview"></a>61 <a name="other.overview"></a> 62 62 <h3>2.1 Overview</h3> 63 63 <p> … … 77 77 </ul> 78 78 79 <a id="other.regex"></a>79 <a name="other.regex"></a> 80 80 <h3>2.2 Regular Expression Validation</h3> 81 81 <p> … … 157 157 </p> 158 158 159 <a id="other.inet"></a>159 <a name="other.inet"></a> 160 160 <h3>2.3 IP Address Validation</h3> 161 161 … … 179 179 </pre> 180 180 181 <a id="other.email"></a>181 <a name="other.email"></a> 182 182 <h3>2.4 Email Address Validation</h3> 183 183 … … 203 203 </pre> 204 204 205 <a id="other.url"></a>205 <a name="other.url"></a> 206 206 <h3>2.5 URL Validation</h3> 207 207 … … 244 244 </pre> 245 245 246 <a id="other.domain"></a>246 <a name="other.domain"></a> 247 247 <h3>2.6 Domain Name Validation</h3> 248 248 -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/InternetTagsTest.java
r7937 r9853 31 31 32 32 /** 33 * Test of "Internet Tags" validation test.33 * Test of valid URLs. 34 34 */ 35 35 @Test 36 public void test() { 37 38 // Valid URLs 36 public void testValidUrls() { 39 37 testUrl("url", "www.domain.com", true); // No protocol 40 38 testUrl("url", "http://josm.openstreetmap.de", true); // Simple HTTP … … 47 45 testUrl("website", "http://золотаяцепь.рф", true); // see #10862: IDN URL in Unicode form 48 46 testUrl("website", "http://золотаяцепь.рф/", true); // see #10862: IDN URL in Unicode form + slash 47 testUrl("website", "http://www.dasideenreich.online", true); // see #12257: new TLD added August 19, 2015 48 } 49 49 50 // Invalid URLs 50 /** 51 * Test of invalid URLs. 52 */ 53 @Test 54 public void testInvalidUrls() { 51 55 testUrl("url", "something://www.domain.com", false); // invalid protocol 52 56 testUrl("url", "http://www.domain.invalidtld", false); // invalid TLD 57 } 53 58 54 // Valid E-mails 59 /** 60 * Test of valid e-mails. 61 */ 62 @Test 63 public void testValidEmails() { 55 64 testEmail("email", "contact@www.domain.com", true); // Simple email 56 65 testEmail("contact:email", "john.doe@other-domain.org", true); // Key with : + dash in domain 66 } 57 67 58 // Invalid E-mails 68 /** 69 * Test of invalid e-mails. 70 */ 71 @Test 72 public void testInvalidEmails() { 59 73 testEmail("email", "contact at www.domain.com", false); // No @ 60 74 testEmail("contact:email", "john.doe@other-domain.invalidtld", false); // invalid TLD -
trunk/tools/checkstyle/josm_filters.xml
r9297 r9853 9 9 <suppress checks="HeaderCheck" files="NTV2SubGrid\.java" /> 10 10 <suppress checks="HeaderCheck" files="NTV2Util\.java" /> 11 <suppress checks="HeaderCheck" files="DomainValidator\.java" /> 12 <suppress checks="HeaderCheck" files="EmailValidator\.java" /> 13 <suppress checks="HeaderCheck" files="InetAddressValidator\.java" /> 14 <suppress checks="HeaderCheck" files="RegexValidator\.java" /> 15 <suppress checks="HeaderCheck" files="UrlValidator\.java" /> 11 <suppress checks="HeaderCheck" files="DomainValidator(Test|IT)?\.java" /> 12 <suppress checks="HeaderCheck" files="EmailValidator(Test)?\.java" /> 13 <suppress checks="HeaderCheck" files="InetAddressValidator(Test)?\.java" /> 14 <suppress checks="HeaderCheck" files="RegexValidator(Test)?\.java" /> 15 <suppress checks="HeaderCheck" files="UrlValidator(Test)?\.java" /> 16 <suppress checks="HeaderCheck" files="ResultPair\.java" /> 16 17 <suppress checks="HeaderCheck" files="Entities\.java" /> 17 18 <suppress checks="HeaderCheck" files="FileDrop\.java" />
Note:
See TracChangeset
for help on using the changeset viewer.