diff --git a/pom.xml b/pom.xml
index 62f1727e..00f2ca44 100644
--- a/pom.xml
+++ b/pom.xml
@@ -81,7 +81,7 @@
3.6.1
0.8.15
- 3.10.1
+ 3.10.2
3.16.0
3.5.0
3.1.4
diff --git a/src/main/java/land/oras/OCILayout.java b/src/main/java/land/oras/OCILayout.java
index 410c90a9..2bc11e76 100644
--- a/src/main/java/land/oras/OCILayout.java
+++ b/src/main/java/land/oras/OCILayout.java
@@ -191,7 +191,7 @@ public void pullArtifact(LayoutRef ref, Path path, PullOptions options) {
.formatted(layer.getAnnotations().get(Const.ANNOTATION_TITLE)));
}
if (options.isOverwrite()) {
- Files.copy(blobPath, targetPath, java.nio.file.StandardCopyOption.REPLACE_EXISTING);
+ Files.copy(blobPath, targetPath, StandardCopyOption.REPLACE_EXISTING);
} else {
Files.copy(blobPath, targetPath);
}
diff --git a/src/main/java/land/oras/Registry.java b/src/main/java/land/oras/Registry.java
index 3b97c637..02ff1ee5 100644
--- a/src/main/java/land/oras/Registry.java
+++ b/src/main/java/land/oras/Registry.java
@@ -35,6 +35,7 @@
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.HexFormat;
import java.util.List;
@@ -1167,7 +1168,7 @@ private String uploadChunks(ContainerRef ref, InputStream stream, long totalSize
}
long rangeEnd = offset + read - 1;
String contentRange = "%d-%d".formatted(offset, rangeEnd);
- final byte[] chunk = java.util.Arrays.copyOf(buffer, read);
+ final byte[] chunk = Arrays.copyOf(buffer, read);
URI patchUri = URI.create(location);
HttpClient.ResponseWrapper patchResponse = client.patch(
patchUri,
diff --git a/src/main/java/land/oras/auth/AbstractUsernamePasswordProvider.java b/src/main/java/land/oras/auth/AbstractUsernamePasswordProvider.java
index e95912a6..64f18134 100644
--- a/src/main/java/land/oras/auth/AbstractUsernamePasswordProvider.java
+++ b/src/main/java/land/oras/auth/AbstractUsernamePasswordProvider.java
@@ -20,6 +20,7 @@
package land.oras.auth;
+import java.util.Base64;
import land.oras.ContainerRef;
import org.jspecify.annotations.NonNull;
@@ -67,7 +68,7 @@ public String getPassword() {
@Override
@NonNull
public String getAuthHeader(ContainerRef registry) {
- return "Basic " + java.util.Base64.getEncoder().encodeToString((username + ":" + password).getBytes());
+ return "Basic " + Base64.getEncoder().encodeToString((username + ":" + password).getBytes());
}
@Override
diff --git a/src/main/java/land/oras/auth/AuthStore.java b/src/main/java/land/oras/auth/AuthStore.java
index e8726146..c3483ea3 100644
--- a/src/main/java/land/oras/auth/AuthStore.java
+++ b/src/main/java/land/oras/auth/AuthStore.java
@@ -27,6 +27,7 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
+import java.util.Base64;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -183,7 +184,7 @@ static ConfigFile fromCredential(Credential credential) {
"auths",
Map.of(
"auth",
- java.util.Base64.getEncoder()
+ Base64.getEncoder()
.encodeToString(
(credential.username + ":" + credential.password).getBytes()))),
Map.of(),
@@ -229,8 +230,7 @@ public static Config load(List configFiles) throws OrasException {
configFile.auths.forEach((host, value) -> {
String auth = value.get("auth");
if (auth != null) {
- String base64Decoded =
- new String(java.util.Base64.getDecoder().decode(auth), StandardCharsets.UTF_8);
+ String base64Decoded = new String(Base64.getDecoder().decode(auth), StandardCharsets.UTF_8);
String[] parts = base64Decoded.split(":", 2);
if (parts.length != 2) {
LOG.warn(
diff --git a/src/main/java/land/oras/utils/Const.java b/src/main/java/land/oras/utils/Const.java
index e2befe8e..e6a6d4c0 100644
--- a/src/main/java/land/oras/utils/Const.java
+++ b/src/main/java/land/oras/utils/Const.java
@@ -23,6 +23,7 @@
import java.time.Instant;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
+import java.time.temporal.ChronoUnit;
import org.jspecify.annotations.NullMarked;
/**
@@ -376,7 +377,7 @@ private Const() {
*/
public static String currentTimestamp() {
return Instant.now()
- .truncatedTo(java.time.temporal.ChronoUnit.SECONDS)
+ .truncatedTo(ChronoUnit.SECONDS)
.atOffset(ZoneOffset.UTC)
.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME);
}
diff --git a/src/test/java/land/oras/RegistryWireMockTest.java b/src/test/java/land/oras/RegistryWireMockTest.java
index 76a4fffb..b6fc5816 100644
--- a/src/test/java/land/oras/RegistryWireMockTest.java
+++ b/src/test/java/land/oras/RegistryWireMockTest.java
@@ -33,6 +33,7 @@
import com.github.tomakehurst.wiremock.WireMockServer;
import com.github.tomakehurst.wiremock.client.WireMock;
import com.github.tomakehurst.wiremock.core.WireMockConfiguration;
+import com.github.tomakehurst.wiremock.http.Fault;
import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo;
import com.github.tomakehurst.wiremock.junit5.WireMockTest;
import com.github.tomakehurst.wiremock.stubbing.Scenario;
@@ -1226,7 +1227,7 @@ void pullArtifactShouldRejectInvalidTitleAnnotation(WireMockRuntimeInfo wmRuntim
String registryUrl = wmRuntimeInfo.getHttpBaseUrl().replace("http://", "");
// Craft a blob and build a manifest whose layer title contains a invalid sequence
- byte[] blobContent = "malicious content".getBytes(java.nio.charset.StandardCharsets.UTF_8);
+ byte[] blobContent = "malicious content".getBytes(StandardCharsets.UTF_8);
String blobDigest = SupportedAlgorithm.SHA256.digest(blobContent);
Layer maliciousLayer = Layer.fromDigest(blobDigest, blobContent.length)
@@ -1234,8 +1235,7 @@ void pullArtifactShouldRejectInvalidTitleAnnotation(WireMockRuntimeInfo wmRuntim
Manifest manifest = Manifest.empty().withLayers(List.of(maliciousLayer));
String manifestJson = JsonUtils.toJson(manifest);
- String manifestDigest =
- SupportedAlgorithm.SHA256.digest(manifestJson.getBytes(java.nio.charset.StandardCharsets.UTF_8));
+ String manifestDigest = SupportedAlgorithm.SHA256.digest(manifestJson.getBytes(StandardCharsets.UTF_8));
// Stub HEAD manifest
wireMock.register(head(urlEqualTo("/v2/library/malicious-artifact/manifests/latest"))
@@ -1372,7 +1372,7 @@ void shouldRetryOnNetworkError(WireMockRuntimeInfo wmRuntimeInfo) {
wireMock.register(get(urlEqualTo("/v2/library/network-error-retry/tags/list"))
.inScenario("network-error-retry")
.whenScenarioStateIs(Scenario.STARTED)
- .willReturn(aResponse().withFault(com.github.tomakehurst.wiremock.http.Fault.CONNECTION_RESET_BY_PEER))
+ .willReturn(aResponse().withFault(Fault.CONNECTION_RESET_BY_PEER))
.willSetStateTo("retry"));
wireMock.register(get(urlEqualTo("/v2/library/network-error-retry/tags/list"))
diff --git a/src/test/java/land/oras/auth/AuthStoreTest.java b/src/test/java/land/oras/auth/AuthStoreTest.java
index c5ad8d0e..7a87dad1 100644
--- a/src/test/java/land/oras/auth/AuthStoreTest.java
+++ b/src/test/java/land/oras/auth/AuthStoreTest.java
@@ -24,8 +24,10 @@
import static org.junit.jupiter.api.Assumptions.assumeFalse;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
+import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
+import java.util.Base64;
import java.util.List;
import land.oras.ContainerRef;
import land.oras.exception.OrasException;
@@ -482,8 +484,7 @@ void testConfigLoad_success() throws Exception {
void testPasswordContainingColonIsPreserved() throws Exception {
String user = "user";
String password = "p@ss:with:colons";
- String auth = java.util.Base64.getEncoder()
- .encodeToString((user + ":" + password).getBytes(java.nio.charset.StandardCharsets.UTF_8));
+ String auth = Base64.getEncoder().encodeToString((user + ":" + password).getBytes(StandardCharsets.UTF_8));
// language=json
String config = """
{
@@ -505,10 +506,8 @@ void testPasswordContainingColonIsPreserved() throws Exception {
@Test
void testMalformedEntryIsSkippedWithoutDroppingOtherCredentials() throws Exception {
- String malformed = java.util.Base64.getEncoder()
- .encodeToString("no-colon-here".getBytes(java.nio.charset.StandardCharsets.UTF_8));
- String valid = java.util.Base64.getEncoder()
- .encodeToString("user:password".getBytes(java.nio.charset.StandardCharsets.UTF_8));
+ String malformed = Base64.getEncoder().encodeToString("no-colon-here".getBytes(StandardCharsets.UTF_8));
+ String valid = Base64.getEncoder().encodeToString("user:password".getBytes(StandardCharsets.UTF_8));
// language=json
String config = """
{
@@ -531,8 +530,7 @@ void testMalformedEntryIsSkippedWithoutDroppingOtherCredentials() throws Excepti
@Test
void testEmptyPasswordIsPreserved() throws Exception {
- String auth =
- java.util.Base64.getEncoder().encodeToString("user:".getBytes(java.nio.charset.StandardCharsets.UTF_8));
+ String auth = Base64.getEncoder().encodeToString("user:".getBytes(StandardCharsets.UTF_8));
// language=json
String config = """
{
@@ -556,8 +554,7 @@ void testEmptyPasswordIsPreserved() throws Exception {
void testPasswordWithArbitraryCharactersIsPreserved() throws Exception {
String user = "user";
String password = "p:รค ss\"w0rd\\:with=๐:tail";
- String auth = java.util.Base64.getEncoder()
- .encodeToString((user + ":" + password).getBytes(java.nio.charset.StandardCharsets.UTF_8));
+ String auth = Base64.getEncoder().encodeToString((user + ":" + password).getBytes(StandardCharsets.UTF_8));
// language=json
String config = """
{