Selenium: Issues with Guava 23.0rc1 in URLChecker.java class

Created on 27 Jul 2017  路  6Comments  路  Source: SeleniumHQ/selenium

Meta -

OS: Windows 7

Selenium Version: 3.4.0

Browser: Chrome

Browser Version: 59.0.3071.86

Expected Behavior -

https://github.com/SeleniumHQ/selenium/blob/d37a5cc4e853b35283ae4ebf1daca2d0b1e95a37/java/client/src/org/openqa/selenium/net/UrlChecker.java#L67

This URLChecker class should on construction create an instance of itself using a new SimpleTimeLimiter.
SimpleTimeLimiter comes from the guava project. This should run and return correctly.

Actual Behavior -

As of Guava 23.0r1, the SimpleTimeLimiter constructor being used is private, and this will cause an IllegalAccessError when creating a new instance of the UrlChecker class.

You can see the new code for 23.0r1 that does this line 51 at:
https://github.com/google/guava/blob/master/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java#L51

However, you can see on line 67:
https://github.com/google/guava/blob/master/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java#L67

that the developers have added in a create method.
It could be fixed as simply by changing:
public UrlChecker() { this(new SimpleTimeLimiter(THREAD_POOL)); }
to
public UrlChecker() { this(SimpleTimeLimiter.create(THREAD_POOL)); }

However, it seems that older version of guava may not have included this create method, so this may not work unless a full transition to 23.0 is made in the future when it is actually released.

Steps to reproduce -

Create a new instance of the chromedriver or attempt to call the default constructor on the UrlChecker class while having guava 23.0rc1 as your current version of guava.

This is a minor issue as you can prevent this error from occurring by downgrading your guava version, however, it is something that may need to be considered going forward.

C-java E-easy

Most helpful comment

Hi , When can we expect a fix on guava version 23.0 with selenium? Since we are facing the issue with guava 23.0. It's working fine with lower versions (guava 22.0) but tests are failing with latest version of guava library 23.0.
Thanks,
Santosh

All 6 comments

I'm marking this issue with label so that Java maintainers can have a look, but the change seems not that big so PR is welcome.

@p0deje I can definitely fix this and create a PR, however, my concern is that the .create method for that SimpleTimeLimiter is implemented on guava 22.0 and later; There was only one version between when the call to that was deprecated, and when it was completely removed. Fixing the issue will require an upgrade to the guava dependency. I might hop into the IRC channel later today just to touch base.

I've bumped the guava version and fixed this call site. Thank you @JordanHansen for pointing this out!

Can we get a release out with this fix? We are having issues with different libraries upgrading to guava 23 and selenium, release version being on guava 22

Hi , When can we expect a fix on guava version 23.0 with selenium? Since we are facing the issue with guava 23.0. It's working fine with lower versions (guava 22.0) but tests are failing with latest version of guava library 23.0.
Thanks,
Santosh

OS - MacOS Sierra
Guava 22.0

Resolved

  • Changed the version to 22.0 and the issue was fixed.
Was this page helpful?
0 / 5 - 0 ratings