Skip to content

Commit ab19cc1

Browse files
committed
Initial apply of OpenReWrite recipe
``` mvn -U org.openrewrite.maven:rewrite-maven-plugin:run \ -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-migrate-java:RELEASE \ -Drewrite.activeRecipes=org.openrewrite.java.migrate.UpgradeToJava17 \ -Drewrite.exportDatatables=true ```
1 parent 6653715 commit ab19cc1

File tree

147 files changed

+966
-842
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+966
-842
lines changed

geowebcache/arcgiscache/src/test/java/org/geowebcache/arcgis/layer/XMLConfigurationLayerConformanceWithArcGisLayersTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import java.net.URISyntaxException;
2323
import java.net.URL;
2424
import java.nio.file.Files;
25-
import java.nio.file.Paths;
25+
import java.nio.file.Path;
2626
import java.util.List;
2727
import java.util.Optional;
2828
import java.util.stream.Collectors;
@@ -123,8 +123,8 @@ protected Matcher<TileLayer> infoEquals(TileLayer expected) {
123123

124124
@Override
125125
public boolean matches(Object item) {
126-
return item instanceof ArcGISCacheLayer
127-
&& ((ArcGISCacheLayer) item).getBackendTimeout().equals(expected.getBackendTimeout());
126+
return item instanceof ArcGISCacheLayer agiscl
127+
&& agiscl.getBackendTimeout().equals(expected.getBackendTimeout());
128128
}
129129
};
130130
}
@@ -135,8 +135,8 @@ protected Matcher<TileLayer> infoEquals(int expected) {
135135

136136
@Override
137137
public boolean matches(Object item) {
138-
return item instanceof ArcGISCacheLayer
139-
&& ((ArcGISCacheLayer) item).getBackendTimeout().equals(expected);
138+
return item instanceof ArcGISCacheLayer agiscl
139+
&& agiscl.getBackendTimeout().equals(expected);
140140
}
141141
};
142142
}
@@ -158,7 +158,7 @@ protected void makeConfigFile() throws Exception {
158158
configFile = temp.newFile("geowebcache.xml");
159159

160160
URL source = XMLConfigurationLayerConformanceWithArcGisLayersTest.class.getResource("geowebcache.xml");
161-
try (Stream<String> lines = Files.lines(Paths.get(source.toURI()))) {
161+
try (Stream<String> lines = Files.lines(Path.of(source.toURI()))) {
162162
List<String> replaced = lines.map(line -> {
163163
String tilingSchemePath =
164164
resourceAsFile("/compactcache/Conf.xml").getAbsolutePath();

geowebcache/azureblob/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@
3737
<artifactId>gwc-core</artifactId>
3838
<version>${project.version}</version>
3939
</dependency>
40+
<dependency>
41+
<groupId>jakarta.annotation</groupId>
42+
<artifactId>jakarta.annotation-api</artifactId>
43+
<version>1.3.5</version>
44+
<scope>provided</scope>
45+
</dependency>
4046

4147
<dependency>
4248
<groupId>com.azure</groupId>

geowebcache/azureblob/src/main/java/org/geowebcache/azure/AzureBlobStoreData.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ public String getLocation() {
160160
String container = this.getContainer();
161161
String prefix = this.getPrefix();
162162
if (prefix == null) {
163-
return String.format("container: %s", container);
163+
return "container: %s".formatted(container);
164164
} else {
165-
return String.format("container: %s prefix: %s", container, prefix);
165+
return "container: %s prefix: %s".formatted(container, prefix);
166166
}
167167
}
168168

geowebcache/azureblob/src/main/java/org/geowebcache/azure/AzureBlobStoreInfo.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import static com.google.common.base.Preconditions.checkNotNull;
1717
import static com.google.common.base.Preconditions.checkState;
1818

19+
import java.io.Serial;
1920
import java.util.logging.Level;
2021
import java.util.logging.Logger;
2122
import javax.annotation.Nullable;
@@ -30,6 +31,7 @@
3031

3132
/** Plain old java object representing the configuration for an Azure blob store. */
3233
public class AzureBlobStoreInfo extends BlobStoreInfo {
34+
@Serial
3335
private static final long serialVersionUID = -8068069256598987874L;
3436

3537
/**
@@ -229,9 +231,9 @@ public String getLocation() {
229231
String container = this.getContainer();
230232
String prefix = this.getPrefix();
231233
if (prefix == null) {
232-
return String.format("container: %s", container);
234+
return "container: %s".formatted(container);
233235
} else {
234-
return String.format("container: %s prefix: %s", container, prefix);
236+
return "container: %s prefix: %s".formatted(container, prefix);
235237
}
236238
}
237239

geowebcache/azureblob/src/main/java/org/geowebcache/azure/AzureClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ String getServiceURL(AzureBlobStoreData configuration) {
142142
// default to account name based location
143143
String proto = configuration.isUseHTTPS() ? "https" : "http";
144144
String account = configuration.getAccountName();
145-
serviceURL = String.format("%s://%s.blob.core.windows.net", proto, account);
145+
serviceURL = "%s://%s.blob.core.windows.net".formatted(proto, account);
146146
}
147147
return serviceURL;
148148
}

geowebcache/azureblob/src/main/java/org/geowebcache/azure/DeleteManager.java

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ public Long deleteParallel(List<String> keys) throws StorageException {
118118

119119
public boolean scheduleAsyncDelete(final String prefix) throws StorageException {
120120
final long timestamp = currentTimeSeconds();
121-
String msg = String.format(
122-
"Issuing bulk delete on '%s/%s' for objects older than %d",
121+
String msg = "Issuing bulk delete on '%s/%s' for objects older than %d".formatted(
123122
client.getContainerName(), prefix, timestamp);
124123
log.info(msg);
125124

@@ -159,8 +158,7 @@ public void issuePendingBulkDeletes() throws StorageException {
159158
final String prefix = e.getKey().toString();
160159
final long timestamp = Long.parseLong(e.getValue().toString());
161160
if (log.isLoggable(Level.INFO))
162-
log.info(String.format(
163-
"Restarting pending bulk delete on '%s/%s':%d",
161+
log.info("Restarting pending bulk delete on '%s/%s':%d".formatted(
164162
client.getContainerName(), prefix, timestamp));
165163
if (!asyncDelete(prefix, timestamp)) {
166164
deletesToClear.add(prefix);
@@ -219,8 +217,7 @@ public Long call() throws Exception {
219217
try {
220218
checkInterrupted();
221219
if (log.isLoggable(Level.INFO))
222-
log.info(String.format(
223-
"Running bulk delete on '%s/%s':%d", client.getContainerName(), prefix, timestamp));
220+
log.info("Running bulk delete on '%s/%s':%d".formatted(client.getContainerName(), prefix, timestamp));
224221

225222
BlobContainerClient container = client.getContainer();
226223

@@ -238,23 +235,20 @@ public Long call() throws Exception {
238235
}
239236
}
240237
} catch (InterruptedException | IllegalStateException e) {
241-
log.info(String.format(
242-
"Azure bulk delete aborted for '%s/%s'. Will resume on next startup.",
238+
log.info("Azure bulk delete aborted for '%s/%s'. Will resume on next startup.".formatted(
243239
client.getContainerName(), prefix));
244240
throw e;
245241
} catch (RuntimeException e) {
246242
log.log(
247243
Level.WARNING,
248-
String.format(
249-
"Unknown error performing bulk Azure blobs delete of '%s/%s'",
244+
"Unknown error performing bulk Azure blobs delete of '%s/%s'".formatted(
250245
client.getContainerName(), prefix),
251246
e);
252247
throw e;
253248
}
254249

255250
if (log.isLoggable(Level.INFO))
256-
log.info(String.format(
257-
"Finished bulk delete on '%s/%s':%d. %d objects deleted",
251+
log.info("Finished bulk delete on '%s/%s':%d. %d objects deleted".formatted(
258252
client.getContainerName(), prefix, timestamp, count));
259253

260254
clearPendingBulkDelete(prefix, timestamp);
@@ -286,8 +280,7 @@ private void clearPendingBulkDelete(final String prefix, final long timestamp) t
286280
if (timestamp >= storedTimestamp) {
287281
client.putProperties(pendingDeletesKey, deletes);
288282
} else if (log.isLoggable(Level.INFO)) {
289-
log.info(String.format(
290-
"bulk delete finished but there's a newer one ongoing for container '%s/%s'",
283+
log.info("bulk delete finished but there's a newer one ongoing for container '%s/%s'".formatted(
291284
client.getContainerName(), prefix));
292285
}
293286
} catch (StorageException e) {
@@ -329,8 +322,7 @@ public Long call() throws Exception {
329322
try {
330323
checkInterrupted();
331324
if (log.isLoggable(Level.FINER)) {
332-
log.finer(String.format(
333-
"Running delete delete on list of items on '%s':%s ... (only the first 100 items listed)",
325+
log.finer("Running delete delete on list of items on '%s':%s ... (only the first 100 items listed)".formatted(
334326
client.getContainerName(), keys.subList(0, Math.min(keys.size(), 100))));
335327
}
336328

@@ -348,8 +340,7 @@ public Long call() throws Exception {
348340
}
349341

350342
if (log.isLoggable(Level.INFO))
351-
log.info(String.format(
352-
"Finished bulk delete on %s, %d objects deleted", client.getContainerName(), count));
343+
log.info("Finished bulk delete on %s, %d objects deleted".formatted(client.getContainerName(), count));
353344
return count;
354345
}
355346

geowebcache/azureblob/src/test/java/org/geowebcache/azure/AzureBlobStoreIntegrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ private void seed(
539539
int max = (int) Math.pow(2, z);
540540
for (int x = 0; x < max; x++) {
541541
for (int y = 0; y < max; y++) {
542-
log.fine(String.format("seeding %d,%d,%d", x, y, z));
542+
log.fine("seeding %d,%d,%d".formatted(x, y, z));
543543
put(x, y, z, gridset, formatExtension, parameters);
544544
}
545545
}

geowebcache/azureblob/src/test/java/org/geowebcache/testcontainers/azure/AzuriteContainer.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
*/
1414
package org.geowebcache.testcontainers.azure;
1515

16-
import static java.lang.String.format;
1716
import static org.junit.Assert.assertTrue;
1817
import static org.junit.Assume.assumeTrue;
1918

@@ -145,7 +144,7 @@ public int getBlobsPort() {
145144
}
146145

147146
public String getBlobServiceUrl() {
148-
return format("http://localhost:%d/%s", getBlobsPort(), getAccountName());
147+
return "http://localhost:%d/%s".formatted(getBlobsPort(), getAccountName());
149148
}
150149

151150
public AzureBlobStoreData getConfiguration(String container) {

geowebcache/core/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,12 @@
105105
<groupId>org.springframework</groupId>
106106
<artifactId>spring-webmvc</artifactId>
107107
</dependency>
108+
<dependency>
109+
<groupId>jakarta.annotation</groupId>
110+
<artifactId>jakarta.annotation-api</artifactId>
111+
<version>1.3.5</version>
112+
<scope>provided</scope>
113+
</dependency>
108114
<dependency>
109115
<groupId>org.springframework</groupId>
110116
<artifactId>spring-jdbc</artifactId>

geowebcache/core/src/main/java/org/geowebcache/ClientStreamAbortedException.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
package org.geowebcache;
1515

1616
import java.io.IOException;
17+
import java.io.Serial;
1718

1819
/**
1920
* An IOException that means a {@link ServiceStrategy#getDestination(javax.servlet.http.HttpServletResponse)
@@ -28,6 +29,7 @@
2829
*/
2930
public final class ClientStreamAbortedException extends IOException {
3031

32+
@Serial
3133
private static final long serialVersionUID = -812677957232110980L;
3234

3335
public ClientStreamAbortedException() {

0 commit comments

Comments
 (0)