Skip to content

Commit 672c50b

Browse files
authored
Merge branch 'master' into fix/retry-transient-delete-errors
2 parents 9b7c558 + a34e8c4 commit 672c50b

26 files changed

Lines changed: 140 additions & 161 deletions

.github/workflows/codeql-analysis.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,17 @@ jobs:
3939

4040
steps:
4141
- name: Checkout repository
42-
uses: actions/checkout@v4
42+
uses: actions/checkout@v6
43+
44+
- name: Set up Java 17
45+
uses: actions/setup-java@v5
46+
with:
47+
java-version: '17'
48+
distribution: 'temurin'
4349

4450
# Initializes the CodeQL tools for scanning.
4551
- name: Initialize CodeQL
46-
uses: github/codeql-action/init@v3
52+
uses: github/codeql-action/init@v4
4753
with:
4854
languages: ${{ matrix.language }}
4955
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -54,7 +60,7 @@ jobs:
5460
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5561
# If this step fails, then you should remove it and run the build manually (see below)
5662
- name: Autobuild
57-
uses: github/codeql-action/autobuild@v3
63+
uses: github/codeql-action/autobuild@v4
5864

5965
# ℹ️ Command-line programs to run using the OS shell.
6066
# 📚 https://git.io/JvXDl
@@ -68,4 +74,4 @@ jobs:
6874
# make release
6975

7076
- name: Perform CodeQL Analysis
71-
uses: github/codeql-action/analyze@v3
77+
uses: github/codeql-action/analyze@v4

.github/workflows/gradle.yml

Lines changed: 52 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,45 +10,79 @@ on:
1010

1111
jobs:
1212
build:
13-
name: Test on java-version ${{ matrix.java-version }} and ${{ matrix.os }}
13+
name: Test on Java ${{ matrix.java-version }} in ${{ matrix.os }}
1414
runs-on: ${{ matrix.os }}
1515
strategy:
16+
fail-fast: false
1617
matrix:
17-
java-version: ['8', '11', '17']
18+
java-version: ['8', '11', '17', '21', '25']
1819
os: [ubuntu-latest, windows-latest]
1920

