mirror of https://github.com/apache/maven.git
MNG-7738 don't dump raw stack traces to System.err (#1064)
This commit is contained in:
parent
703f814e34
commit
cadeab53f6
|
@ -73,8 +73,6 @@ public final class RequirementMatcherFactory {
|
|||
return range.getRecommendedVersion().compareTo(version) == 0;
|
||||
}
|
||||
} catch (InvalidVersionSpecificationException ex) {
|
||||
// TODO error reporting
|
||||
ex.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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." );
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
|
@ -229,7 +229,7 @@ public class TestRepositorySystem implements RepositorySystem {
|
|||
.map(Dependency::new)
|
||||
.collect(Collectors.toList());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
try {
|
||||
Properties conf = PropertyUtils.loadProperties(resource.openStream());
|
||||
|
||||
String impl = conf.getProperty(slf4jBinding);
|
||||
|
||||
if (impl != null) {
|
||||
return (Slf4jConfiguration) Class.forName(impl).newInstance();
|
||||
}
|
||||
|
||||
supported.put(resource, conf.keySet());
|
||||
} catch (IOException | ClassNotFoundException | IllegalAccessException | InstantiationException ex) {
|
||||
// ignore and move on to the next
|
||||
}
|
||||
} catch (IOException | ClassNotFoundException | IllegalAccessException | InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
return new UnsupportedSlf4jBindingConfiguration();
|
||||
|
|
Loading…
Reference in New Issue