Changeset 7779 in josm for trunk/src


Ignore:
Timestamp:
2014-12-10T02:05:02+01:00 (10 years ago)
Author:
Don-vip
Message:

fix #10810 - update Apache Validator routines to latest version in trunk to support recent TLDs in DomainValidator

Location:
trunk/src/org/openstreetmap/josm/data/validation/routines
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/routines/DomainValidator.java

    r7489 r7779  
    1818
    1919import java.util.Arrays;
    20 import java.util.List;
    2120
    2221/**
     
    5756 * </p>
    5857 *
    59  * @version $Revision: 1227719 $ $Date: 2012-01-05 18:45:51 +0100 (Thu, 05 Jan 2012) $
     58 * @version $Revision: 1640271 $ $Date: 2014-11-18 02:32:15 2014 UTC (Tue, 18 Nov 2014) $
    6059 * @since Validator 1.4
    6160 */
     
    163162     */
    164163    public boolean isValidInfrastructureTld(String iTld) {
    165         return INFRASTRUCTURE_TLD_LIST.contains(chompLeadingDot(iTld.toLowerCase()));
     164        return Arrays.binarySearch(INFRASTRUCTURE_TLDS, (chompLeadingDot(iTld.toLowerCase()))) >= 0;
    166165    }
    167166
     
    174173     */
    175174    public boolean isValidGenericTld(String gTld) {
    176         return GENERIC_TLD_LIST.contains(chompLeadingDot(gTld.toLowerCase()));
     175        return Arrays.binarySearch(GENERIC_TLDS, chompLeadingDot(gTld.toLowerCase())) >= 0;
    177176    }
    178177
     
    185184     */
    186185    public boolean isValidCountryCodeTld(String ccTld) {
    187         return COUNTRY_CODE_TLD_LIST.contains(chompLeadingDot(ccTld.toLowerCase()));
     186        return Arrays.binarySearch(COUNTRY_CODE_TLDS, chompLeadingDot(ccTld.toLowerCase())) >= 0;
    188187    }
    189188
     
    196195     */
    197196    public boolean isValidLocalTld(String iTld) {
    198         return LOCAL_TLD_LIST.contains(chompLeadingDot(iTld.toLowerCase()));
     197        return Arrays.binarySearch(LOCAL_TLDS, chompLeadingDot(iTld.toLowerCase())) >= 0;
    199198    }
    200199
     
    218217
    219218    private static final String[] GENERIC_TLDS = new String[] {
    220         "aero",               // air transport industry
    221         "asia",               // Pan-Asia/Asia Pacific
    222         "biz",                // businesses
    223         "cat",                // Catalan linguistic/cultural community
    224         "com",                // commercial enterprises
    225         "coop",               // cooperative associations
    226         "info",               // informational sites
    227         "jobs",               // Human Resource managers
    228         "mobi",               // mobile products and services
    229         "museum",             // museums, surprisingly enough
    230         "name",               // individuals' sites
    231         "net",                // internet support infrastructure/business
    232         "org",                // noncommercial organizations
    233         "pro",                // credentialed professionals and entities
    234         "tel",                // contact data for businesses and individuals
    235         "travel",             // entities in the travel industry
    236         "gov",                // United States Government
    237         "edu",                // accredited postsecondary US education entities
    238         "mil",                // United States Military
    239         "int"                 // organizations established by international treaty
     219        "abogado",
     220        "academy",
     221        "accountants",
     222        "active",
     223        "actor",
     224        "aero",
     225        "agency",
     226        "airforce",
     227        "allfinanz",
     228        "alsace",
     229        "archi",
     230        "army",
     231        "arpa",
     232        "asia",
     233        "associates",
     234        "attorney",
     235        "auction",
     236        "audio",
     237        "autos",
     238        "axa",
     239        "band",
     240        "bar",
     241        "bargains",
     242        "bayern",
     243        "beer",
     244        "berlin",
     245        "best",
     246        "bid",
     247        "bike",
     248        "bio",
     249        "biz",
     250        "black",
     251        "blackfriday",
     252        "blue",
     253        "bmw",
     254        "bnpparibas",
     255        "boo",
     256        "boutique",
     257        "brussels",
     258        "budapest",
     259        "build",
     260        "builders",
     261        "business",
     262        "buzz",
     263        "bzh",
     264        "cab",
     265        "cal",
     266        "camera",
     267        "camp",
     268        "cancerresearch",
     269        "capetown",
     270        "capital",
     271        "caravan",
     272        "cards",
     273        "care",
     274        "career",
     275        "careers",
     276        "casa",
     277        "cash",
     278        "cat",
     279        "catering",
     280        "center",
     281        "ceo",
     282        "cern",
     283        "channel",
     284        "cheap",
     285        "christmas",
     286        "chrome",
     287        "church",
     288        "citic",
     289        "city",
     290        "claims",
     291        "cleaning",
     292        "click",
     293        "clinic",
     294        "clothing",
     295        "club",
     296        "codes",
     297        "coffee",
     298        "college",
     299        "cologne",
     300        "com",
     301        "community",
     302        "company",
     303        "computer",
     304        "condos",
     305        "construction",
     306        "consulting",
     307        "contractors",
     308        "cooking",
     309        "cool",
     310        "coop",
     311        "country",
     312        "credit",
     313        "creditcard",
     314        "crs",
     315        "cruises",
     316        "cuisinella",
     317        "cymru",
     318        "dad",
     319        "dance",
     320        "dating",
     321        "day",
     322        "deals",
     323        "degree",
     324        "democrat",
     325        "dental",
     326        "dentist",
     327        "desi",
     328        "diamonds",
     329        "diet",
     330        "digital",
     331        "direct",
     332        "directory",
     333        "discount",
     334        "dnp",
     335        "domains",
     336        "durban",
     337        "dvag",
     338        "eat",
     339        "edu",
     340        "education",
     341        "email",
     342        "engineer",
     343        "engineering",
     344        "enterprises",
     345        "equipment",
     346        "esq",
     347        "estate",
     348        "eus",
     349        "events",
     350        "exchange",
     351        "expert",
     352        "exposed",
     353        "fail",
     354        "farm",
     355        "feedback",
     356        "finance",
     357        "financial",
     358        "fish",
     359        "fishing",
     360        "fitness",
     361        "flights",
     362        "florist",
     363        "flsmidth",
     364        "fly",
     365        "foo",
     366        "forsale",
     367        "foundation",
     368        "frl",
     369        "frogans",
     370        "fund",
     371        "furniture",
     372        "futbol",
     373        "gal",
     374        "gallery",
     375        "gbiz",
     376        "gent",
     377        "gift",
     378        "gifts",
     379        "gives",
     380        "glass",
     381        "gle",
     382        "global",
     383        "globo",
     384        "gmail",
     385        "gmo",
     386        "gmx",
     387        "google",
     388        "gop",
     389        "gov",
     390        "graphics",
     391        "gratis",
     392        "green",
     393        "gripe",
     394        "guide",
     395        "guitars",
     396        "guru",
     397        "hamburg",
     398        "haus",
     399        "healthcare",
     400        "help",
     401        "here",
     402        "hiphop",
     403        "hiv",
     404        "holdings",
     405        "holiday",
     406        "homes",
     407        "horse",
     408        "host",
     409        "hosting",
     410        "house",
     411        "how",
     412        "ibm",
     413        "immo",
     414        "immobilien",
     415        "industries",
     416        "info",
     417        "ing",
     418        "ink",
     419        "institute",
     420        "insure",
     421        "int",
     422        "international",
     423        "investments",
     424        "jetzt",
     425        "jobs",
     426        "joburg",
     427        "juegos",
     428        "kaufen",
     429        "kim",
     430        "kitchen",
     431        "kiwi",
     432        "koeln",
     433        "krd",
     434        "kred",
     435        "lacaixa",
     436        "land",
     437        "lawyer",
     438        "lease",
     439        "lgbt",
     440        "life",
     441        "lighting",
     442        "limited",
     443        "limo",
     444        "link",
     445        "loans",
     446        "london",
     447        "lotto",
     448        "ltda",
     449        "luxe",
     450        "luxury",
     451        "maison",
     452        "management",
     453        "mango",
     454        "market",
     455        "marketing",
     456        "media",
     457        "meet",
     458        "melbourne",
     459        "meme",
     460        "menu",
     461        "miami",
     462        "mil",
     463        "mini",
     464        "mobi",
     465        "moda",
     466        "moe",
     467        "monash",
     468        "mortgage",
     469        "moscow",
     470        "motorcycles",
     471        "mov",
     472        "museum",
     473        "nagoya",
     474        "name",
     475        "navy",
     476        "net",
     477        "network",
     478        "neustar",
     479        "new",
     480        "nexus",
     481        "ngo",
     482        "nhk",
     483        "ninja",
     484        "nra",
     485        "nrw",
     486        "nyc",
     487        "okinawa",
     488        "ong",
     489        "onl",
     490        "ooo",
     491        "org",
     492        "organic",
     493        "otsuka",
     494        "ovh",
     495        "paris",
     496        "partners",
     497        "parts",
     498        "pharmacy",
     499        "photo",
     500        "photography",
     501        "photos",
     502        "physio",
     503        "pics",
     504        "pictures",
     505        "pink",
     506        "pizza",
     507        "place",
     508        "plumbing",
     509        "pohl",
     510        "poker",
     511        "post",
     512        "praxi",
     513        "press",
     514        "pro",
     515        "prod",
     516        "productions",
     517        "prof",
     518        "properties",
     519        "property",
     520        "pub",
     521        "qpon",
     522        "quebec",
     523        "realtor",
     524        "recipes",
     525        "red",
     526        "rehab",
     527        "reise",
     528        "reisen",
     529        "ren",
     530        "rentals",
     531        "repair",
     532        "report",
     533        "republican",
     534        "rest",
     535        "restaurant",
     536        "reviews",
     537        "rich",
     538        "rio",
     539        "rip",
     540        "rocks",
     541        "rodeo",
     542        "rsvp",
     543        "ruhr",
     544        "ryukyu",
     545        "saarland",
     546        "sarl",
     547        "sca",
     548        "scb",
     549        "schmidt",
     550        "schule",
     551        "scot",
     552        "services",
     553        "sexy",
     554        "shiksha",
     555        "shoes",
     556        "singles",
     557        "social",
     558        "software",
     559        "sohu",
     560        "solar",
     561        "solutions",
     562        "soy",
     563        "space",
     564        "spiegel",
     565        "supplies",
     566        "supply",
     567        "support",
     568        "surf",
     569        "surgery",
     570        "suzuki",
     571        "systems",
     572        "tatar",
     573        "tattoo",
     574        "tax",
     575        "technology",
     576        "tel",
     577        "tienda",
     578        "tips",
     579        "tirol",
     580        "today",
     581        "tokyo",
     582        "tools",
     583        "top",
     584        "town",
     585        "toys",
     586        "trade",
     587        "training",
     588        "travel",
     589        "tui",
     590        "university",
     591        "uno",
     592        "uol",
     593        "vacations",
     594        "vegas",
     595        "ventures",
     596        "versicherung",
     597        "vet",
     598        "viajes",
     599        "villas",
     600        "vision",
     601        "vlaanderen",
     602        "vodka",
     603        "vote",
     604        "voting",
     605        "voto",
     606        "voyage",
     607        "wales",
     608        "wang",
     609        "watch",
     610        "webcam",
     611        "website",
     612        "wed",
     613        "wedding",
     614        "whoswho",
     615        "wien",
     616        "wiki",
     617        "williamhill",
     618        "wme",
     619        "work",
     620        "works",
     621        "world",
     622        "wtc",
     623        "wtf",
     624        "xxx",
     625        "xyz",
     626        "yachts",
     627        "yandex",
     628        "yoga",
     629        "yokohama",
     630        "youtube",
     631        "zip",
     632        "zone",
    240633    };
    241634
     
    293686        "cu",                 // Cuba
    294687        "cv",                 // Cape Verde
     688        "cw",                 // Curaçao
    295689        "cx",                 // Christmas Island
    296690        "cy",                 // Cyprus
     
    449843        "su",                 // Soviet Union (deprecated)
    450844        "sv",                 // El Salvador
     845        "sx",                 // Sint Maarten
    451846        "sy",                 // Syria
    452847        "sz",                 // Swaziland
     
    497892   };
    498893
    499     private static final List<String> INFRASTRUCTURE_TLD_LIST = Arrays.asList(INFRASTRUCTURE_TLDS);
    500     private static final List<String> GENERIC_TLD_LIST = Arrays.asList(GENERIC_TLDS);
    501     private static final List<String> COUNTRY_CODE_TLD_LIST = Arrays.asList(COUNTRY_CODE_TLDS);
    502     private static final List<String> LOCAL_TLD_LIST = Arrays.asList(LOCAL_TLDS);
     894    static {
     895        Arrays.sort(INFRASTRUCTURE_TLDS);
     896        Arrays.sort(COUNTRY_CODE_TLDS);
     897        Arrays.sort(GENERIC_TLDS);
     898        Arrays.sort(LOCAL_TLDS);
     899    }
    503900}
  • trunk/src/org/openstreetmap/josm/data/validation/routines/EmailValidator.java

    r7489 r7779  
    3737 * </p>.
    3838 *
    39  * @version $Revision: 1227719 $ $Date: 2012-01-05 18:45:51 +0100 (Thu, 05 Jan 2012) $
     39 * @version $Revision: 1608584 $ $Date: 2014-07-07 19:54:07 UTC (Mon, 07 Jul 2014) $
    4040 * @since Validator 1.4
    4141 */
     
    169169            DomainValidator domainValidator =
    170170                    DomainValidator.getInstance(allowLocal);
    171             return domainValidator.isValid(domain);
     171            return domainValidator.isValid(domain) ||
     172                    domainValidator.isValidTld(domain);
    172173        }
    173174    }
  • trunk/src/org/openstreetmap/josm/data/validation/routines/UrlValidator.java

    r7698 r7779  
    6969 * </a>
    7070 *
    71  * @version $Revision: 1227719 $ $Date: 2012-01-05 18:45:51 +0100 (Thu, 05 Jan 2012) $
     71 * @version $Revision: 1640269 $ $Date: 2014-11-18 02:28:56 UTC (Tue, 18 Nov 2014) $
    7272 * @since Validator 1.4
    7373 */
Note: See TracChangeset for help on using the changeset viewer.