8215991: Stop hiding exception from ArtifactResolver failures in tests

Reviewed-by: tbell, ctornqvi
This commit is contained in:
Erik Joelsson 2019-01-03 11:21:40 +01:00
parent a5765901b3
commit ee69ace28a

View File

@ -29,16 +29,18 @@ import java.util.Map;
public class ArtifactResolver {
public static Map<String, Path> resolve(Class<?> klass) throws ArtifactResolverException {
ArtifactManager manager = new DefaultArtifactManager();
ArtifactManager manager;
try {
String managerName = System.getProperty("jdk.test.lib.artifacts.artifactmanager");
if (managerName != null) {
manager = (ArtifactManager) Class.forName(managerName).newInstance();
} else if (System.getenv().containsKey(JibArtifactManager.JIB_HOME_ENV_NAME)) {
manager = JibArtifactManager.newInstance();
} else {
manager = new DefaultArtifactManager();
}
} catch (Exception e) {
// If we end up here, we'll use the DefaultArtifactManager
throw new ArtifactResolverException("Failed to load ArtifactManager", e);
}
ArtifactContainer artifactContainer = klass.getAnnotation(ArtifactContainer.class);