google / guava

Google core libraries for Java
Apache License 2.0
50.07k stars 10.86k forks source link

Provide a mechanism to augment the TldPatterns lists dynamically #1123

Open gissuebot opened 9 years ago

gissuebot commented 9 years ago

Original issue created by sheldonreedwhite on 2012-08-28 at 07:38 PM


There are valid domains that can't really be manipulated with InternetDomainName because their TLD isn't in the hard-coded TldPatterns.java class, but it's not reasonable to have to rebuild the Guava library every time a new TLD is encountered. There should be methods along the lines of addExactTld(), addUnderTld(), addExcludedTld() which would allow the user to augment (or perhaps completely override) the library's TLD set with values specific to the user's application. For instance, using Guava 11.0.2 the valid domain "miele.pm" fails Of course we could fork the Guava code to add this additional flexibility but we'd prefer not to.

Thanks in advance.

gissuebot commented 9 years ago

Original comment posted by neveue on 2012-08-29 at 01:21 PM


I wonder if Google Chrome uses Guava to parse domain names. When I type "miele.pm" in the Chrome address bar (on an empty cache), and hit enter, it does a Google search for "miele.pm". But when I do the same for "miele.fr", Chrome detects that it's a domain name, and directly sends me to "miele.fr".

gissuebot commented 9 years ago

Original comment posted by kevinb@google.com on 2012-08-29 at 03:03 PM


It does not use Guava, but might use the same Public Suffix List we do.

gissuebot commented 9 years ago

Original comment posted by wasserman.louis on 2012-08-29 at 03:54 PM


I don't think static state would be an okay thing here -- or anywhere in Guava -- but maybe there's room here for a builder or something for a pattern set?

gissuebot commented 9 years ago

Original comment posted by kevinb@google.com on 2012-10-23 at 04:50 PM


Would issue 475 solve your needs?


Labels: Package-Net, Type-Addition

kamal2311 commented 8 years ago

Having a mechanism to dynamically lookup the public suffix list would be awesome. Please consider doing it.

Thank you.

cpovirk commented 5 years ago

This might be slightly easier if we moved to Bazel.

cpovirk commented 5 years ago

I may have been mixing this up with https://github.com/google/guava/issues/475. Possibly(?) this bug is more about adding patterns at runtime, while #475 is more about being able to build your own Guava with your own set of patterns?