You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by el...@apache.org on 2025/06/13 12:04:57 UTC

(maven-wagon) branch master updated: Simplify exceptions that fail tests (#166)

This is an automated email from the ASF dual-hosted git repository.

elharo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-wagon.git


The following commit(s) were added to refs/heads/master by this push:
     new 9350bd54 Simplify exceptions that fail tests (#166)
9350bd54 is described below

commit 9350bd541b750d434e3a63acec4a475f188c9a09
Author: Elliotte Rusty Harold <el...@users.noreply.github.com>
AuthorDate: Fri Jun 13 12:04:52 2025 +0000

    Simplify exceptions that fail tests (#166)
    
    * Simplify exceptions that fail tests
---
 .../maven/wagon/providers/http/AbstractHttpClientWagonTest.java  | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java b/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java
index 010fbb74..856d0e24 100644
--- a/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java
+++ b/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java
@@ -25,7 +25,6 @@
 import java.io.InterruptedIOException;
 import java.lang.reflect.Field;
 import java.net.ConnectException;
-import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.net.UnknownHostException;
@@ -123,7 +122,7 @@ public void run() {
                     final Set<?> exceptions = Set.class.cast(nonRetriableClasses.get(handler));
                     assertEquals(1, exceptions.size());
                     assertTrue(exceptions.contains(IOException.class));
-                } catch (final Exception e) {
+                } catch (NoSuchFieldException | IllegalAccessException e) {
                     fail(e.getMessage());
                 }
             }
@@ -166,11 +165,7 @@ private void doTestHttpClient(final Runnable test) throws Exception {
         final String[] paths = classpath.split(File.pathSeparator);
         final Collection<URL> urls = new ArrayList<>(paths.length);
         for (final String path : paths) {
-            try {
-                urls.add(new File(path).toURI().toURL());
-            } catch (final MalformedURLException e) {
-                fail(e.getMessage());
-            }
+            urls.add(new File(path).toURI().toURL());
         }
         final URLClassLoader loader = new URLClassLoader(urls.toArray(new URL[paths.length]), new ClassLoader() {
             @Override