laeubi commented on code in PR #1197:
URL: https://github.com/apache/maven/pull/1197#discussion_r1330979699


##########
maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelProcessor.java:
##########
@@ -95,8 +114,15 @@ public File locateExistingPom(File projectDirectory) {
 
     public Path locateExistingPom(Path projectDirectory) {
         // Note that the ModelProcessor#locatePom never returns null
-        File f = modelLocator.locateExistingPom(projectDirectory.toFile());
-        Path pom = f != null ? f.toPath() : null;
+        // while the ModelParser#locatePom needs to return an existing path!
+        Path pom = modelParsers.stream()
+                .map(m -> m.locate(projectDirectory).map(s -> 
s.getPath()).orElse(null))
+                .filter(Objects::nonNull)
+                .findFirst()
+                .orElseGet(() -> {
+                    File f = 
modelLocator.locateExistingPom(projectDirectory.toFile());

Review Comment:
   @elharo I agree with @gnodet that checked exceptions should be used if 
calling code can do something about it (not necessarily "recover") and 
**should** do something, programming errors are usually nothing code can act 
uppon and will only result in try-catch-forget ... 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to