List of InternetDomainName and publicsuffix

Which version of the open suffix list ( https://publicsuffix.org/ ) does the Guava API 21 InternetDomainName use?

Analysis keyupgrade.spaceforupdate.download

leads to

scala> InternetDomainName.from("keyupgrade.spaceforupdate.download").topPrivateDomain
java.lang.IllegalStateException: Not under a public suffix: keyupgrade.spaceforupdate.download
  at com.google.common.base.Preconditions.checkState(Preconditions.java:176)
  at com.google.common.net.InternetDomainName.topPrivateDomain(InternetDomainName.java:445)
  ... 50 elided

      

But .download is a valid open suffix at https://publicsuffix.org/list/public_suffix_list.dat . I think Guava 21 is using an older version of the publicsuffix list. Is there a way to update it? Thank!

+3


source to share


3 answers


This conversation took place in parallel on the guava mailing list and here; I will consolidate it here. In the last answer on the mailing list, Neera responded to my request with, for example, the following code:

I'm trying to parse "keyupgrade.spaceforupdate.download" where .download is a valid TLD as per the last public mozilla suffix list, but Guava cannot parse it.

scala> InternetDomainName.from ("keyupgrade.spaceforupdate.download"). TopPrivateDomain java.lang.IllegalStateException: not under open suffix: keyupgrade.spaceforupdate.download at com.google.common.base.Preconditions.checkState (Preconditions.java:176) at com.google.common.net.InternetDomainName.topPrivateDomain (InternetDomainName .java: 445) ... 50 elided

I am wondering if this could be a Scala issue. As I mentioned, "download" has been in PSL for a long time (2014 to 11-20 according to PSL itself), and this is in local copies of PSL used to build Guava for years up to version 21. Note that I tested this in Java on our head version and got the expected "spaceforupdate.download" output:



  public static void main(String[] args) {
    InternetDomainName top = 
        InternetDomainName.from("keyupgrade.spaceforupdate.download").topPrivateDomain();

    System.out.println(top);
  }

      

Are tests run with "obvious" suffixes? For example, the top private domain "www.google.com" should be "google.com". Try this and also try a Java test rather than Scala if possible. I am looking forward to how the tests go.

0


source


I'm sure you have the Guava v14 jar in your classpath, possibly in addition to the v21 jar you think you are using. It was released in 2013, before being .download

added as a TLD.

Looking at the stack trace, it indicates that an exception was thrown from line 176 Preconditions.java

, but in v21 that line is just a */

. Stepping back until v17 , that line number makes sense.

Same problem with InternetDomainName

- compare v21 vs v14 ( Preconditions

also shows up in v14 ).

So get closer to your classpath, I think that's your problem.




Edit : This has been confirmed to work in v21 with Scala:

$ scala -cp guava-21.0.jar
Welcome to Scala 2.11.11 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_131).
Type in expressions for evaluation. Or try :help.

scala> import com.google.common.net._
import com.google.common.net._

scala> InternetDomainName.from("keyupgrade.spaceforupdate.download").topPrivateDomain
res0: com.google.common.net.InternetDomainName = spaceforupdate.download

      

+2


source


I am the main developer of InternetDomainName. Sorry, you have problems with this.

It looks like the PSL version included in Guava 21 was pulled from Mozilla on 2016-11-30. Unfortunately, there is no easy way to update it yourself.

As I said, I just looked at older versions of PSL and the "download" was there for a long time, long before the version used in Guava 21. Could you please post some working example code that demonstrates the problem you are seeing?

0


source







All Articles