Pankraz76 commented on code in PR #2304:
URL: https://github.com/apache/maven/pull/2304#discussion_r2079124687


##########
impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelProcessor.java:
##########
@@ -126,18 +126,14 @@ public Model read(XmlReaderRequest request) throws 
IOException {
     private Path doLocateExistingPom(Path project) {
         if (project == null) {
             project = Paths.get(System.getProperty("user.dir"));
-        }
-        if (Files.isDirectory(project)) {
+        } else if (Files.isDirectory(project)) {
             Path pom = project.resolve("pom.xml");
             return Files.isRegularFile(pom) ? pom : null;
-        } else if (Files.isRegularFile(project)) {
-            return project;
-        } else {
-            return null;

Review Comment:
   IMHO, it's either a directory (the higher-tier entity), as there is no file 
without a directory containing it. Which one came first is another topic, but I 
think it's that simple—either/or. So, we don't need this check, as the null 
branch is hard to test.
   
   <img width="607" alt="image" 
src="https://github.com/user-attachments/assets/fc538c4c-3e2b-43a2-bcc6-f52af9fab24d";
 />
   
   https://github.com/apache/maven/pull/2292/files#r2077436936



-- 
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