POM read from SCM url may not be correctly decorated
Due to #235 (closed), a new branch was added in MavenDetailsInfererEnhancer#processModelElement(Element)
:
// If there is some kind of SCM path, and a configured SCM provider,
// let's check if we can find some pom.xml
var project= element.getProperties().get(ModelElementKeys.Scm.PROJECT);
for(SCMHandler handler : scmHandler) {
try {
Collection<SCMFile> pomSCMFile = handler.find(project, "/", file -> "pom.xml".equals(file.name()));
for(SCMFile pom : pomSCMFile) {
URL url = new URL(pom.url());
return Optional.ofNullable(readMavenProject(pom.url(), url,
cache.openStreamFor(pom)));
}
} catch (IOException | XmlPullParserException e) {
logger.log(Level.FINER, String.format("There is no pom.xml in %s, maybe it's normal", project), e);
}
}
This new branch works correctly, but doesn't seems to invoke the MavenDetailsInfererEnhancer#decorate(Element, MavenProject)
method.
Seems like this code could deserve a lightweight refactoring ...