Changeset 19689 in josm
- Timestamp:
- 2026-11-12T18:02:08+01:00 (less than one hour ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/routines/DomainValidator.java
r19604 r19689 297 297 // WARNING: this array MUST be sorted, otherwise it cannot be searched reliably using binary search 298 298 private static final String[] GENERIC_TLDS = { 299 // Taken from Version 2026 072500, Last UpdatedSat Jul 2507:07:01 2026 UTC299 // Taken from Version 2026111200, Last Updated Thu Nov 12 07:07:01 2026 UTC 300 300 "aaa", // aaa American Automobile Association, Inc. 301 301 "aarp", // aarp AARP … … 506 506 "coffee", // coffee Binky Moon, LLC 507 507 "college", // college XYZ.COM LLC 508 "cologne", // cologne do tKoelnGmbH508 "cologne", // cologne domainworx Service & Management GmbH 509 509 "com", // com VeriSign Global Registry Services 510 510 "commbank", // commbank COMMONWEALTH BANK OF AUSTRALIA … … 727 727 "healthcare", // healthcare Binky Moon, LLC 728 728 "help", // help Innovation Service Ltd 729 "helsinki", // helsinki City of Helsinki730 729 "here", // here Charleston Road Registry Inc. 731 730 "hermes", // hermes Hermes International … … 804 803 "jprs", // jprs Japan Registry Services Co., Ltd. 805 804 "juegos", // juegos Dog Beach, LLC 806 "juniper", // juniper JUNIPER NETWORKS, INC.807 805 "kaufen", // kaufen Dog Beach, LLC 808 806 "kddi", // kddi KDDI CORPORATION … … 816 814 "kitchen", // kitchen Binky Moon, LLC 817 815 "kiwi", // kiwi DOT KIWI LIMITED 818 "koeln", // koeln do tKoelnGmbH816 "koeln", // koeln domainworx Service & Management GmbH 819 817 "komatsu", // komatsu Komatsu Ltd. 820 818 "kosher", // kosher Kosher Marketing Assets LLC … … 1246 1244 "tunes", // tunes Amazon Registry Services, Inc. 1247 1245 "tushu", // tushu Amazon Registry Services, Inc. 1248 "tvs", // tvs T V SUNDRAM IYENGAR & SONS PRIVATE LIMITED1246 "tvs", // tvs T V SUNDRAM IYENGAR & SONS PRIVATE LIMITED 1249 1247 "ubank", // ubank National Australia Bank Limited 1250 1248 "ubs", // ubs UBS AG … … 1331 1329 "xn--55qx5d", // 公司 China Internet Network Information Center (CNNIC) 1332 1330 "xn--5su34j936bgsg", // 香格里拉 Shangri-La International Hotel Management Limited 1333 "xn--5tzm5g", // 网站 Global Website TLD Asia Limited1331 "xn--5tzm5g", // 网站 Jolly Host, LLC 1334 1332 "xn--6frz82g", // 移动 Identity Digital Limited 1335 1333 "xn--6qq986b3xl", // 我爱你 Tycoon Treasure Limited … … 1430 1428 // WARNING: this array MUST be sorted, otherwise it cannot be searched reliably using binary search 1431 1429 private static final String[] COUNTRY_CODE_TLDS = { 1432 "ac", // Ascension Island 1433 "ad", // Andorra 1434 "ae", // United Arab Emirates 1435 "af", // Afghanistan 1436 "ag", // Antigua and Barbuda 1437 "ai", // Anguilla 1438 "al", // Albania 1439 "am", // Armenia 1440 //"an", // Netherlands Antilles (retired) 1441 "ao", // Angola 1442 "aq", // Antarctica 1443 "ar", // Argentina 1444 "as", // American Samoa 1445 "at", // Austria 1446 "au", // Australia (includes Ashmore and Cartier Islands and Coral Sea Islands) 1447 "aw", // Aruba 1448 "ax", // Åland 1449 "az", // Azerbaijan 1450 "ba", // Bosnia and Herzegovina 1451 "bb", // Barbados 1452 "bd", // Bangladesh 1453 "be", // Belgium 1454 "bf", // Burkina Faso 1455 "bg", // Bulgaria 1456 "bh", // Bahrain 1457 "bi", // Burundi 1458 "bj", // Benin 1459 "bm", // Bermuda 1460 "bn", // Brunei Darussalam 1461 "bo", // Bolivia 1462 "br", // Brazil 1463 "bs", // Bahamas 1464 "bt", // Bhutan 1465 "bv", // Bouvet Island 1466 "bw", // Botswana 1467 "by", // Belarus 1468 "bz", // Belize 1469 "ca", // Canada 1470 "cc", // Cocos (Keeling) Islands 1471 "cd", // Democratic Republic of the Congo (formerly Zaire) 1472 "cf", // Central African Republic 1473 "cg", // Republic of the Congo 1474 "ch", // Switzerland 1475 "ci", // Côte d'Ivoire 1476 "ck", // Cook Islands 1477 "cl", // Chile 1478 "cm", // Cameroon 1479 "cn", // China, mainland 1480 "co", // Colombia 1481 "cr", // Costa Rica 1482 "cu", // Cuba 1483 "cv", // Cape Verde 1484 "cw", // Curaçao 1485 "cx", // Christmas Island 1486 "cy", // Cyprus 1487 "cz", // Czech Republic 1488 "de", // Germany 1489 "dj", // Djibouti 1490 "dk", // Denmark 1491 "dm", // Dominica 1492 "do", // Dominican Republic 1493 "dz", // Algeria 1494 "ec", // Ecuador 1495 "ee", // Estonia 1496 "eg", // Egypt 1497 "er", // Eritrea 1498 "es", // Spain 1499 "et", // Ethiopia 1500 "eu", // European Union 1501 "fi", // Finland 1502 "fj", // Fiji 1503 "fk", // Falkland Islands 1504 "fm", // Federated States of Micronesia 1505 "fo", // Faroe Islands 1506 "fr", // France 1507 "ga", // Gabon 1508 "gb", // Great Britain (United Kingdom) 1509 "gd", // Grenada 1510 "ge", // Georgia 1511 "gf", // French Guiana 1512 "gg", // Guernsey 1513 "gh", // Ghana 1514 "gi", // Gibraltar 1515 "gl", // Greenland 1516 "gm", // The Gambia 1517 "gn", // Guinea 1518 "gp", // Guadeloupe 1519 "gq", // Equatorial Guinea 1520 "gr", // Greece 1521 "gs", // South Georgia and the South Sandwich Islands 1522 "gt", // Guatemala 1523 "gu", // Guam 1524 "gw", // Guinea-Bissau 1525 "gy", // Guyana 1526 "hk", // Hong Kong 1527 "hm", // Heard Island and McDonald Islands 1528 "hn", // Honduras 1529 "hr", // Croatia (Hrvatska) 1530 "ht", // Haiti 1531 "hu", // Hungary 1532 "id", // Indonesia 1533 "ie", // Ireland (Éire) 1534 "il", // Israel 1535 "im", // Isle of Man 1536 "in", // India 1537 "io", // British Indian Ocean Territory 1538 "iq", // Iraq 1539 "ir", // Iran 1540 "is", // Iceland 1541 "it", // Italy 1542 "je", // Jersey 1543 "jm", // Jamaica 1544 "jo", // Jordan 1545 "jp", // Japan 1546 "ke", // Kenya 1547 "kg", // Kyrgyzstan 1548 "kh", // Cambodia (Khmer) 1549 "ki", // Kiribati 1550 "km", // Comoros 1551 "kn", // Saint Kitts and Nevis 1552 "kp", // North Korea 1553 "kr", // South Korea 1554 "kw", // Kuwait 1555 "ky", // Cayman Islands 1556 "kz", // Kazakhstan 1557 "la", // Laos (currently being marketed as the official domain for Los Angeles) 1558 "lb", // Lebanon 1559 "lc", // Saint Lucia 1560 "li", // Liechtenstein 1561 "lk", // Sri Lanka 1562 "lr", // Liberia 1563 "ls", // Lesotho 1564 "lt", // Lithuania 1565 "lu", // Luxembourg 1566 "lv", // Latvia 1567 "ly", // Libya 1568 "ma", // Morocco 1569 "mc", // Monaco 1570 "md", // Moldova 1571 "me", // Montenegro 1572 "mg", // Madagascar 1573 "mh", // Marshall Islands 1574 "mk", // Republic of Macedonia 1575 "ml", // Mali 1576 "mm", // Myanmar 1577 "mn", // Mongolia 1578 "mo", // Macau 1579 "mp", // Northern Mariana Islands 1580 "mq", // Martinique 1581 "mr", // Mauritania 1582 "ms", // Montserrat 1583 "mt", // Malta 1584 "mu", // Mauritius 1585 "mv", // Maldives 1586 "mw", // Malawi 1587 "mx", // Mexico 1588 "my", // Malaysia 1589 "mz", // Mozambique 1590 "na", // Namibia 1591 "nc", // New Caledonia 1592 "ne", // Niger 1593 "nf", // Norfolk Island 1594 "ng", // Nigeria 1595 "ni", // Nicaragua 1596 "nl", // Netherlands 1597 "no", // Norway 1598 "np", // Nepal 1599 "nr", // Nauru 1600 "nu", // Niue 1601 "nz", // New Zealand 1602 "om", // Oman 1603 "pa", // Panama 1604 "pe", // Peru 1605 "pf", // French Polynesia With Clipperton Island 1606 "pg", // Papua New Guinea 1607 "ph", // Philippines 1608 "pk", // Pakistan 1609 "pl", // Poland 1610 "pm", // Saint-Pierre and Miquelon 1611 "pn", // Pitcairn Islands 1612 "pr", // Puerto Rico 1613 "ps", // Palestinian territories (PA-controlled West Bank and Gaza Strip) 1614 "pt", // Portugal 1615 "pw", // Palau 1616 "py", // Paraguay 1617 "qa", // Qatar 1618 "re", // Réunion 1619 "ro", // Romania 1620 "rs", // Serbia 1621 "ru", // Russia 1622 "rw", // Rwanda 1623 "sa", // Saudi Arabia 1624 "sb", // Solomon Islands 1625 "sc", // Seychelles 1626 "sd", // Sudan 1627 "se", // Sweden 1628 "sg", // Singapore 1629 "sh", // Saint Helena 1630 "si", // Slovenia 1631 "sj", // Svalbard and Jan Mayen Islands Not in use (Norwegian dependencies; see .no) 1632 "sk", // Slovakia 1633 "sl", // Sierra Leone 1634 "sm", // San Marino 1635 "sn", // Senegal 1636 "so", // Somalia 1637 "sr", // Suriname 1638 "ss", // South Sudan 1639 "st", // São Tomé and Príncipe 1640 "su", // Soviet Union (deprecated) 1641 "sv", // El Salvador 1642 "sx", // Sint Maarten 1643 "sy", // Syria 1644 "sz", // Swaziland 1645 "tc", // Turks and Caicos Islands 1646 "td", // Chad 1647 "tf", // French Southern and Antarctic Lands 1648 "tg", // Togo 1649 "th", // Thailand 1650 "tj", // Tajikistan 1651 "tk", // Tokelau 1652 "tl", // East Timor (deprecated old code) 1653 "tm", // Turkmenistan 1654 "tn", // Tunisia 1655 "to", // Tonga 1656 //"tp", // East Timor (Retired) 1657 "tr", // Turkey 1658 "tt", // Trinidad and Tobago 1659 "tv", // Tuvalu 1660 "tw", // Taiwan, Republic of China 1661 "tz", // Tanzania 1662 "ua", // Ukraine 1663 "ug", // Uganda 1664 "uk", // United Kingdom 1665 "us", // United States of America 1666 "uy", // Uruguay 1667 "uz", // Uzbekistan 1668 "va", // Vatican City State 1669 "vc", // Saint Vincent and the Grenadines 1670 "ve", // Venezuela 1671 "vg", // British Virgin Islands 1672 "vi", // U.S. Virgin Islands 1673 "vn", // Vietnam 1674 "vu", // Vanuatu 1675 "wf", // Wallis and Futuna 1676 "ws", // Samoa (formerly Western Samoa) 1430 // Taken from Version 2026111200, Last Updated Thu Nov 12 07:07:01 2026 UTC 1431 "ac", // ac Internet Computer Bureau Limited 1432 "ad", // ad Andorra Telecom 1433 "ae", // ae Telecommunications and Digital Government Regulatory Authority (TDRA) 1434 "af", // af Ministry of Communications and IT 1435 "ag", // ag UHSA School of Medicine 1436 "ai", // ai Government of Anguilla 1437 "al", // al Electronic and Postal Communications Authority - AKEP 1438 "am", // am "Internet Society" Non-governmental Organization 1439 "ao", // ao Ministry of Telecommunications and Information Technologies (MTTI) 1440 "aq", // aq Antarctica Network Information Centre Limited 1441 "ar", // ar Presidencia de la Nación , Secretaría Legal y Técnica 1442 "as", // as AS Domain Registry 1443 "at", // at nic.at GmbH 1444 "au", // au .au Domain Administration (auDA) 1445 "aw", // aw SETAR 1446 "ax", // ax Ålands landskapsregering 1447 "az", // az IntraNS 1448 "ba", // ba University Tele-Informatic Center (UTIC) 1449 "bb", // bb Ministry of Innovation, Science and Smart Technology 1450 "bd", // bd Posts and Telecommunications Division 1451 "be", // be DNS Belgium vzw/asbl 1452 "bf", // bf Autorité de Régulation des Communications Electroniques et des Postes (ARCEP) 1453 "bg", // bg Register.BG 1454 "bh", // bh Telecommunications Regulatory Authority (TRA) 1455 "bi", // bi Centre National de l'Informatique 1456 "bj", // bj Autorité de Régulation des Communications Electroniques et de la Poste du Bénin (ARCEP BENIN) 1457 "bm", // bm Registry General Department, Ministry of Home Affairs 1458 "bn", // bn Authority for Info-communications Technology Industry of Brunei Darussalam (AITI) 1459 "bo", // bo Agencia de Gobierno Electrónico y Tecnologías de Información y Comunicación 1460 "br", // br Comite Gestor da Internet no Brasil 1461 "bs", // bs University of The Bahamas 1462 "bt", // bt Ministry of Information and Communications 1463 "bv", // bv Norid A/S 1464 "bw", // bw Botswana Communications Regulatory Authority (BOCRA) 1465 "by", // by Belarusian Cloud Technologies LLC 1466 "bz", // bz University of Belize 1467 "ca", // ca Canadian Internet Registration Authority (CIRA) Autorité Canadienne pour les enregistrements Internet (ACEI) 1468 "cc", // cc eNIC Cocos (Keeling) Islands Pty. Ltd. d/b/a Island Internet Services 1469 "cd", // cd Office Congolais des Postes et Télécommunications - OCPT 1470 "cf", // cf Societe Centrafricaine de Telecommunications (SOCATEL) 1471 "cg", // cg Interpoint Switzerland 1472 "ch", // ch SWITCH The Swiss Education & Research Network 1473 "ci", // ci Autorité de Régulation des Télécommunications/TIC de Côte d’lvoire (ARTCI) 1474 "ck", // ck Telecom Cook Islands Ltd. 1475 "cl", // cl NIC Chile (University of Chile) 1476 "cm", // cm Agence Nationale des Technologies de l'Information et de la Communication (ANTIC) 1477 "cn", // cn China Internet Network Information Center (CNNIC) 1478 "co", // co Ministry of Information and Communications Technologies (MinTIC) 1479 "cr", // cr National Academy of Sciences (Academia Nacional de Ciencias) 1480 "cu", // cu CENIAInternet 1481 "cv", // cv Agência Reguladora Multissectorial da Economia (ARME) 1482 "cw", // cw University of Curacao 1483 "cx", // cx Christmas Island Domain Administration Limited 1484 "cy", // cy University of Cyprus 1485 "cz", // cz CZ.NIC, z.s.p.o 1486 "de", // de DENIC eG 1487 "dj", // dj Djibouti Telecom S.A 1488 "dk", // dk Dansk Internet Forum 1489 "dm", // dm DotDM Corporation 1490 "do", // do Pontificia Universidad Catolica Madre y Maestra, Recinto Santo Tomas de Aquino 1491 "dz", // dz CERIST 1492 "ec", // ec ECUADORDOMAIN S.A. 1493 "ee", // ee Eesti Interneti Sihtasutus (EIS) 1494 "eg", // eg Egyptian Universities Network (EUN), Supreme Council of Universities 1495 "er", // er Eritrea Telecommunication Services Corporation (EriTel) 1496 "es", // es Red.es 1497 "et", // et Ethio telecom 1498 "eu", // eu EURid vzw 1499 "fi", // fi Finnish Transport and Communications Agency Traficom 1500 "fj", // fj The University of the South Pacific IT Services 1501 "fk", // fk Falkland Islands Government 1502 "fm", // fm FSM Telecommunications Corporation 1503 "fo", // fo FO Council 1504 "fr", // fr Association Française pour le Nommage Internet en Coopération (A.F.N.I.C.) 1505 "ga", // ga Agence Nationale des Infrastructures Numériques et des Fréquences (ANINF) 1506 "gb", // gb Reserved Domain - IANA 1507 "gd", // gd The National Telecommunications Regulatory Commission (NTRC) 1508 "ge", // ge Caucasus Online LLC 1509 "gf", // gf CANAL+ TELECOM 1510 "gg", // gg Island Networks Ltd. 1511 "gh", // gh Network Computer Systems Limited 1512 "gi", // gi Sapphire Networks 1513 "gl", // gl TELE Greenland A/S 1514 "gm", // gm GM-NIC 1515 "gn", // gn Centre National des Sciences Halieutiques de Boussoura 1516 "gp", // gp Networking Technologies Group 1517 "gq", // gq GETESA 1518 "gr", // gr ICS-FORTH GR 1519 "gs", // gs Government of South Georgia and South Sandwich Islands (GSGSSI) 1520 "gt", // gt Universidad del Valle de Guatemala 1521 "gu", // gu University of Guam 1522 "gw", // gw Autoridade Reguladora Nacional - Tecnologias de Informação e Comunicação da Guiné-Bissau 1523 "gy", // gy University of Guyana 1524 "hk", // hk Hong Kong Internet Registration Corporation Ltd. 1525 "hm", // hm HM Domain Registry 1526 "hn", // hn Red de Desarrollo Sostenible Honduras 1527 "hr", // hr CARNet - Croatian Academic and Research Network 1528 "ht", // ht Consortium FDS/RDDH 1529 "hu", // hu Council of Hungarian Internet Providers (CHIP) 1530 "id", // id Perkumpulan Pengelola Nama Domain Internet Indonesia (PANDI) 1531 "ie", // ie IE Domain Registry CLG 1532 "il", // il The Israel Internet Association (RA) 1533 "im", // im Isle of Man Government 1534 "in", // in National Internet Exchange of India 1535 "io", // io Internet Computer Bureau Limited 1536 "iq", // iq Communications and Media Commission (CMC) 1537 "ir", // ir Institute for Research in Fundamental Sciences 1538 "is", // is ISNIC - Internet á Íslandi hf. 1539 "it", // it IIT - CNR 1540 "je", // je Island Networks (Jersey) Ltd. 1541 "jm", // jm University of West Indies 1542 "jo", // jo Ministry of Digital Economy and Entrepreneurship (MoDEE) 1543 "jp", // jp Japan Registry Services Co., Ltd. 1544 "ke", // ke Kenya Network Information Center (KeNIC) 1545 "kg", // kg AsiaInfo Telecommunication Enterprise 1546 "kh", // kh Telecommunication Regulator of Cambodia (TRC) 1547 "ki", // ki Ministry of Information, Communications and Transport (MICT) 1548 "km", // km Comores Telecom 1549 "kn", // kn Ministry of Finance, Sustainable Development Information & Technology 1550 "kp", // kp Star Joint Venture Company 1551 "kr", // kr Korea Internet & Security Agency (KISA) 1552 "kw", // kw Communications and Information Technology Regulatory Authority 1553 "ky", // ky Utility Regulation and Competition Office (OfReg) 1554 "kz", // kz Association of IT Companies of Kazakhstan 1555 "la", // la Lao National Internet Center (LANIC), Ministry of Technology and Communications 1556 "lb", // lb Internet Society Lebanon 1557 "lc", // lc University of Puerto Rico 1558 "li", // li SWITCH The Swiss Education & Research Network 1559 "lk", // lk Council for Information Technology LK Domain Registrar 1560 "lr", // lr Data Technology Solutions, Inc. 1561 "ls", // ls Lesotho Network Information Centre Proprietary (LSNIC) 1562 "lt", // lt Kaunas University of Technology 1563 "lu", // lu RESTENA 1564 "lv", // lv University of Latvia, Institute of Mathematics and Computer Science, Department of Network Solutions (DNS) 1565 "ly", // ly General Authority of Communications and Informatics (GACI) 1566 "ma", // ma Agence Nationale de Réglementation des Télécommunications (ANRT) 1567 "mc", // mc Direction des Plateformes et des Ressources Numériques 1568 "md", // md IP Serviciul Tehnologia Informatiei si Securitate Cibernetica 1569 "me", // me Government of Montenegro 1570 "mg", // mg NIC-MG (Network Information Center Madagascar) 1571 "mh", // mh Office of the Cabinet 1572 "mk", // mk Macedonian Academic Research Network Skopje 1573 "ml", // ml Agence des Technologies de l’Information et de la Communication 1574 "mm", // mm Ministry of Transport and Communications 1575 "mn", // mn Datacom Co., Ltd. 1576 "mo", // mo Macao Post and Telecommunications Bureau (CTT) 1577 "mp", // mp Saipan Datacom, Inc. 1578 "mq", // mq CANAL+ TELECOM 1579 "mr", // mr Université de Nouakchott Al Aasriya 1580 "ms", // ms MNI Networks Ltd. 1581 "mt", // mt NIC (Malta) 1582 "mu", // mu Internet Direct Ltd 1583 "mv", // mv Dhivehi Raajjeyge Gulhun PLC 1584 "mw", // mw Malawi Sustainable Development Network Programme (Malawi SDNP) 1585 "mx", // mx NIC-Mexico ITESM - Campus Monterrey 1586 "my", // my MYNIC Berhad 1587 "mz", // mz Centro de Informatica de Universidade Eduardo Mondlane 1588 "na", // na Namibian Network Information Center 1589 "nc", // nc Office des Postes et Telecommunications 1590 "ne", // ne Niger Télécoms SA (NIGERTELECOMS) 1591 "nf", // nf Norfolk Island Data Services 1592 "ng", // ng Nigeria Internet Registration Association 1593 "ni", // ni Universidad Nacional del Ingernieria. Division de Tecnologias de la Informacion. 1594 "nl", // nl SIDN (Stichting Internet Domeinregistratie Nederland) 1595 "no", // no Norid A/S 1596 "np", // np Mercantile Communications Pvt. Ltd. 1597 "nr", // nr CENPAC NET 1598 "nu", // nu The IUSN Foundation 1599 "nz", // nz InternetNZ 1600 "om", // om Telecommunications Regulatory Authority (TRA) 1601 "pa", // pa Universidad Tecnologica de Panama 1602 "pe", // pe Red Cientifica Peruana 1603 "pf", // pf Gouvernement de la Polynésie française 1604 "pg", // pg PNG DNS Administration, Vice Chancellors Office, The Papua New Guinea University of Technology 1605 "ph", // ph PH Domain Foundation 1606 "pk", // pk PKNIC 1607 "pl", // pl Research and Academic Computer Network 1608 "pm", // pm Association Française pour le Nommage Internet en Coopération (A.F.N.I.C.) 1609 "pn", // pn Pitcairn Island Administration 1610 "pr", // pr Gauss Research Laboratory Inc. 1611 "ps", // ps Ministry of Telecommunications & Information Technology, Government Computer Center 1612 "pt", // pt Associação DNS.PT 1613 "pw", // pw Micronesia Investment and Development Corporation 1614 "py", // py NIC-PY 1615 "qa", // qa Communications Regulatory Authority 1616 "re", // re Association Française pour le Nommage Internet en Coopération (A.F.N.I.C.) 1617 "ro", // ro National Institute for R&D in Informatics 1618 "rs", // rs Serbian National Internet Domain Registry (RNIDS) 1619 "ru", // ru Coordination Center for TLD RU 1620 "rw", // rw Rwanda Internet Community and Technology Alliance (RICTA) Ltd 1621 "sa", // sa Communications, Space and Technology Commission 1622 "sb", // sb Solomon Telekom Company Limited 1623 "sc", // sc VCS Pty Ltd 1624 "sd", // sd Sudan Internet Society 1625 "se", // se The Internet Infrastructure Foundation 1626 "sg", // sg Singapore Network Information Centre (SGNIC) Pte Ltd 1627 "sh", // sh Government of St. Helena 1628 "si", // si Academic and Research Network of Slovenia (ARNES) 1629 "sj", // sj Norid A/S 1630 "sk", // sk SK-NIC, a.s. 1631 "sl", // sl Sierratel 1632 "sm", // sm Telecom Italia San Marino S.p.A. 1633 "sn", // sn Universite Cheikh Anta Diop 1634 "so", // so Ministry of Post and Telecommunications 1635 "sr", // sr Telesur 1636 "ss", // ss National Communication Authority (NCA) 1637 "st", // st Tecnisys 1638 "su", // su Russian Institute for Development of Public Networks (ROSNIIROS) 1639 "sv", // sv SVNet 1640 "sx", // sx SX Registry SA B.V. 1641 "sy", // sy National Authority for Information Technology Services (NAITS) 1642 "sz", // sz University of Swaziland Department of Computer Science 1643 "tc", // tc Melrex TC 1644 "td", // td l'Agence de Développement des Technologies de l'Information et de la Communication (ADETIC) 1645 "tf", // tf Association Française pour le Nommage Internet en Coopération (A.F.N.I.C.) 1646 "tg", // tg Autorité de Régulation des Communications Electroniques et des Postes (ARCEP) 1647 "th", // th Thai Network Information Center Foundation 1648 "tj", // tj Information Technology Center 1649 "tk", // tk Telecommunication Tokelau Corporation (Teletok) 1650 "tl", // tl Autoridade Nacional de Comunicações 1651 "tm", // tm TM Domain Registry Ltd 1652 "tn", // tn Agence Tunisienne d'Internet 1653 "to", // to Government of the Kingdom of Tonga, H.R.H. Crown Prince Tupouto'a, c/o Consulate of Tonga 1654 "tr", // tr Bilgi Teknolojileri ve İletişim Kurumu (BTK) 1655 "tt", // tt University of the West Indies, Faculty of Engineering 1656 "tv", // tv Ministry of Transport, Energy, Communications and Innovations 1657 "tw", // tw Taiwan Network Information Center (TWNIC) 1658 "tz", // tz Tanzania Communications Regulatory Authority 1659 "ua", // ua Hostmaster Ltd. 1660 "ug", // ug Uganda Online Ltd. 1661 "uk", // uk Nominet UK 1662 "us", // us Registry Services, LLC 1663 "uy", // uy SeCIU - Universidad de la Republica 1664 "uz", // uz Single Integrator for Creation and Support of State Information Systems UZINFOCOM 1665 "va", // va Holy See - Vatican City State 1666 "vc", // vc Ministry of Telecommunications, Science, Technology and Industry 1667 "ve", // ve Comisión Nacional de Telecomunicaciones (CONATEL) 1668 "vg", // vg Telecommunications Regulatory Commission of the Virgin Islands 1669 "vi", // vi Virgin Islands Public Telecommunications System, Inc. 1670 "vn", // vn Viet Nam Internet Network Information Center (VNNIC) 1671 "vu", // vu Telecommunications Radiocommunications and Broadcasting Regulator (TRBR) 1672 "wf", // wf Association Française pour le Nommage Internet en Coopération (A.F.N.I.C.) 1673 "ws", // ws Government of Samoa Ministry of Foreign Affairs & Trade 1677 1674 "xn--2scrj9c", // ಭಾರತ National Internet eXchange of India 1678 1675 "xn--3e0b707e", // 한국 KISA (Korea Internet & Security Agency) … … 1736 1733 "xn--yfro4i67o", // 新加坡 Singapore Network Information Centre (SGNIC) Pte Ltd 1737 1734 "xn--ygbi2ammx", // فلسطين Ministry of Telecom & Information Technology (MTIT) 1738 "ye", //Yemen1739 "yt", // Mayotte1740 "za", // South Africa1741 "zm", //Zambia1742 "zw", //Zimbabwe1735 "ye", // ye TeleYemen 1736 "yt", // yt Association Française pour le Nommage Internet en Coopération (A.F.N.I.C.) 1737 "za", // za ZA Domain Name Authority 1738 "zm", // zm Zambia Information and Communications Technology Authority (ZICTA) 1739 "zw", // zw Postal and Telecommunications Regulatory Authority of Zimbabwe (POTRAZ) 1743 1740 }; 1744 1741 -
trunk/test/unit/org/openstreetmap/josm/data/validation/routines/DomainValidatorTestIT.java
r19527 r19689 32 32 import java.net.HttpURLConnection; 33 33 import java.net.IDN; 34 import java.net.UR L;34 import java.net.URI; 35 35 import java.nio.charset.StandardCharsets; 36 36 import java.nio.file.Files; … … 43 43 import java.util.Set; 44 44 import java.util.TreeMap; 45 import java.util.regex.Matcher; 46 import java.util.regex.Pattern; 45 46 import jakarta.json.Json; 47 import jakarta.json.JsonArray; 48 import jakarta.json.JsonObject; 49 import jakarta.json.JsonReader; 50 import jakarta.json.JsonValue; 47 51 48 52 import org.junit.jupiter.api.Test; … … 50 54 import org.openstreetmap.josm.testutils.annotations.IntegrationTest; 51 55 import org.openstreetmap.josm.tools.Logging; 52 53 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;54 56 55 57 /** … … 83 85 File txtFile = new File(System.getProperty("java.io.tmpdir"), "tlds-alpha-by-domain.txt"); 84 86 long timestamp; 87 String tlds = "https://data.iana.org/TLD/tlds-alpha-by-domain.txt"; 85 88 try { 86 timestamp = download(txtFile, "http://data.iana.org/TLD/tlds-alpha-by-domain.txt", 0L);89 timestamp = download(txtFile, tlds, 0L); 87 90 } catch (ConnectException e) { 88 91 Logging.error(e); 89 92 // Try again one more time in case of random network issue 90 timestamp = download(txtFile, "http://data.iana.org/TLD/tlds-alpha-by-domain.txt", 0L);91 } 92 final File htmlFile = new File(System.getProperty("java.io.tmpdir"), "tlds-alpha-by-domain.html");93 // N.B. sometimes the html filemay be updated a day or so after the txt file94 // if the txt file contains entries not found in the htmlfile, try again in a day or two95 download( htmlFile, "http://www.iana.org/domains/root/db", timestamp);93 timestamp = download(txtFile, tlds, 0L); 94 } 95 final File jsonFile = new File(System.getProperty("java.io.tmpdir"), "tlds-alpha-by-domain.json"); 96 // N.B. sometimes the JSON data may be updated a day or so after the txt file 97 // if the txt file contains entries not found in the JSON file, try again in a day or two 98 download(jsonFile, "https://data.iana.org/TLD/v1/tlds.json", timestamp); 96 99 97 100 try (BufferedReader br = new BufferedReader(new InputStreamReader(Files.newInputStream(txtFile.toPath()), StandardCharsets.UTF_8))) { … … 106 109 final boolean generateUnicodeTlds = false; // Change this to generate Unicode TLDs as well 107 110 108 // Parse html pageto get entries109 Map<String, String[]> htmlInfo = getHtmlInfo(htmlFile);111 // Parse JOSN to get entries 112 Map<String, String[]> jsonInfo = getJSONInfo(jsonFile); 110 113 Map<String, String> missingTLD = new TreeMap<>(); // stores entry and comments as String[] 111 114 Map<String, String> missingCC = new TreeMap<>(); … … 121 124 unicodeTld = asciiTld; 122 125 } 123 String[] info = htmlInfo.get(asciiTld);126 String[] info = jsonInfo.get(asciiTld); 124 127 if (info != null) { 125 128 String type = info[0]; 126 String comment = info[1] .replaceAll(""", "\"").replaceAll("'", "'").replaceAll("&", "&");129 String comment = info[1]; 127 130 if ("country-code".equals(type)) { // Which list to use? 128 131 if (!dv.isValidInfrastructureTld(asciiTld)) { … … 150 153 } 151 154 } 152 } else {153 Logging.error("Expected to find HTML info for "+ asciiTld);154 155 } 156 } else { 157 Logging.error("Expected to find JSON information for "+ asciiTld); 155 158 } 156 159 ianaTlds.add(asciiTld); … … 163 166 } 164 167 } 165 // List htmlentries not in TLD text list166 for (String key : (new TreeMap<>( htmlInfo)).keySet()) {168 // List JSON entries not in TLD text list 169 for (String key : (new TreeMap<>(jsonInfo)).keySet()) { 167 170 if (!ianaTlds.contains(key)) { 168 if (isNotInRootZone(key)) { 169 Logging.info("HTML entry not yet in root zone: "+key); 170 } else { 171 Logging.warn("Expected to find text entry for html: "+key); 172 } 171 Logging.warn("Expected to find text entry for JSON: "+key); 173 172 } 174 173 } … … 177 176 if (s != null) /* text too long, shorten a bit */ 178 177 allTLD.replace("melbourne", s.replace("represented by its ", "")); 179 printMap(header, allTLD, "allTLD"); 180 printMap(header, allCC, "allCC"); 178 printMap(header, allTLD, "allTLD", "in"); 179 printMap(header, allCC, "allCC", "in"); 181 180 if (!missingTLD.isEmpty()) { 182 printMap(header, missingTLD, "TLD"); 181 printMap(header, missingTLD, "TLD", "missing from"); 183 182 fail("missing TLD"); 184 183 } 185 184 if (!missingCC.isEmpty()) { 186 printMap(header, missingCC, "CC"); 185 printMap(header, missingCC, "CC", "missing from"); 187 186 fail("missing CC"); 188 187 } … … 195 194 } 196 195 197 private static void printMap(final String header, Map<String, String> map, String string) { 198 Logging.warn("Entries missing from"+ string +" List\n");196 private static void printMap(final String header, Map<String, String> map, String string, String mode) { 197 Logging.warn("Entries " + mode + " "+ string +" List\n"); 199 198 if (header != null) { 200 199 Logging.warn(" // Taken from " + header); … … 206 205 } 207 206 208 @SuppressFBWarnings(value = "PERFORMANCE") 209 private static Map<String, String[]> getHtmlInfo(final File f) throws IOException { 207 private static Map<String, String[]> getJSONInfo(final File f) throws IOException { 210 208 final Map<String, String[]> info = new HashMap<>(); 211 209 212 final Pattern domain = Pattern.compile(".*<a href=\"/domains/root/db/([^.]+)\\.html"); 213 final Pattern type = Pattern.compile("\\s+<td>([^<]+)</td>"); 214 final Pattern comment = Pattern.compile("\\s+<td>([^<]+)</td>"); 215 216 try (BufferedReader br = new BufferedReader(new InputStreamReader(Files.newInputStream(f.toPath()), StandardCharsets.UTF_8))) { 217 String line; 218 while ((line = br.readLine()) != null) { 219 Matcher m = domain.matcher(line); 220 if (m.lookingAt()) { 221 String dom = m.group(1); 222 String typ = "??"; 210 try (BufferedReader br = new BufferedReader(new InputStreamReader(Files.newInputStream(f.toPath()), StandardCharsets.UTF_8)); 211 JsonReader reader = Json.createReader(br)) { 212 213 JsonObject root = reader.readObject(); 214 JsonArray domains = root.getJsonArray("domains"); 215 216 if (domains != null) { 217 for (JsonValue val : domains) { 218 JsonObject domainNode = val.asJsonObject(); 219 220 String dom = domainNode.getString("name", ""); 221 String typ = domainNode.getString("type", "??"); 222 String status = domainNode.getString("status", ""); 223 223 224 String com = "??"; 224 line = br.readLine(); 225 while (line != null && line.matches("^\\s*$")) { // extra blank lines introduced 226 line = br.readLine(); 227 } 228 Matcher t = type.matcher(line); 229 if (t.lookingAt()) { 230 typ = t.group(1); 231 line = br.readLine(); 232 if (line != null && line.matches("\\s+<!--.*")) { 233 while (line != null && !line.matches(".*-->.*")) { 234 line = br.readLine(); 235 } 236 line = br.readLine(); 225 if (domainNode.containsKey("manager") && !domainNode.isNull("manager")) { 226 JsonObject managerNode = domainNode.getJsonObject("manager"); 227 if (managerNode != null && managerNode.containsKey("organization") && !managerNode.isNull("organization")) { 228 com = managerNode.getString("organization", "??"); 237 229 } 238 // Should have comment; is it wrapped? 239 while (line != null && !line.matches(".*</td>.*")) { 240 line += " " +br.readLine(); 241 } 242 Matcher n = comment.matcher(line); 243 if (n.lookingAt()) { 244 com = n.group(1); 245 } 246 // Don't save unused entries 247 if (!com.contains("Not assigned") && !com.contains("Retired") && !typ.equals("test")) { 248 info.put(dom.toLowerCase(Locale.ENGLISH), new String[]{typ, com}); 249 } 250 } else { 251 Logging.error("Unexpected type: " + line); 230 } 231 232 boolean isRetired = "retired".equalsIgnoreCase(status); 233 boolean isTest = "test".equalsIgnoreCase(typ); 234 boolean isNotAssigned = com.contains("Not assigned") || com.equals("??"); 235 236 if (!isRetired && !isTest && !isNotAssigned) { 237 info.put(dom.toLowerCase(Locale.ENGLISH), new String[]{typ, com}); 252 238 } 253 239 } … … 260 246 * Download a file if it is more recent than our cached copy. 261 247 * Unfortunately the server does not seem to honour If-Modified-Since for the 262 * Htmlpage, so we check if it is newer than the txt file and skip download if so248 * page, so we check if it is newer than the txt file and skip download if so 263 249 */ 264 250 private static long download(File f, String tldurl, long timestamp) throws IOException { … … 275 261 modTime = 0; 276 262 } 277 HttpURLConnection hc = (HttpURLConnection) new URL(tldurl).openConnection();263 HttpURLConnection hc = (HttpURLConnection) URI.create(tldurl).toURL().openConnection(); 278 264 if (modTime > 0) { 279 265 SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z"); //Sun, 06 Nov 1994 08:49:37 GMT … … 288 274 byte[] buff = new byte[1024]; 289 275 try (InputStream is = hc.getInputStream(); 290 FileOutputStream fos = new FileOutputStream(f)) {291 int len; 292 while ((len = is.read(buff)) != -1) { 293 fos.write(buff, 0, len); 276 FileOutputStream fos = new FileOutputStream(f)) { 277 int len; 278 while ((len = is.read(buff)) != -1) { 279 fos.write(buff, 0, len); 294 280 } 295 281 } … … 297 283 } 298 284 return f.lastModified(); 299 }300 301 /**302 * Check whether the domain is in the root zone currently.303 * Reads the URL http://www.iana.org/domains/root/db/*domain*.html304 * (using a local disk cache)305 * and checks for the string "This domain is not present in the root zone at this time."306 * @param domain the domain to check307 * @return true if the string is found308 */309 private static boolean isNotInRootZone(String domain) {310 String tldurl = "http://www.iana.org/domains/root/db/" + domain + ".html";311 BufferedReader in = null;312 try {313 File rootCheck = new File(System.getProperty("java.io.tmpdir"), "tld_" + domain + ".html");314 download(rootCheck, tldurl, 0L);315 in = new BufferedReader(new InputStreamReader(Files.newInputStream(rootCheck.toPath()), StandardCharsets.UTF_8));316 String inputLine;317 while ((inputLine = in.readLine()) != null) {318 if (inputLine.contains("This domain is not present in the root zone at this time.")) {319 return true;320 }321 }322 in.close();323 } catch (IOException e) {324 e.printStackTrace();325 } finally {326 closeQuietly(in);327 }328 return false;329 285 } 330 286
Note:
See TracChangeset
for help on using the changeset viewer.
