From 9735a7a71254fff663ef88fcc0b013fec77f2fcd Mon Sep 17 00:00:00 2001 From: Tamas Cservenak Date: Fri, 20 Oct 2023 19:47:33 +0200 Subject: [PATCH] [MRESOLVER-409] More deprecation removal Now the last bit remaining is ChecksumUtils that is to be handled in different issue. This PR merely removes all the compiler warnings about deprecation but ChecksumUtils. --- https://issues.apache.org/jira/browse/MRESOLVER-409 --- .../DefaultRemoteRepositoryFilterManager.java | 10 ---------- .../transport/http/HttpTransporterFactory.java | 17 ----------------- .../aether/transport/http/HttpServer.java | 6 +++--- .../transport/http/HttpTransporterTest.java | 5 ++++- 4 files changed, 7 insertions(+), 31 deletions(-) diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/filter/DefaultRemoteRepositoryFilterManager.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/filter/DefaultRemoteRepositoryFilterManager.java index f6070e91b..276153ce4 100644 --- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/filter/DefaultRemoteRepositoryFilterManager.java +++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/filter/DefaultRemoteRepositoryFilterManager.java @@ -52,16 +52,6 @@ public final class DefaultRemoteRepositoryFilterManager implements RemoteReposit private final Map sources; - /** - * SL enabled ctor. - * - * @deprecated for SL and testing purposes only. - */ - @Deprecated - public DefaultRemoteRepositoryFilterManager() { - this.sources = new HashMap<>(); - } - @Inject public DefaultRemoteRepositoryFilterManager(Map sources) { this.sources = requireNonNull(sources); diff --git a/maven-resolver-transport-http/src/main/java/org/eclipse/aether/transport/http/HttpTransporterFactory.java b/maven-resolver-transport-http/src/main/java/org/eclipse/aether/transport/http/HttpTransporterFactory.java index 8cd098b10..f648d6c42 100644 --- a/maven-resolver-transport-http/src/main/java/org/eclipse/aether/transport/http/HttpTransporterFactory.java +++ b/maven-resolver-transport-http/src/main/java/org/eclipse/aether/transport/http/HttpTransporterFactory.java @@ -21,8 +21,6 @@ import javax.inject.Inject; import javax.inject.Named; -import java.util.Collections; -import java.util.HashMap; import java.util.Map; import org.eclipse.aether.RepositorySystemSession; @@ -41,25 +39,10 @@ public final class HttpTransporterFactory implements TransporterFactory { public static final String NAME = "http"; - private static Map getManuallyCreatedExtractors() { - HashMap map = new HashMap<>(); - map.put(Nexus2ChecksumExtractor.NAME, new Nexus2ChecksumExtractor()); - map.put(XChecksumChecksumExtractor.NAME, new XChecksumChecksumExtractor()); - return Collections.unmodifiableMap(map); - } - private float priority = 5.0f; private final Map extractors; - /** - * Ctor for ServiceLocator. - */ - @Deprecated - public HttpTransporterFactory() { - this(getManuallyCreatedExtractors()); - } - /** * Creates an (uninitialized) instance of this transporter factory. Note: In case of manual instantiation * by clients, the new factory needs to be configured via its various mutators before first use or runtime errors diff --git a/maven-resolver-transport-http/src/test/java/org/eclipse/aether/transport/http/HttpServer.java b/maven-resolver-transport-http/src/test/java/org/eclipse/aether/transport/http/HttpServer.java index 29ff91a55..74f3c9e24 100644 --- a/maven-resolver-transport-http/src/test/java/org/eclipse/aether/transport/http/HttpServer.java +++ b/maven-resolver-transport-http/src/test/java/org/eclipse/aether/transport/http/HttpServer.java @@ -25,7 +25,9 @@ import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; +import java.util.Base64; import java.util.Collections; import java.util.Enumeration; import java.util.List; @@ -44,9 +46,7 @@ import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.server.handler.AbstractHandler; import org.eclipse.jetty.server.handler.HandlerList; -import org.eclipse.jetty.util.B64Code; import org.eclipse.jetty.util.IO; -import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.URIUtil; import org.eclipse.jetty.util.ssl.SslContextFactory; import org.slf4j.Logger; @@ -484,7 +484,7 @@ static boolean checkBasicAuth(String credentials, String username, String passwo String method = credentials.substring(0, space); if ("basic".equalsIgnoreCase(method)) { credentials = credentials.substring(space + 1); - credentials = B64Code.decode(credentials, StringUtil.__ISO_8859_1); + credentials = new String(Base64.getDecoder().decode(credentials), StandardCharsets.ISO_8859_1); int i = credentials.indexOf(':'); if (i > 0) { String user = credentials.substring(0, i); diff --git a/maven-resolver-transport-http/src/test/java/org/eclipse/aether/transport/http/HttpTransporterTest.java b/maven-resolver-transport-http/src/test/java/org/eclipse/aether/transport/http/HttpTransporterTest.java index 01ea9d3e1..1226e7cc5 100644 --- a/maven-resolver-transport-http/src/test/java/org/eclipse/aether/transport/http/HttpTransporterTest.java +++ b/maven-resolver-transport-http/src/test/java/org/eclipse/aether/transport/http/HttpTransporterTest.java @@ -105,7 +105,10 @@ private void newTransporter(String url) throws Exception { void setUp(TestInfo testInfo) throws Exception { System.out.println("=== " + testInfo.getDisplayName() + " ==="); session = TestUtils.newSession(); - factory = new HttpTransporterFactory(); + HashMap extractors = new HashMap<>(); + extractors.put(XChecksumChecksumExtractor.NAME, new XChecksumChecksumExtractor()); + extractors.put(Nexus2ChecksumExtractor.NAME, new Nexus2ChecksumExtractor()); + factory = new HttpTransporterFactory(extractors); repoDir = TestFileUtils.createTempDir(); TestFileUtils.writeString(new File(repoDir, "file.txt"), "test"); TestFileUtils.writeString(new File(repoDir, "dir/file.txt"), "test");