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;
|
return range.getRecommendedVersion().compareTo(version) == 0;
|
||||||
}
|
}
|
||||||
} catch (InvalidVersionSpecificationException ex) {
|
} catch (InvalidVersionSpecificationException ex) {
|
||||||
// TODO error reporting
|
|
||||||
ex.printStackTrace();
|
|
||||||
return false;
|
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)
|
.map(Dependency::new)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
// ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,7 @@ package org.apache.maven.cli.logging;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.apache.maven.cli.logging.impl.UnsupportedSlf4jBindingConfiguration;
|
import org.apache.maven.cli.logging.impl.UnsupportedSlf4jBindingConfiguration;
|
||||||
import org.codehaus.plexus.util.PropertyUtils;
|
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 final String RESOURCE = "META-INF/maven/slf4j-configuration.properties";
|
||||||
|
|
||||||
public static Slf4jConfiguration getConfiguration(ILoggerFactory loggerFactory) {
|
public static Slf4jConfiguration getConfiguration(ILoggerFactory loggerFactory) {
|
||||||
Map<URL, Set<Object>> supported = new LinkedHashMap<>();
|
|
||||||
|
|
||||||
String slf4jBinding = loggerFactory.getClass().getCanonicalName();
|
String slf4jBinding = loggerFactory.getClass().getCanonicalName();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -52,19 +47,18 @@ public class Slf4jConfigurationFactory {
|
||||||
|
|
||||||
while (resources.hasMoreElements()) {
|
while (resources.hasMoreElements()) {
|
||||||
URL resource = resources.nextElement();
|
URL resource = resources.nextElement();
|
||||||
|
try {
|
||||||
Properties conf = PropertyUtils.loadProperties(resource.openStream());
|
Properties conf = PropertyUtils.loadProperties(resource.openStream());
|
||||||
|
|
||||||
String impl = conf.getProperty(slf4jBinding);
|
String impl = conf.getProperty(slf4jBinding);
|
||||||
|
|
||||||
if (impl != null) {
|
if (impl != null) {
|
||||||
return (Slf4jConfiguration) Class.forName(impl).newInstance();
|
return (Slf4jConfiguration) Class.forName(impl).newInstance();
|
||||||
}
|
}
|
||||||
|
} catch (IOException | ClassNotFoundException | IllegalAccessException | InstantiationException ex) {
|
||||||
supported.put(resource, conf.keySet());
|
// ignore and move on to the next
|
||||||
}
|
}
|
||||||
} catch (IOException | ClassNotFoundException | IllegalAccessException | InstantiationException e) {
|
}
|
||||||
e.printStackTrace();
|
} catch (IOException ex) {
|
||||||
|
// ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
return new UnsupportedSlf4jBindingConfiguration();
|
return new UnsupportedSlf4jBindingConfiguration();
|
||||||
|
|
Loading…
Reference in New Issue