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

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

commit 9b73bf7096df557664ee51ba36d7de8db92d7bfa
Author: Elliotte Rusty Harold <[email protected]>
AuthorDate: Fri Mar 17 18:41:44 2023 -0400

    MNG-7738 don't dump raw stack traces to System.err
---
 .../maven/toolchain/RequirementMatcherFactory.java |  2 -
 .../src/test/java/org/apache/maven/MavenTest.java  | 52 ----------------------
 .../maven/repository/TestRepositorySystem.java     |  2 +-
 .../cli/logging/Slf4jConfigurationFactory.java     | 26 +++++------
 4 files changed, 11 insertions(+), 71 deletions(-)

diff --git 
a/maven-core/src/main/java/org/apache/maven/toolchain/RequirementMatcherFactory.java
 
b/maven-core/src/main/java/org/apache/maven/toolchain/RequirementMatcherFactory.java
index 4c7476bdc..ebadd4120 100644
--- 
a/maven-core/src/main/java/org/apache/maven/toolchain/RequirementMatcherFactory.java
+++ 
b/maven-core/src/main/java/org/apache/maven/toolchain/RequirementMatcherFactory.java
@@ -73,8 +73,6 @@ public final class RequirementMatcherFactory {
                     return range.getRecommendedVersion().compareTo(version) == 
0;
                 }
             } catch (InvalidVersionSpecificationException ex) {
-                // TODO error reporting
-                ex.printStackTrace();
                 return false;
             }
         }
diff --git a/maven-core/src/test/java/org/apache/maven/MavenTest.java 
b/maven-core/src/test/java/org/apache/maven/MavenTest.java
deleted file mode 100644
index 920f40113..000000000
--- a/maven-core/src/test/java/org/apache/maven/MavenTest.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.maven;
-
-import javax.inject.Inject;
-
-import org.apache.maven.exception.ExceptionHandler;
-import org.junit.jupiter.api.Test;
-
-public class MavenTest extends AbstractCoreMavenComponentTestCase {
-    @Inject
-    private Maven maven;
-
-    @Inject
-    private ExceptionHandler exceptionHandler;
-
-    protected String getProjectsDirectory() {
-        return "src/test/projects/lifecycle-executor";
-    }
-
-    @Test
-    public void testLifecycleExecutionUsingADefaultLifecyclePhase() throws 
Exception {
-        /*
-                File pom = getProject( 
"project-with-additional-lifecycle-elements" );
-                MavenExecutionRequest request = createMavenExecutionRequest( 
pom );
-                MavenExecutionResult result = maven.execute( request );
-                if ( result.hasExceptions() )
-                {
-                    ExceptionSummary es = exceptionHandler.handleException( 
result.getExceptions().get( 0 ) );
-                    System.out.println( es.getMessage() );
-                    es.getException().printStackTrace();
-                    fail( "Maven did not execute correctly." );
-                }
-        */
-    }
-}
diff --git 
a/maven-core/src/test/java/org/apache/maven/repository/TestRepositorySystem.java
 
b/maven-core/src/test/java/org/apache/maven/repository/TestRepositorySystem.java
index e882e517c..83aa2d38d 100644
--- 
a/maven-core/src/test/java/org/apache/maven/repository/TestRepositorySystem.java
+++ 
b/maven-core/src/test/java/org/apache/maven/repository/TestRepositorySystem.java
@@ -229,7 +229,7 @@ public class TestRepositorySystem implements 
RepositorySystem {
                             .map(Dependency::new)
                             .collect(Collectors.toList());
                 } catch (IOException e) {
-                    e.printStackTrace();
+                    // ignore
                 }
             }
 
diff --git 
a/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfigurationFactory.java
 
b/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfigurationFactory.java
index 92fa07d19..56470b3db 100644
--- 
a/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfigurationFactory.java
+++ 
b/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfigurationFactory.java
@@ -21,10 +21,7 @@ package org.apache.maven.cli.logging;
 import java.io.IOException;
 import java.net.URL;
 import java.util.Enumeration;
-import java.util.LinkedHashMap;
-import java.util.Map;
 import java.util.Properties;
-import java.util.Set;
 
 import org.apache.maven.cli.logging.impl.UnsupportedSlf4jBindingConfiguration;
 import org.codehaus.plexus.util.PropertyUtils;
@@ -42,8 +39,6 @@ public class Slf4jConfigurationFactory {
     public static final String RESOURCE = 
"META-INF/maven/slf4j-configuration.properties";
 
     public static Slf4jConfiguration getConfiguration(ILoggerFactory 
loggerFactory) {
-        Map<URL, Set<Object>> supported = new LinkedHashMap<>();
-
         String slf4jBinding = loggerFactory.getClass().getCanonicalName();
 
         try {
@@ -52,19 +47,18 @@ public class Slf4jConfigurationFactory {
 
             while (resources.hasMoreElements()) {
                 URL resource = resources.nextElement();
-
-                Properties conf = 
PropertyUtils.loadProperties(resource.openStream());
-
-                String impl = conf.getProperty(slf4jBinding);
-
-                if (impl != null) {
-                    return (Slf4jConfiguration) 
Class.forName(impl).newInstance();
+                try {
+                    Properties conf = 
PropertyUtils.loadProperties(resource.openStream());
+                    String impl = conf.getProperty(slf4jBinding);
+                    if (impl != null) {
+                        return (Slf4jConfiguration) 
Class.forName(impl).newInstance();
+                    }
+                } catch (IOException | ClassNotFoundException | 
IllegalAccessException | InstantiationException ex) {
+                    // ignore and move on to the next
                 }
-
-                supported.put(resource, conf.keySet());
             }
-        } catch (IOException | ClassNotFoundException | IllegalAccessException 
| InstantiationException e) {
-            e.printStackTrace();
+        } catch (IOException ex) {
+            // ignore
         }
 
         return new UnsupportedSlf4jBindingConfiguration();

Reply via email to