Copilot commented on code in PR #12322:
URL: https://github.com/apache/maven/pull/12322#discussion_r3470439731


##########
impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilder.java:
##########
@@ -1692,6 +1692,30 @@ Model doReadFileModel(Set<Path> activeModelReads) throws 
ModelBuilderException {
                         model = model.withProperties(newProps);
                     }
                     model = model.withProfiles(merge(model.getProfiles(), 
userProps));
+                } else {
+                    if (modelSource.getPath() != null) {
+                        model = model.withPomFile(modelSource.getPath());
+                    }
+                    if (rootDirectory != null) {
+                        try {
+                            Map<String, String> properties =
+                                    getEnhancedProperties(model, 
rootDirectory, activeModelReads);
+                            model = model.with()
+                                    
.version(replaceCiFriendlyVersion(properties, model.getVersion()))
+                                    .parent(
+                                            model.getParent() != null
+                                                    ? model.getParent()
+                                                            
.withVersion(replaceCiFriendlyVersion(
+                                                                    properties,
+                                                                    
model.getParent()
+                                                                            
.getVersion()))
+                                                    : null)
+                                    .build();
+                        } catch (ModelBuilderException e) {
+                            logger.debug("Could not read root model properties 
for CI-friendly"
+                                    + " version interpolation: " + 
e.getMessage());
+                        }

Review Comment:
   The catch block logs only `e.getMessage()` and drops the exception itself, 
which makes debugging harder (no stack trace) while still swallowing the 
failure. Pass the exception as the second argument to `logger.debug(...)` so 
the stack trace is available when needed.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to