gnodet commented on code in PR #1446:
URL: https://github.com/apache/maven/pull/1446#discussion_r1581850909


##########
maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java:
##########
@@ -897,69 +904,91 @@ private List<org.apache.maven.api.model.Profile> 
interpolateActivations(
             List<org.apache.maven.api.model.Profile> profiles,
             DefaultProfileActivationContext context,
             DefaultModelProblemCollector problems) {
-        List<org.apache.maven.api.model.Profile> newProfiles = null;
-        for (int index = 0; index < profiles.size(); index++) {
-            org.apache.maven.api.model.Profile profile = profiles.get(index);
-            org.apache.maven.api.model.Activation activation = 
profile.getActivation();
-            if (activation != null) {
-                org.apache.maven.api.model.ActivationFile file = 
activation.getFile();
-                if (file != null) {
-                    String oldExists = file.getExists();
-                    if (isNotEmpty(oldExists)) {
+        if (profiles.stream()
+                .map(org.apache.maven.api.model.Profile::getActivation)
+                .filter(Objects::nonNull)
+                .findFirst()
+                .isEmpty()) {

Review Comment:
   use `anyMatch` here too



##########
maven-api-impl/src/main/java/org/apache/maven/internal/impl/model/DefaultModelBuilder.java:
##########
@@ -377,69 +383,88 @@ private Model readEffectiveModel(
 
     private List<Profile> interpolateActivations(
             List<Profile> profiles, DefaultProfileActivationContext context, 
DefaultModelProblemCollector problems) {
-        List<Profile> newProfiles = null;
-        for (int index = 0; index < profiles.size(); index++) {
-            Profile profile = profiles.get(index);
-            Activation activation = profile.getActivation();
-            if (activation != null) {
-                ActivationFile file = activation.getFile();
-                if (file != null) {
-                    String oldExists = file.getExists();
-                    if (isNotEmpty(oldExists)) {
+        if (profiles.stream()
+                .map(org.apache.maven.api.model.Profile::getActivation)
+                .filter(Objects::nonNull)
+                .findFirst()
+                .isEmpty()) {
+            return profiles;

Review Comment:
   `.noneMatch(Objects::nonNull)` instead ?



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