Skip to content

Commit 845297d

Browse files
committed
Update google-java-format to 1.24.0
1.25.0 require a minimum java build version of 17, so we can update to latest as we upgrade our build. Signed-off-by: Appu Goundan <[email protected]>
1 parent e90977c commit 845297d

File tree

11 files changed

+101
-34
lines changed

11 files changed

+101
-34
lines changed

build-logic/jvm/src/main/kotlin/build-logic.java.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ tasks.configureEach<JavaExec> {
2525

2626
spotless {
2727
java {
28-
googleJavaFormat("1.15.0")
28+
googleJavaFormat("1.24.0")
2929
licenseHeaderFile("$rootDir/config/licenseHeader")
3030
// Note if submodule needs to add more exclusions, it should list ALL of them since
3131
// Spotless does not have "addTargetExclude" method

sigstore-java/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ spotless {
9393
)
9494
}
9595
format("conscrypt", com.diffplug.gradle.spotless.JavaExtension::class.java) {
96-
googleJavaFormat("1.15.0")
96+
googleJavaFormat("1.24.0")
9797
licenseHeaderFile("$rootDir/config/conscryptLicenseHeader")
9898
target("src/*/java/dev/sigstore/encryption/certificates/transparency/*.java")
9999
}
100100
format("webPki", com.diffplug.gradle.spotless.JavaExtension::class.java) {
101-
googleJavaFormat("1.15.0")
101+
googleJavaFormat("1.24.0")
102102
licenseHeaderFile("$rootDir/config/webPKILicenseHeader")
103103
target("src/*/java/dev/sigstore/json/canonicalizer/*.java")
104104
}

sigstore-java/src/main/java/dev/sigstore/KeylessSigner.java

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,12 @@ public Builder minSigningCertificateLifetime(Duration minSigningCertificateLifet
213213

214214
@CheckReturnValue
215215
public KeylessSigner build()
216-
throws CertificateException, IOException, NoSuchAlgorithmException, InvalidKeySpecException,
217-
InvalidKeyException, InvalidAlgorithmParameterException {
216+
throws CertificateException,
217+
IOException,
218+
NoSuchAlgorithmException,
219+
InvalidKeySpecException,
220+
InvalidKeyException,
221+
InvalidAlgorithmParameterException {
218222
Preconditions.checkNotNull(trustedRootProvider);
219223
var trustedRoot = trustedRootProvider.get();
220224
Preconditions.checkNotNull(fulcioUri);
@@ -361,9 +365,16 @@ public List<Bundle> sign(List<byte[]> artifactDigests) throws KeylessSignerExcep
361365
}
362366

363367
private void renewSigningCertificate()
364-
throws InterruptedException, CertificateException, IOException, UnsupportedAlgorithmException,
365-
NoSuchAlgorithmException, InvalidKeyException, SignatureException,
366-
FulcioVerificationException, OidcException, KeylessSignerException {
368+
throws InterruptedException,
369+
CertificateException,
370+
IOException,
371+
UnsupportedAlgorithmException,
372+
NoSuchAlgorithmException,
373+
InvalidKeyException,
374+
SignatureException,
375+
FulcioVerificationException,
376+
OidcException,
377+
KeylessSignerException {
367378
// Check if the certificate is still valid
368379
lock.readLock().lock();
369380
try {

sigstore-java/src/main/java/dev/sigstore/KeylessVerifier.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,12 @@ public static class Builder {
7979
private TrustedRootProvider trustedRootProvider;
8080

8181
public KeylessVerifier build()
82-
throws InvalidAlgorithmParameterException, CertificateException, InvalidKeySpecException,
83-
NoSuchAlgorithmException, IOException, InvalidKeyException {
82+
throws InvalidAlgorithmParameterException,
83+
CertificateException,
84+
InvalidKeySpecException,
85+
NoSuchAlgorithmException,
86+
IOException,
87+
InvalidKeyException {
8488
Preconditions.checkNotNull(trustedRootProvider);
8589
var trustedRoot = trustedRootProvider.get();
8690
var fulcioVerifier = FulcioVerifier.newFulcioVerifier(trustedRoot);

sigstore-java/src/main/java/dev/sigstore/TrustedRootProvider.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,12 @@
3434
public interface TrustedRootProvider {
3535

3636
SigstoreTrustedRoot get()
37-
throws InvalidAlgorithmParameterException, CertificateException, InvalidKeySpecException,
38-
NoSuchAlgorithmException, IOException, InvalidKeyException;
37+
throws InvalidAlgorithmParameterException,
38+
CertificateException,
39+
InvalidKeySpecException,
40+
NoSuchAlgorithmException,
41+
IOException,
42+
InvalidKeyException;
3943

4044
static TrustedRootProvider from(SigstoreTufClient.Builder tufClientBuilder) {
4145
Preconditions.checkNotNull(tufClientBuilder);

sigstore-java/src/main/java/dev/sigstore/fulcio/client/FulcioVerifier.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,18 @@ public class FulcioVerifier {
5151
private final CTVerifier ctVerifier;
5252

5353
public static FulcioVerifier newFulcioVerifier(SigstoreTrustedRoot trustRoot)
54-
throws InvalidAlgorithmParameterException, CertificateException, InvalidKeySpecException,
54+
throws InvalidAlgorithmParameterException,
55+
CertificateException,
56+
InvalidKeySpecException,
5557
NoSuchAlgorithmException {
5658
return newFulcioVerifier(trustRoot.getCAs(), trustRoot.getCTLogs());
5759
}
5860

5961
public static FulcioVerifier newFulcioVerifier(
6062
List<CertificateAuthority> cas, List<TransparencyLog> ctLogs)
61-
throws InvalidKeySpecException, NoSuchAlgorithmException, InvalidAlgorithmParameterException,
63+
throws InvalidKeySpecException,
64+
NoSuchAlgorithmException,
65+
InvalidAlgorithmParameterException,
6266
CertificateException {
6367
List<CTLogInfo> logs = new ArrayList<>();
6468
for (var ctLog : ctLogs) {

sigstore-java/src/main/java/dev/sigstore/rekor/client/RekorEntryFetcher.java

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,28 +45,44 @@ public class RekorEntryFetcher {
4545
private final List<RekorClient> rekorClients;
4646

4747
public static RekorEntryFetcher sigstoreStaging()
48-
throws InvalidAlgorithmParameterException, CertificateException, InvalidKeySpecException,
49-
NoSuchAlgorithmException, IOException, InvalidKeyException {
48+
throws InvalidAlgorithmParameterException,
49+
CertificateException,
50+
InvalidKeySpecException,
51+
NoSuchAlgorithmException,
52+
IOException,
53+
InvalidKeyException {
5054
var sigstoreTufClientBuilder = SigstoreTufClient.builder().useStagingInstance();
5155
return fromTrustedRoot(TrustedRootProvider.from(sigstoreTufClientBuilder));
5256
}
5357

5458
public static RekorEntryFetcher sigstorePublicGood()
55-
throws InvalidAlgorithmParameterException, CertificateException, InvalidKeySpecException,
56-
NoSuchAlgorithmException, IOException, InvalidKeyException {
59+
throws InvalidAlgorithmParameterException,
60+
CertificateException,
61+
InvalidKeySpecException,
62+
NoSuchAlgorithmException,
63+
IOException,
64+
InvalidKeyException {
5765
var sigstoreTufClientBuilder = SigstoreTufClient.builder().usePublicGoodInstance();
5866
return fromTrustedRoot(TrustedRootProvider.from(sigstoreTufClientBuilder));
5967
}
6068

6169
public static RekorEntryFetcher fromTrustedRoot(Path trustedRoot)
62-
throws InvalidAlgorithmParameterException, CertificateException, InvalidKeySpecException,
63-
NoSuchAlgorithmException, IOException, InvalidKeyException {
70+
throws InvalidAlgorithmParameterException,
71+
CertificateException,
72+
InvalidKeySpecException,
73+
NoSuchAlgorithmException,
74+
IOException,
75+
InvalidKeyException {
6476
return fromTrustedRoot(TrustedRootProvider.from(trustedRoot));
6577
}
6678

6779
public static RekorEntryFetcher fromTrustedRoot(TrustedRootProvider trustedRootProvider)
68-
throws InvalidAlgorithmParameterException, CertificateException, InvalidKeySpecException,
69-
NoSuchAlgorithmException, IOException, InvalidKeyException {
80+
throws InvalidAlgorithmParameterException,
81+
CertificateException,
82+
InvalidKeySpecException,
83+
NoSuchAlgorithmException,
84+
IOException,
85+
InvalidKeyException {
7086
var trustedRoot = trustedRootProvider.get();
7187
var rekorClients =
7288
trustedRoot.getTLogs().stream()

sigstore-java/src/main/java/dev/sigstore/tuf/SigstoreTufClient.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,10 @@ public SigstoreTufClient build() throws IOException {
152152
* defined on the client.
153153
*/
154154
public void update()
155-
throws IOException, NoSuchAlgorithmException, InvalidKeySpecException, InvalidKeyException,
155+
throws IOException,
156+
NoSuchAlgorithmException,
157+
InvalidKeySpecException,
158+
InvalidKeyException,
156159
CertificateException {
157160
if (lastUpdate == null
158161
|| Duration.between(lastUpdate, Instant.now()).compareTo(cacheValidity) > 0) {
@@ -162,7 +165,10 @@ public void update()
162165

163166
/** Force an update, ignoring any cache validity. */
164167
public void forceUpdate()
165-
throws IOException, NoSuchAlgorithmException, InvalidKeySpecException, InvalidKeyException,
168+
throws IOException,
169+
NoSuchAlgorithmException,
170+
InvalidKeySpecException,
171+
InvalidKeyException,
166172
CertificateException {
167173
updater.update();
168174
lastUpdate = Instant.now();

sigstore-java/src/main/java/dev/sigstore/tuf/Updater.java

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,13 @@ public void downloadTarget(String targetName) throws IOException {
142142

143143
// https://theupdateframework.github.io/specification/latest/#detailed-client-workflow
144144
void updateRoot()
145-
throws IOException, RoleExpiredException, NoSuchAlgorithmException, InvalidKeySpecException,
146-
FileExceedsMaxLengthException, RollbackVersionException, SignatureVerificationException {
145+
throws IOException,
146+
RoleExpiredException,
147+
NoSuchAlgorithmException,
148+
InvalidKeySpecException,
149+
FileExceedsMaxLengthException,
150+
RollbackVersionException,
151+
SignatureVerificationException {
147152
// 5.3.1) record the time at start and use for expiration checks consistently throughout the
148153
// update.
149154
updateStartTime = ZonedDateTime.now(clock);
@@ -319,7 +324,10 @@ void verifyDelegate(
319324
}
320325

321326
void updateTimestamp()
322-
throws IOException, NoSuchAlgorithmException, InvalidKeySpecException, FileNotFoundException,
327+
throws IOException,
328+
NoSuchAlgorithmException,
329+
InvalidKeySpecException,
330+
FileNotFoundException,
323331
SignatureVerificationException {
324332
// 1) download the timestamp.json bytes.
325333
var timestamp =
@@ -352,8 +360,12 @@ void updateTimestamp()
352360
}
353361

354362
void updateSnapshot()
355-
throws IOException, FileNotFoundException, InvalidHashesException,
356-
SignatureVerificationException, NoSuchAlgorithmException, InvalidKeySpecException {
363+
throws IOException,
364+
FileNotFoundException,
365+
InvalidHashesException,
366+
SignatureVerificationException,
367+
NoSuchAlgorithmException,
368+
InvalidKeySpecException {
357369
// 1) download the snapshot.json bytes up to timestamp's snapshot length.
358370
int timestampSnapshotVersion =
359371
trustedMetaStore.getTimestamp().getSignedMeta().getSnapshotMeta().getVersion();
@@ -441,8 +453,12 @@ static void verifyHashes(String name, byte[] data, Hashes hashes) throws Invalid
441453
}
442454

443455
void updateTargets()
444-
throws IOException, FileNotFoundException, InvalidHashesException,
445-
SignatureVerificationException, NoSuchAlgorithmException, InvalidKeySpecException,
456+
throws IOException,
457+
FileNotFoundException,
458+
InvalidHashesException,
459+
SignatureVerificationException,
460+
NoSuchAlgorithmException,
461+
InvalidKeySpecException,
446462
FileExceedsMaxLengthException {
447463
// 1) download the targets.json up to targets.json length in bytes.
448464
SnapshotMeta.SnapshotTarget targetMeta =

sigstore-java/src/test/java/dev/sigstore/rekor/client/RekorClientHttpTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,12 @@ public void getEntry_entryDoesntExist() throws Exception {
160160

161161
@NotNull
162162
private static HashedRekordRequest createdRekorRequest()
163-
throws NoSuchAlgorithmException, InvalidKeyException, SignatureException,
164-
OperatorCreationException, CertificateException, IOException {
163+
throws NoSuchAlgorithmException,
164+
InvalidKeyException,
165+
SignatureException,
166+
OperatorCreationException,
167+
CertificateException,
168+
IOException {
165169
// the data we want to sign
166170
var data = "some data " + UUID.randomUUID();
167171

0 commit comments

Comments
 (0)