2021
steps:
21-
- uses: actions/checkout@v4
22+
- uses: actions/checkout@v6
23+
2224
- name: Check limited Guava usage
2325
if: matrix.os == 'ubuntu-latest'
2426
run: |
2527
if grep --with-filename --line-number --no-messages --recursive --exclude-dir=.github "com.google.common.base.Objects" .; then
2628
echo "Error: use java.util.Objects instead of com.google.common.base.Objects"
2729
exit 1
2830
fi
29-
- name: Setup java ${{ matrix.java-version }}
30-
uses: actions/setup-java@v4
31+
32+
- name: Setup java 17 for building
33+
uses: actions/setup-java@v5
3134
with:
3235
distribution: temurin
33-
java-version: ${{ matrix.java-version }}
34-
- name: Set environment variables
36+
java-version: '17'
37+
38+
- name: Set environment variables on Ubuntu
39+
if: matrix.os == 'ubuntu-latest'
3540
run: |
3641
echo "DEV_VERSION=$(./gradlew properties | awk '/^version:/ { print $2 }')" >> $GITHUB_ENV
3742
echo "RELEASE_VERSION=$(./gradlew properties -Prelease | awk '/^version:/ { print $2 }')" >> $GITHUB_ENV
38-
- name: Gradle build on Ubuntu
43+
44+
- name: Set environment variables on Windows
45+
if: matrix.os == 'windows-latest'
46+
run: |
47+
$devVersion = (./gradlew.bat properties | Select-String '^version:').ToString().Split(' ')[1].Trim()
48+
echo "DEV_VERSION=$devVersion" >> $Env:GITHUB_ENV
49+
50+
- name: Run build on Ubuntu
3951
if: matrix.os == 'ubuntu-latest'
4052
run: |
4153
./gradlew build
42-
./gradlew runFunctionalTest
43-
javac -cp api/build/libs/minio-${DEV_VERSION}-all.jar functional/TestUserAgent.java
44-
java -Dversion=${DEV_VERSION} -cp api/build/libs/minio-${DEV_VERSION}-all.jar:functional TestUserAgent
45-
./gradlew clean
4654
./gradlew build -Prelease
47-
javac -cp api/build/libs/minio-${RELEASE_VERSION}-all.jar functional/TestUserAgent.java
48-
java -Dversion=${RELEASE_VERSION} -cp api/build/libs/minio-${RELEASE_VERSION}-all.jar:functional TestUserAgent
49-
- name: Gradle build on Windows
55+
56+
- name: Run build on Windows
57+
if: matrix.os == 'windows-latest'
58+
run: |
59+
./gradlew.bat build
60+
61+
- name: Setup java ${{ matrix.java-version }} for testing
62+
if: matrix.java-version != '17'
63+
uses: actions/setup-java@v5
64+
with:
65+
distribution: temurin
66+
java-version: ${{ matrix.java-version }}
67+
68+
- name: Run tests on Ubuntu
69+
if: matrix.os == 'ubuntu-latest'
70+
run: |
71+
cd functional
72+
curl -sSfLO https://repo1.maven.org/maven2/org/junit/platform/junit-platform-console-standalone/1.11.4/junit-platform-console-standalone-1.11.4.jar
73+
curl -sSfLO https://repo1.maven.org/maven2/com/github/spotbugs/spotbugs-annotations/4.9.8/spotbugs-annotations-4.9.8.jar
74+
javac -cp spotbugs-annotations-4.9.8.jar:junit-platform-console-standalone-1.11.4.jar:../api/build/libs/minio-${DEV_VERSION}-all.jar:../adminapi/build/libs/minio-admin-${DEV_VERSION}-all.jar:. FunctionalTest.java
75+
java -cp spotbugs-annotations-4.9.8.jar:junit-platform-console-standalone-1.11.4.jar:../api/build/libs/minio-${DEV_VERSION}-all.jar:../adminapi/build/libs/minio-admin-${DEV_VERSION}-all.jar:. FunctionalTest
76+
javac -cp spotbugs-annotations-4.9.8.jar:junit-platform-console-standalone-1.11.4.jar:../api/build/libs/minio-${DEV_VERSION}-all.jar:. ./TestUserAgent.java
77+
java -Dversion=${DEV_VERSION} -cp spotbugs-annotations-4.9.8.jar:junit-platform-console-standalone-1.11.4.jar:../api/build/libs/minio-${DEV_VERSION}-all.jar:. TestUserAgent
78+
javac -cp spotbugs-annotations-4.9.8.jar:junit-platform-console-standalone-1.11.4.jar:../api/build/libs/minio-${RELEASE_VERSION}-all.jar:. ./TestUserAgent.java
79+
java -Dversion=${RELEASE_VERSION} -cp spotbugs-annotations-4.9.8.jar:junit-platform-console-standalone-1.11.4.jar:../api/build/libs/minio-${RELEASE_VERSION}-all.jar:. TestUserAgent
80+
81+
- name: Run tests on Windows
5082
if: matrix.os == 'windows-latest'
5183
run: |
52-
$Env:Path += ';.'
53-
gradlew.bat build
54-
gradlew.bat runFunctionalTest
84+
cd functional
85+
curl -sSfLO https://repo1.maven.org/maven2/org/junit/platform/junit-platform-console-standalone/1.11.4/junit-platform-console-standalone-1.11.4.jar
86+
curl -sSfLO https://repo1.maven.org/maven2/com/github/spotbugs/spotbugs-annotations/4.9.8/spotbugs-annotations-4.9.8.jar
87+
javac -encoding UTF-8 -cp "spotbugs-annotations-4.9.8.jar;junit-platform-console-standalone-1.11.4.jar;../api/build/libs/minio-$Env:DEV_VERSION-all.jar;../adminapi/build/libs/minio-admin-$Env:DEV_VERSION-all.jar;." FunctionalTest.java
88+
java -cp "spotbugs-annotations-4.9.8.jar;junit-platform-console-standalone-1.11.4.jar;../api/build/libs/minio-$Env:DEV_VERSION-all.jar;../adminapi/build/libs/minio-admin-$Env:DEV_VERSION-all.jar;." FunctionalTest

