Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed ClassNotFoundException when creating okhttp3.OkHttpConnector with Cache #627

Merged
merged 1 commit into from
Nov 27, 2019

Conversation

alecharp
Copy link
Contributor

Description

The okhttp3.OkHttpConnector class is still referencing the okhttp.CacheControl. However, this class is not part of OkHttp 3.x or 4.x. This creates a ClassNotFoundException at runtime on projects creating a okhttp3.OkHttpConnector with a Cache.

Before submitting a PR:

We love getting PRs, but we hate asking people for the same basic changes every time.

  • Push your changes to a branch other than master. Create your PR from that branch.
  • Add JavaDocs and other comments
  • Write tests that run and pass in CI. See CONTRIBUTING.md for details on how to capture snapshot data.
  • Run mvn install site locally. This may reformat your code, commit those changes. If this command doesn't succeed, your change will not pass CI.

With okhttp 3, the package name changed. In the okhttp3.OkHttpConnector,
the incorrect class is loaded, creating a ClassNotFoundException at
runtime when okhttp3 only is loaded.
@bitwiseman
Copy link
Member

No way to detect this aside from better code reviews or having a test project that only has okhttp3 and not okhttp. 😞 Thanks!

@bitwiseman bitwiseman merged commit d7f5113 into hub4j:master Nov 27, 2019
@alecharp alecharp deleted the fix-cache-control-packagename branch November 27, 2019 18:24
@alecharp
Copy link
Contributor Author

I figured it was a "copy-paste" issue, no big deal. Imports are not the first thing I think of and here I got angry because the class was available in the classpath. But not the correct class..

@bitwiseman
Copy link
Member

Published as v1.101.

@bitwiseman bitwiseman changed the title Fixed CacheControl package name Fixed ClassNotFoundException when creating okhttp3.OkHttpConnector with Cache Nov 27, 2019
@bitwiseman bitwiseman changed the title Fixed ClassNotFoundException when creating okhttp3.OkHttpConnector with Cache Fixed ClassNotFoundException when creating okhttp3.OkHttpConnector with Cache Nov 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants