Skip to content

Commit

Permalink
Fail if unsupported okhttp3 is found. (#1211)
Browse files Browse the repository at this point in the history
As `okhttp` 4.x and 3.x use same package name `okhttp3`, `minio-java`
fails at middle of runtime if `okhttp` 3.x is used. This patch fails
at beginning if unsupported okhttp3 is found.

Signed-off-by: Bala.FA <bala.gluster@gmail.com>
  • Loading branch information
balamurugana committed Jul 19, 2021
1 parent 18608e1 commit 9585da3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions api/src/main/java/io/minio/S3Base.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@

/** Core S3 API client. */
public abstract class S3Base {
static {
try {
RequestBody.create(new byte[] {}, null);
} catch (NoSuchMethodError ex) {
throw new RuntimeException("Unsupported OkHttp library found. Must use okhttp >= 4.8.1", ex);
}
}

protected static final String NO_SUCH_BUCKET_MESSAGE = "Bucket does not exist";
protected static final String NO_SUCH_BUCKET = "NoSuchBucket";
protected static final String NO_SUCH_BUCKET_POLICY = "NoSuchBucketPolicy";
Expand Down

0 comments on commit 9585da3

Please sign in to comment.