adminapi/src/main/java/io/minio/admin/MinioAdminClient.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
2828
import com.google.common.collect.ImmutableMultimap;
2929
import com.google.common.collect.Multimap;
30-
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
3130
import io.minio.Checksum;
3231
import io.minio.Http;
3332
import io.minio.Signer;
@@ -127,9 +126,9 @@ private MinioAdminClient(
127126
this.httpClient = httpClient;
128127
}
129128

130-
private Credentials getCredentials() {
129+
private Credentials getCredentials() throws MinioException {
131130
Credentials creds = provider.fetch();
132-
if (creds == null) throw new RuntimeException("Credential provider returns null credential");
131+
if (creds == null) throw new MinioException("Credential provider returns null credential");
133132
return creds;
134133
}
135134

@@ -216,7 +215,7 @@ private Response httpExecute(
216215

217216
if (response.isSuccessful()) return response;
218217

219-
throw new RuntimeException("Request failed with response: " + response.body().string());
218+
throw new MinioException("Request failed with response: " + response.body().string());
220219
}
221220

222221
private Response execute(
@@ -890,7 +889,6 @@ public void setTimeout(long connectTimeout, long writeTimeout, long readTimeout)
890889
*
891890
* @throws MinioException thrown to indicate SDK exception.
892891
*/
893-
@SuppressFBWarnings(value = "SIC", justification = "Should not be used in production anyways.")
894892
public void ignoreCertCheck() throws MinioException {
895893
this.httpClient = Http.disableCertCheck(this.httpClient);
896894
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,14 @@ private A newInstance() {
108108
}
109109
}
110110

111-
throw new RuntimeException(
111+
throw new IllegalStateException(
112112
this.getClass().getEnclosingClass() + " must have no argument constructor");
113113
} catch (InstantiationException
114114
| IllegalAccessException
115115
| InvocationTargetException
116116
| SecurityException e) {
117117
// Args class must have no argument constructor with at least protected access.
118-
throw new RuntimeException(e);
118+
throw new IllegalStateException(e);
119119
}
120120
}
121121

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ public abstract class BaseS3Client implements AutoCloseable {
7979
try {
8080
RequestBody.create(new byte[] {}, null);
8181
} catch (NoSuchMethodError ex) {
82-
throw new RuntimeException("Unsupported OkHttp library found. Must use okhttp >= 4.11.0", ex);
82+
throw new IllegalStateException(
83+
"Unsupported OkHttp library found. Must use okhttp >= 4.11.0", ex);
8384
}
8485
}
8586

@@ -162,9 +163,6 @@ public void setTimeout(long connectTimeout, long writeTimeout, long readTimeout)
162163
*
163164
* @throws MinioException thrown to indicate SDK exception.
164165
*/
165-
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(
166-
value = "SIC",
167-
justification = "Should not be used in production anyways.")
168166
public void ignoreCertCheck() throws MinioException {
169167
this.httpClient = Http.disableCertCheck(this.httpClient);
170168
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public ByteBufferPool(int capacity, long bufferSize) {
3333
// Optionally pre-fill
3434
for (int i = 0; i < capacity - 1; i++) {
3535
if (!pool.offer(new ByteBuffer(bufferSize))) {
36-
throw new RuntimeException("unable to allocate byte buffer; this should not happen");
36+
throw new IllegalStateException("unable to allocate byte buffer; this should not happen");
3737
}
3838
}
3939
}
@@ -52,7 +52,7 @@ public void put(ByteBuffer buffer) {
5252
buffer.reset();
5353
if (!pool.offer(buffer)) return; // ignore if pool is full
5454
} catch (MinioException e) {
55-
throw new RuntimeException(e);
55+
throw new IllegalStateException(e);
5656
}
5757
}
5858
}

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -624,17 +624,14 @@ public static OkHttpClient newDefaultClient() {
624624
try {
625625
return enableExternalCertificatesFromEnv(client);
626626
} catch (MinioException e) {
627-
throw new RuntimeException(e);
627+
throw new IllegalStateException(e);
628628
}
629629
}
630630

