Skip to content

Commit 9585da3

Browse files
authored
Fail if unsupported okhttp3 is found. (#1211)
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>
1 parent 18608e1 commit 9585da3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

api/src/main/java/io/minio/S3Base.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,14 @@
100100

101101
/** Core S3 API client. */
102102
public abstract class S3Base {
103+
static {
104+
try {
105+
RequestBody.create(new byte[] {}, null);
106+
} catch (NoSuchMethodError ex) {
107+
throw new RuntimeException("Unsupported OkHttp library found. Must use okhttp >= 4.8.1", ex);
108+
}
109+
}
110+
103111
protected static final String NO_SUCH_BUCKET_MESSAGE = "Bucket does not exist";
104112
protected static final String NO_SUCH_BUCKET = "NoSuchBucket";
105113
protected static final String NO_SUCH_BUCKET_POLICY = "NoSuchBucketPolicy";

0 commit comments

Comments
 (0)