631631
/**
632632
* Disables TLS certificate check as a special case for self-signed certificate and testing to the
633633
* specified HTTP client.
634634
*/
635-
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(
636-
value = "SIC",
637-
justification = "Should not be used in production anyways.")
638635
public static OkHttpClient disableCertCheck(OkHttpClient client) throws MinioException {
639636
try {
640637
final TrustManager[] trustAllCerts =

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,7 +1271,7 @@ public Iterator<Result<ListAllMyBucketsResult.Bucket>> iterator() {
12711271
private ListAllMyBucketsResult result = null;
12721272
private Result<ListAllMyBucketsResult.Bucket> error = null;
12731273
private Iterator<ListAllMyBucketsResult.Bucket> iterator = null;
1274-
private boolean completed = false;
1274+
private volatile boolean completed = false;
12751275

12761276
private synchronized void populate() {
12771277
if (completed) return;
@@ -1851,7 +1851,7 @@ private CompletableFuture<List<UploadPartResponse>> uploadPartsParallelly(
18511851
}
18521852
});
18531853
if (result == null) {
1854-
throw new RuntimeException(
1854+
throw new IllegalStateException(
18551855
"uploadExecutor.submit() returns null; this should not happen");
18561856
}
18571857
}
@@ -3675,15 +3675,15 @@ public void throwMinioException(CompletionException e) throws MinioException {
36753675
Throwable ex = e.getCause();
36763676
if (ex instanceof MinioException) throw (MinioException) ex;
36773677
Throwable exc = ex.getCause();
3678-
throw new RuntimeException(exc != null ? exc : ex);
3678+
throw new IllegalStateException(exc != null ? exc : ex);
36793679
}
36803680

36813681
private abstract class ObjectIterator implements Iterator<Result<Item>> {
36823682
protected Result<Item> error;
36833683
protected Iterator<? extends Item> itemIterator;
36843684
protected Iterator<ListVersionsResult.DeleteMarker> deleteMarkerIterator;
36853685
protected Iterator<ListObjectsResult.Prefix> prefixIterator;
3686-
protected boolean completed = false;
3686+
protected volatile boolean completed = false;
36873687
protected ListObjectsResult listObjectsResult;
36883688
protected String lastObjectName;
36893689

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1917,9 +1917,6 @@ public void setTimeout(long connectTimeout, long writeTimeout, long readTimeout)
19171917
*
19181918
* @throws MinioException thrown to indicate SDK exception.
19191919
*/
1920-
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(
1921-
value = "SIC",
1922-
justification = "Should not be used in production anyways.")
19231920
public void ignoreCertCheck() throws MinioException {
19241921
asyncClient.ignoreCertCheck();
19251922
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public Map<String, String> formData(@Nonnull Credentials creds, @Nonnull String
213213
try {
214214
policyBytes = objectMapper.writeValueAsString(policyMap).getBytes(StandardCharsets.UTF_8);
215215
} catch (JsonProcessingException e) {
216-
throw new RuntimeException(e);
216+
throw new IllegalStateException(e);
217217
}
218218

219219
String policy = Base64.getEncoder().encodeToString(policyBytes);

0 commit comments

Comments
 (0)